//
// VideoOptionsLayer::onApply from 0x100881460 to 0x10088169e (574 bytes)
//
// 1 xrefs:
// > VideoOptionsLayer::init @ 0x100880cc7
//
// 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 12:36:57 +0000
//
__int64 __fastcall VideoOptionsLayer::onApply(__int64 a1)
{
__int64 v1; // rax
int v2; // r14d
__int64 v3; // rax
__int64 v4; // rax
char GameVariable; // al
char v6; // cl
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rbx
__int64 v11; // r14
_BYTE *v12; // rax
__int64 v13; // rax
__int64 v14; // rax
int v15; // r14d
__int64 v16; // rax
int v17; // ebx
__int64 v18; // rdi
__int128 v19; // [rsp+0h] [rbp-30h] BYREF
void *__p; // [rsp+10h] [rbp-20h]
float v21[6]; // [rsp+18h] [rbp-18h] BYREF
v1 = cocos2d::CCArray::stringAtIndex(*(_QWORD *)(a1 + 712), *(_DWORD *)(a1 + 756));
v2 = cocos2d::CCString::intValue(v1);
v3 = GameManager::sharedState();
GameManager::resolutionForKey(v21, v3, v2);
v4 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v4, "0025");
v6 = *(_BYTE *)(a1 + 752);
if ( v6 != GameVariable
&& (!v6
|| (v7 = GameManager::sharedState(),
*(_BYTE *)(a1 + 753) == (unsigned __int8)GameManager::getGameVariable(v7, "0170"))
&& (v8 = GameManager::sharedState(),
*(_BYTE *)(a1 + 754) == (unsigned __int8)GameManager::getGameVariable(v8, "0175")))
&& *(_DWORD *)(GameManager::sharedState() + 1056) == v2
&& *(_DWORD *)(GameManager::sharedState() + 1060) == *(_DWORD *)(a1 + 704) )
{
__p = operator new(0x20u);
*(_QWORD *)&v19 = 33;
*((_QWORD *)&v19 + 1) = 26;
strcpy((char *)__p, "No changes have been made.");
v9 = sub_100493AB0(0, (__int64)"Graphics", &v19, (__int64)"OK", 0);
if ( (v19 & 1) != 0 )
operator delete(__p);
return (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 1312LL))(v9);
}
else
{
GameManager::sharedState();
*(_DWORD *)(GameManager::sharedState() + 1056) = v2;
*(_DWORD *)(GameManager::sharedState() + 1060) = *(_DWORD *)(a1 + 704);
v11 = cocos2d::CCDirector::sharedDirector();
v12 = cocos2d::CCScene::create();
cocos2d::CCDirector::replaceScene(v11, v12);
PlatformToolbox::resizeWindow((__m128)LODWORD(v21[0]), v21[1]);
v13 = GameManager::sharedState();
if ( *(_BYTE *)(a1 + 752) == (unsigned __int8)GameManager::getGameVariable(v13, "0025") )
{
v14 = GameManager::sharedState();
GameManager::setGameVariable(v14, (std::string::value_type *)"0025");
PlatformToolbox::toggleFullScreen(*(unsigned __int8 *)(a1 + 752));
}
v15 = *(_DWORD *)(cocos2d::CCDirector::sharedDirector() + 400);
v16 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::updateContentScale(v16, *(_DWORD *)(a1 + 704));
v17 = *(_DWORD *)(cocos2d::CCDirector::sharedDirector() + 400);
v18 = GameManager::sharedState();
if ( v15 == v17 )
return sub_100376D40(v18, 1);
else
return GameManager::reloadAll(v18, 0, 0, 0, 0);
}
}