//
// SetupPersistentItemTriggerPopup::init from 0x1005afa40 to 0x1005aff0a (1226 bytes)
//
// 1 xrefs:
// > sub_1005AF930 @ 0x1005af9f4
//
// 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 12:32:38 +0000
//
__int64 __fastcall SetupPersistentItemTriggerPopup::init(float *a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
unsigned int v4; // r15d
__int64 v5; // rax
__m128 v6; // xmm0
char v7; // [rsp+28h] [rbp-118h] BYREF
char v8[15]; // [rsp+29h] [rbp-117h] BYREF
void *v9; // [rsp+38h] [rbp-108h]
__int128 v10; // [rsp+40h] [rbp-100h] BYREF
void *v11; // [rsp+50h] [rbp-F0h]
__int128 v12; // [rsp+58h] [rbp-E8h] BYREF
void *v13; // [rsp+68h] [rbp-D8h]
__int128 v14; // [rsp+70h] [rbp-D0h] BYREF
void *v15; // [rsp+80h] [rbp-C0h]
__int128 v16; // [rsp+88h] [rbp-B8h] BYREF
void *v17; // [rsp+98h] [rbp-A8h]
__int128 v18; // [rsp+A0h] [rbp-A0h] BYREF
void *v19; // [rsp+B0h] [rbp-90h]
unsigned __int64 v20; // [rsp+B8h] [rbp-88h] BYREF
_BYTE v21[24]; // [rsp+C0h] [rbp-80h] BYREF
__int128 v22; // [rsp+D8h] [rbp-68h] BYREF
void *v23; // [rsp+E8h] [rbp-58h]
float v24; // [rsp+F4h] [rbp-4Ch]
__int64 v25; // [rsp+F8h] [rbp-48h] BYREF
unsigned __int64 v26[3]; // [rsp+100h] [rbp-40h] BYREF
unsigned __int64 v27; // [rsp+118h] [rbp-28h] BYREF
unsigned __int64 v28[4]; // [rsp+120h] [rbp-20h] BYREF
result = SetupTriggerPopup::init((__int64)a1, a2, a3, 1, 300.0, 230.0, 0.0);
if ( (_BYTE)result )
{
v4 = result;
SetupTriggerPopup::preSetup(a1);
strcpy(v21, "*Persistent Item Setup");
SetupTriggerPopup::addTitle((__int64)a1, (__int64)v21);
if ( (v21[0] & 1) != 0 )
operator delete(*(void **)&v21[16]);
v7 = 4;
strcpy(v8, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, (__int64)&v7);
if ( (v7 & 1) != 0 )
operator delete(v9);
LOBYTE(v10) = 8;
strcpy((char *)&v10 + 1, "Help");
v13 = operator new(0xE0u);
*(_QWORD *)&v12 = 225;
*((_QWORD *)&v12 + 1) = 222;
strcpy(
(char *)v13,
"Lets you set ItemID to be Persistent. This means it does not reset upon player death, but only on "
"level exit.\n"
"TargetAll targets all persistent Item IDs.\n"
"Reset resets the target item(s) to 0.");
SetupTriggerPopup::addHelpButton((__int64)a1, &v10, &v12, 1.0);
if ( (v12 & 1) != 0 )
operator delete(v13);
if ( (v10 & 1) != 0 )
operator delete(v11);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1, (__int64)&v10);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v25, v5);
sub_100278250((float *)&v20, *(float *)&v25 * 0.5, *((float *)&v25 + 1) * 0.5);
v24 = (*(float (__fastcall **)(float *, __int64))(*(_QWORD *)a1 + 1464LL))(a1, 494);
LOBYTE(v26[0]) = 14;
strcpy((char *)v26 + 1, "Item ID");
sub_100278250((float *)&v27, -40.0, 40.0);
sub_100278350((double *)v28, &v20, &v27);
v6.i32[0] = 0;
IDNameInput::create(
(_DWORD)a1,
(_DWORD)a1 + 544,
2 * (_mm_cvtsi128_si32((__m128i)_mm_cmpneq_ss((__m128)LODWORD(v24), v6)) & 1) + 2,
80,
(unsigned int)v26,
(unsigned int)v28,
6,
0,
0,
0);
if ( (v26[0] & 1) != 0 )
operator delete((void *)v26[2]);
strcpy((char *)&v14, "\nTimer");
sub_100278250((float *)v28, 80.0, 40.0);
sub_100278350((double *)v26, &v20, v28);
SetupTriggerPopup::createToggleValueControl((int)a1, 494, &v14, (__int64)v26, 1, 0, 1.0, 0);
if ( (v14 & 1) != 0 )
operator delete(v15);
sub_100278250((float *)v26, *(float *)&v25 * 0.5, (float)(0.5 * *((float *)&v25 + 1)) + -23.0);
LOBYTE(v22) = 20;
strcpy((char *)&v22 + 1, "Persistent");
sub_100278250((float *)&v27, -80.0, 0.0);
sub_100278350((double *)v28, v26, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 491, &v22, (__int64)v28, 1, 0, 1.0, 0);
if ( (v22 & 1) != 0 )
operator delete(v23);
LOBYTE(v16) = 18;
strcpy((char *)&v16 + 1, "TargetAll");
sub_100278250((float *)&v27, 0.0, 0.0);
sub_100278350((double *)v28, v26, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 492, &v16, (__int64)v28, 1, 0, 1.0, 0);
if ( (v16 & 1) != 0 )
operator delete(v17);
strcpy((char *)&v18, "\nReset");
sub_100278250((float *)&v27, 80.0, 0.0);
sub_100278350((double *)v28, v26, &v27);
SetupTriggerPopup::createToggleValueControl((int)a1, 493, &v18, (__int64)v28, 1, 0, 1.0, 0);
if ( (v18 & 1) != 0 )
operator delete(v19);
SetupTriggerPopup::postSetup(a1);
return v4;
}
return result;
}