// AUC TA command surface, decompiled with restored names, prototypes and types. // Source: psp_out/versions_win/ta_0.7.0.1_9e9044cf.bin // Handlers resolved from fw/cmdmaps/auc.json; loc_* labels mapped to their // containing function. Generated by fw/ta_surface.py. // ================ cmd 0x3 @ 0x4013e2 ================ int __fastcall auc_cmd03(void *ctx, struct ta_params *params) { int result; // r0 int v4; // [sp+4h] [bp-4h] BYREF if ( ctx == nullptr ) return 2; result = auc_cmd03__h1(ctx, params: (struct ta_params *)&v4); *((_DWORD *)ctx + 128) = v4; return result; } // ================ cmd 0x2 @ 0x4013fe ================ int __fastcall auc_cmd02(void *ctx, struct ta_params *params) { int result; // r0 char *v5; // r11 unsigned int v6; // r6 int v7; // r2 void *v8; // r0 int v9; // r9 int v10; // r10 int v11; // r6 int v12; // r0 bool v13; // zf unsigned int v14; // r0 bool v15; // zf int v16; // r3 unsigned int v17; // r2 unsigned int v18; // r1 int v19; // r3 unsigned int v20; // r0 int *v21; // r1 struct ta_params *v22; // r3 int v23; // t1 unsigned int v24; // r3 int v25; // [sp+4h] [bp-18h] int v26; // [sp+8h] [bp-14h] int v27; // [sp+Ch] [bp-10h] int v28; // [sp+10h] [bp-Ch] BYREF int v29; // [sp+14h] [bp-8h] BYREF int v30; // [sp+18h] [bp-4h] BYREF result = 2; if ( ctx != nullptr && params != nullptr ) { if ( *(_DWORD *)ctx <= 0xFu && *((_DWORD *)(v5 = (char *)nullsub_3 + 28 * *(_DWORD *)ctx) + 2) == 1 ) { result = 11; v6 = *((_DWORD *)v5 + 7); v7 = *((_DWORD *)ctx + 3); if ( v7 - 1 >= v6 && (v6 == -1 || v7 != 0) ) { v8 = *((void **)v5 + 1); v9 = 0; *((_DWORD *)v5 + 7) = v7; v10 = *((_DWORD *)ctx + 5); v29 = 0; v11 = auc_cmd02__h3(ctx: v8, params: (struct ta_params *)&v30); v12 = auc_cmd02__h2(ctx: *((void **)v5 + 1), params: (struct ta_params *)&v29); if ( v11 != 0 ) v11 = 13; if ( v12 != 0 ) v11 = 14; if ( auc_cmd02__h4(ctx: *((void **)v5 + 1), params: (struct ta_params *)&v28) != 0 ) v11 = 15; v13 = v27 == 3; if ( v27 == 3 ) v13 = v25 == 1; if ( v13 ) { v14 = *((unsigned __int16 *)ctx + 12); v9 = 1; if ( v14 <= 6 ) *((_DWORD *)nullsub_3 + v14 + 113) = 1; } v15 = v9 == 0; if ( v9 == 0 ) v15 = (v30 | 1) == 3; v16 = 8; if ( v15 ) { v24 = *((unsigned __int16 *)ctx + 12); if ( v24 > 6 ) v16 = 8; else v16 = 8 * (*((_DWORD *)nullsub_3 + v24 + 113) != 1); } if ( (v29 & 2) != 0 ) { v18 = 8194; if ( v26 == 2 ) v18 = 139266; v17 = v10 & 0x80 | (32 * (v27 != 0)) | (16 * v9) | (v9 << 11) | ((v28 == 2) << 8) | v16 & 0xFFFFFFF8; } else { v17 = 16388; v18 = v10 & 0x80 | (32 * (v27 != 0)) | (16 * v9) | (v9 << 11) | ((v28 == 2) << 8) | v16 & 0xFFFFFFF8; if ( v29 << 31 == 0 ) v17 = 16396; } *((_DWORD *)params + 72) = v11; v19 = *((_DWORD *)ctx + 3); v20 = *((_DWORD *)ctx + 7); *((_DWORD *)params + 64) = v20; *((_DWORD *)params + 65) = v19; *((_DWORD *)params + 67) = v18 | v17; *((_DWORD *)params + 66) = *((unsigned __int16 *)ctx + 12); if ( v20 <= 0x20 ) { if ( v20 != 0 ) { v21 = (int *)((char *)ctx + 32); v22 = params; do { *((_DWORD *)v22 + 1) = 0; --v20; v23 = *v21++; *(_DWORD *)v22 = v23; v22 = (struct ta_params *)((char *)v22 + 8); } while ( v20 != 0 ); } if ( auc_cmd02__h1(ctx: params, params: (struct ta_params *)0x110) != 0 ) return 12; else return 16 * (sub_4018B8(a1: (int)nullsub_3, a2: 496) != 0); } else { return 17; } } } else { return 1; } } return result; } // ================ cmd 0x6 @ 0x4015c4 ================ int __fastcall auc_cmd06(void *ctx, struct ta_params *params) { if ( ctx == nullptr ) return 2; if ( *(_DWORD *)ctx <= 0xFu && auc_cmd06__h1(ctx: nullsub_3, params: (struct ta_params *)0x1F0) != 0 ) return 16; return 0; } // ================ cmd 0x5 @ 0x4015ee ================ int __fastcall auc_cmd05(void *ctx, struct ta_params *params) { if ( ctx == nullptr ) return 2; if ( sub_4018B8(a1: (int)nullsub_3, a2: 496) != 0 ) return 16; *((_DWORD *)ctx + 160) = 496; return 0; } // --------------------------------------------------------------- // COMMANDS ENTERED AT AN INTERNAL LABEL, NOT AT A FUNCTION ENTRY. // These dispatch into the middle of a larger function, which is what a // switch-style dispatcher produces. IDA refuses to split them out, and // undefining the owner to force a split was not worth the risk, so the // containing function is reproduced below IN FULL. Read the command's // code at the stated offset -- the function as a whole is NOT the handler. // --------------------------------------------------------------- // cmd 0x1 -> 0x4012e6 (enters auc_cmd02__h5+0xda) // cmd 0x4 -> 0x4013ae (enters auc_cmd02__h5+0x1a2) // ---- containing function auc_cmd02__h5 @ 0x40120c (entered mid-body by the commands above) ---- int __fastcall auc_cmd02__h5(void *ctx, struct ta_params *params) { int v2; // r2 int v3; // r3 int v6; // r4 int v7; // r7 int v8; // r6 __int64 v10; // r0 int v11; // lr __int64 v12; // r4 int *v13; // r7 int v14; // r6 int v15; // r2 int v16; // r3 int v17; // r6 int *v18; // r0 unsigned int *v19; // r0 unsigned int v20; // r0 int v21; // r0 _DWORD v22[128]; // [sp+8h] [bp-264h] BYREF int v23; // [sp+208h] [bp-64h] int v24; // [sp+20Ch] [bp-60h] void *v25; // [sp+210h] [bp-5Ch] int v26; // [sp+214h] [bp-58h] int v27; // [sp+218h] [bp-54h] struct ta_params *v28; // [sp+21Ch] [bp-50h] int *v29; // [sp+220h] [bp-4Ch] int v30; // [sp+224h] [bp-48h] int *v31; // [sp+228h] [bp-44h] int v32; // [sp+230h] [bp-3Ch] BYREF _DWORD v33[3]; // [sp+234h] [bp-38h] BYREF int a1; // [sp+240h] [bp-2Ch] BYREF int v35; // [sp+244h] [bp-28h] BYREF int dst[8]; // [sp+248h] [bp-24h] BYREF int v37; // [sp+268h] [bp-4h] int v38; // [sp+288h] [bp+1Ch] v37 = dword_401954; v6 = v3; v7 = v2; auc_lib_zero_fill_words(dst, len: 0x20u); a1 = 0; v35 = 0; if ( ctx != nullptr ) { v8 = auc_sysdrv_rpc_30(a1: -1610612720, a2: 256, a3: (int)&a1); if ( v8 == 0 ) { v33[1] = v7; v33[2] = v6; v33[0] = -1073741824; v8 = auc_sysdrv_rpc_33(a1, a2: (int)v33, a3: 1); if ( v8 == 0 ) { v8 = auc_sysdrv_rpc_1(a1: (int)&v35, a2: 805307920, a3: 4, a4: 256); if ( v8 == 0 ) { v8 = auc_sysdrv_rpc_3(a1: v35, a2: a1); if ( v8 == 0 ) { auc_sysdrv_rpc_E(a1: v35, a2: 0, a3: 0); v32 = 32; v31 = &v32; v8 = auc_sysdrv_rpc_10(a1: v35, a2: (int)ctx, a3: (int)params, a4: (int)dst); if ( v8 == 0 ) { auc_lib_thunk_tailjump(a1: v38); v8 = 0; } } } } } if ( v35 != 0 ) auc_sysdrv_rpc_2(a1: v35); if ( a1 != 0 ) auc_sysdrv_rpc_31(a1); } else { v8 = -65525; } if ( dword_401954 == v37 ) return v8; v10 = ((__int64 (__fastcall *)(int))loc_401958)(a1: dword_401954 - v37); v24 = v6; v25 = ctx; v26 = v8; v27 = v7; v28 = params; v29 = &dword_401954; v30 = v11; v12 = v10; v23 = dword_401954; auc_lib_zero_fill_words(dst: v22, len: 0x200u); if ( (_DWORD)v12 != 0 && HIDWORD(v12) != 0 ) { v13 = &dword_406004[6]; v14 = 0; *(_DWORD *)HIDWORD(v12) = 0xFFFF; while ( *(v13 - 5) != 0 ) { ++v14; v13 += 7; if ( v14 == 16 ) goto LABEL_25; } auc_lib_zero_fill_words(dst: v13 - 5, len: 0x18u); *(v13 - 5) = 1; *(_DWORD *)HIDWORD(v12) = v14; *(v13 - 6) = *(_DWORD *)v12; if ( auc_cmd02__h6(ctx: (void *)(v12 + 4), params: (struct ta_params *)0x100) != 0 ) { auc_lib_zero_fill_words(dst: v13 - 6, len: 0x1Cu); } else { v15 = v22[1]; v16 = v22[2]; v17 = v22[3]; v18 = v13 - 4; *v18 = v22[0]; v18[1] = v15; v18[2] = v16; v18[3] = v17; *v13 = v22[4]; if ( *(_DWORD *)v12 <= 6u ) *((_DWORD *)nullsub_3 + *(_DWORD *)v12 + 113) = 0; } } LABEL_25: if ( dword_401954 == v23 ) __asm { POPEQ.W {R4-R9,PC} } v19 = (unsigned int *)((int (__fastcall *)(int))loc_401958)(a1: dword_401954 - v23); if ( v19 == nullptr ) return 2; v20 = *v19; if ( v20 > 0xF ) return 1; v21 = 28 * v20 + 4218880; if ( *(_DWORD *)(v21 + 8) != 1 ) return 1; auc_lib_zero_fill_words(dst: (void *)(v21 + 4), len: 0x1Cu); return 0; }