//
// PauseLayer::onSideButtonPressed from 0x1404d9520 to 0x1404d9bbc (1692 bytes)
//
// 4 xrefs:
// > PauseLayer::customSetup @ 0x1404d7cdb
// > PauseLayer::customSetup @ 0x1404d7b25
// > ??> @ 0x14092993c
// > ??> @ 0x140929948
//
// 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:33:04 +0000
//
// Hidden C++ exception states: #wind=16
__int64 __fastcall PauseLayer::onSideButtonPressed(__int64 a1, __int64 a2)
{
__int64 v4; // kr00_8
__int64 v5; // rcx
__int64 v6; // rcx
unsigned __int64 *v7; // rax
__int64 result; // rax
__int64 v9; // rax
_QWORD *v10; // rax
__int64 v11; // rcx
char *v12; // rax
__int64 v13; // rcx
__int64 v14; // rcx
_QWORD *v15; // rax
__int64 v16; // rcx
__int64 v17; // rdi
_QWORD *v18; // rbx
__int64 v19; // r8
int v20; // r9d
__int64 v21; // rcx
__int64 v22; // rcx
void *v23; // rax
cocos2d::CCObject *v24; // rax
char v25; // bp
__int64 v26; // rcx
__int64 v27; // rcx
__int64 v28; // rdx
__int64 v29; // rcx
__int64 *v30; // rsi
__int64 v31; // rdi
const char *v32; // rbx
cocos2d::CCSpriteFrameCache *v33; // rax
struct cocos2d::CCSpriteFrame *v34; // rax
__int64 v35; // rcx
__int64 (__fastcall *v36)(__int64); // rdi
__int64 v37; // rbx
__int64 v38; // rax
__int64 v39; // rcx
__int64 v40; // rax
__int64 v41; // rdi
__int64 v42; // rbx
__int64 v43; // rax
__int64 v44; // rdx
void *v45; // [rsp+48h] [rbp+10h] BYREF
char v46; // [rsp+50h] [rbp+18h] BYREF
void *v47; // [rsp+58h] [rbp+20h] BYREF
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
v5 = 0x140000000uLL;
switch ( v4 )
{
case 0LL:
v6 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v6 = qword_14090BFD0;
}
v7 = GameSettingsLayer::create(*(_QWORD *)(v6 + 560), 0);
result = (*(__int64 (__fastcall **)(unsigned __int64 *))(*v7 + 1064))(v7);
break;
case 1LL:
result = PauseLayer::onToggleUI(a1, 0);
break;
case 2LL:
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
v13 = *(_QWORD *)(result + 560);
if ( v13 )
{
v14 = *(_QWORD *)(v13 + 2168);
if ( v14 )
{
v15 = DeathTrackerPopup::create(v14);
result = (*(__int64 (__fastcall **)(_QWORD *))(*v15 + 1064LL))(v15);
}
}
break;
case 3LL:
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
v16 = *(_QWORD *)(result + 560);
if ( v16 )
{
v17 = *(_QWORD *)(v16 + 2168);
if ( v17 )
{
v18 = operator new(0x418u);
v45 = v18;
SetupTriggerPopup::SetupTriggerPopup((__int64)v18);
*v18 = &DeathMarkerSettingsPopup::`vftable';
v18[40] = &DeathMarkerSettingsPopup::`vftable';
v18[41] = &DeathMarkerSettingsPopup::`vftable';
v18[42] = &DeathMarkerSettingsPopup::`vftable';
v18[43] = &DeathMarkerSettingsPopup::`vftable';
v18[44] = &DeathMarkerSettingsPopup::`vftable';
v18[51] = &DeathMarkerSettingsPopup::`vftable';
v18[54] = &DeathMarkerSettingsPopup::`vftable';
v18[68] = &DeathMarkerSettingsPopup::`vftable';
v18[83] = &DeathMarkerSettingsPopup::`vftable';
v18[84] = &DeathMarkerSettingsPopup::`vftable';
v18[125] = &DeathMarkerSettingsPopup::`vftable';
v18[126] = 0;
v18[127] = 0;
v18[128] = 0;
v18[129] = 0;
v18[130] = 0;
if ( DeathMarkerSettingsPopup::init((__int64)v18, v17, v19, v20) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v18);
result = (*(__int64 (__fastcall **)(_QWORD *))(*v18 + 1064LL))(v18);
}
else
{
(*(void (__fastcall **)(_QWORD *, __int64))(*v18 + 8LL))(v18, 1);
result = (*(__int64 (__fastcall **)(_QWORD))(MEMORY[0] + 1064LL))(0);
}
}
}
break;
case 4LL:
v11 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v11 = qword_14090BFD0;
}
v12 = InfoLayer::create(*(_QWORD *)(*(_QWORD *)(v11 + 560) + 2168LL), 0, 0, 0);
result = (*(__int64 (__fastcall **)(char *))(*(_QWORD *)v12 + 1064LL))(v12);
break;
case 5LL:
v9 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 952LL))(a2);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v9 + 560LL))(v9, 99);
v10 = ChallengesPage::create();
result = (*(__int64 (__fastcall **)(_QWORD *))(*v10 + 1064LL))(v10);
break;
case 6LL:
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
}
v25 = GameManager::toggleGameVariable(v5, "0173");
v26 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v26 = qword_14090BFD0;
}
v27 = *(_QWORD *)(v26 + 560);
if ( v27 )
{
*(_BYTE *)(v27 + 2210) = v25;
if ( v25 )
*(_BYTE *)(v27 + 14841) = v25;
*(_BYTE *)(*(_QWORD *)(v27 + 3512) + 2029LL) = v25;
*(_BYTE *)(*(_QWORD *)(v27 + 3520) + 2029LL) = v25;
PlayLayer::updateTestModeLabel();
}
v30 = (__int64 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 952LL))(a2);
v31 = *v30;
v32 = "sideBtn_damageOn_001.png";
if ( v25 )
v32 = "sideBtn_damageOff_001.png";
v33 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v29, v28);
v34 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v33, v32);
result = (*(__int64 (__fastcall **)(__int64 *, struct cocos2d::CCSpriteFrame *))(v31 + 1008))(v30, v34);
break;
case 7LL:
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
v21 = *(_QWORD *)(result + 560);
if ( v21 )
{
v22 = *(_QWORD *)(v21 + 2168);
if ( v22 )
{
v23 = PlatformerControlsPopup::create(v22, 0);
result = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v23 + 1064LL))(v23);
}
}
break;
case 8LL:
v35 = *(_QWORD *)(a1 + 624);
if ( v35 )
{
LOBYTE(v44) = (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v35 + 344LL))(v35) == 0;
result = (*(__int64 (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(a1 + 624) + 336LL))(
*(_QWORD *)(a1 + 624),
v44);
}
else
{
v36 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 504LL);
v37 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 200LL))(a2);
v38 = v36(a2);
cocos2d::CCNode::convertToWorldSpace(v38, &v46, v37);
cocos2d::CCNode::convertToNodeSpace(a1, &v45, &v46);
v39 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v47 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v47);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v39 = qword_14090BFD0;
}
v40 = TimeSpeedControl::create(*(_QWORD *)(v39 + 560));
*(_QWORD *)(a1 + 624) = v40;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**(_QWORD **)(a1 + 632) + 456LL))(
*(_QWORD *)(a1 + 632),
v40,
4);
v41 = **(_QWORD **)(a1 + 624);
v42 = *(_QWORD *)(a1 + 624);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v47, *(float *)&v45, *((float *)&v45 + 1) - 80.0);
result = (*(__int64 (__fastcall **)(__int64, __int64))(v41 + 184))(v42, v43);
}
break;
case 9LL:
v24 = UIPOptionsLayer::create();
result = (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v24 + 1064LL))(v24);
break;
default:
result = v4;
break;
}
return result;
}