//
// ObjectManager::replaceAllOccurencesOfString from 0x58c094 to 0x58cb00 (2668 bytes)
//
// 4 xrefs:
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x573bd4
// > ObjectManager::replaceAllOccurencesOfString @ 0x58c5c0
// > ObjectManager::loadCopiedSets @ 0x58cc94
// > ??> @ 0x90f18
//
// 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
//
cocos2d::CCDictionary *ObjectManager::replaceAllOccurencesOfString(
cocos2d::CCString *a1,
cocos2d::CCString *a2,
cocos2d::CCDictionary *a3)
{
char *CString; // x0
char *v5; // x0
cocos2d::CCDictionary *v6; // x25
unsigned int v7; // w22
cocos2d::CCString *v8; // x0
char *v9; // x24
char *v10; // x28
char *v11; // x27
char *v12; // x0
char *v13; // x0
char *v14; // x0
const void **v15; // x27
const void *v16; // x1
size_t v17; // x4
size_t v18; // x28
size_t v19; // x2
int v20; // w27
void *v21; // x5
__int64 v22; // x28
char *v23; // x0
unsigned int *v24; // x1
int v25; // w2
unsigned int *v26; // x3
int v27; // w0
const std::string *v28; // x28
cocos2d::CCObject *v29; // x0
std::string v30; // x1
cocos2d::CCObject *v31; // x27
__int64 *v32; // x0
char *v33; // x0
unsigned int *v34; // x1
int v35; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
cocos2d::CCArray *v44; // x24
unsigned int v45; // w21
cocos2d::CCString *v46; // x23
char *v47; // x0
cocos2d::CCDictionary *v48; // x27
char *v49; // x0
cocos2d::CCDictionary *v50; // x27
char *v51; // x0
__int64 *v52; // x23
__int64 v53; // x1
__int64 *v54; // x0
unsigned int *v55; // x1
int v56; // w2
unsigned int *v57; // x1
int v58; // w2
char *v59; // x0
const std::string *v60; // x1
cocos2d::CCObject *v61; // x27
void *v62; // x0
char *v63; // x0
void *v64; // x0
unsigned int *v65; // x1
int v66; // w2
unsigned int *v67; // x1
int v68; // w2
unsigned int *v69; // x1
int v70; // w2
void *v71; // x0
void *v72; // x0
unsigned int *v74; // x1
int v75; // w2
unsigned int *v76; // x1
int v77; // w2
_QWORD v78[2]; // [xsp+0h] [xbp+0h] BYREF
int v79[2]; // [xsp+68h] [xbp+68h]
__int64 *v80; // [xsp+70h] [xbp+70h]
void **v81; // [xsp+78h] [xbp+78h]
int v82[2]; // [xsp+80h] [xbp+80h]
char *v83; // [xsp+88h] [xbp+88h]
size_t v84; // [xsp+90h] [xbp+90h]
cocos2d::CCString *v85; // [xsp+98h] [xbp+98h]
cocos2d::CCString *v86; // [xsp+A0h] [xbp+A0h]
void *p; // [xsp+A8h] [xbp+A8h]
int v88[2]; // [xsp+B0h] [xbp+B0h]
cocos2d::CCArray *v89; // [xsp+B8h] [xbp+B8h]
char v90; // [xsp+D0h] [xbp+D0h] BYREF
__int64 v91; // [xsp+D8h] [xbp+D8h] BYREF
__int64 v92; // [xsp+E0h] [xbp+E0h] BYREF
char *v93; // [xsp+E8h] [xbp+E8h] BYREF
char v94; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v95; // [xsp+F8h] [xbp+F8h] BYREF
std::string v96; // [xsp+100h] [xbp+100h] BYREF
std::string v97; // [xsp+108h] [xbp+108h] BYREF
__int64 v98; // [xsp+110h] [xbp+110h] BYREF
__int64 v99; // [xsp+118h] [xbp+118h] BYREF
__int64 v100; // [xsp+120h] [xbp+120h]
_DWORD *v101; // [xsp+128h] [xbp+128h] BYREF
char *v102; // [xsp+130h] [xbp+130h] BYREF
v85 = a2;
v81 = (void **)&v91;
v86 = a1;
CString = (char *)cocos2d::CCString::getCString(a1);
sub_D153B8((int)&v91, CString);
v5 = (char *)cocos2d::CCString::getCString(a2);
v80 = &v92;
sub_D153B8((int)&v92, v5);
v6 = cocos2d::CCDictionary::createWithDictionary();
cocos2d::CCObject::retain(v6);
v89 = cocos2d::CCDictionary::allKeys(v6);
v83 = &v90;
v7 = 0;
*(_QWORD *)v82 = &v94;
*(_QWORD *)v79 = &v95;
while ( v7 < (unsigned int)cocos2d::CCArray::count(v89) )
{
v8 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v89, v7);
v9 = (char *)cocos2d::CCString::getCString(v8);
v10 = (char *)cocos2d::CCString::getCString(v86);
v11 = (char *)cocos2d::CCString::getCString(v85);
sub_D153B8((int)&v93, v9);
sub_D153B8((unsigned int)v78 + 296, v10);
sub_D153B8((int)&v102, v11);
sub_58B5D4((__int64)&v93, (void **)&v101, &v102);
v12 = v102 - 24;
if ( v102 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v102 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *((_DWORD *)v102 - 2);
*((_DWORD *)v102 - 2) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v12);
}
v13 = (char *)(v101 - 6);
if ( v101 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = v101 - 2;
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(v101 - 2);
*(v101 - 2) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v13);
}
sub_D153B8((int)&v102, v93);
v14 = v93 - 24;
if ( v93 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)(v93 - 8);
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = *((_DWORD *)v93 - 2);
*((_DWORD *)v93 - 2) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v14);
}
v15 = *(const void ***)v82;
sub_D153B8(v82[0], v9);
v16 = *v15;
v17 = *((_QWORD *)*v15 - 3);
v18 = *((_QWORD *)v102 - 3);
p = (char *)*v15 - 24;
*(_QWORD *)v88 = v16;
if ( v17 > v18 )
v19 = v18;
else
v19 = v17;
v84 = v17;
v20 = memcmp(v102, v16, v19);
v21 = p;
if ( !v20 )
{
v20 = 0x7FFFFFFF;
v22 = v18 - v84;
if ( v22 <= 0x7FFFFFFF )
{
if ( v22 >= (__int64)0xFFFFFFFF80000000LL )
v20 = v22;
else
v20 = 0x80000000;
}
}
if ( p == &qword_124B6B0 )
goto LABEL_15;
if ( &pthread_create )
{
v26 = (unsigned int *)(*(_QWORD *)v88 - 8LL);
do
v27 = __ldaxr(v26);
while ( __stlxr(v27 - 1, v26) );
}
else
{
v27 = *(_DWORD *)(*(_QWORD *)v88 - 8LL);
*(_DWORD *)(*(_QWORD *)v88 - 8LL) = v27 - 1;
}
if ( v27 > 0 )
{
LABEL_15:
if ( !v20 )
goto LABEL_16;
}
else
{
operator delete(v21);
if ( !v20 )
goto LABEL_16;
}
v28 = *(const std::string **)v79;
sub_D153B8(v79[0], v9);
v29 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v6, v28);
v30.m_data.m_data = v28->m_data.m_data;
v31 = v29;
v32 = (__int64 *)((char *)v28->m_data.m_data - 24);
if ( v32 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)((char *)v30.m_data.m_data - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *((_DWORD *)v30.m_data.m_data - 2);
*((_DWORD *)v30.m_data.m_data - 2) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v32);
}
cocos2d::CCDictionary::setObject((int)v6, v31);
sub_D153B8((int)&v96, v9);
cocos2d::CCDictionary::removeObjectForKey(v6, &v96);
v33 = (char *)v96.m_data.m_data - 24;
if ( (__int64 *)v96.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v34 = (unsigned int *)((char *)v96.m_data.m_data - 8);
do
v35 = __ldaxr(v34);
while ( __stlxr(v35 - 1, v34) );
}
else
{
v35 = *((_DWORD *)v96.m_data.m_data - 2);
*((_DWORD *)v96.m_data.m_data - 2) = v35 - 1;
}
if ( v35 <= 0 )
operator delete(v33);
}
LABEL_16:
v23 = v102 - 24;
if ( v102 - 24 == (char *)&qword_124B6B0 )
goto LABEL_17;
if ( &pthread_create )
{
v24 = (unsigned int *)(v102 - 8);
do
v25 = __ldaxr(v24);
while ( __stlxr(v25 - 1, v24) );
}
else
{
v25 = *((_DWORD *)v102 - 2);
*((_DWORD *)v102 - 2) = v25 - 1;
}
if ( v25 > 0 )
{
LABEL_17:
++v7;
}
else
{
++v7;
operator delete(v23);
}
}
v44 = cocos2d::CCDictionary::allKeys(v6);
v45 = 0;
v89 = (cocos2d::CCArray *)&v101;
*(_QWORD *)v88 = &v98;
while ( v45 < (unsigned int)cocos2d::CCArray::count(v44) )
{
v46 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v44, v45);
v47 = (char *)cocos2d::CCString::getCString(v46);
sub_D153B8((int)&v97, v47);
v48 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v6, &v97);
v49 = (char *)v97.m_data.m_data - 24;
if ( (__int64 *)v97.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = (unsigned int *)((char *)v97.m_data.m_data - 8);
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *((_DWORD *)v97.m_data.m_data - 2);
*((_DWORD *)v97.m_data.m_data - 2) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v49);
}
if ( !v48 )
goto LABEL_66;
if ( _dynamic_cast(
v48,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCDictionary,
0) )
{
v50 = ObjectManager::replaceAllOccurencesOfString(v86, v85, v48);
v51 = (char *)cocos2d::CCString::getCString(v46);
v52 = *(__int64 **)v88;
sub_D153B8(v88[0], v51);
cocos2d::CCDictionary::setObject((int)v6, v50);
v53 = *v52;
v54 = (__int64 *)(*v52 - 24);
if ( v54 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)(v53 - 8);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *(_DWORD *)(v53 - 8);
*(_DWORD *)(v53 - 8) = v58 - 1;
}
if ( v58 <= 0 )
goto LABEL_76;
}
LABEL_66:
++v45;
}
else
{
v59 = (char *)cocos2d::CCString::getCString((cocos2d::CCString *)v48);
sub_D153B8((int)&v102, v59);
sub_58B5D4((__int64)&v102, v81, v80);
sub_D153B8((unsigned int)v78 + 280, v102);
v61 = (cocos2d::CCObject *)cocos2d::CCString::create((cocos2d::CCString *)&v99, v60);
v62 = (void *)(v99 - 24);
if ( (__int64 *)(v99 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v69 = (unsigned int *)(v99 - 8);
do
v70 = __ldaxr(v69);
while ( __stlxr(v70 - 1, v69) );
}
else
{
v70 = *(_DWORD *)(v99 - 8);
*(_DWORD *)(v99 - 8) = v70 - 1;
}
if ( v70 <= 0 )
operator delete(v62);
}
v63 = (char *)cocos2d::CCString::getCString(v46);
sub_D153B8((unsigned int)v78 + 288, v63);
cocos2d::CCDictionary::setObject((int)v6, v61);
v64 = (void *)(v100 - 24);
if ( (__int64 *)(v100 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v67 = (unsigned int *)(v100 - 8);
do
v68 = __ldaxr(v67);
while ( __stlxr(v68 - 1, v67) );
}
else
{
v68 = *(_DWORD *)(v100 - 8);
*(_DWORD *)(v100 - 8) = v68 - 1;
}
if ( v68 <= 0 )
operator delete(v64);
}
v54 = (__int64 *)(v102 - 24);
if ( v102 - 24 == (char *)&qword_124B6B0 )
goto LABEL_66;
if ( &pthread_create )
{
v65 = (unsigned int *)(v102 - 8);
do
v66 = __ldaxr(v65);
while ( __stlxr(v66 - 1, v65) );
}
else
{
v66 = *((_DWORD *)v102 - 2);
*((_DWORD *)v102 - 2) = v66 - 1;
}
if ( v66 > 0 )
goto LABEL_66;
LABEL_76:
++v45;
operator delete(v54);
}
}
v71 = (void *)(v92 - 24);
if ( (__int64 *)(v92 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v76 = (unsigned int *)(v92 - 8);
do
v77 = __ldaxr(v76);
while ( __stlxr(v77 - 1, v76) );
}
else
{
v77 = *(_DWORD *)(v92 - 8);
*(_DWORD *)(v92 - 8) = v77 - 1;
}
if ( v77 <= 0 )
operator delete(v71);
}
v72 = (void *)(v91 - 24);
if ( (__int64 *)(v91 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v74 = (unsigned int *)(v91 - 8);
do
v75 = __ldaxr(v74);
while ( __stlxr(v75 - 1, v74) );
}
else
{
v75 = *(_DWORD *)(v91 - 8);
*(_DWORD *)(v91 - 8) = v75 - 1;
}
if ( v75 <= 0 )
operator delete(v72);
}
return v6;
}