//
// LevelInfoLayer::setupProgressBars from 0x7ea40c to 0x7ea7c8 (956 bytes)
//
// 2 xrefs:
// > LevelInfoLayer::init @ 0x7ec970
// > ??> @ 0x84ef8
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:54:31 +0000
//
__int64 __fastcall LevelInfoLayer::setupProgressBars(GJGameLevel **this)
{
cocos2d::CCDirector *v2; // x0
unsigned int NormalPercent; // w0
cocos2d::CCString *v4; // x0
const char *CString; // x0
size_t v6; // x0
GameManager *v7; // x0
GameManager *v8; // x0
size_t GameVariable; // x0
float v10; // s8
cocos2d::CCDirector *v11; // x0
float v12; // s0
int v13; // w2
long double v14; // q0
cocos2d::CCLabelBMFont *v15; // x5
__int64 v16; // x21
const char *v17; // x1
__int64 v18; // x23
cocos2d::CCMenu *v19; // x0
cocos2d::CCMenuItem *v20; // x1
__int64 v21; // x25
void (__fastcall *v22)(__int64, __int64 *); // x26
__int64 v23; // x27
float v24; // s8
float v25; // s0
cocos2d::CCString *v26; // x0
cocos2d::CCLabelBMFont *v27; // x24
__int64 v28; // x21
long double v29; // q0
const char *v31; // x1
cocos2d::CCString *v32; // x0
const char *v33; // x25
unsigned __int64 v34; // x23
size_t v35; // x20
unsigned __int64 v36; // x1
char *v37; // x26
char *v38; // x0
size_t v39; // x20
char *v40; // [xsp+68h] [xbp+68h]
const char *v41; // [xsp+70h] [xbp+70h]
__int64 v42; // [xsp+78h] [xbp+78h] BYREF
_BYTE v43[8]; // [xsp+80h] [xbp+80h] BYREF
__int64 v44; // [xsp+88h] [xbp+88h] BYREF
__int64 v45; // [xsp+90h] [xbp+90h] BYREF
size_t v46; // [xsp+98h] [xbp+98h]
void *v47; // [xsp+A0h] [xbp+A0h]
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(_stack_chk_guard);
cocos2d::CCDirector::getWinSize(&v42, v2);
NormalPercent = GJGameLevel::getNormalPercent(*(this + 63));
v4 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%%",
(const char *)NormalPercent);
CString = (const char *)cocos2d::CCString::getCString(v4);
v45 = 0;
v40 = (char *)CString;
v46 = 0;
v47 = nullptr;
v6 = strlen(CString);
v7 = (GameManager *)std::string::__init(&v45, v40, v6);
v8 = (GameManager *)GameManager::sharedState(v7);
GameVariable = (unsigned __int8)GameManager::getGameVariable(v8, "0099");
if ( !(_BYTE)GameVariable )
goto LABEL_2;
GameVariable = GJGameLevel::getNormalPercent(*(this + 63));
v31 = (const char *)(unsigned int)(*((_DWORD *)*(this + 63) + 219) - *((_DWORD *)*(this + 63) + 220));
if ( (_DWORD)GameVariable == (_DWORD)v31 )
goto LABEL_2;
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)" (%i%%)", v31);
v33 = (const char *)cocos2d::CCString::getCString(v32);
v34 = strlen(v33);
if ( (v45 & 1) != 0 )
{
v35 = v46;
v36 = (v45 & 0xFFFFFFFFFFFFFFFELL) - 1;
GameVariable = v36 - v46;
if ( v34 <= v36 - v46 )
goto LABEL_12;
LABEL_19:
std::string::__grow_by_and_replace((__int64)&v45, v36, v35 + v34 - v36, v35, v35, 0, v34, v33);
goto LABEL_2;
}
v35 = (unsigned __int8)v45 >> 1;
v36 = 22;
GameVariable = 22 - v35;
if ( v34 > 22 - v35 )
goto LABEL_19;
LABEL_12:
if ( v34 )
{
v37 = (char *)&v45 + 1;
if ( (v45 & 1) != 0 )
v37 = (char *)v47;
v38 = &v37[v35];
v39 = v35 + v34;
memcpy(v38, v33, v34);
GameVariable = (unsigned __int8)v45;
if ( (v45 & 1) != 0 )
{
v46 = v39;
}
else
{
GameVariable = (unsigned int)(2 * v39);
LOBYTE(v45) = 2 * v39;
}
v37[v39] = 0;
}
LABEL_2:
v10 = *(float *)&v42 * 0.5;
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector((cocos2d::CCDirector *)GameVariable);
cocos2d::CCDirector::getScreenBottom(v11);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v44, v10, v12 + 136.0);
v13 = GJGameLevel::getNormalPercent(*(this + 63));
v15 = (cocos2d::CCLabelBMFont *)((char *)&v45 + 1);
if ( (v45 & 1) != 0 )
v15 = (cocos2d::CCLabelBMFont *)v47;
v16 = LevelInfoLayer::addProgressBar(
(__int64)this,
(__int64)&v44,
v13,
(const char *)&elf_hash_bucket[16194],
(cocos2d::CCLabelBMFont *)"Normal Mode",
v15,
v14);
if ( !(unsigned __int8)GJGameLevel::isPlatformer(*(this + 63)) )
{
v18 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"sideBtn_death_001.png", v17);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v18 + 160LL))(v18, 0.9);
v19 = (cocos2d::CCMenu *)CCMenuItemSpriteExtra::create(
v18,
0,
(__int64)this,
(__int64)LevelInfoLayer::onDeathTracker,
0);
v21 = cocos2d::CCMenu::createWithItem(v19, v20);
(*((void (__fastcall **)(GJGameLevel **, __int64, __int64))*this + 58))(this, v21, 3);
v22 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v21 + 184LL);
v23 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v16 + 192LL))(v16);
v24 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v16 + 328LL))(v16);
v25 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v16 + 168LL))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, (float)((float)(v24 * v25) * 0.5) + 22.0, 0.0);
cocos2d::CCPoint::operator+(&v44, v23);
v22(v21, &v44);
}
v26 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i%%",
(const char *)*((unsigned int *)*(this + 63) + 222));
v27 = (cocos2d::CCLabelBMFont *)cocos2d::CCString::getCString(v26);
v28 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v16 + 192LL))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v43, 0.0, -32.0);
cocos2d::CCPoint::operator+(&v44, v28);
LOWORD(v41) = -256;
BYTE2(v41) = -1;
LevelInfoLayer::addProgressBar(
(__int64)this,
(__int64)&v44,
*((_DWORD *)*(this + 63) + 222),
v41,
(cocos2d::CCLabelBMFont *)"Practice Mode",
v27,
v29);
if ( (v45 & 1) != 0 )
operator delete(v47);
return _stack_chk_guard;
}