//
// SetupShakePopup::init from 0x959798 to 0x95a120 (2440 bytes)
//
// 2 xrefs:
// > SetupShakePopup::create @ 0x95a2fc
// > ??> @ 0x510d8
//
// 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 SetupShakePopup::init(SetupShakePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
cocos2d::CCDirector *v5; // x0
cocos2d::CCLabelBMFont *v6; // x19
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
const char *v8; // x6
cocos2d::CCNode *v9; // x0
CCMenuItemSpriteExtra *v10; // x0
cocos2d::CCNode *v11; // x19
void *v12; // x0
void *v13; // x0
int v14; // w22
cocos2d::CCMenu *m_buttonMenu; // x26
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
float v17; // s0
float v18; // s1
float v19; // s0
float v20; // s1
float m_interval; // s8
cocos2d::CCLabelBMFont *v22; // x19
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCNode *v24; // x23
void (__fastcall *v25)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x19
const char *v26; // x0
CCTextInputNode *v27; // x19
cocos2d::CCNode *v28; // x0
const cocos2d::CCPoint *(__fastcall *getPosition)(cocos2d::CCNode *__hidden); // x1
void (__fastcall *v30)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
__int64 v31; // x0
void *v32; // x0
Slider *v33; // x23
CCTextInputNode_vtbl *v34; // x2
SliderThumb *v35; // x0
float v36; // s1
float v37; // s0
bool v38; // nf
char *v39; // x0
SliderThumb *v40; // x0
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x1
int v44; // w2
unsigned int *v45; // x1
int v46; // w2
unsigned int *v47; // x1
int v48; // w2
SliderThumb *Thumb; // x0
float v50; // s0
float v51; // s1
bool v52; // [xsp+B7h] [xbp+B7h]
void (__fastcall *v53)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [xsp+B8h] [xbp+B8h]
cocos2d::ccColor3B v54; // [xsp+D0h] [xbp+D0h]
float v55; // [xsp+D8h] [xbp+D8h]
float v56; // [xsp+DCh] [xbp+DCh]
cocos2d::CCPoint v57; // [xsp+E0h] [xbp+E0h] BYREF
cocos2d::CCPoint v58; // [xsp+E8h] [xbp+E8h] BYREF
char *v59; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCSize v60; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v61; // [xsp+100h] [xbp+100h] BYREF
cocos2d::CCRect v62; // [xsp+108h] [xbp+108h] BYREF
cocos2d::CCRect v63; // [xsp+118h] [xbp+118h] BYREF
cocos2d::CCPoint v64; // 0:kr08_8.8
cocos2d::SEL_MenuHandler v65; // 0:x2.16
cocos2d::CCRect v66; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v52 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 285.0, 1);
if ( v52 )
{
a1->determineStartValues(a1);
v5 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v5);
v6 = cocos2d::CCLabelBMFont::create();
a1->m_mainLayer->addChild(a1->m_mainLayer, v6);
v6->setScale(v6, 0.5);
setPosition = v6->setPosition;
cocos2d::CCPoint::CCPoint(&v63.origin, v55 * 0.5, (float)((float)(a1->m_height * 0.5) + (float)(v56 * 0.5)) - 14.0);
setPosition(v6, &v63.origin);
v9 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v8,
30.0);
v65.adj = 1320;
v65.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v10 = CCMenuItemSpriteExtra::create(v9, nullptr, v65);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v10);
sub_D153B8((int)&v62, "Help");
sub_D153B8(
(int)&v63,
"Shakes the screen for a set duration.\n"
"Strength is how intense the shake is.\n"
"Interval is how often the screen shakes. Leaving this at 0 means that every frame shakes.\n"
"Avoid overusing this effect as it can cause bad gameplay.");
v11 = (cocos2d::CCNode *)InfoAlertButton::create(1.0);
v12 = (void *)(*(_QWORD *)&v63.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v63.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v45 = (unsigned int *)(*(_QWORD *)&v63.origin - 8LL);
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(_DWORD *)(*(_QWORD *)&v63.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v63.origin - 8LL) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v12);
}
v13 = (void *)(*(_QWORD *)&v62.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v62.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v47 = (unsigned int *)(*(_QWORD *)&v62.origin - 8LL);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
}
else
{
v48 = *(_DWORD *)(*(_QWORD *)&v62.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v62.origin - 8LL) = v48 - 1;
}
if ( v48 <= 0 )
operator delete(v13);
}
v14 = 0;
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v11);
m_buttonMenu = a1->m_buttonMenu;
v16 = v11->setPosition;
cocos2d::CCPoint::CCPoint(
&v62.origin,
18.0 - (float)((float)(a1->m_width * 0.5) - (float)(v55 * 0.5)),
(float)((float)(a1->m_height * 0.5) + (float)(v56 * 0.5)) - 18.0);
v64 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v62.origin);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCRect *, float, float))v16)(v11, &v63, v64.x, v64.y);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
cocos2d::CCPoint::CCPoint(&v57, v55 * 0.5, (float)(v56 * 0.5) + 95.0);
while ( 1 )
{
cocos2d::CCPoint::CCPoint(&v58);
v59 = &byte_124B6C8;
if ( v14 )
{
if ( v14 == 1 )
{
cocos2d::CCPoint::CCPoint(&v62.origin, 0.0, -60.0);
cocos2d::CCPoint::operator+(&v63, &v57, &v62);
cocos2d::CCPoint::operator=(&v58, v50, v51);
sub_D1798C(&v59, "Interval: ", 10);
m_interval = a1->m_interval;
}
else
{
cocos2d::CCPoint::CCPoint(&v62.origin, 0.0, -120.0);
cocos2d::CCPoint::operator+(&v63, &v57, &v62);
cocos2d::CCPoint::operator=(&v58, v19, v20);
sub_D1798C(&v59, "Duration: ", 10);
m_interval = a1->m_duration;
}
}
else
{
cocos2d::CCPoint::operator=(&v58, v17, v18);
sub_D1798C(&v59, "Strength: ", 10);
m_interval = a1->m_strength;
}
v22 = cocos2d::CCLabelBMFont::create();
v22->setScale(v22, 0.7);
v22->setPosition(v22, &v58);
setAnchorPoint = v22->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v63.origin, 1.0, 0.5);
setAnchorPoint(v22, &v63.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v22);
cocos2d::CCRect::CCRect(&v62, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v63, &v62);
v24 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"square02_small.png",
(const char *)&v63,
v66);
((void (__fastcall *)(cocos2d::CCNode *, __int64))v24->__vftable[1].~CCNode_0)(v24, 100);
cocos2d::CCSize::CCSize(&v60, 70.0, 30.0);
v24->setContentSize(v24, &v60);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, -1);
v25 = v24->setPosition;
cocos2d::CCPoint::CCPoint(&v61, 45.0, 0.0);
cocos2d::CCPoint::operator+(&v63, &v58, &v61);
v25(v24, &v63.origin);
if ( m_interval == -99999.0 )
v26 = "Mixed";
else
v26 = "Num";
v27 = CCTextInputNode::create(50.0, 40.0, v26, "Thonburi");
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v27, 20);
v28 = v24;
getPosition = v24->getPosition;
v30 = v27->setPosition;
v31 = (__int64)getPosition(v28);
v30(v27, (const cocos2d::CCPoint *)v31);
CCTextInputNode::setMaxLabelScale(v27, 0.6);
CCTextInputNode::setMaxLabelWidth(v27, 200.0);
v27->m_textField->setVisible(v27->m_textField, 0);
v27->m_maxLabelLength = 4;
sub_D153B8((int)&v63, "0123456789.");
CCTextInputNode::setAllowedChars((__int64)v27, (__int64)&v63);
v32 = (void *)(*(_QWORD *)&v63.origin - 24LL);
if ( (__int64 *)(*(_QWORD *)&v63.origin - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)(*(_QWORD *)&v63.origin - 8LL);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *(_DWORD *)(*(_QWORD *)&v63.origin - 8LL);
*(_DWORD *)(*(_QWORD *)&v63.origin - 8LL) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v32);
}
v54.r = 120;
*(_WORD *)&v54.g = -3926;
CCTextInputNode::setLabelPlaceholderColor(v27, v54);
CCTextInputNode::setLabelPlaceholderScale(v27, 0.5);
v27->m_numberInput = 1;
v27->m_delegate = &a1->TextInputDelegate;
v33 = (Slider *)Slider::create(a1, (void (__cdecl *)(cocos2d::CCObject *))SetupShakePopup::sliderChanged, 0, 0.8);
Slider::setBarVisibility(v33, 0);
a1->m_mainLayer->addChild(a1->m_mainLayer, v33);
v53 = v33->setPosition;
cocos2d::CCPoint::CCPoint(&v61, 0.0, -32.0);
cocos2d::CCPoint::operator+(&v63, &v58, &v61);
v53(v33, &v63.origin);
v34 = v27->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
if ( v14 )
{
if ( v14 == 1 )
{
a1->m_intervalInput = v27;
v34->setTag(v27, 8);
a1->m_intervalSlider = v33;
Thumb = Slider::getThumb(v33);
Thumb->setTag(Thumb, 7);
v36 = 1.0;
v37 = m_interval / 0.1;
v38 = (float)(m_interval / 0.1) < 1.0;
if ( (float)(m_interval / 0.1) < 1.0 )
{
LABEL_21:
if ( v37 <= 0.0 )
v37 = 0.0;
goto LABEL_17;
}
}
else
{
a1->m_durationInput = v27;
v34->setTag(v27, 5);
a1->m_durationSlider = v33;
v35 = Slider::getThumb(v33);
v35->setTag(v35, 3);
v36 = 1.0;
v37 = m_interval * 0.5;
v38 = (float)(m_interval * 0.5) < 1.0;
if ( (float)(m_interval * 0.5) < 1.0 )
goto LABEL_21;
}
}
else
{
a1->m_strengthInput = v27;
v34->setTag(v27, 6);
a1->m_strengthSlider = v33;
v40 = Slider::getThumb(v33);
v40->setTag(v40, 4);
v36 = 1.0;
v37 = m_interval / 5.0;
v38 = (float)(m_interval / 5.0) < 1.0;
if ( (float)(m_interval / 5.0) < 1.0 )
goto LABEL_21;
}
if ( !v38 )
v37 = v36;
LABEL_17:
Slider::setValue(v33, v37);
v39 = v59 - 24;
if ( v59 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v43 = (unsigned int *)(v59 - 8);
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *((_DWORD *)v59 - 2);
*((_DWORD *)v59 - 2) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v39);
}
if ( ++v14 == 3 )
{
SetupShakePopup::updateShakeLabel(a1, 0);
SetupShakePopup::updateDurLabel(a1, 0);
SetupShakePopup::updateIntervalLabel(a1, 0);
a1->m_disableTextDelegate = 0;
return v52;
}
}
}
return v52;
}