//
// VideoOptionsLayer::onApply from 0x1007a0370 to 0x1007a05a9 (569 bytes)
//
// 1 xrefs:
// > VideoOptionsLayer::init @ 0x10079fbd7
//
// 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
//
void __fastcall VideoOptionsLayer::onApply(VideoOptionsLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCString *v2; // rax
int v3; // r14d
int v4; // eax
GameManager *v5; // rax
char GameVariable; // al
char m_fullscreen; // cl
GameManager *v8; // rax
GameManager *v9; // rax
__int64 v10; // rbx
cocos2d::CCDirector *v11; // r14
cocos2d::CCScene *v12; // rax
GameManager *v13; // rax
GameManager *v14; // rax
cocos2d::TextureQuality m_eTextureQuality; // r14d
cocos2d::CCDirector *v16; // rax
cocos2d::TextureQuality v17; // ebx
GameManager *v18; // rdi
__int128 v19; // [rsp+0h] [rbp-30h] BYREF
void *__p; // [rsp+10h] [rbp-20h]
float v21[6]; // [rsp+18h] [rbp-18h] BYREF
v2 = cocos2d::CCArray::stringAtIndex(a1->m_availableResolutions, a1->m_currentResolution);
v3 = cocos2d::CCString::intValue(v2);
v4 = (unsigned int)GameManager::sharedState();
GameManager::resolutionForKey((GameManager *)v21, v4);
v5 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v5, "0025");
m_fullscreen = a1->m_fullscreen;
if ( m_fullscreen != GameVariable
&& (!m_fullscreen
|| (v8 = GameManager::sharedState(), a1->m_borderless == GameManager::getGameVariable(v8, "0170"))
&& (v9 = GameManager::sharedState(), a1->m_fix == GameManager::getGameVariable(v9, "0175")))
&& GameManager::sharedState()->m_resolution == v3
&& GameManager::sharedState()->m_texQuality == a1->m_textureQuality )
{
__p = operator new(0x20u);
*(_QWORD *)&v19 = 33;
*((_QWORD *)&v19 + 1) = 26;
strcpy((char *)__p, "No changes have been made.");
v10 = sub_10049B0F0(0, (__int64)"Graphics", &v19, (__int64)"OK", 0, 1.692007116111932e190);
if ( (v19 & 1) != 0 )
operator delete(__p);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v10 + 1288LL))(v10);
}
else
{
GameManager::sharedState();
GameManager::sharedState()->m_resolution = v3;
GameManager::sharedState()->m_texQuality = a1->m_textureQuality;
v11 = cocos2d::CCDirector::sharedDirector();
v12 = cocos2d::CCScene::create();
cocos2d::CCDirector::replaceScene(v11, v12);
PlatformToolbox::resizeWindow(v21[0], v21[1]);
v13 = GameManager::sharedState();
if ( a1->m_fullscreen == GameManager::getGameVariable(v13, "0025") )
{
v14 = GameManager::sharedState();
GameManager::setGameVariable(v14, "0025", !a1->m_fullscreen);
PlatformToolbox::toggleFullScreen(a1->m_fullscreen, a1->m_borderless, a1->m_fix);
}
m_eTextureQuality = cocos2d::CCDirector::sharedDirector()->m_eTextureQuality;
v16 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::updateContentScale(v16, (cocos2d::TextureQuality)a1->m_textureQuality);
v17 = cocos2d::CCDirector::sharedDirector()->m_eTextureQuality;
v18 = GameManager::sharedState();
if ( m_eTextureQuality == v17 )
GameManager::queueReloadMenu(v18);
else
GameManager::reloadAll(v18, 0, 0, 0, 0, 1);
}
}