//
// GameManager::switchCustomObjects from 0x1003849c0 to 0x100384d04 (836 bytes)
//
// 1 xrefs:
// > GameManager::reorderKey @ 0x1003849ae
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void __fastcall GameManager::switchCustomObjects(GameManager *a1, int a2, int a3)
{
double v3; // xmm0_8
cocos2d::CCDictionary *m_customObjectDict; // rbx
cocos2d::CCString *v5; // rax
const char *CString; // r13
size_t v7; // rax
size_t v8; // r14
char *v9; // r12
size_t v10; // r15
cocos2d::CCObject *v11; // r15
__int64 v12; // r14
cocos2d::CCString *v13; // rax
const char *v14; // rbx
size_t v15; // rax
size_t v16; // r13
char *v17; // r12
cocos2d::CCObject *v18; // r14
size_t v19; // r15
cocos2d::CCObject *v20; // r13
__int64 v21; // r14
cocos2d::CCString *v22; // rax
const char *v23; // rbx
size_t v24; // rax
size_t v25; // r12
char *v26; // r15
cocos2d::CCObject *v27; // r14
size_t v28; // r13
__int64 v29; // r14
cocos2d::CCString *v30; // rax
const char *v31; // rbx
size_t v32; // rax
size_t v33; // r15
char *v34; // r12
size_t v35; // r13
__int64 v36; // [rsp+0h] [rbp-60h]
__int64 v37; // [rsp+0h] [rbp-60h]
__int64 v38; // [rsp+0h] [rbp-60h]
cocos2d::CCObject *v39; // [rsp+8h] [rbp-58h]
__int64 v40; // [rsp+10h] [rbp-50h]
__int64 v41; // [rsp+10h] [rbp-50h]
size_t __dst; // [rsp+20h] [rbp-40h] BYREF
size_t v43; // [rsp+28h] [rbp-38h]
void *__p; // [rsp+30h] [rbp-30h]
m_customObjectDict = a1->m_customObjectDict;
v5 = (cocos2d::CCString *)sub_1007AB580("%i", (char)a1);
CString = cocos2d::CCString::getCString(v5);
v7 = strlen(CString);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_42;
v8 = v7;
if ( v7 >= 0x17 )
{
v10 = 26;
if ( (v7 | 7) != 0x17 )
v10 = (v7 | 7) + 1;
v9 = (char *)operator new(v10);
__p = v9;
__dst = v10 + 1;
v43 = v8;
goto LABEL_8;
}
LOBYTE(__dst) = 2 * v7;
v9 = (char *)&__dst + 1;
if ( v7 )
LABEL_8:
memmove(v9, CString, v8);
v9[v8] = 0;
v11 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey_1((__int64)m_customObjectDict, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v12 = *(_QWORD *)(v36 + 416);
v13 = (cocos2d::CCString *)sub_1007AB580("%i", v36);
v14 = cocos2d::CCString::getCString(v13);
v15 = strlen(v14);
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
LABEL_42:
sub_100006BF0(v3);
v16 = v15;
if ( v15 >= 0x17 )
{
v40 = v12;
v18 = v11;
v19 = 26;
if ( (v15 | 7) != 0x17 )
v19 = (v15 | 7) + 1;
v17 = (char *)operator new(v19);
__p = v17;
__dst = v19 + 1;
v11 = v18;
v12 = v40;
v43 = v16;
goto LABEL_18;
}
LOBYTE(__dst) = 2 * v15;
v17 = (char *)&__dst + 1;
if ( v15 )
LABEL_18:
memmove(v17, v14, v16);
v17[v16] = 0;
v20 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey_1(v12, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
cocos2d::CCObject::retain(v11);
v21 = *(_QWORD *)(v37 + 416);
v22 = (cocos2d::CCString *)sub_1007AB580("%i", v37);
v23 = cocos2d::CCString::getCString(v22);
v24 = strlen(v23);
if ( v24 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_42;
v25 = v24;
v39 = v11;
if ( v24 >= 0x17 )
{
v41 = v21;
v27 = v20;
v28 = 26;
if ( (v24 | 7) != 0x17 )
v28 = (v24 | 7) + 1;
v26 = (char *)operator new(v28);
__p = v26;
__dst = v28 + 1;
v20 = v27;
v21 = v41;
v43 = v25;
goto LABEL_28;
}
LOBYTE(__dst) = 2 * v24;
v26 = (char *)&__dst + 1;
if ( v24 )
LABEL_28:
memmove(v26, v23, v25);
v26[v25] = 0;
cocos2d::CCDictionary::setObject_1(v21, v20, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
v29 = *(_QWORD *)(v38 + 416);
v30 = (cocos2d::CCString *)sub_1007AB580("%i", v38);
v31 = cocos2d::CCString::getCString(v30);
v32 = strlen(v31);
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_42;
v33 = v32;
if ( v32 >= 0x17 )
{
v35 = 26;
if ( (v32 | 7) != 0x17 )
v35 = (v32 | 7) + 1;
v34 = (char *)operator new(v35);
__p = v34;
__dst = v35 + 1;
v43 = v33;
goto LABEL_38;
}
LOBYTE(__dst) = 2 * v32;
v34 = (char *)&__dst + 1;
if ( v32 )
LABEL_38:
memmove(v34, v31, v33);
v34[v33] = 0;
cocos2d::CCDictionary::setObject_1(v29, v39, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
cocos2d::CCObject::release(v39);
}