//
// SetupShakePopup::init from 0x140454d20 to 0x140455a65 (3397 bytes)
//
// 2 xrefs:
// > SetupShakePopup::create @ 0x140454cdc
// > ??> @ 0x1406da8b0
//
// 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
//
// Hidden C++ exception states: #wind=4
bool SetupShakePopup::init(SetupShakePopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v5; // rcx
cocos2d::CCDirector *v6; // rax
struct cocos2d::CCLabelBMFont *v7; // rdi
cocos2d::CCLabelBMFont_vtbl *v8; // rbx
const cocos2d::CCPoint *v9; // rax
ButtonSprite *v10; // rbx
CCMenuItemSpriteExtra *v11; // rax
char *v12; // rdi
__int64 v13; // rbx
double v14; // xmm0_8
struct cocos2d::CCPoint v15; // rax
int i; // r15d
unsigned __int64 v17; // rdi
void **v18; // rbx
float m_interval; // xmm6_4
unsigned __int64 v20; // rcx
__int64 v21; // rbx
char *v22; // rsi
void *v23; // rcx
unsigned __int64 v24; // rdi
void **v25; // rbx
unsigned __int64 v26; // rcx
__int64 v27; // rbx
char *v28; // rsi
void *v29; // rcx
unsigned __int64 v30; // rdi
void **v31; // rbx
unsigned __int64 v32; // rcx
__int64 v33; // rbx
char *v34; // rsi
void *v35; // rcx
void **v36; // rcx
struct cocos2d::CCLabelBMFont *v37; // rdi
float v38; // xmm0_4
cocos2d::CCLabelBMFont_vtbl *v39; // rbx
const cocos2d::CCPoint *v40; // rax
struct cocos2d::CCRect *v41; // rax
struct cocos2d::extension::CCScale9Sprite *v42; // rdi
__int64 v43; // rdx
float v44; // xmm0_4
const char *v45; // r9
const char *v46; // r8
CCTextInputNode *v47; // rsi
CCTextInputNode_vtbl *v48; // rbx
__int64 v49; // rax
const char *v50; // r8
Slider *v51; // rdi
float v52; // xmm0_4
float v53; // xmm1_4
float v54; // xmm1_4
float Value; // xmm0_4
float m_width; // xmm3_4
cocos2d::CCRect *v57; // rcx
float v58; // xmm1_4
float v59; // xmm0_4
cocos2d::CCSprite_vtbl *v60; // rbx
const cocos2d::CCRect *v61; // rax
void *v62; // rcx
int v63; // [rsp+28h] [rbp-E0h]
float v64; // [rsp+60h] [rbp-A8h]
cocos2d::CCPoint v65; // [rsp+68h] [rbp-A0h] BYREF
ButtonSprite *v66; // [rsp+70h] [rbp-98h] BYREF
__int64 v67; // [rsp+78h] [rbp-90h] BYREF
char Src[12]; // [rsp+80h] [rbp-88h] BYREF
int v69; // [rsp+8Ch] [rbp-7Ch]
__int64 v70; // [rsp+90h] [rbp-78h]
__int64 v71; // [rsp+98h] [rbp-70h]
struct cocos2d::CCPoint v72; // [rsp+A0h] [rbp-68h] BYREF
char v73[8]; // [rsp+A8h] [rbp-60h] BYREF
char v74[8]; // [rsp+B0h] [rbp-58h] BYREF
cocos2d::CCSize v75[2]; // [rsp+B8h] [rbp-50h] BYREF
__int128 v76; // [rsp+C8h] [rbp-40h] BYREF
__int64 v77; // [rsp+D8h] [rbp-30h]
__int64 v78; // [rsp+E0h] [rbp-28h]
cocos2d::CCRect v79; // [rsp+110h] [rbp+8h] BYREF
cocos2d::CCRect v80; // [rsp+120h] [rbp+18h] BYREF
char v81; // [rsp+130h] [rbp+28h] BYREF
void *v82[2]; // [rsp+140h] [rbp+38h] BYREF
__int64 v83; // [rsp+150h] [rbp+48h]
unsigned __int64 v84; // [rsp+158h] [rbp+50h]
result = SetupTriggerPopup::init(a1, a2, a3, 300.0, 285.0, 1);
if ( result )
{
a1->determineStartValues(a1);
v6 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v5);
cocos2d::CCDirector::getWinSize(v6);
v7 = cocos2d::CCLabelBMFont::create("Setup Shake", &qword_14052A4D8);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v7);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v7->setScale_0)(v7);
v8 = v7->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(a1->m_height * 0.5, v64 * 0.5);
v8->setPosition_0(v7, v9);
v66 = (ButtonSprite *)operator new(0x2C0u);
v10 = ButtonSprite::ButtonSprite(v66);
if ( v10 )
{
if ( ButtonSprite::init_1(v10, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v10);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v10->~ButtonSprite)(v10, 1);
v10 = nullptr;
}
}
v11 = CCMenuItemSpriteExtra::create(v10, nullptr, a1, (cocos2d::SEL_MenuHandler *)sub_14009BEF0);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v11);
v66 = (ButtonSprite *)v82;
*(_OWORD *)v82 = 0;
v83 = 0;
v84 = 15;
v82[0] = sub_14003AA10(0x100u);
v83 = 247;
v84 = 255;
strcpy(
(char *)v82[0],
"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.");
v76 = 0;
v77 = 4;
v78 = 15;
strcpy((char *)&v76, "Help");
v12 = InfoAlertButton::create((__int64)&v76, (__int64)v82);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, (cocos2d::CCNode *)v12);
v13 = *(_QWORD *)v12;
v14 = cocos2d::CCPoint::CCPoint(a1->m_width * 0.5, (float)((float)(v64 * 0.5) - (float)(a1->m_width * 0.5)) + 18.0);
v15 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v72);
(*(void (__fastcall **)(char *, struct cocos2d::CCPoint))(v13 + 184))(v12, v15);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
cocos2d::CCPoint::CCPoint(*(float *)&v14, v64 * 0.5);
for ( i = 0; i < 3; ++i )
{
cocos2d::CCPoint::CCPoint(&v65);
*(_OWORD *)v82 = 0;
v83 = 0;
v84 = 15;
LOBYTE(v82[0]) = 0;
if ( i )
{
if ( i == 1 )
{
cocos2d::CCPoint::CCPoint(0.0, 0.0);
cocos2d::CCPoint::operator+(&v67, v73);
cocos2d::CCPoint::operator=(&v65, v73);
v24 = v84;
if ( v84 < 0xA )
{
v26 = v84 >> 1;
if ( v84 <= 0x7FFFFFFFFFFFFFFFLL - (v84 >> 1) )
{
v27 = 15;
if ( v26 + v84 > 0xF )
v27 = v26 + v84;
}
else
{
v27 = 0x7FFFFFFFFFFFFFFFLL;
}
v28 = (char *)sub_14003AA10(v27 + 1);
v83 = 10;
v84 = v27;
strcpy(v28, "Interval: ");
if ( v24 > 0xF )
{
v29 = v82[0];
if ( v24 + 1 >= 0x1000 )
{
v29 = *((void **)v82[0] - 1);
if ( (unsigned __int64)((char *)v82[0] - (char *)v29 - 8) > 0x1F )
goto LABEL_77;
}
j_j_free(v29);
}
v82[0] = v28;
m_interval = a1->m_interval;
}
else
{
v25 = v82;
if ( v84 > 0xF )
v25 = (void **)v82[0];
v83 = 10;
memmove(v25, "Interval: ", 0xAu);
*((_BYTE *)v25 + 10) = 0;
m_interval = a1->m_interval;
}
}
else
{
cocos2d::CCPoint::CCPoint(0.0, 0.0);
cocos2d::CCPoint::operator+(&v67, v74);
cocos2d::CCPoint::operator=(&v65, v74);
v30 = v84;
if ( v84 < 0xA )
{
v32 = v84 >> 1;
if ( v84 <= 0x7FFFFFFFFFFFFFFFLL - (v84 >> 1) )
{
v33 = 15;
if ( v32 + v84 > 0xF )
v33 = v32 + v84;
}
else
{
v33 = 0x7FFFFFFFFFFFFFFFLL;
}
v34 = (char *)sub_14003AA10(v33 + 1);
v83 = 10;
v84 = v33;
strcpy(v34, "Duration: ");
if ( v30 > 0xF )
{
v35 = v82[0];
if ( v30 + 1 >= 0x1000 )
{
v35 = *((void **)v82[0] - 1);
if ( (unsigned __int64)((char *)v82[0] - (char *)v35 - 8) > 0x1F )
LABEL_77:
invalid_parameter_noinfo_noreturn();
}
j_j_free(v35);
}
v82[0] = v34;
}
else
{
v31 = v82;
if ( v84 > 0xF )
v31 = (void **)v82[0];
v83 = 10;
memmove(v31, "Duration: ", 0xAu);
*((_BYTE *)v31 + 10) = 0;
}
m_interval = a1->m_duration;
}
}
else
{
cocos2d::CCPoint::operator=(&v65, &v67);
v17 = v84;
if ( v84 < 0xA )
{
v20 = v84 >> 1;
if ( v84 <= 0x7FFFFFFFFFFFFFFFLL - (v84 >> 1) )
{
v21 = 15;
if ( v84 + v20 > 0xF )
v21 = v84 + v20;
}
else
{
v21 = 0x7FFFFFFFFFFFFFFFLL;
}
v22 = (char *)sub_14003AA10(v21 + 1);
v83 = 10;
v84 = v21;
strcpy(v22, "Strength: ");
if ( v17 > 0xF )
{
v23 = v82[0];
if ( v17 + 1 >= 0x1000 )
{
v23 = *((void **)v82[0] - 1);
if ( (unsigned __int64)((char *)v82[0] - (char *)v23 - 8) > 0x1F )
goto LABEL_77;
}
j_j_free(v23);
}
v82[0] = v22;
m_interval = a1->m_strength;
}
else
{
v18 = v82;
if ( v84 > 0xF )
v18 = (void **)v82[0];
v83 = 10;
memmove(v18, "Strength: ", 0xAu);
*((_BYTE *)v18 + 10) = 0;
m_interval = a1->m_strength;
}
}
v36 = v82;
if ( v84 > 0xF )
v36 = (void **)v82[0];
v37 = cocos2d::CCLabelBMFont::create((const char *)v36, "goldFont.fnt");
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v37->setScale_0)(v37);
v38 = ((float (__fastcall *)(struct cocos2d::CCLabelBMFont *, cocos2d::CCPoint *))v37->setPosition_0)(v37, &v65);
v39 = v37->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v38, 1.0);
v39->setAnchorPoint(v37, v40);
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v37);
cocos2d::CCRect::CCRect(&v79, 0.0, 0.0, 40.0, 40.0);
cocos2d::CCRect::CCRect(&v80, &v79);
v42 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v41);
LOBYTE(v43) = 100;
v42->setOpacity(&v42->cocos2d::CCRGBAProtocol, v43);
cocos2d::CCSize::CCSize(v75, 70.0, 30.0);
v42->setContentSize(v42, v75);
v44 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::extension::CCScale9Sprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v42,
0xFFFFFFFFLL);
cocos2d::CCPoint::CCPoint(v44, 45.0);
cocos2d::CCPoint::operator+(&v65, &v72);
v42->setPosition_0(v42, &v72);
v46 = "Num";
if ( m_interval == -99999.0 )
v46 = "Mixed";
v47 = CCTextInputNode::create(50.0, 40.0, v46, v45, v63, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v47, 20);
v48 = v47->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v49 = (__int64)v42->getPosition_0(v42);
v48->setPosition_0(v47, (const cocos2d::CCPoint *)v49);
v47->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(v47);
v47->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v47);
v47->m_textField->setVisible(v47->m_textField, 0);
v47->m_maxLabelLength = 4;
v69 = 0;
v70 = 11;
v71 = 15;
strcpy(Src, "0123456789.");
v75[1] = (cocos2d::CCSize)Src;
if ( &v47->m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)&v47->m_allowedChars, Src, 0xBu);
sub_14003A830((__int64)Src);
*(_WORD *)&v47->m_placeholderColor.r = -21896;
v47->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v47);
v47->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v47);
v47->m_numberInput = 1;
v47->m_delegate = &a1->TextInputDelegate;
v51 = Slider::create(
a1,
(cocos2d::SEL_MenuHandler *)SetupShakePopup::sliderChanged,
v50,
"slidergroove.png",
"sliderthumb.png",
"sliderthumbsel.png",
0.80000001);
v51->m_sliderBar->setVisible(v51->m_sliderBar, 0);
v52 = ((float (__fastcall *)(cocos2d::CCLayer *, Slider *))a1->m_mainLayer->addChild_1)(a1->m_mainLayer, v51);
cocos2d::CCPoint::CCPoint(v52, 0.0);
cocos2d::CCPoint::operator+(&v65, &v66);
v51->setPosition_0(v51, (const cocos2d::CCPoint *)&v66);
if ( i )
{
if ( i == 1 )
{
a1->m_intervalInput = v47;
v47->setTag(v47, 8);
a1->m_intervalSlider = v51;
v51->m_touchLogic->m_thumb->setTag(v51->m_touchLogic->m_thumb, 7);
v54 = fminf(1.0, m_interval / 0.1);
if ( v54 < 0.0 )
v54 = 0.0;
SliderThumb::setValue(v51->m_touchLogic->m_thumb, v54);
Value = SliderThumb::getValue(v51->m_touchLogic->m_thumb);
m_width = v51->m_width;
if ( (float)(Value * m_width) <= m_width )
m_width = Value * m_width;
v57 = (cocos2d::CCRect *)&v81;
}
else
{
a1->m_durationInput = v47;
v47->setTag(v47, 5);
a1->m_durationSlider = v51;
v51->m_touchLogic->m_thumb->setTag(v51->m_touchLogic->m_thumb, 3);
v58 = fminf(1.0, m_interval * 0.5);
if ( v58 < 0.0 )
v58 = 0.0;
SliderThumb::setValue(v51->m_touchLogic->m_thumb, v58);
v59 = SliderThumb::getValue(v51->m_touchLogic->m_thumb);
m_width = v51->m_width;
if ( (float)(v59 * m_width) <= m_width )
m_width = m_width * v59;
v57 = (cocos2d::CCRect *)&v76;
}
v60 = v51->m_sliderBar->__vftable;
cocos2d::CCRect::CCRect(v57, 0.0, 0.0, m_width, v51->m_height);
v60->setTextureRect_0(v51->m_sliderBar, v61);
}
else
{
a1->m_strengthInput = v47;
v47->setTag(v47, 6);
a1->m_strengthSlider = v51;
v51->m_touchLogic->m_thumb->setTag(v51->m_touchLogic->m_thumb, 4);
v53 = fminf(1.0, m_interval / 5.0);
if ( v53 < 0.0 )
v53 = 0.0;
Slider::setValue(v51, v53);
}
if ( v84 > 0xF )
{
v62 = v82[0];
if ( v84 + 1 >= 0x1000 )
{
v62 = *((void **)v82[0] - 1);
if ( (unsigned __int64)((char *)v82[0] - (char *)v62 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v62);
}
}
SetupShakePopup::updateShakeLabel(a1, 0);
GJFollowCommandLayer::updateDurLabel((__int64)a1, 0);
SetupShakePopup::updateIntervalLabel(a1, 0);
a1->m_disableTextDelegate = 0;
return 1;
}
return result;
}