//
// cocos2d::CCBMFontConfiguration::purgeKerningDictionary from 0x5cbabc to 0x5cbb4c (144 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::~CCBMFontConfiguration @ 0x5ccd80
//
// 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::purgeKerningDictionary(cocos2d::CCBMFontConfiguration *a1)
{
cocos2d::tCCKerningHashElement *m_pKerningDictionary; // r4
UT_hash_table *tbl; // r1
char *prev; // r3
cocos2d::tCCKerningHashElement *next; // r7
std::ptrdiff_t hho; // r2
char *v7; // r0
cocos2d::tCCKerningHashElement *v8; // r1
UT_hash_table *v9; // r1
UT_hash_bucket *buckets; // r2
int v11; // r3
UT_hash_handle *hh_next; // r0
UT_hash_handle *hh_prev; // r3
UT_hash_handle *v14; // r2
while ( 1 )
{
m_pKerningDictionary = a1->m_pKerningDictionary;
if ( !m_pKerningDictionary )
break;
tbl = m_pKerningDictionary->hh.tbl;
prev = (char *)m_pKerningDictionary->hh.prev;
next = (cocos2d::tCCKerningHashElement *)m_pKerningDictionary->hh.next;
if ( prev || next )
{
hho = tbl->hho;
if ( m_pKerningDictionary == (cocos2d::tCCKerningHashElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
if ( prev )
*(_DWORD *)&prev[hho + 8] = next;
else
a1->m_pKerningDictionary = next;
v7 = (char *)m_pKerningDictionary->hh.next;
v8 = a1->m_pKerningDictionary;
if ( v7 )
*(_DWORD *)&v7[v8->hh.tbl->hho + 4] = prev;
v9 = v8->hh.tbl;
buckets = v9->buckets;
v11 = m_pKerningDictionary->hh.hashv & (v9->num_buckets - 1);
buckets[v11].count = v9->buckets[v11].count - 1;
hh_next = m_pKerningDictionary->hh.hh_next;
if ( buckets[v11].hh_head == &m_pKerningDictionary->hh )
buckets[v11].hh_head = hh_next;
hh_prev = m_pKerningDictionary->hh.hh_prev;
if ( hh_prev )
hh_prev->hh_next = hh_next;
v14 = m_pKerningDictionary->hh.hh_next;
if ( v14 )
v14->hh_prev = hh_prev;
--v9->num_items;
}
else
{
free(tbl->buckets);
free(a1->m_pKerningDictionary->hh.tbl);
a1->m_pKerningDictionary = nullptr;
}
free(m_pKerningDictionary);
}
}