//
// EditorUI::toggleEnableRotate from 0x1401b36a0 to 0x1401b37d9 (313 bytes)
//
// 4 xrefs:
// > EditorUI::init @ 0x1401ac32a
// > EditorUI::handleEditorAction @ 0x1401c2907
// > EditorUI::init @ 0x1401aa69f
// > ??> @ 0x14091a03c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:27:56 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall EditorUI::toggleEnableRotate(__int64 a1)
{
__int64 v2; // rcx
unsigned __int8 v3; // si
__int64 v4; // rcx
_QWORD *v5; // rbx
bool hasSoundsForAction; // al
__int64 v7; // rcx
__int64 v9; // rdx
void *v10; // [rsp+30h] [rbp+8h]
void *v11; // [rsp+30h] [rbp+8h]
v2 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v10 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090BFD0;
}
v3 = GameManager::getGameVariable(v2, "0007") ^ 1;
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v11 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
GameManager::setGameVariable(v4, "0007", v3);
v5 = (_QWORD *)EditorSFXManager::sharedState();
hasSoundsForAction = EditorSFXManager::hasSoundsForAction(v5, 193);
EditorSFXManager::playAction((__int64)v5, 4 * hasSoundsForAction + 189);
v7 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 1032) + 952LL))(*(_QWORD *)(a1 + 1032));
if ( v3 )
{
ButtonSprite::updateBGImage(v7, "GJ_button_02.png");
LOBYTE(v9) = 1;
return EditorUI::toggleSpecialEditButtons(a1, v9);
}
else
{
ButtonSprite::updateBGImage(v7, "GJ_button_01.png");
return EditorUI::deactivateRotationControl(a1);
}
}