//
// cocos2d::CCBMFontConfiguration::purgeFontDefDictionary from 0x1005d5d50 to 0x1005d5ead (349 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::dCCBMFontConfiguration @ 0x1005d5cd4
//
// 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 *m_pFontDefDictionary; // rdi
cocos2d::tCCFontDefHashElement **p_m_pFontDefDictionary; // rbx
char *prev; // rax
cocos2d::tCCFontDefHashElement *next; // r14
void ***v6; // rcx
void **v7; // rdx
void *v8; // rsi
cocos2d::tCCFontDefHashElement *v9; // rdx
cocos2d::tCCFontDefHashElement **v10; // rsi
void **v11; // rcx
char *v12; // rdx
__int64 v13; // rax
UT_hash_handle *hh_prev; // rax
UT_hash_handle *hh_next; // rdx
m_pFontDefDictionary = a1->m_pFontDefDictionary;
if ( m_pFontDefDictionary )
{
p_m_pFontDefDictionary = &a1->m_pFontDefDictionary;
while ( 1 )
{
prev = (char *)m_pFontDefDictionary->hh.prev;
next = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
if ( prev )
{
v6 = (void ***)*p_m_pFontDefDictionary;
}
else
{
v6 = (void ***)*p_m_pFontDefDictionary;
if ( !next )
{
free(*v6[4]);
free((*p_m_pFontDefDictionary)->hh.tbl);
*p_m_pFontDefDictionary = nullptr;
free(m_pFontDefDictionary);
return;
}
}
v7 = v6[4];
v8 = v7[4];
if ( m_pFontDefDictionary == (cocos2d::tCCFontDefHashElement *)((_BYTE *)v7[3] - (_BYTE *)v8) )
v7[3] = &prev[(_QWORD)v8];
v9 = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
v10 = (cocos2d::tCCFontDefHashElement **)&prev[(_QWORD)v8 + 16];
if ( !prev )
{
v10 = p_m_pFontDefDictionary;
v6 = (void ***)m_pFontDefDictionary->hh.next;
}
*v10 = v9;
v11 = v6[4];
if ( v9 )
*(cocos2d::CCPoint *)((char *)&v9->fontDef.rect.origin + (_QWORD)v11[4]) = (cocos2d::CCPoint)prev;
v12 = (char *)*v11;
v13 = 16LL * (m_pFontDefDictionary->hh.hashv & (*((_DWORD *)v11 + 2) - 1));
--*(_DWORD *)&v12[v13 + 8];
if ( *(cocos2d::tCCFontDefHashElement **)&v12[v13] == (cocos2d::tCCFontDefHashElement *)&m_pFontDefDictionary->hh )
break;
hh_prev = m_pFontDefDictionary->hh.hh_prev;
hh_next = m_pFontDefDictionary->hh.hh_next;
if ( hh_prev )
goto LABEL_15;
LABEL_16:
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*((_DWORD *)v11 + 4);
free(m_pFontDefDictionary);
m_pFontDefDictionary = next;
if ( !next )
return;
}
*(_QWORD *)&v12[v13] = m_pFontDefDictionary->hh.hh_next;
hh_prev = m_pFontDefDictionary->hh.hh_prev;
hh_next = m_pFontDefDictionary->hh.hh_next;
if ( !hh_prev )
goto LABEL_16;
LABEL_15:
hh_prev->hh_next = hh_next;
goto LABEL_16;
}
}