//
// StartPosLayer::init from 0x14045de00 to 0x14045ec29 (3625 bytes)
//
// 3 xrefs:
// > EditorUI::editObject @ 0x1401bb904
// > ??> @ 0x140927da0
// > ??> @ 0x140927dac
//
// 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:32:32 +0000
//
// Hidden C++ exception states: #wind=5
char __fastcall StartPosLayer::init(__int64 a1, cocos2d::CCObject *a2)
{
int v3; // r9d
__int64 v4; // rcx
__int64 v5; // rax
__int64 v6; // rcx
__int64 v7; // rax
_BYTE *v8; // r8
_OWORD *v9; // rcx
const char *v10; // rax
__int64 v11; // rdx
char *v12; // rsi
__int64 v13; // rdi
__int64 v14; // rbx
__int64 v15; // rax
__int64 v16; // rax
cocos2d::CCObject *v17; // rbx
cocos2d::CCObject *v18; // rsi
__int64 v19; // rdi
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
float v23; // xmm1_4
float v24; // xmm10_4
float v25; // xmm13_4
float v26; // xmm12_4
float v27; // xmm7_4
int v28; // eax
float v29; // xmm8_4
int v30; // eax
float v31; // xmm9_4
int v32; // eax
float v33; // xmm6_4
int v34; // eax
float v35; // xmm12_4
int v36; // eax
int v37; // eax
int v38; // eax
int v39; // eax
int v40; // eax
int v41; // eax
__int64 v42; // rax
__int64 v43; // rax
void *v44; // rcx
__int64 v45; // rax
void *v46; // rcx
__int64 v47; // rax
__int64 v48; // rax
__int64 v49; // rax
__int64 v50; // rax
void **v52; // [rsp+68h] [rbp-A0h] BYREF
void **v53; // [rsp+70h] [rbp-98h] BYREF
__int128 v54; // [rsp+78h] [rbp-90h] BYREF
__int64 v55; // [rsp+88h] [rbp-80h]
__int64 v56; // [rsp+90h] [rbp-78h]
float v57; // [rsp+98h] [rbp-70h] BYREF
float v58; // [rsp+9Ch] [rbp-6Ch]
_BYTE v59[8]; // [rsp+A0h] [rbp-68h] BYREF
void *Block[2]; // [rsp+A8h] [rbp-60h] BYREF
__int64 v61; // [rsp+B8h] [rbp-50h]
unsigned __int64 v62; // [rsp+C0h] [rbp-48h]
int v63; // [rsp+C8h] [rbp-40h] BYREF
void *v64[4]; // [rsp+D0h] [rbp-38h] BYREF
_BYTE v65[8]; // [rsp+F0h] [rbp-18h] BYREF
int v66; // [rsp+F8h] [rbp-10h]
char v67; // [rsp+FCh] [rbp-Ch]
int v68; // [rsp+100h] [rbp-8h]
int v69; // [rsp+104h] [rbp-4h]
char v70; // [rsp+108h] [rbp+0h]
char v71; // [rsp+125h] [rbp+1Dh]
int v72; // [rsp+128h] [rbp+20h]
_BYTE v73[32]; // [rsp+130h] [rbp+28h] BYREF
int v74; // [rsp+150h] [rbp+48h]
void *v75[4]; // [rsp+158h] [rbp+50h] BYREF
if ( !a2 )
return 0;
*(_QWORD *)(a1 + 1000) = a2;
cocos2d::CCObject::retain(a2);
if ( !(unsigned __int8)SetupTriggerPopup::init(a1, 0, 0, v3, 1133248512, 1, 0) )
return 0;
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
*(_BYTE *)(a1 + 596) = 1;
v5 = cocos2d::CCDirector::sharedDirector(v4);
cocos2d::CCDirector::getWinSize(v5, &v57);
v7 = cocos2d::CCMenu::create(v6);
*(_QWORD *)(a1 + 552) = v7;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 584) + 456LL))(*(_QWORD *)(a1 + 584), v7, 10);
v52 = Block;
*(_OWORD *)Block = 0;
v61 = 0;
v62 = 0;
v8 = sub_14003D460(0x220u);
Block[0] = v8;
v61 = 536;
v62 = 543;
v9 = v8;
v10 = "Y Velocity: Adds speed up or down.\n"
"Spawn Group ID: Spawns a specific Group ID.\n"
"P2 Group ID: If not '0', spawns player 2 at this Group ID.\n"
"SP Name: Gives the start position a name in menus.\n"
"Free: Removes borders for certain game modes.\n"
"Reset: Resets the camera.\n"
"Inactive: Disables the start position for immediate spawning. Can still switch to it using start positio"
"n switcher.\n"
"Online: Shows the start position in the Practice mode switcher when the level is played online.";
v11 = 4;
do
{
*v9 = *(_OWORD *)v10;
v9[1] = *((_OWORD *)v10 + 1);
v9[2] = *((_OWORD *)v10 + 2);
v9[3] = *((_OWORD *)v10 + 3);
v9[4] = *((_OWORD *)v10 + 4);
v9[5] = *((_OWORD *)v10 + 5);
v9[6] = *((_OWORD *)v10 + 6);
v9 += 8;
*(v9 - 1) = *((_OWORD *)v10 + 7);
v10 += 128;
--v11;
}
while ( v11 );
*v9 = *(_OWORD *)v10;
*((_QWORD *)v9 + 2) = *((_QWORD *)v10 + 2);
v8[536] = 0;
*((_QWORD *)&v54 + 1) = 115;
v55 = 9;
v56 = 15;
*(_QWORD *)&v54 = 0x6F50207472617453LL;
v12 = InfoAlertButton::create((__int64)&v54, (__int64)Block);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v12);
v13 = *(_QWORD *)v12;
v14 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v52,
(float)((float)(v57 * 0.5) + (float)(*(float *)(a1 + 732) * 0.5)) - 2.0,
(float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v58 * 0.5)) - 2.0);
cocos2d::CCNode::convertToNodeSpace(v14, &v53, v15);
(*(void (__fastcall **)(char *, __int64))(v13 + 184))(v12, v16);
v53 = (void **)operator new(0x2C8u);
v17 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v53);
if ( v17 )
{
if ( ButtonSprite::init_1(
(__int64)v17,
(__int64)"OK",
40,
0,
1061997773,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1106247680) )
{
cocos2d::CCObject::autorelease(v17);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v17 + 8LL))(v17, 1);
LODWORD(v17) = 0;
}
}
v18 = CCMenuItemSpriteExtra::create((int)v17, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v18);
v19 = *(_QWORD *)v18;
v20 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v53,
v57 * 0.5,
(float)((float)(v58 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 25.0);
cocos2d::CCNode::convertToNodeSpace(v20, &v52, v21);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v19 + 184))(v18, v22);
StartPosLayer::addModeButtons(a1);
StartPosLayer::addSpeedButtons(a1);
v23 = *(float *)(a1 + 732) * 0.5;
v24 = (float)((float)(v57 * 0.5) - v23) + 35.0;
v25 = (float)((float)(v57 * 0.5) + v23) - 35.0;
v26 = (float)((float)(*(float *)(a1 + 736) * 0.5) + (float)(v58 * 0.5)) - 40.0;
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Flip");
v27 = v26 - 0.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v24, v26 - 0.0);
SetupTriggerPopup::createToggleValueControl(a1, -1, (unsigned int)&v54, v28, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Mini");
v29 = v26 - 50.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v24, v26 - 50.0);
SetupTriggerPopup::createToggleValueControl(a1, -2, (unsigned int)&v54, v30, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Dual");
v31 = v26 - 100.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v24, v26 - 100.0);
SetupTriggerPopup::createToggleValueControl(a1, -3, (unsigned int)&v54, v32, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 6;
v56 = 15;
strcpy((char *)&v54, "Mirror");
v33 = v26 - 150.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v24, v26 - 150.0);
SetupTriggerPopup::createToggleValueControl(a1, -4, (unsigned int)&v54, v34, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 4;
v56 = 15;
strcpy((char *)&v54, "Free");
v35 = v26 - 200.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v24, v35);
SetupTriggerPopup::createToggleValueControl(a1, -5, (unsigned int)&v54, v36, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 6;
v56 = 15;
strcpy((char *)&v54, "Rotate");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v25, v27);
SetupTriggerPopup::createToggleValueControl(a1, -6, (unsigned int)&v54, v37, 1, 0, 0, 1065353216);
v53 = Block;
Block[1] = nullptr;
v61 = 7;
v62 = 15;
Block[0] = (void *)0x65737265766552LL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v25, v29);
SetupTriggerPopup::createToggleValueControl(a1, -7, (unsigned int)Block, v38, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 5;
v56 = 15;
LODWORD(v54) = *(_DWORD *)"Reset";
WORD2(v54) = (unsigned __int8)aReset[4];
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v25, v31);
SetupTriggerPopup::createToggleValueControl(a1, -8, (unsigned int)&v54, v39, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v55 = 8;
v56 = 15;
v54 = 0x6576697463616E49uLL;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v25, v33);
SetupTriggerPopup::createToggleValueControl(a1, -9, (unsigned int)&v54, v40, 1, 0, 0, 1065353216);
v53 = (void **)&v54;
v54 = 0;
v55 = 6;
v56 = 15;
strcpy((char *)&v54, "Online");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v52, v25, v35);
SetupTriggerPopup::createToggleValueControl(a1, -10, (unsigned int)&v54, v41, 1, 0, 0, 1065353216);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v59, v57 * 0.5, (float)(v58 * 0.5) - 15.0);
sub_14009BE60((__int64)&v63);
v63 = -13;
sub_1400405A0(v64, "Y Velocity:", 0xBu);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -70.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v52, v42);
cocos2d::CCPoint::operator=(v65, &v52);
v66 = 1058642330;
v67 = 1;
v70 = 0;
v71 = 1;
v74 = 1060320051;
v68 = 1;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v63);
v61 = 15;
v62 = 15;
strcpy((char *)Block, "Spawn Group ID:");
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, 70.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v52, v43);
IDNameInput::create(
a1,
a1 + 544,
1,
-14,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v52,
1058642330,
6,
0,
0,
0);
if ( v62 > 0xF )
{
v44 = Block[0];
if ( v62 + 1 >= 0x1000 )
{
v44 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v44 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v44);
}
v61 = 12;
v62 = 15;
strcpy((char *)Block, "P2 Group ID:");
BYTE5(Block[1]) = 0;
HIWORD(Block[1]) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -70.0, -55.0);
cocos2d::CCPoint::operator+(v59, &v52, v45);
IDNameInput::create(
a1,
a1 + 544,
1,
-15,
(__int64)Block,
(const struct cocos2d::CCPoint *)&v52,
1058642330,
6,
0,
0,
0);
if ( v62 > 0xF )
{
v46 = Block[0];
if ( v62 + 1 >= 0x1000 )
{
v46 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v46 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v46);
}
v63 = -16;
sub_1400405A0(v64, "SP Name:", 8u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, 70.0, -55.0);
cocos2d::CCPoint::operator+(v59, &v52, v47);
cocos2d::CCPoint::operator=(v65, &v52);
v68 = 4;
v69 = 20;
v72 = 1124859904;
sub_1400405A0(v75, "Name", 4u);
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v63);
cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 760), -16);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v53,
v57 * 0.5,
(float)((float)(v58 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 20.0);
cocos2d::CCPoint::operator=(v59, v48);
v72 = 1116471296;
v69 = 6;
v63 = -11;
sub_1400405A0(v64, "Order:", 6u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, -90.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v52, v49);
cocos2d::CCPoint::operator=(v65, &v52);
v70 = 1;
v68 = 3;
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v63);
v63 = -12;
sub_1400405A0(v64, "Channel:", 8u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, 90.0, 0.0);
cocos2d::CCPoint::operator+(v59, &v52, v50);
cocos2d::CCPoint::operator=(v65, &v52);
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v63);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
sub_14003D310((__int64)v75);
sub_14003D310((__int64)v73);
sub_14003D310((__int64)v64);
return 1;
}