//
// cocos2d::CCBMFontConfiguration::purgeKerningDictionary from 0x1005d5eb0 to 0x1005d5fe6 (310 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::dCCBMFontConfiguration @ 0x1005d5cdc
//
// 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 *m_pKerningDictionary; // rdi
cocos2d::tCCKerningHashElement **p_m_pKerningDictionary; // rbx
void ***p_hh; // rax
UT_hash_table *prev; // rdx
UT_hash_table *tbl; // rsi
std::ptrdiff_t hho; // rcx
cocos2d::tCCKerningHashElement *next; // rsi
cocos2d::tCCKerningHashElement **v9; // r8
_QWORD *p_key; // rcx
__int64 *v11; // rcx
__int64 v12; // rsi
__int64 v13; // rdx
UT_hash_handle *hh_prev; // rax
UT_hash_handle *hh_next; // rdx
m_pKerningDictionary = a1->m_pKerningDictionary;
if ( m_pKerningDictionary )
{
p_m_pKerningDictionary = &a1->m_pKerningDictionary;
while ( 1 )
{
while ( 1 )
{
p_hh = (void ***)&m_pKerningDictionary->hh;
prev = (UT_hash_table *)m_pKerningDictionary->hh.prev;
if ( prev || m_pKerningDictionary->hh.next )
break;
free(**p_hh);
free((*p_m_pKerningDictionary)->hh.tbl);
*p_m_pKerningDictionary = nullptr;
free(m_pKerningDictionary);
m_pKerningDictionary = *p_m_pKerningDictionary;
if ( !*p_m_pKerningDictionary )
return;
}
tbl = m_pKerningDictionary->hh.tbl;
hho = tbl->hho;
if ( m_pKerningDictionary == (cocos2d::tCCKerningHashElement *)((char *)tbl->tail - hho) )
tbl->tail = (UT_hash_handle *)((char *)prev + hho);
next = (cocos2d::tCCKerningHashElement *)m_pKerningDictionary->hh.next;
v9 = (cocos2d::tCCKerningHashElement **)((char *)&prev->num_items + hho);
if ( !prev )
v9 = p_m_pKerningDictionary;
p_key = &m_pKerningDictionary->key;
if ( !prev )
p_key = m_pKerningDictionary->hh.next;
*v9 = next;
v11 = (__int64 *)p_key[1];
if ( next )
*(UT_hash_table **)((char *)&next->hh.tbl + v11[4]) = prev;
v12 = *v11;
v13 = 16LL * (m_pKerningDictionary->hh.hashv & (*((_DWORD *)v11 + 2) - 1));
--*(_DWORD *)(v12 + v13 + 8);
if ( *(void ****)(v12 + v13) == p_hh )
break;
hh_prev = m_pKerningDictionary->hh.hh_prev;
hh_next = m_pKerningDictionary->hh.hh_next;
if ( hh_prev )
goto LABEL_16;
LABEL_17:
if ( hh_next )
hh_next->hh_prev = hh_prev;
--*((_DWORD *)v11 + 4);
free(m_pKerningDictionary);
m_pKerningDictionary = *p_m_pKerningDictionary;
if ( !*p_m_pKerningDictionary )
return;
}
*(_QWORD *)(v13 + v12) = m_pKerningDictionary->hh.hh_next;
hh_prev = m_pKerningDictionary->hh.hh_prev;
hh_next = m_pKerningDictionary->hh.hh_next;
if ( !hh_prev )
goto LABEL_17;
LABEL_16:
hh_prev->hh_next = hh_next;
goto LABEL_17;
}
}