//
// cocos2d::CCBMFontConfiguration::purgeFontDefDictionary from 0x18004c110 to 0x18004c278 (360 bytes)
//
// 5 xrefs:
// > cocos2d::CCBMFontConfiguration::~CCBMFontConfiguration @ 0x1800472cd
// > ??> @ 0x18013771c
// > ??> @ 0x18013772c
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b19c8
//
// 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 *this)
{
cocos2d::tCCFontDefHashElement *m_pFontDefDictionary; // rdi
cocos2d::tCCFontDefHashElement *i; // rsi
char *prev; // r8
cocos2d::tCCFontDefHashElement *v5; // r10
UT_hash_table *tbl; // r9
std::ptrdiff_t hho; // r11
char *v8; // r9
cocos2d::tCCFontDefHashElement *next; // r8
char *v10; // r9
UT_hash_table *v11; // rdx
__int64 v12; // r9
UT_hash_table *v13; // rdx
UT_hash_handle *hh_prev; // rdx
UT_hash_handle *hh_next; // rcx
m_pFontDefDictionary = this->m_pFontDefDictionary;
if ( m_pFontDefDictionary )
{
for ( i = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
;
i = (cocos2d::tCCFontDefHashElement *)i->hh.next )
{
prev = (char *)m_pFontDefDictionary->hh.prev;
if ( prev || m_pFontDefDictionary->hh.next )
{
v5 = this->m_pFontDefDictionary;
tbl = v5->hh.tbl;
hho = tbl->hho;
if ( m_pFontDefDictionary == (cocos2d::tCCFontDefHashElement *)((char *)tbl->tail - hho) )
{
tbl->tail = (UT_hash_handle *)&prev[hho];
v5 = this->m_pFontDefDictionary;
}
v8 = (char *)m_pFontDefDictionary->hh.prev;
next = (cocos2d::tCCFontDefHashElement *)m_pFontDefDictionary->hh.next;
if ( v8 )
{
*(_QWORD *)&v8[v5->hh.tbl->hho + 16] = next;
next = this->m_pFontDefDictionary;
}
else
{
this->m_pFontDefDictionary = next;
}
v10 = (char *)m_pFontDefDictionary->hh.next;
if ( v10 )
*(_QWORD *)&v10[next->hh.tbl->hho + 8] = m_pFontDefDictionary->hh.prev;
v11 = this->m_pFontDefDictionary->hh.tbl;
v12 = m_pFontDefDictionary->hh.hashv & (v11->num_buckets - 1);
--v11->buckets[v12].count;
v13 = this->m_pFontDefDictionary->hh.tbl;
if ( v13->buckets[v12].hh_head == &m_pFontDefDictionary->hh )
v13->buckets[v12].hh_head = m_pFontDefDictionary->hh.hh_next;
hh_prev = m_pFontDefDictionary->hh.hh_prev;
if ( hh_prev )
hh_prev->hh_next = m_pFontDefDictionary->hh.hh_next;
hh_next = m_pFontDefDictionary->hh.hh_next;
if ( hh_next )
hh_next->hh_prev = m_pFontDefDictionary->hh.hh_prev;
--this->m_pFontDefDictionary->hh.tbl->num_items;
}
else
{
free(this->m_pFontDefDictionary->hh.tbl->buckets);
free(this->m_pFontDefDictionary->hh.tbl);
this->m_pFontDefDictionary = nullptr;
}
free(m_pFontDefDictionary);
m_pFontDefDictionary = i;
if ( !i )
break;
}
}
}