//
// cocos2d::CCBMFontConfiguration::purgeKerningDictionary from 0x18004c280 to 0x18004c3cb (331 bytes)
//
// 5 xrefs:
// > cocos2d::CCBMFontConfiguration::~CCBMFontConfiguration @ 0x1800472d5
// > ??> @ 0x1801376f4
// > ??> @ 0x180137704
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b19ec
//
// 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::purgeKerningDictionary(cocos2d::CCBMFontConfiguration *this)
{
cocos2d::tCCKerningHashElement *i; // rbx
char *prev; // r8
UT_hash_table *tbl; // r9
cocos2d::tCCKerningHashElement *m_pKerningDictionary; // r10
std::ptrdiff_t hho; // r11
char *v7; // r9
cocos2d::tCCKerningHashElement *next; // r8
char *v9; // r9
UT_hash_table *v10; // rdx
__int64 v11; // r9
UT_hash_table *v12; // rdx
UT_hash_handle *hh_prev; // rdx
UT_hash_handle *hh_next; // rcx
for ( i = this->m_pKerningDictionary; i; i = this->m_pKerningDictionary )
{
prev = (char *)i->hh.prev;
if ( prev || i->hh.next )
{
tbl = i->hh.tbl;
m_pKerningDictionary = i;
hho = tbl->hho;
if ( i == (cocos2d::tCCKerningHashElement *)((char *)tbl->tail - hho) )
{
tbl->tail = (UT_hash_handle *)&prev[hho];
m_pKerningDictionary = this->m_pKerningDictionary;
}
v7 = (char *)i->hh.prev;
next = (cocos2d::tCCKerningHashElement *)i->hh.next;
if ( v7 )
{
*(_QWORD *)&v7[m_pKerningDictionary->hh.tbl->hho + 16] = next;
next = this->m_pKerningDictionary;
}
else
{
this->m_pKerningDictionary = next;
}
v9 = (char *)i->hh.next;
if ( v9 )
*(_QWORD *)&v9[next->hh.tbl->hho + 8] = i->hh.prev;
v10 = this->m_pKerningDictionary->hh.tbl;
v11 = i->hh.hashv & (v10->num_buckets - 1);
--v10->buckets[v11].count;
v12 = this->m_pKerningDictionary->hh.tbl;
if ( v12->buckets[v11].hh_head == &i->hh )
v12->buckets[v11].hh_head = i->hh.hh_next;
hh_prev = i->hh.hh_prev;
if ( hh_prev )
hh_prev->hh_next = i->hh.hh_next;
hh_next = i->hh.hh_next;
if ( hh_next )
hh_next->hh_prev = i->hh.hh_prev;
--this->m_pKerningDictionary->hh.tbl->num_items;
}
else
{
free(i->hh.tbl->buckets);
free(this->m_pKerningDictionary->hh.tbl);
this->m_pKerningDictionary = nullptr;
}
free(i);
}
}