//
// HSVWidgetPopup::init from 0x5e5dcc to 0x5e6044 (632 bytes)
//
// 1 xrefs:
// > HSVWidgetPopup::create @ 0x5e61ea
//
// 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:54:19 +0000
//
GameManager *__fastcall HSVWidgetPopup::init(
int a1,
int a2,
int a3,
int a4,
int a5,
unsigned int a6,
int a7,
_DWORD *a8)
{
GameManager *v9; // r0
GameManager *v10; // r9
int v11; // r10
void (__fastcall *v12)(int, _DWORD *); // r11
void (__fastcall *v13)(int, _DWORD *); // r11
const char *v14; // r2
unsigned int v15; // r3
char *v16; // r3
unsigned int v17; // r2
int v18; // r3
bool v19; // nf
int v20; // r3
cocos2d::CCLabelBMFont *v21; // r0
int v22; // r4
void (__fastcall *v23)(int, _DWORD *); // r10
cocos2d::CCMenu *v24; // r0
int v25; // r0
ButtonSprite *v26; // r0
int v27; // r0
int v28; // r10
void (__fastcall *v29)(int, _BYTE *); // r11
int v30; // r0
int v31; // r6
void (__fastcall *v32)(int, _BYTE *); // r7
bool v34; // [sp+4h] [bp-68h]
float v35; // [sp+14h] [bp-58h] BYREF
float v36; // [sp+18h] [bp-54h]
_BYTE v37[8]; // [sp+1Ch] [bp-50h] BYREF
_DWORD v38[4]; // [sp+24h] [bp-48h] BYREF
int savedregs[15]; // [sp+3Ch] [bp-30h]
savedregs[12] = a2;
savedregs[13] = a3;
savedregs[14] = a4;
v9 = FLAlertLayer::init((FLAlertLayer *)a1, 200);
v10 = v9;
if ( v9 )
{
*(_DWORD *)(a1 + 524) = a7;
*(_BYTE *)(a1 + 468) = 1;
cocos2d::CCDirector::sharedDirector(v9);
cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)&v35);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v38, 0.0, 0.0, 80.0, 80.0);
v11 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v38);
v12 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v11 + 160);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v38, 360.0, 250.0);
v12(v11, v38);
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v11, -1);
v13 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v11 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v35 * 0.5, v36 * 0.5);
v13(v11, v38);
v15 = *(unsigned __int8 *)a8;
if ( (v15 & 1) != 0 )
{
if ( a8[1] )
goto LABEL_16;
v17 = *a8 & 0xFFFFFFFE;
if ( v17 - 1 <= 8 )
{
std::string::__grow_by_and_replace((int)a8, v17 - 1, 10 - v17, 0, 0, 0, 9u, "Setup HSV");
goto LABEL_16;
}
v16 = (char *)a8[2];
}
else
{
if ( v15 >> 1 )
goto LABEL_18;
v16 = (char *)a8 + 1;
}
strcpy(v16, "Setup HSV");
v18 = *(unsigned __int8 *)a8;
v14 = (const char *)(v18 << 31);
v19 = (v18 & 1) != 0;
if ( (v18 & 1) != 0 )
v20 = 9;
else
v20 = 18;
if ( v19 )
a8[1] = v20;
else
*(_BYTE *)a8 = v20;
LABEL_16:
if ( (*(_BYTE *)a8 & 1) != 0 )
{
v21 = (cocos2d::CCLabelBMFont *)a8[2];
LABEL_19:
v22 = cocos2d::CCLabelBMFont::create(v21, "goldFont.fnt", v14);
v23 = *(void (__fastcall **)(int, _DWORD *))(*(_DWORD *)v22 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v38, v35 * 0.5, (float)((float)(v36 * 0.5) + 125.0) - 23.0);
v23(v22, v38);
v24 = (cocos2d::CCMenu *)(*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(
*(_DWORD *)(a1 + 460),
v22);
v25 = cocos2d::CCMenu::create(v24);
*(_DWORD *)(a1 + 444) = v25;
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 460) + 228))(*(_DWORD *)(a1 + 460), v25);
v26 = ButtonSprite::create((ButtonSprite *)"OK", (const char *)&dword_58 + 2, 0, 1.0, 0.0, v34);
v38[0] = HSVWidgetPopup::onClose;
v38[1] = 0;
v27 = CCMenuItemSpriteExtra::create((int)v26, 0, a1, (int)HSVWidgetPopup::onClose, 0);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 444) + 228))(*(_DWORD *)(a1 + 444), v27);
v28 = *(_DWORD *)(a1 + 444);
v29 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v28 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v35 * 0.5, (float)((float)(v36 * 0.5) - 125.0) + 25.0);
v29(v28, v37);
v30 = ConfigureHSVWidget::create(savedregs[12], savedregs[13], (const char *)savedregs[14], a5, 0, 1);
*(_DWORD *)(a1 + 520) = v30;
(*(void (__fastcall **)(_DWORD, int, int))(**(_DWORD **)(a1 + 460) + 232))(*(_DWORD *)(a1 + 460), v30, 1);
v31 = *(_DWORD *)(a1 + 520);
v32 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v31 + 92);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v37, v35 * 0.5, v36 * 0.5);
v32(v31, v37);
ConfigureHSVWidget::setBaseColor(*(_DWORD *)(a1 + 520), a6);
return v10;
}
LABEL_18:
v21 = (cocos2d::CCLabelBMFont *)((char *)a8 + 1);
goto LABEL_19;
}
return v10;
}