// FP TA command surface, decompiled with restored names, prototypes and types. // Source: psp_out/versions_win/ta_0.7.0.1_7e8be282.bin // Handlers resolved from fw/cmdmaps/fp.json; loc_* labels mapped to their // containing function. Generated by fw/ta_surface.py. // ================ cmd 0x1 @ 0x40293a ================ int __fastcall fp_cmd01(void *ctx, struct ta_params *params) { int v2; // r2 _DWORD *i; // r3 int v4; // r12 if ( ctx == nullptr ) return 2; v2 = 0; *(_DWORD *)ctx = 0xFFFF; for ( i = dword_407000 + 4; *(i - 1) != 0; i += 5 ) { if ( ++v2 == 4 ) return 6; } v4 = 0; *(i - 1) = 1; *i = 0; i[1] = 0; i[2] = 0; i[3] = 0; *(_DWORD *)ctx = v2; return v4; } // ================ cmd 0x6 @ 0x402988 ================ int __fastcall fp_cmd06(void *ctx, struct ta_params *params) { unsigned int v2; // r0 int v4; // r0 if ( ctx == nullptr ) return 2; v2 = *(_DWORD *)ctx; if ( v2 > 3 ) return 4; v4 = 5 * v2; if ( dword_407000[v4] != 1 ) return 5; fp_lib_zero_fill_words(dst: &dword_407000[v4], len: 0x14u); return 0; } // ================ cmd 0x5 @ 0x4029c0 ================ int __fastcall fp_cmd05(void *ctx, struct ta_params *params) { int result; // r0 __int64 v5; // r0 int *v6; // [sp+0h] [bp-38h] BYREF int v7; // [sp+4h] [bp-34h] char *v8; // [sp+8h] [bp-30h] int v9; // [sp+Ch] [bp-2Ch] char *v10; // [sp+10h] [bp-28h] int v11; // [sp+14h] [bp-24h] struct ta_params *v12; // [sp+18h] [bp-20h] _DWORD v13[5]; // [sp+20h] [bp-18h] BYREF int v14; // [sp+34h] [bp-4h] v14 = dword_403054; fp_lib_zero_fill_words(dst: &v6, len: 0x1Cu); memset(v13, 0, 16); result = 2; if ( ctx != nullptr && params != nullptr ) { if ( *(_DWORD *)ctx > 3u ) { result = 4; } else if ( dword_407000[5 * *(_DWORD *)ctx] == 1 ) { v6 = &dword_407000[5 * *(_DWORD *)ctx + 1]; v12 = (struct ta_params *)v13; v11 = 16; v7 = 16; v10 = (char *)ctx + 4; if ( sub_402844(a1: (int)&v6, a2: 0) != 0 ) { result = 12; } else { v11 = 16; v12 = params; v9 = 16; v6 = v13; v7 = 16; v10 = (char *)ctx + 36; v8 = (char *)ctx + 20; result = sub_402844(a1: (int)&v6, a2: 2); if ( result != 0 ) result = 12; } } else { result = 5; } } if ( dword_403054 != v14 ) { v5 = ((__int64 (__fastcall *)(int, int))loc_403058)(a1: result, a2: dword_403054 - v14); return fp_cmd03(ctx: (void *)v5, params: (struct ta_params *)HIDWORD(v5)); } return result; } // ================ cmd 0x3 @ 0x402a70 ================ int __fastcall fp_cmd03(void *ctx, struct ta_params *params) { int v2; // r5 int *v4; // r6 v2 = 2; if ( ctx != nullptr && params != nullptr ) { if ( *(_DWORD *)ctx > 3u ) { return 4; } else if ( dword_407000[5 * *(_DWORD *)ctx] == 1 ) { v4 = &dword_407000[5 * *(_DWORD *)ctx + 1]; v2 = fp_cmd03__h1(ctx: (char *)ctx + 4, params); if ( v2 == 0 ) { v2 = 16; if ( sub_4032C2(a1: 0, a2: (int)v4, a3: 16) == 0 ) { if ( fp_cmd03__h7(ctx: v4, params: (struct ta_params *)((char *)params + 256)) != 0 ) { return 17; } else { v2 = 0; *((_DWORD *)params + 96) = 0; } } } } else { return 5; } } return v2; } // ================ cmd 0x2 @ 0x402ad8 ================ int __fastcall fp_cmd02(void *ctx, struct ta_params *params) { int result; // r0 int v4; // [sp+4h] [bp-4h] BYREF if ( ctx == nullptr ) return 2; result = fp_cmd02__h1(ctx, params: (struct ta_params *)&v4); *((_DWORD *)ctx + 2048) = v4; return result; } // ================ cmd 0x7 @ 0x402af6 ================ int __fastcall fp_cmd07(void *ctx, struct ta_params *params) { int v2; // r1 _DWORD *v4; // r4 void *v5; // r4 if ( ctx == nullptr ) return 2; v2 = *(_DWORD *)ctx; if ( *(_DWORD *)ctx > 3u ) return 4; v4 = (_DWORD *)(20 * v2 + 4222976); *v4 = 1; v4[2] = 0; v4[3] = 0; v4[4] = 0; v4[1] = 0; v5 = (void *)(20 * v2 + 4222980); if ( fp_cmd07__h1(ctx: v5, params: (struct ta_params *)((char *)ctx + 4)) != 0 ) return 17; else return 16 * (sub_4032C2(a1: 0, a2: (int)v5, a3: 16) != 0); } // ================ cmd 0x4 @ 0x402b4c ================ int __fastcall fp_cmd04(void *ctx, struct ta_params *params) { int result; // r0 int v4; // r0 __int64 v5; // r0 _DWORD v6[7]; // [sp+4h] [bp-34h] BYREF _DWORD v7[5]; // [sp+20h] [bp-18h] BYREF int v8; // [sp+34h] [bp-4h] v8 = dword_403054; result = 2; if ( ctx != nullptr && params != nullptr ) { if ( *(_DWORD *)ctx > 3u ) { result = 4; } else { v4 = 5 * *(_DWORD *)ctx; if ( dword_407000[5 * *(_DWORD *)ctx] == 1 ) { v6[2] = 0; v6[3] = 0; v7[0] = dword_403440[0]; v7[1] = dword_403440[1]; v7[2] = dword_403440[2]; v7[3] = dword_403440[3]; v6[6] = params; v6[4] = v7; v6[5] = 16; v6[0] = &dword_407000[v4 + 1]; v6[1] = 16; result = sub_402844(a1: (int)v6, a2: 1); if ( result != 0 ) result = 12; } else { result = 5; } } } if ( dword_403054 != v8 ) { v5 = ((__int64 (__fastcall *)(int, int))loc_403058)(a1: result, a2: dword_403054 - v8); return fp_cmd03__h3(ctx: (void *)v5, params: (struct ta_params *)HIDWORD(v5)); } return result; }