//
// cocos2d::CCBMFontConfiguration::purgeFontDefDictionary from 0x5cbb4c to 0x5cbc1a (206 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::~CCBMFontConfiguration @ 0x5ccd7a
//
// 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 cocos2d::CCBMFontConfiguration::purgeFontDefDictionary(cocos2d::CCBMFontConfiguration *a1)
{
cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // r4
cocos2d::tCCFontDefHashElement *next; // r5
char *prev; // r1
cocos2d::tCCFontDefHashElement *v5; // r3
cocos2d::tCCFontDefHashElement *v6; // r8
UT_hash_table *tbl; // lr
std::ptrdiff_t hho; // r3
char *v9; // r2
cocos2d::tCCFontDefHashElement *v10; // lr
UT_hash_table *v11; // r1
UT_hash_bucket *buckets; // r2
int v13; // r3
UT_hash_handle *hh_next; // r0
UT_hash_table *v15; // r1
UT_hash_handle *hh_prev; // r3
UT_hash_handle *v17; // r2
cocos2d::tCCFontDefHashElement *v18; // r3
m_pFontDefDictionary = a1->m_pFontDefDictionary;
if ( m_pFontDefDictionary )
next = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
else
next = nullptr;
while ( m_pFontDefDictionary )
{
prev = (char *)m_pFontDefDictionary->hh.prev;
v5 = a1->m_pFontDefDictionary;
v6 = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
if ( prev || v6 )
{
tbl = v5->hh.tbl;
hho = tbl->hho;
if ( m_pFontDefDictionary == (cocos2d::tCCFontDefHashElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
if ( prev )
*(_DWORD *)&prev[hho + 8] = v6;
else
a1->m_pFontDefDictionary = v6;
v9 = (char *)m_pFontDefDictionary->hh.next;
v10 = a1->m_pFontDefDictionary;
if ( v9 )
*(_DWORD *)&v9[v10->hh.tbl->hho + 4] = prev;
v11 = v10->hh.tbl;
buckets = v11->buckets;
v13 = m_pFontDefDictionary->hh.hashv & (v11->num_buckets - 1);
buckets[v13].count = v11->buckets[v13].count - 1;
hh_next = m_pFontDefDictionary->hh.hh_next;
v15 = v10->hh.tbl;
if ( buckets[v13].hh_head == &m_pFontDefDictionary->hh )
buckets[v13].hh_head = hh_next;
hh_prev = m_pFontDefDictionary->hh.hh_prev;
if ( hh_prev )
hh_prev->hh_next = hh_next;
v17 = m_pFontDefDictionary->hh.hh_next;
if ( v17 )
v17->hh_prev = hh_prev;
--v15->num_items;
}
else
{
free(v5->hh.tbl->buckets);
free(a1->m_pFontDefDictionary->hh.tbl);
a1->m_pFontDefDictionary = nullptr;
}
free(m_pFontDefDictionary);
if ( next )
v18 = (cocos2d::tCCFontDefHashElement *)next->hh.next;
else
v18 = nullptr;
m_pFontDefDictionary = next;
next = v18;
}
}