//
// PlayLayer::updateProgressbar from 0x4064a0 to 0x40660c (364 bytes)
//
// 4 xrefs:
// > PlayLayer::toggleProgressbar @ 0x40671e
// > PlayLayer::setupHasCompleted @ 0x40a59a
// > PlayLayer::postUpdate @ 0x40ccac
// > PlayLayer::resetLevel @ 0x412a0e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:47:28 +0000
//
PlayLayer *__fastcall PlayLayer::updateProgressbar(PlayLayer *this)
{
PlayLayer *v1; // r4
float v2; // r0
float v3; // s14
float v4; // s16
float v5; // s15
float v6; // s15
int v7; // r7
void (__fastcall *v8)(int, _BYTE *); // r8
const char *v9; // r1
int v10; // r3
char *v11; // r4
int v12; // r4
int (__fastcall *v13)(int, int); // r5
cocos2d::CCString *v14; // r0
int CString; // r0
int v16; // r1
_DWORD v17[2]; // [sp+8h] [bp-20h] BYREF
_BYTE v18[16]; // [sp+14h] [bp-14h] BYREF
v1 = this;
if ( !*((_BYTE *)this + 10614) )
{
v2 = COERCE_FLOAT(PlayLayer::getCurrentPercent(this));
v3 = *((float *)v1 + 2980);
v4 = v2;
if ( v2 <= 0.01 )
v5 = 0.0001;
else
v5 = 100.0;
if ( v2 > 0.01 )
v5 = v2 / v5;
if ( v3 > (float)(v3 * v5) )
{
if ( v2 <= 0.01 )
v6 = 0.0001;
else
v6 = 100.0;
if ( v2 > 0.01 )
v6 = v2 / v6;
v3 = v3 * v6;
}
v7 = *((_DWORD *)v1 + 2979);
v8 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v7 + 568);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v18, 0.0, 0.0, v3, *((float *)v1 + 2981));
v8(v7, v18);
v10 = *((unsigned __int8 *)v1 + 11908);
v11 = (char *)v1 + 11904;
if ( v10 )
{
if ( v4 < 0.0 )
{
v4 = 0.0;
}
else if ( v4 >= 100.0 )
{
v4 = 100.0;
}
else if ( v4 < 0.0 )
{
v4 = 0.0;
}
v12 = *(_DWORD *)v11;
v13 = *(int (__fastcall **)(int, int))(*(_DWORD *)v12 + 464);
v14 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%.2f%%", v9, v4);
CString = cocos2d::CCString::getCString(v14);
return (PlayLayer *)v13(v12, CString);
}
else
{
if ( (int)v4 > 99 )
v16 = 100;
else
v16 = (int)v4 & ~((int)v4 >> 31);
GameToolbox::intToString((GameToolbox *)v17, v16);
std::string::append(v17, "%");
(*(void (**)(void))(**(_DWORD **)v11 + 464))();
return (PlayLayer *)std::string::~string((int)v17);
}
}
return this;
}