//
// ObjectManager::loadCopiedSets from 0x14007c8a0 to 0x14007cd69 (1225 bytes)
//
// 2 xrefs:
// > ObjectManager::init @ 0x14007bf81
// > ??> @ 0x140911e1c
//
// This function is hookable on this platform (idp: pc, 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 11:25:53 +0000
//
// Hidden C++ exception states: #wind=4
unsigned int __fastcall ObjectManager::loadCopiedSets(__int64 a1)
{
cocos2d::CCArray *v2; // r12
unsigned int v3; // r14d
unsigned int result; // eax
__m128i si128; // xmm6
__m128i v6; // xmm9
__m128i v7; // xmm8
__m128i v8; // xmm7
cocos2d::CCString *v9; // r15
const char *CString; // rax
size_t v11; // r8
__int64 v12; // rdi
void *v13; // rcx
cocos2d::CCString *v14; // rbx
void *v15; // rcx
__int64 v16; // rsi
void *v17; // rcx
const char *v18; // rax
size_t v19; // r8
void *v20; // rcx
__int64 v21; // rax
__int64 v22; // rbx
void *v23; // rcx
const char *v24; // rax
size_t v25; // r8
void *v26; // rcx
__int128 v27; // [rsp+38h] [rbp-99h] BYREF
__m128i v28; // [rsp+48h] [rbp-89h]
__int128 v29; // [rsp+58h] [rbp-79h] BYREF
__m128i v30; // [rsp+68h] [rbp-69h]
_QWORD v31[2]; // [rsp+78h] [rbp-59h] BYREF
__m128i v32; // [rsp+88h] [rbp-49h]
__int128 v33; // [rsp+98h] [rbp-39h] BYREF
__m128i v34; // [rsp+A8h] [rbp-29h]
v2 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 320));
v3 = 0;
result = cocos2d::CCArray::count(v2);
if ( result )
{
si128 = _mm_load_si128((const __m128i *)&Size);
v6 = _mm_load_si128((const __m128i *)&xmmword_140836540);
v7 = _mm_load_si128((const __m128i *)&xmmword_1408365B0);
v8 = _mm_load_si128((const __m128i *)&xmmword_140836550);
do
{
v9 = cocos2d::CCArray::objectAtIndex(v2, v3);
CString = cocos2d::CCString::getCString(v9);
v33 = 0;
v34 = 0;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003D230(&v33, CString, v11);
v12 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 320), &v33);
if ( v34.m128i_i64[1] > 0xFuLL )
{
v13 = (void *)v33;
if ( (unsigned __int64)(v34.m128i_i64[1] + 1) >= 0x1000 )
{
v13 = *(void **)(v33 - 8);
if ( (unsigned __int64)(v33 - (_QWORD)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
v34 = si128;
LOBYTE(v33) = 0;
v27 = 0;
v28 = v8;
strcpy((char *)&v27, "copy");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(v12, &v27);
if ( v28.m128i_i64[1] > 0xFuLL )
{
v15 = (void *)v27;
if ( (unsigned __int64)(v28.m128i_i64[1] + 1) >= 0x1000 )
{
v15 = *(void **)(v27 - 8);
if ( (unsigned __int64)(v27 - (_QWORD)v15 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v15);
}
v28 = si128;
LOBYTE(v27) = 0;
v31[1] = 26465;
v32 = v7;
v31[0] = 0x546563616C706572LL;
v16 = cocos2d::CCDictionary::objectForKey(v12, v31);
if ( v32.m128i_i64[1] > 0xFuLL )
{
v17 = (void *)v31[0];
if ( (unsigned __int64)(v32.m128i_i64[1] + 1) >= 0x1000 )
{
v17 = *(void **)(v31[0] - 8LL);
if ( (unsigned __int64)(v31[0] - (_QWORD)v17 - 8LL) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
v32 = si128;
LOBYTE(v31[0]) = 0;
if ( v16 )
{
if ( v14 )
{
v18 = cocos2d::CCString::getCString(v14);
v29 = 0;
v30 = 0;
v19 = -1;
do
++v19;
while ( v18[v19] );
sub_14003D230(&v29, v18, v19);
v12 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 320), &v29);
if ( v30.m128i_i64[1] > 0xFuLL )
{
v20 = (void *)v29;
if ( (unsigned __int64)(v30.m128i_i64[1] + 1) >= 0x1000 )
{
v20 = *(void **)(v29 - 8);
if ( (unsigned __int64)(v29 - (_QWORD)v20 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v20);
}
v30 = si128;
LOBYTE(v29) = 0;
}
v27 = 0;
v28 = v6;
LODWORD(v27) = 8026488;
v21 = cocos2d::CCString::create(&v27);
v22 = ObjectManager::replaceAllOccurencesOfString(v21, v16, v12);
if ( v28.m128i_i64[1] > 0xFuLL )
{
v23 = (void *)v27;
if ( (unsigned __int64)(v28.m128i_i64[1] + 1) >= 0x1000 )
{
v23 = *(void **)(v27 - 8);
if ( (unsigned __int64)(v27 - (_QWORD)v23 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v23);
}
v28 = si128;
LOBYTE(v27) = 0;
v24 = cocos2d::CCString::getCString(v9);
v29 = 0;
v30 = 0;
v25 = -1;
do
++v25;
while ( v24[v25] );
sub_14003D230(&v29, v24, v25);
cocos2d::CCDictionary::setObject(*(_QWORD *)(a1 + 320), v22, &v29);
if ( v30.m128i_i64[1] > 0xFuLL )
{
v26 = (void *)v29;
if ( (unsigned __int64)(v30.m128i_i64[1] + 1) >= 0x1000 )
{
v26 = *(void **)(v29 - 8);
if ( (unsigned __int64)(v29 - (_QWORD)v26 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v26);
}
}
++v3;
result = cocos2d::CCArray::count(v2);
}
while ( v3 < result );
}
return result;
}