//
// GraphicsReloadLayer::performReload from 0x14037c200 to 0x14037c76f (1391 bytes)
//
// 2 xrefs:
// > VideoOptionsLayer::onApply @ 0x1403788b1
// > ??> @ 0x1406d5d2c
//
// 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=13
void GraphicsReloadLayer::performReload(GraphicsReloadLayer *a1)
{
struct cocos2d::CCScene *v2; // rbx
__int64 v3; // rcx
cocos2d::CCDirector *v4; // rax
__int64 v5; // rax
__int64 v6; // rbx
__int64 v7; // rax
__int64 v8; // rcx
int v9; // esi
__int64 v10; // rcx
cocos2d::CCDirector *v11; // rax
__int64 v12; // rcx
int v13; // ebp
GameManager *v14; // rcx
char GameVariable; // al
char m_fullscreen; // cl
GameManager *v17; // rcx
GameManager *v18; // rcx
bool *p_m_fullscreen; // rbx
GameManager *v20; // rcx
GameManager *v21; // rcx
int height; // ebx
int width; // edi
cocos2d::CCEGLView *v24; // rax
cocos2d::CCEGLView *v25; // rax
GameManager *v26; // rcx
__int64 v27; // rdi
__int64 v28; // rbx
struct cocos2d::CCDelayTime *v29; // rax
struct cocos2d::CCSequence *v30; // rax
GameManager *v31; // rcx
GameManager *v32; // rcx
GameManager *v33; // rcx
GameManager *v34; // rcx
GameManager *v35; // rcx
__int64 v36; // rax
__int64 v37; // rbx
__int64 v38; // rcx
__int64 v39; // rax
__int64 v40; // rdx
bool v41; // [rsp+20h] [rbp-48h]
bool v42; // [rsp+28h] [rbp-40h]
_QWORD v43[7]; // [rsp+30h] [rbp-38h] BYREF
_QWORD *v44; // [rsp+70h] [rbp+8h] BYREF
v2 = (struct cocos2d::CCScene *)cocos2d::CCScene::create(a1);
v4 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v3);
cocos2d::CCDirector::replaceScene(v4, v2);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v44, a1->m_resolution.width, a1->m_resolution.height);
v6 = v5;
v7 = cocos2d::CCEGLView::sharedOpenGLView();
cocos2d::CCSize::operator=(v7 + 216, v6);
v9 = *(_DWORD *)(cocos2d::CCDirector::sharedDirector(v8) + 392);
v11 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::updateContentScale(v11, a1->m_quality);
v13 = *(_DWORD *)(cocos2d::CCDirector::sharedDirector(v12) + 392);
v14 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v14 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v14, "0025");
m_fullscreen = a1->m_fullscreen;
if ( GameVariable == m_fullscreen )
goto LABEL_25;
if ( !m_fullscreen )
goto LABEL_11;
v17 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v17 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v17, "0170") != a1->m_borderless )
goto LABEL_25;
v18 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v18 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v18, "0175") != a1->m_fix )
{
LABEL_25:
v31 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v31 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v31, "0025", !a1->m_fullscreen);
v32 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v32 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v32, "0170", a1->m_borderless);
v33 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v33 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v33, "0175", a1->m_fix);
v34 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v34 = (GameManager *)qword_1406C2ED8;
}
GameManager::reloadAll(v34, 1, a1->m_fullscreen, a1->m_borderless, a1->m_fix, v42);
}
else
{
LABEL_11:
p_m_fullscreen = &a1->m_fullscreen;
v20 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v20 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v20, "0170", a1->m_borderless);
v21 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
p_m_fullscreen = &a1->m_fullscreen;
v21 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v21, "0175", a1->m_fix);
if ( a1->m_changedResolution && !*p_m_fullscreen )
{
height = (int)a1->m_resolution.height;
width = (int)a1->m_resolution.width;
v24 = (cocos2d::CCEGLView *)cocos2d::CCEGLView::sharedOpenGLView();
cocos2d::CCEGLView::resizeWindow(v24, width, height);
v25 = (cocos2d::CCEGLView *)cocos2d::CCEGLView::sharedOpenGLView();
cocos2d::CCEGLView::centerWindow(v25);
}
if ( v9 == v13 )
{
v27 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v27 = qword_1406C2ED8;
}
v28 = cocos2d::CCCallFunc::create(v27, GameManager::reloadMenu);
v29 = cocos2d::CCDelayTime::create(0.1);
v30 = cocos2d::CCSequence::create(v29, v28, 0);
cocos2d::CCActionManager::addAction(*(GameManager **)(v27 + 264), v30, (struct cocos2d::CCNode *)v27, 0, v41);
}
else
{
v26 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v26 = (GameManager *)qword_1406C2ED8;
}
GameManager::reloadAll(v26, 0, 0, 0, 0, v42);
}
}
v35 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v44 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v35 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v35, "0115") )
{
v44 = v43;
v43[2] = 12;
v43[3] = 15;
v43[0] = *(_QWORD *)"chatFont.fnt";
v43[1] = *(unsigned int *)".fnt";
cocos2d::CCPoint::CCPoint(7.1434571e31, 0.0);
v37 = v36;
v39 = cocos2d::CCDirector::sharedDirector(v38);
LOBYTE(v40) = 1;
cocos2d::CCDirector::toggleShowFPS(v39, v40, v43, v37);
}
}