//
// ObjectManager::replaceAllOccurencesOfString from 0x2f1ee8 to 0x2f21c8 (736 bytes)
//
// 3 xrefs:
// > CCAnimateFrameCache::addCustomSpriteFramesWithFile @ 0x2e51d4
// > ObjectManager::replaceAllOccurencesOfString @ 0x2f219a
// > ObjectManager::loadCopiedSets @ 0x2f22b8
//
// 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; // r0
char *v4; // r0
cocos2d::CCDictionary *v5; // r11
unsigned int v6; // r7
cocos2d::CCString *v7; // r0
char *v8; // r8
char *v9; // r9
char *v10; // r6
int i; // r2
int v12; // r9
int v13; // r6
cocos2d::CCArray *v14; // r8
unsigned int j; // r5
cocos2d::CCString *v16; // r9
char *v17; // r0
cocos2d::CCDictionary *v18; // r7
char *v19; // r0
int k; // r2
int v21; // r7
const std::string *v22; // r1
char *v23; // r0
char **v24; // r0
cocos2d::CCDictionary *v26; // r7
char *v27; // r0
cocos2d::CCArray *v29; // [sp+8h] [bp-4Ch]
cocos2d::CCArray *v30; // [sp+8h] [bp-4Ch]
cocos2d::CCObject *v32; // [sp+14h] [bp-40h]
int v33; // [sp+1Ch] [bp-38h] BYREF
int v34; // [sp+20h] [bp-34h] BYREF
char *v35; // [sp+24h] [bp-30h] BYREF
_BYTE v36[4]; // [sp+28h] [bp-2Ch] BYREF
std::string v37; // [sp+2Ch] [bp-28h] BYREF
_BYTE v38[4]; // [sp+30h] [bp-24h] BYREF
std::string v39; // [sp+34h] [bp-20h] BYREF
_BYTE v40[4]; // [sp+38h] [bp-1Ch] BYREF
char v41; // [sp+3Ch] [bp-18h] BYREF
_BYTE v42[4]; // [sp+40h] [bp-14h] BYREF
int v43; // [sp+44h] [bp-10h] BYREF
char *v44; // [sp+48h] [bp-Ch] BYREF
CString = (char *)cocos2d::CCString::getCString(a1);
sub_776584((int)&v33, CString);
v4 = (char *)cocos2d::CCString::getCString(a2);
sub_776584((int)&v34, v4);
v5 = cocos2d::CCDictionary::createWithDictionary();
cocos2d::CCObject::retain(v5);
v6 = 0;
v29 = cocos2d::CCDictionary::allKeys(v5);
while ( v6 < cocos2d::CCArray::count(v29) )
{
v7 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v29, v6);
v8 = (char *)cocos2d::CCString::getCString(v7);
v9 = (char *)cocos2d::CCString::getCString(a1);
v10 = (char *)cocos2d::CCString::getCString(a2);
sub_776584((int)&v35, v8);
sub_776584((int)&v43, v9);
sub_776584((int)&v44, v10);
for ( i = 0; ; i = *((_DWORD *)v44 - 3) + v12 )
{
v12 = sub_774834(&v35, &v43, i);
if ( v12 == -1 )
break;
sub_776454(&v35, v12, *(_DWORD *)(v43 - 12), &v44);
}
sub_774008(&v44);
sub_774008(&v43);
sub_776584((int)&v44, v35);
sub_774008(&v35);
sub_776584((int)v36, v8);
v13 = sub_774DBC(&v44, v36);
sub_774008(v36);
if ( v13 )
{
sub_776584((int)&v37, v8);
v32 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(v5, &v37);
sub_774008(&v37);
cocos2d::CCDictionary::setObject((int)v5, v32);
sub_776584((int)v38, v8);
cocos2d::CCDictionary::removeObjectForKey(v5);
sub_774008(v38);
}
++v6;
sub_774008(&v44);
}
v14 = cocos2d::CCDictionary::allKeys(v5);
for ( j = 0; j < cocos2d::CCArray::count(v14); ++j )
{
v16 = (cocos2d::CCString *)cocos2d::CCArray::objectAtIndex(v14, j);
v17 = (char *)cocos2d::CCString::getCString(v16);
sub_776584((int)&v39, v17);
v18 = (cocos2d::CCDictionary *)cocos2d::CCDictionary::objectForKey(v5, &v39);
sub_774008(&v39);
if ( v18 )
{
if ( _dynamic_cast(
v18,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCDictionary,
0) )
{
v26 = ObjectManager::replaceAllOccurencesOfString(a1, a2, v18);
v27 = (char *)cocos2d::CCString::getCString(v16);
sub_776584((int)v40, v27);
cocos2d::CCDictionary::setObject((int)v5, v26);
v24 = (char **)v40;
}
else
{
v19 = (char *)cocos2d::CCString::getCString((cocos2d::CCString *)v18);
sub_776584((int)&v44, v19);
for ( k = 0; ; k = *(_DWORD *)(v34 - 12) + v21 )
{
v21 = sub_774834(&v44, &v33, k);
if ( v21 == -1 )
break;
sub_776454(&v44, v21, *(_DWORD *)(v33 - 12), &v34);
}
sub_776584((int)&v41, v44);
v30 = (cocos2d::CCArray *)cocos2d::CCString::create((cocos2d::CCString *)&v41, v22);
sub_774008(&v41);
v23 = (char *)cocos2d::CCString::getCString(v16);
sub_776584((int)v42, v23);
cocos2d::CCDictionary::setObject((int)v5, v30);
sub_774008(v42);
v24 = &v44;
}
sub_774008(v24);
}
}
sub_774008(&v34);
sub_774008(&v33);
return v5;
}