//
// cocos2d::CCBMFontConfiguration::purgeKerningDictionary from 0xae2e60 to 0xae2fb0 (336 bytes)
//
// 2 xrefs:
// > cocos2d::CCBMFontConfiguration::~CCBMFontConfiguration @ 0xae4be0
// > ??> @ 0xc48f0
//
// 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; // x19
UT_hash_table *prev; // x1
UT_hash_table *v4; // x4
UT_hash_handle *p_hh; // x2
std::ptrdiff_t v6; // x0
void *v7; // x3
UT_hash_handle *v8; // x0
cocos2d::tCCKerningHashElement *v9; // x4
cocos2d::tCCKerningHashElement *next; // x3
UT_hash_table *v11; // x3
UT_hash_bucket *buckets; // x4
__int64 v13; // x0
UT_hash_handle *hh_head; // x6
UT_hash_handle *hh_next; // x1
UT_hash_handle *hh_prev; // x0
UT_hash_table *tbl; // x4
UT_hash_handle *hho; // x5
m_pKerningDictionary = a1->m_pKerningDictionary;
if ( m_pKerningDictionary )
{
while ( 1 )
{
prev = (UT_hash_table *)m_pKerningDictionary->hh.prev;
if ( prev )
break;
next = (cocos2d::tCCKerningHashElement *)m_pKerningDictionary->hh.next;
if ( next )
{
tbl = m_pKerningDictionary->hh.tbl;
p_hh = &m_pKerningDictionary->hh;
hho = (UT_hash_handle *)tbl->hho;
if ( m_pKerningDictionary == (cocos2d::tCCKerningHashElement *)((char *)tbl->tail - (char *)hho) )
tbl->tail = hho;
a1->m_pKerningDictionary = next;
v9 = next;
LABEL_6:
*(UT_hash_table **)((char *)&next->hh.tbl + v9->hh.tbl->hho) = prev;
LABEL_7:
v11 = v9->hh.tbl;
buckets = v11->buckets;
v13 = (v11->num_buckets - 1) & p_hh->hashv;
hh_head = v11->buckets[v13].hh_head;
--v11->buckets[v13].count;
hh_next = p_hh->hh_next;
if ( hh_head == p_hh )
buckets[v13].hh_head = hh_next;
hh_prev = p_hh->hh_prev;
if ( hh_prev )
{
hh_prev->hh_next = hh_next;
hh_next = p_hh->hh_next;
}
if ( hh_next )
hh_next->hh_prev = hh_prev;
--v11->num_items;
goto LABEL_14;
}
free(m_pKerningDictionary->hh.tbl->buckets);
free(a1->m_pKerningDictionary->hh.tbl);
a1->m_pKerningDictionary = nullptr;
LABEL_14:
free(m_pKerningDictionary);
m_pKerningDictionary = a1->m_pKerningDictionary;
if ( !m_pKerningDictionary )
return;
}
v4 = m_pKerningDictionary->hh.tbl;
p_hh = &m_pKerningDictionary->hh;
v6 = v4->hho;
v7 = m_pKerningDictionary->hh.next;
if ( m_pKerningDictionary == (cocos2d::tCCKerningHashElement *)((char *)v4->tail - v6) )
{
v8 = (UT_hash_handle *)((char *)prev + v6);
v4->tail = v8;
}
else
{
v8 = (UT_hash_handle *)((char *)prev + v6);
}
v8->next = v7;
v9 = m_pKerningDictionary;
next = (cocos2d::tCCKerningHashElement *)m_pKerningDictionary->hh.next;
if ( next )
goto LABEL_6;
goto LABEL_7;
}
}