// // GameToolbox::saveStringToFile from 0x3d01c8 to 0x3d038e (454 bytes) // // 3 xrefs: // > sub_46BA3C @ 0x46ba9e // > sub_46BB18 @ 0x46bb7c // > sub_4B5A60 @ 0x4b5a9e // // This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False! // // Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings // Generated at Fri, 27 Nov 2026 11:46:40 +0000 // int __fastcall GameToolbox::saveStringToFile(unsigned __int8 *a1, unsigned __int8 *a2, int a3, int a4) { cocos2d::CCFileUtils *v8; // r0 int v9; // r0 int v10; // r2 const void *v11; // r1 size_t v12; // r2 int *v13; // r3 int v14; // r1 char *v15; // r2 int v16; // r0 size_t v17; // r1 char *v18; // r2 size_t v19; // r2 char *v20; // r1 char *v21; // r0 FILE *v22; // r0 FILE *v23; // r10 int v24; // r2 FILE *v25; // r3 const void *v26; // r0 size_t v27; // r2 size_t v28; // r9 int v29; // r0 int v30; // r3 int v31; // r3 const char *v32; // r0 const char *v33; // r1 int v34; // r7 char *v35; // r0 int v37; // [sp+0h] [bp-28h] BYREF size_t v38; // [sp+4h] [bp-24h] char *v39; // [sp+8h] [bp-20h] _DWORD v40[3]; // [sp+Ch] [bp-1Ch] BYREF int v41; // [sp+18h] [bp-10h] BYREF int v42; // [sp+1Ch] [bp-Ch] char *filename; // [sp+20h] [bp-8h] v37 = 0; v38 = 0; v39 = nullptr; v8 = (cocos2d::CCFileUtils *)std::string::__init(&v37, &unk_B6B226, 0); if ( a3 ) { std::string::operator=((unsigned __int8 *)&v37, a1); } else { v9 = cocos2d::CCFileUtils::sharedFileUtils(v8); (*(void (__fastcall **)(_DWORD *, int))(*(_DWORD *)v9 + 72))(v40, v9); v10 = *a1; if ( (v10 & 1) != 0 ) { v11 = *((const void **)a1 + 2); v12 = *((_DWORD *)a1 + 1); } else { v11 = a1 + 1; v12 = v10 >> 1; } v13 = std::string::append(v40, v11, v12); v14 = v13[1]; v15 = (char *)v13[2]; v41 = *v13; v42 = v14; filename = v15; *v13 = 0; v13[1] = 0; v13[2] = 0; if ( (v37 & 1) != 0 ) { *v39 = 0; v38 = 0; } else { LOWORD(v37) = 0; } std::string::reserve(&v37, 0); v16 = v41; v17 = v42; v18 = filename; v41 = 0; v42 = 0; filename = nullptr; v37 = v16; v38 = v17; v39 = v18; std::string::~string((int)&v41); std::string::~string((int)v40); } if ( a4 ) { v41 = 0; v42 = 0; filename = nullptr; if ( (v37 & 1) != 0 ) { v19 = v38; v20 = v39; } else { v19 = (int)(unsigned __int8)v37 >> 1; v20 = (char *)&v37 + 1; } std::string::__init(&v41, v20, v19, v19 + 4); std::string::append(&v41, ".tmp", 4u); } else { std::string::basic_string(&v41, (int)&v37); } if ( (v41 & 1) != 0 ) v21 = filename; else v21 = (char *)&v41 + 1; v22 = fopen(v21, "w"); v23 = v22; if ( !v22 ) goto LABEL_37; v24 = *a2; v25 = v22; if ( (v24 & 1) != 0 ) { v26 = *((const void **)a2 + 2); v27 = *((_DWORD *)a2 + 1); } else { v26 = a2 + 1; v27 = v24 >> 1; } v28 = fwrite(v26, 1u, v27, v25); v29 = fclose(v23); v30 = *a2; v31 = (v30 & 1) != 0 ? *((_DWORD *)a2 + 1) : v30 >> 1; if ( v28 != v31 || v29 ) { LABEL_37: if ( !a4 ) { LABEL_42: v34 = 0; goto LABEL_43; } LABEL_38: if ( (v41 & 1) != 0 ) v35 = filename; else v35 = (char *)&v41 + 1; remove(v35); goto LABEL_42; } if ( a4 ) { v32 = (v41 & 1) != 0 ? filename : (char *)&v41 + 1; v33 = (v37 & 1) != 0 ? v39 : (char *)&v37 + 1; if ( rename(v32, v33) ) goto LABEL_38; } v34 = 1; LABEL_43: std::string::~string((int)&v41); std::string::~string((int)&v37); return v34; }
GD Web Decomp Icon

GD Web Decomp

Raw Source