//
// LevelInfoLayer::onLevelInfo from 0x6d7318 to 0x6d7600 (744 bytes)
//
// 3 xrefs:
// > ??> @ 0xb4660
// > LevelInfoLayer::init @ 0x6dc0c0
// > ??> @ 0x122e420
//
// 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 LevelInfoLayer::onLevelInfo(LevelInfoLayer *a1, cocos2d::CCObject *a2)
{
const char *v3; // x24
GJGameLevel *m_level; // x0
unsigned int v5; // w23
unsigned int v6; // w21
unsigned int NormalPercent; // w0
cocos2d::CCString *v8; // x0
char *CString; // x0
char *v10; // x0
int v11; // w0
const char *v12; // x1
cocos2d::CCString *v13; // x0
size_t v14; // x0
FLAlertLayer *v15; // x20
char *v16; // x0
char *v17; // x0
unsigned int *v18; // x20
int v19; // w1
unsigned int *v20; // x1
int v21; // w2
unsigned int *v22; // x1
int v23; // w2
const char *v24; // [xsp+48h] [xbp+48h]
char *v25; // [xsp+68h] [xbp+68h] BYREF
const char *v26; // [xsp+70h] [xbp+70h] BYREF
if ( !a1->m_isBusy )
{
sub_D18D28(&v26, &a1->m_level->m_levelName);
v3 = v26;
m_level = a1->m_level;
v5 = m_level->m_attempts.random - m_level->m_attempts.seed;
v6 = m_level->m_jumps.random - m_level->m_jumps.seed;
NormalPercent = GJGameLevel::getNormalPercent(m_level);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s\n"
"Total Attempts: %i\n"
"Total Jumps: %i\n"
"Normal: %i%%\n"
"Practice: %i%%",
v3,
v5,
v6,
NormalPercent,
(unsigned int)a1->m_level->m_practicePercent);
CString = (char *)cocos2d::CCString::getCString(v8);
sub_D153B8((int)&v25, CString);
v10 = (char *)(v26 - 24);
if ( v26 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v26 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v10);
}
v11 = GJGameLevel::getNormalPercent(a1->m_level);
v12 = (const char *)(unsigned int)(a1->m_level->m_newNormalPercent2.random - a1->m_level->m_newNormalPercent2.seed);
if ( v11 != (_DWORD)v12 )
{
v13 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"\nLeaderboard: %i%%",
v12);
v24 = cocos2d::CCString::getCString(v13);
v14 = strlen(v24);
sub_D15FD4(&v25, v24, v14);
}
sub_D153B8((int)&v26, v25);
v15 = FLAlertLayer::create(0, (__int64)"Level Stats", (__int64)&v26);
v16 = (char *)(v26 - 24);
if ( v26 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)(v26 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v26 - 2);
*((_DWORD *)v26 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v16);
}
v15->show(v15);
v17 = v25 - 24;
if ( v25 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v25 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v25 - 2);
*((_DWORD *)v25 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v17);
}
}
}