//
// EditorUI::onPlaytest from 0x10000c510 to 0x10000c722 (530 bytes)
//
// 3 xrefs:
// > EditorUI::onPlaytest @ 0x10000c6fa
// > EditorUI::keyDown @ 0x100050de2
// > EditorUI::init @ 0x10000a06d
//
// 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; // rdi
PlaybackMode m_playbackMode; // r13d
bool v5; // zf
int v6; // eax
unsigned int v7; // eax
const char *v8; // r15
__int64 v9; // rdi
__int64 v10; // r12
cocos2d::CCSpriteFrameCache *v11; // rax
cocos2d::CCSpriteFrame *v12; // rax
LevelEditorLayer *v13; // rdi
PlaybackMode v14; // eax
GameManager *v15; // rax
bool GameVariable; // r15
__int64 v17; // r12
PlaybackMode v18; // r14d
cocos2d::CCSpriteFrameCache *v19; // rax
const char *v20; // rsi
cocos2d::CCSpriteFrame *v21; // rax
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);
v5 = a1->m_editorLayer->m_playbackMode == Playing;
a1->m_isPlayingMusic = 0;
if ( !v5 )
{
v6 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_editModeBtn->getTag)(a1->m_editModeBtn);
if ( a1->m_selectedMode != v6 )
{
a1->m_selectedMode = v6;
EditorUI::resetUI(a1);
v7 = a1->m_selectedMode - 1;
if ( v7 <= 2 )
{
v8 = off_1008B1FA8[v7];
v9 = *((_QWORD *)&a1->m_deleteModeBtn + v7);
v10 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 1056LL))(v9);
v11 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v12 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v11, v8);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v10 + 1144LL))(v10, v12);
}
}
}
}
EditorUI::deselectAll(a1);
v13 = a1->m_editorLayer;
v14 = v13->m_playbackMode;
if ( v14 )
{
if ( v14 == Paused )
{
LevelEditorLayer::onResumePlaytest(v13);
}
else if ( v14 == Playing )
{
LevelEditorLayer::onPausePlaytest(v13);
}
goto LABEL_15;
}
a1->m_editorZoom = ((float (__fastcall *)(cocos2d::CCLayer *))v13->m_objectLayer->getScale)(v13->m_objectLayer);
LevelEditorLayer::onPlaytest(a1->m_editorLayer);
if ( !a1->m_editorLayer->m_startPosObject )
{
LABEL_15:
GameVariable = 0;
goto LABEL_16;
}
v15 = GameManager::sharedState();
GameVariable = GameManager::getGameVariable(v15, "0150");
LABEL_16:
EditorUI::showUI(a1, a1->m_editorLayer->m_playbackMode != Playing);
v17 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_playtestBtn->getNormalImage)(a1->m_playtestBtn);
v18 = a1->m_editorLayer->m_playbackMode;
v19 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache();
v20 = "GJ_playEditorBtn_001.png";
if ( v18 == Playing )
v20 = "GJ_pauseEditorBtn_001.png";
v21 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v19, v20);
(*(void (__fastcall **)(__int64, cocos2d::CCSpriteFrame *))(*(_QWORD *)v17 + 1144LL))(v17, v21);
((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;
}