//
// cocos2d::CCBMFontConfiguration::purgeKerningDictionary from 0x1002f9b48 to 0x1002f9c60 (280 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::dCCBMFontConfiguration @ 0x1002f99bc
//
// 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 *a1)
{
cocos2d::tCCKerningHashElement **p_m_pKerningDictionary; // x19
cocos2d::tCCKerningHashElement *m_pKerningDictionary; // x20
void ***p_hh; // x8
char *prev; // x10
UT_hash_table *tbl; // x11
std::ptrdiff_t hho; // x9
char *next; // x11
__int64 v8; // x9
_QWORD *v9; // x12
_QWORD *p_key; // x9
__int64 v11; // x9
__int64 v12; // x10
UT_hash_handle *hh_prev; // x8
UT_hash_handle *hh_next; // x10
p_m_pKerningDictionary = &a1->m_pKerningDictionary;
m_pKerningDictionary = a1->m_pKerningDictionary;
if ( m_pKerningDictionary )
{
do
{
p_hh = (void ***)&m_pKerningDictionary->hh;
prev = (char *)m_pKerningDictionary->hh.prev;
if ( prev || m_pKerningDictionary->hh.next )
{
tbl = m_pKerningDictionary->hh.tbl;
hho = tbl->hho;
if ( m_pKerningDictionary == (cocos2d::tCCKerningHashElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)&prev[hho];
next = (char *)m_pKerningDictionary->hh.next;
v8 = (__int64)&prev[hho + 16];
if ( prev )
v9 = (_QWORD *)v8;
else
v9 = p_m_pKerningDictionary;
if ( prev )
p_key = &m_pKerningDictionary->key;
else
p_key = m_pKerningDictionary->hh.next;
*v9 = next;
v11 = p_key[1];
if ( next )
*(_QWORD *)&next[*(_QWORD *)(v11 + 32) + 8] = prev;
v12 = *(_QWORD *)v11 + 16LL * ((*(_DWORD *)(v11 + 8) - 1) & m_pKerningDictionary->hh.hashv);
--*(_DWORD *)(v12 + 8);
if ( *(void ****)v12 == p_hh )
*(_QWORD *)v12 = m_pKerningDictionary->hh.hh_next;
hh_prev = m_pKerningDictionary->hh.hh_prev;
hh_next = m_pKerningDictionary->hh.hh_next;
if ( hh_prev )
hh_prev->hh_next = hh_next;
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*(_DWORD *)(v11 + 16);
}
else
{
free(**p_hh);
free((*p_m_pKerningDictionary)->hh.tbl);
*p_m_pKerningDictionary = nullptr;
}
free(m_pKerningDictionary);
m_pKerningDictionary = *p_m_pKerningDictionary;
}
while ( *p_m_pKerningDictionary );
}
}