//
// EditorUI::toggleSpecialEditButtons from 0x1401bb050 to 0x1401bb3e0 (912 bytes)
//
// 4 xrefs:
// > EditorUI::updateButtons @ 0x1401ad313
// > EditorUI::toggleEnableRotate @ 0x1401b37d4
// > EditorUI::activateTransformControl @ 0x14020331c
// > ??> @ 0x14091a468
//
// 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:59 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall EditorUI::toggleSpecialEditButtons(__int64 a1, char a2)
{
unsigned __int8 v4; // r14
unsigned int v5; // ebx
struct cocos2d::CCObject *v6; // rax
int v7; // ecx
__int64 v8; // rcx
int v9; // eax
int i; // ebp
__int64 v11; // rdx
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r8
__int64 v15; // rdi
void *v16; // r8
_QWORD *v17; // rbx
__int16 v18; // ax
char v19; // cl
__int64 v20; // rcx
__int64 v21; // rcx
__int64 v22; // rcx
__int64 v23; // rcx
__int64 v24; // rcx
__int16 v26; // [rsp+30h] [rbp-68h] BYREF
char v27; // [rsp+32h] [rbp-66h]
void *v28; // [rsp+40h] [rbp-58h]
void *Block[2]; // [rsp+48h] [rbp-50h] BYREF
__int64 v30; // [rsp+58h] [rbp-40h]
unsigned __int64 v31; // [rsp+60h] [rbp-38h]
v4 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
v4 = 1;
v5 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
while ( 1 )
{
v6 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 944), v5);
v7 = *((_DWORD *)v6 + 232);
if ( (!v7 || ((v7 - 21) & 0xFFFFFFFB) == 0) && !*((_BYTE *)v6 + 1222) )
break;
if ( ++v5 >= cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
goto LABEL_14;
}
v4 = 0;
}
}
else
{
v8 = *(_QWORD *)(a1 + 1568);
if ( v8 )
{
if ( (v9 = *(_DWORD *)(v8 + 928)) != 0 && ((v9 - 21) & 0xFFFFFFFB) != 0 || *(_BYTE *)(v8 + 1222) )
v4 = 1;
}
}
LABEL_14:
for ( i = 0; i < 4; ++i )
{
switch ( i )
{
case 1:
v11 = 44;
break;
case 2:
v11 = 41;
break;
case 3:
v11 = 42;
break;
default:
v11 = 43;
break;
}
v12 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v11);
CString = cocos2d::CCString::getCString(v12);
*(_OWORD *)Block = 0;
v30 = 0;
v31 = 0;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003D230(Block, CString, v14);
v15 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 864), Block);
if ( v31 > 0xF )
{
v16 = Block[0];
if ( v31 + 1 >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
v30 = 0;
v31 = 15;
LOBYTE(Block[0]) = 0;
if ( v15 )
{
v17 = (_QWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v15 + 952LL))(v15);
if ( v4 )
{
v18 = -1;
v19 = -1;
}
else
{
v18 = -22874;
v19 = -90;
}
v26 = v18;
v27 = v19;
v20 = v17[79];
if ( v20 )
(**(void (__fastcall ***)(__int64, __int16 *))(v20 + 368))(v20 + 368, &v26);
v21 = v17[80];
if ( v21 )
(**(void (__fastcall ***)(__int64, __int16 *))(v21 + 320))(v21 + 320, &v26);
v22 = v17[82];
if ( v22 || (v22 = v17[81]) != 0 )
(**(void (__fastcall ***)(__int64, __int16 *))(v22 + 320))(v22 + 320, &v26);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v15 + 936LL))(v15, v4);
}
}
if ( v4 )
{
v23 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v28 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v23 = qword_14090BFD0;
}
if ( (unsigned __int8)GameManager::getGameVariable(v23, "0007")
&& (a2 || !(*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 840) + 344LL))(*(_QWORD *)(a1 + 840))) )
{
EditorUI::activateRotationControl(a1, 0);
}
}
else
{
*(_DWORD *)(a1 + 744) = -1;
if ( (*(unsigned __int8 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 808) + 344LL))(*(_QWORD *)(a1 + 808)) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(a1 + 808) + 336LL))(*(_QWORD *)(a1 + 808), 0);
GJRotationControl::finishTouch(*(_QWORD *)(a1 + 808));
v24 = *(_QWORD *)(*(_QWORD *)(a1 + 808) + 464LL);
if ( v24 )
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v24 + 1032LL))(v24, 0);
}
}
return EditorUI::updateGridNodeSize_1(a1);
}