//
// LevelSettingsLayer::selectSettingClosed from 0xa3973c to 0xa3992c (496 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'LevelSettingsLayer::selectSettingClosed @ 0xa39930
// > ??> @ 0xba630
// > ??> @ 0x11db6b8
//
// 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 LevelSettingsLayer::selectSettingClosed(LevelSettingsLayer *a1, SelectSettingLayer *a2)
{
SelectSettingType m_type; // w21
int SelectedValue; // w23
cocos2d::CCSprite *m_speedSprite; // x21
void (__fastcall *v7)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v8; // x25
cocos2d::CCSpriteFrame *v9; // x0
char *v10; // x0
cocos2d::CCSprite *m_modeSprite; // x21
void (__fastcall *setDisplayFrame)(cocos2d::CCSprite *__hidden, cocos2d::CCSpriteFrame *); // x24
cocos2d::CCSpriteFrameCache *v13; // x25
cocos2d::CCSpriteFrame *v14; // x0
char *v15; // x0
unsigned int *v16; // x2
int v17; // w1
unsigned int *v18; // x2
int v19; // w1
char *v20; // [xsp+60h] [xbp+60h] BYREF
m_type = a2->m_type;
SelectedValue = SelectSettingLayer::getSelectedValue(a2);
if ( (unsigned int)m_type <= StartingModePlatformer )
{
m_modeSprite = a1->m_modeSprite;
setDisplayFrame = m_modeSprite->setDisplayFrame;
v13 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
SelectSettingLayer::getSelectedFrame(a2, (__int64)&v20);
v14 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v13, v20);
setDisplayFrame(m_modeSprite, v14);
v15 = v20 - 24;
if ( v20 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v20 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v20 - 2);
*((_DWORD *)v20 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v15);
}
a1->m_settingsObject->m_startMode = SelectedValue;
}
else if ( m_type == StartingSpeed )
{
m_speedSprite = a1->m_speedSprite;
v7 = m_speedSprite->setDisplayFrame;
v8 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
SelectSettingLayer::getSelectedFrame(a2, (__int64)&v20);
v9 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v8, v20);
v7(m_speedSprite, v9);
v10 = v20 - 24;
if ( v20 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v20 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *((_DWORD *)v20 - 2);
*((_DWORD *)v20 - 2) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v10);
}
a1->m_settingsObject->m_startSpeed = SelectedValue;
}
}