//
// SetupGameplayOffsetPopup::init from 0x9f03a4 to 0x9f0cc0 (2332 bytes)
//
// 2 xrefs:
// > SetupGameplayOffsetPopup::create @ 0x9f0e84
// > ??> @ 0x4e3d8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
bool SetupGameplayOffsetPopup::init(SetupGameplayOffsetPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool v4; // w26
cocos2d::CCPoint *p_m_textOffset; // x0
__int64 v7; // x2
__int64 v8; // x3
__int64 v9; // x4
__int64 v10; // x5
const char *v11; // x6
cocos2d::CCPoint *v12; // x0
cocos2d::CCPoint *v13; // x0
void *v14; // x0
cocos2d::CCDirector *v15; // x0
float v16; // s3
float v17; // s4
cocos2d::CCPoint *v18; // x0
float v19; // s3
float v20; // s4
cocos2d::CCPoint *v21; // x0
int v22; // w28
cocos2d::CCPoint *v23; // x0
cocos2d::CCPoint *v24; // x0
cocos2d::CCPoint *v25; // x0
bool v26; // w4
__int64 v27; // x5
const char *v28; // x6
cocos2d::CCPoint *v29; // x0
cocos2d::CCNode *v30; // x0
CCMenuItemSpriteExtra *v31; // x22
cocos2d::CCMenu *m_buttonMenu; // x25
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
unsigned int *p_m_caption; // x1
int m_data; // w2
unsigned int *v36; // x1
int v37; // w2
unsigned int *v38; // x1
int v39; // w2
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x22
int v53; // w1
_QWORD v54[2]; // [xsp+30h] [xbp+0h] BYREF
int v55; // [xsp+BCh] [xbp+8Ch]
float v56; // [xsp+D0h] [xbp+A0h]
float v57; // [xsp+D4h] [xbp+A4h]
cocos2d::CCPoint v58; // [xsp+D8h] [xbp+A8h] BYREF
cocos2d::CCPoint v59; // [xsp+E0h] [xbp+B0h] BYREF
cocos2d::CCPoint v60; // [xsp+E8h] [xbp+B8h] BYREF
ButtonSprite *v61; // [xsp+F0h] [xbp+C0h] BYREF
cocos2d::CCPoint v62; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v63; // 0:x2.16
cocos2d::CCPoint v64; // 0:s0.4,4:s1.4
cocos2d::CCPoint v65; // 0:s0.4,4:s1.4
v4 = SetupTriggerPopup::init(a1, a2, a3, 380.0, 240.0, 1);
if ( v4 )
{
SetupTriggerPopup::preSetup(a1);
sub_D153B8((unsigned int)v54 + 192, "Gameplay Offset");
SetupTriggerPopup::addTitle((__int64)a1);
p_m_textOffset = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_caption = (unsigned int *)&v61[-1].m_caption;
do
m_data = __ldaxr(p_m_caption);
while ( __stlxr(m_data - 1, p_m_caption) );
}
else
{
m_data = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(p_m_textOffset);
}
sub_D153B8((unsigned int)v54 + 192, "OK");
SetupTriggerPopup::addCloseButton((__int64)a1, &v61, v7, v8, v9, v10, v11);
v12 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v36 = (unsigned int *)&v61[-1].m_caption;
do
v37 = __ldaxr(v36);
while ( __stlxr(v37 - 1, v36) );
}
else
{
v37 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v37 - 1;
}
if ( v37 <= 0 )
operator delete(v12);
}
sub_D153B8((int)&v60, "Help");
sub_D153B8(
(int)&v61,
"Change the offset between the player and the camera center. 0 = player will be placed in the center of the camera.");
SetupTriggerPopup::addHelpButton((__int64)a1, 1.0);
v13 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)&v61[-1].m_caption;
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v13);
}
v14 = (void *)(*(_QWORD *)&v60 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v60 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(*(_QWORD *)&v60 - 8LL);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(*(_QWORD *)&v60 - 8LL);
*(_DWORD *)(*(_QWORD *)&v60 - 8LL) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v14);
}
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v15 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v15);
cocos2d::CCPoint::CCPoint(&v58, (float)(v56 * 0.5) + -80.0, (float)(v57 * 0.5) + 55.0);
sub_D153B8((int)&v61, "Offset X:");
cocos2d::CCPoint::CCPoint(&v59, 0.0, 0.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
v64.x = 0.8;
v64.y = -100.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1Cu,
v64,
100.0,
v16,
v17,
(std::string)&v61,
&v60,
(InputValueType)0,
Int,
10,
0,
0,
28,
0,
2,
0);
v18 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)&v61[-1].m_caption;
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v18);
}
sub_D153B8((int)&v61, "Offset Y:");
cocos2d::CCPoint::CCPoint(&v59, 0.0, -60.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
v65.x = 0.8;
v65.y = -100.0;
SetupTriggerPopup::createValueControlAdvanced(
a1,
0x1Du,
v65,
100.0,
v19,
v20,
(std::string)&v61,
&v60,
(InputValueType)0,
Int,
10,
0,
0,
29,
0,
2,
0);
v21 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)&v61[-1].m_caption;
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v21);
}
v22 = (int)a1->getValue(a1, 101);
v55 = v22 == 1;
sub_D153B8((int)&v61, "X\nOnly");
cocos2d::CCPoint::CCPoint(&v59, 105.0, -8.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
SetupTriggerPopup::createCustomToggleValueControl(a1, 1, v55, 1u, (int)&v61, &v60, 0, 0, 0);
v23 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)&v61[-1].m_caption;
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v23);
}
sub_D153B8((int)&v61, "Y\nOnly");
cocos2d::CCPoint::CCPoint(&v59, 105.0, -68.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
SetupTriggerPopup::createCustomToggleValueControl(a1, 2, v22 == 2, 1u, (int)&v61, &v60, 0, 0, 0);
v24 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)&v61[-1].m_caption;
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v24);
}
sub_D153B8((int)&v61, "Dont\nZoom");
cocos2d::CCPoint::CCPoint(&v59, 180.0, -8.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
SetupTriggerPopup::createToggleValueControl(a1, 58, 1.0, (__int64)&v61, &v60, 0, 0, 0);
v25 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)&v61[-1].m_caption;
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v25);
}
sub_D153B8((int)&v61, "Dont\nZoom");
cocos2d::CCPoint::CCPoint(&v59, 180.0, -68.0);
cocos2d::CCPoint::operator+(&v60, &v58, &v59);
SetupTriggerPopup::createToggleValueControl(a1, 59, 1.0, (__int64)&v61, &v60, 0, 0, 0);
v29 = &v61[-1].m_textOffset;
if ( &v61[-1].m_textOffset != (cocos2d::CCPoint *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)&v61[-1].m_caption;
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = (int)v61[-1].m_caption.m_data.m_data;
LODWORD(v61[-1].m_caption.m_data.m_data) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v29);
}
v30 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"Default",
(const char *)&qword_58 + 2,
0,
0,
0.4,
v26,
v27,
v28);
v63.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v63.adj = (size_t)SetupGameplayOffsetPopup::onDefaultValues;
v31 = CCMenuItemSpriteExtra::create(v30, nullptr, v63);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v31);
m_buttonMenu = a1->m_buttonMenu;
setPosition = v31->setPosition;
cocos2d::CCPoint::CCPoint(
&v60,
(float)((float)(a1->m_width * 0.5) + (float)(v56 * 0.5)) - 40.0,
(float)((float)(a1->m_height * 0.5) + (float)(v57 * 0.5)) - 25.0);
v62 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v60);
((void (__fastcall *)(CCMenuItemSpriteExtra *, ButtonSprite **, float, float))setPosition)(v31, &v61, v62.x, v62.y);
SetupTriggerPopup::postSetup(a1);
}
return v4;
}