//
// SetupProgressPopup::init from 0x140609e80 to 0x14060a50c (1676 bytes)
//
// 3 xrefs:
// > SetupProgressPopup::create @ 0x140609e3e
// > ??> @ 0x14092fab0
// > ??> @ 0x14092fabc
//
// This function is hookable on this platform (idp: pc, 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 11:35:13 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall SetupProgressPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
_BYTE *v6; // r9
_BYTE *v7; // rcx
const char *v8; // rdx
__int64 v9; // r8
__int64 v10; // rcx
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rbx
__int64 v15; // rax
void *v16; // rcx
__int64 v17; // rax
__int64 v18; // rax
void *v19; // rcx
__int64 v20; // rbx
void **v21; // [rsp+88h] [rbp-80h] BYREF
_BYTE v22[8]; // [rsp+90h] [rbp-78h] BYREF
void **v23; // [rsp+98h] [rbp-70h] BYREF
__int128 v24; // [rsp+A0h] [rbp-68h] BYREF
__int64 v25; // [rsp+B0h] [rbp-58h]
__int64 v26; // [rsp+B8h] [rbp-50h]
float v27[2]; // [rsp+C0h] [rbp-48h] BYREF
void **v28; // [rsp+C8h] [rbp-40h] BYREF
void *Block[2]; // [rsp+D0h] [rbp-38h] BYREF
__m128i si128; // [rsp+E0h] [rbp-28h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1131413504, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
Block[1] = nullptr;
si128.m128i_i64[0] = 8;
si128.m128i_i64[1] = 15;
Block[0] = (void *)0x73736572676F7250LL;
SetupTriggerPopup::addTitle(a1, Block);
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "OK");
SetupTriggerPopup::addCloseButton(a1, Block);
v21 = Block;
*(_OWORD *)Block = 0;
si128 = 0u;
v6 = sub_14003D460(0x160u);
Block[0] = v6;
si128.m128i_i64[0] = 346;
si128.m128i_i64[1] = 351;
v7 = v6;
v8 = "Sets the player's Platformer progress to the selected value.\n"
"Lower values are ignored.\n"
"Add increases the current progress by that amount.\n"
"Input takes the value from an itemID instead.\n"
"Progress is saved on death, like Classic percent, and awards orbs in rated levels.\n"
"Target ItemID: Progress is also written to this itemID.";
v9 = 2;
do
{
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_OWORD *)v7 + 5) = *((_OWORD *)v8 + 5);
*((_OWORD *)v7 + 6) = *((_OWORD *)v8 + 6);
v7 += 128;
*((_OWORD *)v7 - 1) = *((_OWORD *)v8 + 7);
v8 += 128;
--v9;
}
while ( v9 );
*(_OWORD *)v7 = *(_OWORD *)v8;
*((_OWORD *)v7 + 1) = *((_OWORD *)v8 + 1);
*((_OWORD *)v7 + 2) = *((_OWORD *)v8 + 2);
*((_OWORD *)v7 + 3) = *((_OWORD *)v8 + 3);
*((_OWORD *)v7 + 4) = *((_OWORD *)v8 + 4);
*((_QWORD *)v7 + 10) = *((_QWORD *)v8 + 10);
*((_WORD *)v7 + 44) = *((_WORD *)v8 + 44);
v6[346] = 0;
v24 = 0;
v25 = 4;
v26 = 15;
strcpy((char *)&v24, "Help");
SetupTriggerPopup::addHelpButton(a1, &v24, Block);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v11 = cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::getWinSize(v11, v27);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v22, v27[0] * 0.5, v27[1] * 0.5);
v28 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 5;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Input");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v23, -80.0, 50.0);
cocos2d::CCPoint::operator+(v22, &v21, v12);
SetupTriggerPopup::createToggleValueControl(a1, 605, (unsigned int)Block, (unsigned int)&v21, 1, 0, 0, 1065353216);
v23 = (void **)&v24;
v25 = 8;
v26 = 15;
v24 = 0x3A746E6563726550uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, 50.0, 65.0);
cocos2d::CCPoint::operator+(v22, &v21, v13);
SetupTriggerPopup::createValueControlAdvanced(
a1,
602,
(unsigned int)&v24,
(unsigned int)&v21,
1061997773,
0,
2,
3,
0,
0,
1120272384,
0,
602,
0,
0,
0,
v21);
LODWORD(v21) = 602;
*(_BYTE *)sub_14016EE40((__int64 *)(a1 + 856), (int *)&v21) = 1;
Block[1] = nullptr;
si128 = _mm_load_si128((const __m128i *)&xmmword_140836580);
Block[0] = (void *)0x3A44496D657449LL;
v14 = a1 + 544;
if ( !a1 )
v14 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v23, 50.0, 50.0);
cocos2d::CCPoint::operator+(v22, &v21, v15);
IDNameInput::create(a1, v14, 2, 95, (__int64)Block, (const struct cocos2d::CCPoint *)&v21, 1061997773, 6, 605, 0, 0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v16 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
v23 = Block;
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 3;
si128.m128i_i64[1] = 15;
LOWORD(Block[0]) = *(_WORD *)"Add";
WORD1(Block[0]) = (unsigned __int8)aAdd[2];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, -80.0, -20.0);
cocos2d::CCPoint::operator+(v22, &v21, v17);
SetupTriggerPopup::createToggleValueControl(a1, 603, (unsigned int)Block, (unsigned int)&v21, 1, 0, 0, 1065353216);
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365F0);
strcpy((char *)Block, "Target ItemID:");
HIBYTE(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v23, 50.0, -20.0);
cocos2d::CCPoint::operator+(v22, &v21, v18);
IDNameInput::create(a1, v14, 2, 80, (__int64)Block, (const struct cocos2d::CCPoint *)&v21, 1061997773, 6, 0, 0, 0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v19 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v19 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v19 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v19);
}
v20 = *(_QWORD *)a1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)a1 + 1168LL))(a1, 605);
(*(void (__fastcall **)(__int64, __int64))(v20 + 1160))(a1, 605);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}