//
// AppDelegate::setupGLView from 0x1400825d0 to 0x140082a38 (1128 bytes)
//
// 2 xrefs:
// > ??> @ 0x14053c598
// > ??> @ 0x1406c6a44
//
// 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=12
void AppDelegate::setupGLView(AppDelegate *a1)
{
__int64 v2; // rax
__int64 v3; // rax
GameManager *v4; // rcx
GameManager *v5; // rcx
GameManager *v6; // rdi
GameManager *v7; // rbx
bool GameVariable; // bl
bool v9; // al
__int64 v10; // rcx
__int64 v11; // rbx
void *v12; // rcx
__int64 v13; // rax
cocos2d::CCDirector *v14; // rax
__int64 v15; // rdi
struct cocos2d::CCSize v16; // rax
struct cocos2d::CCSize v17; // rbx
__int64 v18; // rcx
cocos2d::CCDirector *v19; // rax
cocos2d::CCSize v20; // [rsp+30h] [rbp-29h] BYREF
float v21[2]; // [rsp+38h] [rbp-21h] BYREF
cocos2d::CCSize v22; // [rsp+40h] [rbp-19h] BYREF
void *v23; // [rsp+48h] [rbp-11h]
cocos2d::CCSize v24; // [rsp+50h] [rbp-9h] BYREF
cocos2d::CCRect v25; // [rsp+58h] [rbp-1h] BYREF
void *Block[2]; // [rsp+68h] [rbp+Fh] BYREF
__int64 v27; // [rsp+78h] [rbp+1Fh]
unsigned __int64 v28; // [rsp+80h] [rbp+27h]
char v29[14]; // [rsp+88h] [rbp+2Fh] BYREF
__int16 v30; // [rsp+96h] [rbp+3Dh]
__int64 v31; // [rsp+98h] [rbp+3Fh]
__int64 v32; // [rsp+A0h] [rbp+47h]
if ( !LOBYTE(a1[1].m_saveTime) )
{
cocos2d::CCSize::CCSize(&v22, 480.0, 320.0);
LOBYTE(a1[1].m_saveTime) = 1;
v2 = cocos2d::CCFileUtils::sharedFileUtils();
(*(void (__fastcall **)(__int64, const char *))(*(_QWORD *)v2 + 112LL))(v2, "Resources");
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
LocalLevelManager::sharedState();
v3 = sub_140077D60();
v4 = (GameManager *)qword_1406C2ED8;
if ( *(_BYTE *)(v3 + 320) )
{
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
GameManager::setGameVariable(v4, "0025", 1);
v4 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
if ( v4->m_resolution <= 0 )
v4->m_resolution = 1;
}
if ( !v4 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v4 = (GameManager *)qword_1406C2ED8;
}
if ( GameManager::getGameVariable(v4, "0025") )
{
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
}
}
GameManager::resolutionForKey(v5, (int)v21);
v31 = 13;
v32 = 15;
strcpy(v29, "Geometry Dash");
v30 = 0;
v13 = cocos2d::CCRect::CCRect(&v25, 0.0, 0.0, v21[0], v21[1]);
v11 = cocos2d::CCEGLView::createWithRect(v29, v13);
sub_14003A830((__int64)v29);
}
else
{
v27 = 13;
v28 = 15;
strcpy((char *)Block, "Geometry Dash");
HIWORD(Block[1]) = 0;
v6 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
v7 = v6;
if ( !v6 )
{
v20 = (cocos2d::CCSize)operator new(0x668u);
qword_1406C2ED8 = ((__int64 (__fastcall *)(_QWORD))sub_14017AB00)(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v6 = (GameManager *)qword_1406C2ED8;
}
GameVariable = GameManager::getGameVariable(v7, "0175");
v9 = GameManager::getGameVariable(v6, "0170");
v11 = cocos2d::CCEGLView::createWithFullScreen(Block, v9, GameVariable);
if ( v28 > 0xF )
{
v12 = Block[0];
if ( v28 + 1 >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
v27 = 0;
v28 = 15;
LOBYTE(Block[0]) = 0;
}
v14 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v10);
cocos2d::CCDirector::setOpenGLView(v14, (struct cocos2d::CCEGLView *)v11);
v15 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v23 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v15 = qword_1406C2ED8;
}
cocos2d::CCSize::CCSize(&v20, (const struct cocos2d::CCSize *)(v11 + 216));
cocos2d::CCSize::CCSize(&v24, &v22);
v17 = v16;
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v18);
cocos2d::CCDirector::setupScreenScale(
v19,
v17,
(struct cocos2d::CCSize)&v20,
*(enum cocos2d::TextureQuality *)(v15 + 1032));
}
}