//
// cocos2d::CCBMFontConfiguration::purgeFontDefDictionary from 0x1002f9a20 to 0x1002f9b48 (296 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::dCCBMFontConfiguration @ 0x1002f99b4
//
// 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 cocos2d::CCBMFontConfiguration::purgeFontDefDictionary(cocos2d::CCBMFontConfiguration *a1)
{
cocos2d::tCCFontDefHashElement **p_m_pFontDefDictionary; // x19
cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // x20
char *prev; // x9
cocos2d::tCCFontDefHashElement *next; // x21
void ***v5; // x8
void **v6; // x10
void *v7; // x11
cocos2d::tCCFontDefHashElement *v8; // x10
cocos2d::tCCFontDefHashElement **v9; // x11
void **v10; // x8
__int64 v11; // x9
UT_hash_handle *hh_prev; // x9
UT_hash_handle *hh_next; // x10
p_m_pFontDefDictionary = &a1->m_pFontDefDictionary;
m_pFontDefDictionary = a1->m_pFontDefDictionary;
if ( m_pFontDefDictionary )
{
while ( 1 )
{
prev = (char *)m_pFontDefDictionary->hh.prev;
next = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
if ( prev )
break;
v5 = (void ***)*p_m_pFontDefDictionary;
if ( next )
goto LABEL_5;
free(*v5[4]);
free((*p_m_pFontDefDictionary)->hh.tbl);
*p_m_pFontDefDictionary = nullptr;
LABEL_18:
free(m_pFontDefDictionary);
m_pFontDefDictionary = next;
if ( !next )
return;
}
v5 = (void ***)*p_m_pFontDefDictionary;
LABEL_5:
v6 = v5[4];
v7 = v6[4];
if ( m_pFontDefDictionary == (cocos2d::tCCFontDefHashElement *)((_BYTE *)v6[3] - (_BYTE *)v7) )
v6[3] = &prev[(_QWORD)v7];
v8 = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
v9 = (cocos2d::tCCFontDefHashElement **)&prev[(_QWORD)v7 + 16];
if ( !prev )
{
v9 = p_m_pFontDefDictionary;
v5 = (void ***)m_pFontDefDictionary->hh.next;
}
*v9 = v8;
v10 = v5[4];
if ( v8 )
*(cocos2d::CCPoint *)((char *)&v8->fontDef.rect.origin + (_QWORD)v10[4]) = (cocos2d::CCPoint)prev;
v11 = (__int64)*v10 + 16 * ((*((_DWORD *)v10 + 2) - 1) & m_pFontDefDictionary->hh.hashv);
--*(_DWORD *)(v11 + 8);
if ( *(cocos2d::tCCFontDefHashElement **)v11 == (cocos2d::tCCFontDefHashElement *)&m_pFontDefDictionary->hh )
*(_QWORD *)v11 = m_pFontDefDictionary->hh.hh_next;
hh_prev = m_pFontDefDictionary->hh.hh_prev;
hh_next = m_pFontDefDictionary->hh.hh_next;
if ( hh_prev )
hh_prev->hh_next = hh_next;
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*((_DWORD *)v10 + 4);
goto LABEL_18;
}
}