// // sub_10004E540 from 0x10004e540 to 0x10004e7ec (684 bytes) // // 3 xrefs: // > sub_1000AF6A4 @ 0x1000af6fc // > sub_1004149FC @ 0x100414a80 // > sub_100414B90 @ 0x100414c18 // // This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True! // // 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 10:57:42 +0000 // __int64 __fastcall sub_10004E540(__int64 a1, const void **a2, int a3, int a4) { _QWORD *v8; // x0 __int64 v9; // x0 int v10; // w9 const std::string::value_type *v11; // x1 std::string::size_type v12; // x2 std::string *v13; // x0 std::string::size_type v14; // x21 char v15; // w22 size_t size; // x21 std::string *p_p; // x22 std::string *v18; // x1 std::string *v19; // x0 std::error_code *v20; // x1 FILE *v21; // x21 int v22; // w9 const void *v23; // x0 size_t v24; // x2 size_t v25; // x22 int v26; // w0 std::error_code *v27; // x2 const void *v28; // x8 bool v29; // zf __int64 v30; // x20 const std::__fs::filesystem::path *v31; // x0 const std::__fs::filesystem::path *v32; // x1 int v33; // w0 const std::__fs::filesystem::path *v34; // x0 std::string __p; // [xsp+0h] [xbp-70h] BYREF std::string v37; // [xsp+20h] [xbp-50h] BYREF _QWORD v38[2]; // [xsp+38h] [xbp-38h] v8 = sub_100009900(&v37, ""); if ( a3 ) { std::string::operator=(&v37, (const std::string *)a1); } else { v9 = cocos2d::CCFileUtils::sharedFileUtils(v8); (*(void (__fastcall **)(std::string *__return_ptr))(*(_QWORD *)v9 + 144LL))(&__p); v10 = *(char *)(a1 + 23); if ( v10 >= 0 ) v11 = (const std::string::value_type *)a1; else v11 = *(const std::string::value_type **)a1; if ( v10 >= 0 ) v12 = *(unsigned __int8 *)(a1 + 23); else v12 = *(_QWORD *)(a1 + 8); v13 = std::string::append(&__p, v11, v12); v14 = v13->__r_.__value_.__r.__words[0]; v38[0] = v13->__r_.__value_.__l.__size_; *(_QWORD *)((char *)v38 + 7) = *(std::string::size_type *)((char *)&v13->__r_.__value_.__r.__words[1] + 7); v15 = HIBYTE(v13->__r_.__value_.__r.__words[2]); v13->__r_.__value_.__l.__size_ = 0; v13->__r_.__value_.__r.__words[2] = 0; v13->__r_.__value_.__r.__words[0] = 0; if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v37.__r_.__value_.__l.__data_); v37.__r_.__value_.__r.__words[0] = v14; v37.__r_.__value_.__l.__size_ = v38[0]; *(std::string::size_type *)((char *)&v37.__r_.__value_.__r.__words[1] + 7) = *(_QWORD *)((char *)v38 + 7); *((_BYTE *)&v37.__r_.__value_.__s + 23) = v15; if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 ) { operator delete(__p.__r_.__value_.__l.__data_); if ( a4 ) goto LABEL_13; LABEL_25: if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 ) sub_1000097D0(&__p, v37.__r_.__value_.__l.__data_, v37.__r_.__value_.__l.__size_); else __p = v37; goto LABEL_28; } } if ( !a4 ) goto LABEL_25; LABEL_13: if ( (v37.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ) size = HIBYTE(v37.__r_.__value_.__r.__words[2]); else size = v37.__r_.__value_.__l.__size_; p_p = &__p; sub_100026068((__int64)&__p, size + 4); if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL ) p_p = (std::string *)__p.__r_.__value_.__r.__words[0]; if ( size ) { if ( (v37.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ) v18 = &v37; else v18 = (std::string *)v37.__r_.__value_.__r.__words[0]; memmove(p_p, v18, size); } strcpy((char *)p_p + size, ".tmp"); LABEL_28: if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ) v19 = &__p; else v19 = (std::string *)__p.__r_.__value_.__r.__words[0]; v21 = fopen((const char *)v19, "w"); if ( !v21 ) { if ( (a4 & 1) == 0 ) { LABEL_61: v30 = 0; goto LABEL_62; } LABEL_57: if ( (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ) v34 = (const std::__fs::filesystem::path *)&__p; else v34 = (const std::__fs::filesystem::path *)__p.__r_.__value_.__r.__words[0]; remove(v34, v20); goto LABEL_61; } v22 = *((char *)a2 + 23); if ( v22 >= 0 ) v23 = a2; else v23 = *a2; if ( v22 >= 0 ) v24 = *((unsigned __int8 *)a2 + 23); else v24 = (size_t)a2[1]; v25 = fwrite(v23, 1u, v24, v21); v26 = fclose(v21); v28 = (const void *)*((unsigned __int8 *)a2 + 23); if ( (char)v28 < 0 ) v28 = a2[1]; if ( v26 ) v29 = 0; else v29 = v25 == (_QWORD)v28; v30 = v29; if ( (a4 & 1) != 0 ) { if ( (_DWORD)v30 ) { v31 = (__p.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ? (const std::__fs::filesystem::path *)&__p : (const std::__fs::filesystem::path *)__p.__r_.__value_.__r.__words[0]; v32 = (v37.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL ? (const std::__fs::filesystem::path *)&v37 : (const std::__fs::filesystem::path *)v37.__r_.__value_.__r.__words[0]; rename(v31, v32, v27); if ( !v33 ) { v30 = 1; goto LABEL_62; } } goto LABEL_57; } LABEL_62: if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 ) operator delete(__p.__r_.__value_.__l.__data_); if ( SHIBYTE(v37.__r_.__value_.__r.__words[2]) < 0 ) operator delete(v37.__r_.__value_.__l.__data_); return v30; }
GD Web Decomp Icon

GD Web Decomp

Raw Source