//
// EditorUI::onPlaytest from 0x1003c7880 to 0x1003c7a18 (408 bytes)
//
// 3 xrefs:
// > EditorUI::onPlaytest @ 0x1003c79e8
// > EditorUI::keyDown @ 0x1003fa184
// > EditorUI::init @ 0x1003c5a48
//
// 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 EditorUI::onPlaytest(EditorUI *a1, cocos2d::CCObject *a2)
{
LevelEditorLayer *m_editorLayer; // x0
PlaybackMode m_playbackMode; // w23
PlaybackMode v6; // w8
LevelEditorLayer *v7; // x0
PlaybackMode v8; // w8
GameManager *v9; // x0
_BOOL4 GameVariable; // w21
__int64 v11; // x22
PlaybackMode v12; // w24
cocos2d::CCSpriteFrameCache *v13; // x0
const char *v14; // x1
cocos2d::CCSpriteFrame *v15; // x0
if ( a1->m_isPaused )
return;
m_editorLayer = a1->m_editorLayer;
m_playbackMode = m_editorLayer->m_playbackMode;
if ( m_playbackMode == Playing )
{
a1->m_isPlayingMusic = 0;
}
else
{
GJBaseGameLayer::pauseAudio(m_editorLayer);
v6 = a1->m_editorLayer->m_playbackMode;
a1->m_isPlayingMusic = 0;
if ( v6 != Playing )
EditorUI::toggleMode(a1, a1->m_editModeBtn);
}
EditorUI::deselectAll(a1);
v7 = a1->m_editorLayer;
v8 = v7->m_playbackMode;
if ( v8 )
{
if ( v8 == Paused )
{
LevelEditorLayer::onResumePlaytest(v7);
}
else if ( v8 == Playing )
{
LevelEditorLayer::onPausePlaytest(v7);
}
goto LABEL_13;
}
a1->m_editorZoom = ((float (__fastcall *)(cocos2d::CCLayer *))v7->m_objectLayer->getScale)(v7->m_objectLayer);
LevelEditorLayer::onPlaytest(a1->m_editorLayer);
if ( !a1->m_editorLayer->m_startPosObject )
{
LABEL_13:
GameVariable = 0;
goto LABEL_14;
}
v9 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v9, "0150");
LABEL_14:
EditorUI::showUI(a1, a1->m_editorLayer->m_playbackMode != Playing);
v11 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_playtestBtn->getNormalImage)(a1->m_playtestBtn);
v12 = a1->m_editorLayer->m_playbackMode;
v13 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
if ( v12 == Playing )
v14 = "GJ_pauseEditorBtn_001.png";
else
v14 = "GJ_playEditorBtn_001.png";
v15 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v13, v14);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v11 + 1144LL))(v11, v15);
((void (__fastcall *)(CCMenuItemSpriteExtra *, __int64))a1->m_playtestStopBtn->setVisible)(a1->m_playtestStopBtn, 1);
EditorUI::updatePlaybackBtn(a1);
if ( GameVariable )
EditorUI::onPlaytest(a1, a2);
if ( m_playbackMode != Playing )
a1->m_editorLayer->m_audioPaused = 1;
}