//
// GJRotationControl::init from 0x1401a2140 to 0x1401a25a9 (1129 bytes)
//
// 6 xrefs:
// > EditorUI::init @ 0x1401a9c3c
// > EditorUI::init @ 0x1401a9c2d
// > ??> @ 0x140750d58
// > ??> @ 0x1408a07bc
// > ??> @ 0x1408a07cc
// > ??> @ 0x1409198e0
//
// 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:48 +0000
//
bool __fastcall GJRotationControl::init(cocos2d::CCLayer *a1)
{
bool result; // al
__int64 v3; // rdx
__int64 v4; // rax
struct cocos2d::CCSprite *v5; // rax
__int64 v6; // rcx
int v7; // eax
cocos2d::CCObject *v8; // rax
struct cocos2d::CCMenu *v9; // rdi
__int64 v10; // rbx
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rcx
_BYTE *v14; // rdx
char *v15; // rax
char *v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rcx
__int64 v20; // rcx
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rcx
__int64 v24; // rax
_QWORD *v25; // rdi
__int64 v26; // rbx
__int64 v27; // rax
__int64 v28; // rdx
struct cocos2d::CCSprite *v29; // rax
cocos2d::CCObject *v30; // rax
cocos2d::CCObject *v31; // rdi
__int64 v32; // rbx
__int64 v33; // rax
__int64 v34; // rcx
__int64 v35; // rbx
__int64 v36; // rax
_BYTE *v37; // rdx
__int128 v38; // [rsp+30h] [rbp-28h] BYREF
__int64 v39; // [rsp+40h] [rbp-18h]
__int64 v40; // [rsp+48h] [rbp-10h]
__int64 v41; // [rsp+68h] [rbp+10h] BYREF
result = cocos2d::CCLayer::init(a1);
if ( result )
{
LOBYTE(v3) = 1;
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64))(*(_QWORD *)a1 + 920LL))(a1, v3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 60.0, 0.0);
cocos2d::CCPoint::operator=((char *)a1 + 416, v4);
(*(void (__fastcall **)(cocos2d::CCLayer *, void *))(*(_QWORD *)a1 + 288LL))(a1, &unk_14090A6C8);
v5 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_rotationControlBtn01_001.png");
v6 = *(_QWORD *)a1;
*((_QWORD *)a1 + 53) = v5;
(*(void (__fastcall **)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))(v6 + 456))(a1, v5, 1);
v7 = (unsigned int)cocos2d::CCSprite::createWithSpriteFrameName("warpLockOffBtn_001.png");
v8 = CCMenuItemSpriteExtra::create(v7, 0, (int)a1, (__int64)GJRotationControl::onToggleLockRotation);
*((_QWORD *)a1 + 56) = v8;
v9 = cocos2d::CCMenu::createWithItem(v8);
v10 = *(_QWORD *)v9;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 110.0, 35.0);
(*(void (__fastcall **)(struct cocos2d::CCMenu *, __int64))(v10 + 184))(v9, v11);
(*(void (__fastcall **)(cocos2d::CCLayer *, struct cocos2d::CCMenu *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v9, 3);
v12 = *(_QWORD *)v9;
v41 = (__int64)v9;
(*(void (__fastcall **)(struct cocos2d::CCMenu *, _QWORD))(v12 + 920))(v9, 0);
v14 = *((_BYTE **)a1 + 61);
if ( v14 == *((_BYTE **)a1 + 62) )
{
sub_1400699B0((_QWORD *)a1 + 60, v14, &v41);
}
else
{
*(_QWORD *)v14 = v9;
*((_QWORD *)a1 + 61) += 8LL;
}
v15 = CCTextInputNode::create(v13, (__int64)v14, (__int64)" ");
*((_QWORD *)a1 + 58) = v15;
v16 = v15;
v17 = *(_QWORD *)v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 110.0, 0.0);
(*(void (__fastcall **)(char *, __int64))(v17 + 184))(v16, v18);
v19 = *((_QWORD *)a1 + 58);
*(_DWORD *)(v19 + 564) = 1056293520;
CCTextInputNode::refreshLabel(v19);
v20 = *((_QWORD *)a1 + 58);
*(_DWORD *)(v20 + 560) = 1111490560;
CCTextInputNode::refreshLabel(v20);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*((_QWORD *)a1 + 58) + 592LL) + 336LL))(
*(_QWORD *)(*((_QWORD *)a1 + 58) + 592LL),
0);
v21 = *((_QWORD *)a1 + 58);
v39 = 12;
v38 = 0;
v40 = 15;
*(_DWORD *)(v21 + 608) = 7;
v22 = *((_QWORD *)a1 + 58);
BYTE12(v38) = 0;
*(_DWORD *)(v22 + 716) = 1;
*(_DWORD *)(*((_QWORD *)a1 + 58) + 720LL) = 2;
v23 = *((_QWORD *)a1 + 58);
qmemcpy(&v38, "0123456789.-", 12);
CCTextInputNode::setAllowedChars(v23, (void **)&v38);
*(_BYTE *)(*((_QWORD *)a1 + 58) + 424LL) = 1;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)&v38, 0.0, 0.0, 40.0, 40.0);
v25 = (_QWORD *)cocos2d::extension::CCScale9Sprite::create("square02_small.png", v24);
v26 = *v25;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v41, 80.0, 32.0);
(*(void (__fastcall **)(_QWORD *, __int64))(v26 + 312))(v25, v27);
(*(void (__fastcall **)(_QWORD *))(*v25 + 160LL))(v25);
LOBYTE(v28) = 90;
(*(void (__fastcall **)(_QWORD *, __int64))(v25[40] + 40LL))(v25 + 40, v28);
(*(void (__fastcall **)(_QWORD *))(*v25 + 240LL))(v25);
(*(void (__fastcall **)(_QWORD, _QWORD *, __int64))(**((_QWORD **)a1 + 58) + 456LL))(
*((_QWORD *)a1 + 58),
v25,
0xFFFFFFFFLL);
(*(void (__fastcall **)(cocos2d::CCLayer *, _QWORD, __int64))(*(_QWORD *)a1 + 456LL))(a1, *((_QWORD *)a1 + 58), 2);
v29 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_updateBtn_001.png");
LODWORD(v26) = (_DWORD)v29;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v29 + 160LL))(v29);
v30 = CCMenuItemSpriteExtra::create(v26, 0, (int)a1, (__int64)GJRotationControl::onApplyAngle);
*((_QWORD *)a1 + 59) = v30;
v31 = v30;
v32 = *(_QWORD *)v30;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v41, 151.0, 0.0);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(v32 + 184))(v31, v33);
v35 = cocos2d::CCMenu::create(v34);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v35 + 184LL))(v35, &unk_14090A6C8);
(*(void (__fastcall **)(__int64, void *))(*(_QWORD *)v35 + 312LL))(v35, &unk_14090A6E0);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v35 + 464LL))(v35, *((_QWORD *)a1 + 59));
(*(void (__fastcall **)(cocos2d::CCLayer *, __int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v35, 3);
v36 = *(_QWORD *)v35;
v41 = v35;
(*(void (__fastcall **)(__int64, _QWORD))(v36 + 920))(v35, 0);
v37 = *((_BYTE **)a1 + 61);
if ( v37 == *((_BYTE **)a1 + 62) )
{
sub_1400699B0((_QWORD *)a1 + 60, v37, &v41);
}
else
{
*(_QWORD *)v37 = v35;
*((_QWORD *)a1 + 61) += 8LL;
}
GJRotationControl::setAngle(a1);
return 1;
}
return result;
}