//
// VideoOptionsLayer::onApply from 0x7c7c44 to 0x7c7ed8 (660 bytes)
//
// 3 xrefs:
// > ??> @ 0xbdf48
// > VideoOptionsLayer::init @ 0x7cd7a8
// > ??> @ 0x122e948
//
// 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 VideoOptionsLayer::onApply(VideoOptionsLayer *a1, cocos2d::CCObject *a2)
{
cocos2d::CCString *v3; // x0
int v4; // w22
GameManager *v5; // x0
GameManager *v6; // x0
cocos2d::CCDirector *v7; // x22
cocos2d::CCScene *v8; // x0
GameManager *v9; // x0
cocos2d::TextureQuality m_eTextureQuality; // w20
cocos2d::CCDirector *v11; // x0
GameManager *v12; // x0
GameManager *v13; // x0
GameManager *v14; // x0
GameManager *v15; // x0
FLAlertLayer *v16; // x19
void *v17; // x0
GameManager *v18; // x0
unsigned int *v19; // x2
int v20; // w1
float v21; // [xsp+48h] [xbp+48h]
float v22; // [xsp+4Ch] [xbp+4Ch]
__int64 v23; // [xsp+50h] [xbp+50h] BYREF
v3 = cocos2d::CCArray::stringAtIndex(a1->m_availableResolutions, a1->m_currentResolution);
v4 = cocos2d::CCString::intValue(v3);
v5 = GameManager::sharedState();
GameManager::resolutionForKey(v5, v4);
v6 = GameManager::sharedState();
if ( a1->m_fullscreen != GameManager::getGameVariable(v6, "0025")
&& (!a1->m_fullscreen
|| (v13 = GameManager::sharedState(), a1->m_borderless == GameManager::getGameVariable(v13, "0170"))
&& (v14 = GameManager::sharedState(), a1->m_fix == GameManager::getGameVariable(v14, "0175")))
&& v4 == GameManager::sharedState()->m_resolution
&& GameManager::sharedState()->m_texQuality == a1->m_textureQuality )
{
sub_D153B8((int)&v23, "No changes have been made.");
v16 = FLAlertLayer::create(0, (__int64)"Graphics", (__int64)&v23);
v17 = (void *)(v23 - 24);
if ( (__int64 *)(v23 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v19 = (unsigned int *)(v23 - 8);
do
v20 = __ldaxr(v19);
while ( __stlxr(v20 - 1, v19) );
}
else
{
v20 = *(_DWORD *)(v23 - 8);
*(_DWORD *)(v23 - 8) = v20 - 1;
}
if ( v20 <= 0 )
operator delete(v17);
}
v16->show(v16);
}
else
{
GameManager::sharedState();
GameManager::sharedState()->m_resolution = v4;
GameManager::sharedState()->m_texQuality = a1->m_textureQuality;
v7 = cocos2d::CCDirector::sharedDirector();
v8 = cocos2d::CCScene::create();
cocos2d::CCDirector::replaceScene(v7, v8);
PlatformToolbox::resizeWindow(v21, v22);
v9 = GameManager::sharedState();
if ( a1->m_fullscreen == GameManager::getGameVariable(v9, "0025") )
{
v18 = GameManager::sharedState();
GameManager::setGameVariable(v18, "0025", !a1->m_fullscreen);
PlatformToolbox::toggleFullScreen(a1->m_fullscreen, a1->m_borderless, a1->m_fix);
}
m_eTextureQuality = cocos2d::CCDirector::sharedDirector()->m_eTextureQuality;
v11 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::updateContentScale(v11, (cocos2d::TextureQuality)a1->m_textureQuality);
if ( m_eTextureQuality == cocos2d::CCDirector::sharedDirector()->m_eTextureQuality )
{
v15 = GameManager::sharedState();
GameManager::queueReloadMenu(v15);
}
else
{
v12 = GameManager::sharedState();
GameManager::reloadAll(v12, 0, 0, 0);
}
}
}