//
// cocos2d::CCDictMaker::textHandler from 0xb04d38 to 0xb04f04 (460 bytes)
//
// 2 xrefs:
// > ??> @ 0x84f48
// > ??> @ 0x1217a70
//
// 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
//
__int64 __fastcall cocos2d::CCDictMaker::textHandler(cocos2d::CCDictMaker *this, void *a2, char *a3, int a4)
{
cocos2d::CCString *v6; // x22
void *v7; // x0
void *v8; // x0
int v9; // w0
size_t v10; // x0
size_t v11; // x0
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
const char *v17; // [xsp+48h] [xbp+48h]
const char *CString; // [xsp+48h] [xbp+48h]
__int64 v19; // [xsp+68h] [xbp+68h] BYREF
__int64 v20; // [xsp+70h] [xbp+70h] BYREF
if ( *((_DWORD *)this + 34) )
{
sub_D153B8((int)&v20, a3);
sub_D14F84(&v19, &v20, 0, a4);
v6 = (cocos2d::CCString *)operator new(0x40u);
cocos2d::CCString::CCString(v6);
v7 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v19 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v7);
}
v8 = (void *)(v20 - 24);
if ( (__int64 *)(v20 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v20 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v20 - 8);
*(_DWORD *)(v20 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v8);
}
v9 = *((_DWORD *)this + 34);
if ( v9 == 1 )
{
CString = cocos2d::CCString::getCString(v6);
v11 = strlen(CString);
sub_D1798C((char *)this + 120, CString, v11);
cocos2d::CCObject::release(v6);
}
else
{
if ( v9 && (unsigned int)(v9 - 3) <= 2 )
{
v17 = cocos2d::CCString::getCString(v6);
v10 = strlen(v17);
sub_D15FD4((char *)this + 128, v17, v10);
}
cocos2d::CCObject::release(v6);
}
}
return _stack_chk_guard;
}