//
// GJTransformControl::updateButtons from 0x1003f662c to 0x1003f6f48 (2332 bytes)
//
// 13 xrefs:
// > GJTransformControl::loadValues @ 0x1003f0660
// > GJTransformControl::applyRotation @ 0x1003f06dc
// > GJTransformControl::refreshControl @ 0x1003f6158
// > GJTransformControl::refreshControl @ 0x1003f6168
// > GJTransformControl::refreshControl @ 0x1003f61e0
// > GJTransformControl::refreshControl @ 0x1003f61f0
// > EditorUI::transformObjectCall_1 @ 0x1003f659c
// > GJTransformControl::ccTouchMoved @ 0x1003fc304
// > GJTransformControl::ccTouchEnded @ 0x1003fc408
// > GJTransformControl::ccTouchEnded @ 0x1003fc41c
// > GJTransformControl::ccTouchEnded @ 0x1003fc494
// > GJTransformControl::ccTouchEnded @ 0x1003fc4d4
// > GJTransformControl::ccTouchEnded @ 0x1003fc4e8
//
// 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 GJTransformControl::updateButtons(GJTransformControl *a1, bool a2, bool a3)
{
_BOOL4 v3; // w21
GJTransformControlDelegate *m_delegate; // x0
GJTransformControlDelegate_vtbl *v7; // x8
EditorUI *v8; // x0
GameManager *v9; // x0
float v10; // s8
GameManager *v11; // x0
__int64 *v12; // x0
GameManager *v13; // x0
GameManager *v14; // x0
__n128 v15; // q0
__n128 v16; // q1
cocos2d::CCArray *m_objects; // x0
int v18; // s10
unsigned __int32 v19; // s9
int v20; // w0
unsigned int v21; // w22
cocos2d::CCNode *v22; // x23
float v23; // s0
float c; // s12
float d; // s11
int v26; // w0
float v27; // s0
float v28; // s1
__n128 v29; // q0
__n128 v30; // q1
__n128 v31; // q0
__n128 v32; // q1
__n128 v33; // q0
__n128 v34; // q1
__n128 v35; // q0
__n128 v36; // q1
__n128 v37; // q0
__n128 v38; // q1
__int64 *v39; // x0
float32x2_t v40; // d4
float32x2_t v41; // d4
float32x2_t v42; // d4
__n128 v43; // q7
float32x2_t v44; // d0
float32x2_t v45; // d0
float32x2_t v46; // d0
__n128 v47; // q2
float32x2_t *v48; // x0
__n128 v49; // q1
float32x2_t *v50; // x0
double v51; // d0
GJTransformControlDelegate *v52; // x0
GJTransformControlDelegate_vtbl *v53; // x8
EditorUI *v54; // x0
float v60; // s11
float v61; // s10
float m_scaleY; // s4
float v63; // s12
float v64; // s9
float v65; // s14
float v66; // s13
__int64 v67; // x21
__n128 v68; // q1
__n128 v69; // q0
__int64 v70; // x21
__n128 v71; // q1
__n128 v72; // q0
__int64 v73; // x21
__n128 v74; // q0
__n128 v75; // q1
__int64 v76; // x21
__n128 v77; // q0
__n128 v78; // q1
__int64 v79; // x21
__n128 v80; // q0
__n128 v81; // q1
__int64 v82; // x21
__n128 v83; // q0
__n128 v84; // q1
__int64 v85; // x21
__n128 v86; // q0
__n128 v87; // q1
__int64 v88; // x21
__n128 v89; // q0
__n128 v90; // q1
__int64 v91; // x21
__n128 v92; // q1
unsigned __int32 v93; // s10
__n128 v94; // q0
__int64 v95; // x0
__int64 v96; // x21
__n128 v97; // q0
__n128 v98; // q1
float v99; // s11
__int64 v100; // x0
__int64 v101; // x20
__n128 v102; // q0
__n128 v103; // q1
__n128 v104; // q0
__n128 v105; // q1
__int64 v106; // x20
GameManager *v107; // x0
GameManager *v108; // x0
__n128 v109; // [xsp+0h] [xbp-F0h]
__n128 v110; // [xsp+10h] [xbp-E0h]
__n128 v111; // [xsp+10h] [xbp-E0h]
float32x2_t v112; // [xsp+20h] [xbp-D0h] BYREF
float32x2_t v113; // [xsp+28h] [xbp-C8h] BYREF
float32x2_t v114; // [xsp+30h] [xbp-C0h] BYREF
float32x2_t v115; // [xsp+38h] [xbp-B8h] BYREF
float32x2_t v116; // [xsp+40h] [xbp-B0h] BYREF
float32x2_t v117; // [xsp+48h] [xbp-A8h] BYREF
float32x2_t v118; // [xsp+50h] [xbp-A0h] BYREF
float32x2_t v119; // [xsp+58h] [xbp-98h] BYREF
float32x2_t v120; // [xsp+60h] [xbp-90h] BYREF
float v121; // [xsp+68h] [xbp-88h]
float v122; // [xsp+6Ch] [xbp-84h]
float32x2_t v123; // [xsp+70h] [xbp-80h] BYREF
__int64 v124; // [xsp+78h] [xbp-78h] BYREF
cocos2d::CCPoint v125; // 0:kr20_8.8
cocos2d::CCPoint v126; // 0:kr30_8.8
v3 = a3;
m_delegate = a1->m_delegate;
if ( m_delegate )
{
v7 = m_delegate->__vftable;
if ( a3 )
{
v8 = (EditorUI *)((__int64 (*)(void))v7->getUI)();
EditorUI::transformObjectsReset(v8);
}
else
{
((void (*)(void))v7->transformResetRotation)();
}
}
v9 = GameManager::sharedState();
v10 = ((float (__fastcall *)(cocos2d::CCLayer *))v9->m_levelEditorLayer->m_objectLayer->getScale)(v9->m_levelEditorLayer->m_objectLayer);
v11 = GameManager::sharedState();
v12 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCLayer *))v11->m_levelEditorLayer->m_objectLayer->getPosition)(v11->m_levelEditorLayer->m_objectLayer);
sub_1000229B8(&v124, v12);
v13 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, float))v13->m_levelEditorLayer->m_objectLayer->setScale)(
v13->m_levelEditorLayer->m_objectLayer,
1.0);
v14 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, int *))v14->m_levelEditorLayer->m_objectLayer->setPosition)(
v14->m_levelEditorLayer->m_objectLayer,
&dword_10086E8B0);
m_objects = a1->m_objects;
v18 = -887581057;
v19 = 1259902591;
if ( m_objects && (unsigned int)sub_10024A36C((__int64)m_objects) )
{
v20 = sub_10024A36C((__int64)a1->m_objects);
v16.n128_u32[0] = 1259902591;
v15.n128_u32[0] = -887581057;
if ( v20 )
{
v21 = 0;
v15.n128_u64[0] = (unsigned __int64)vdup_n_s32(0xCB18967F);
v109 = v15;
v15.n128_u64[0] = (unsigned __int64)vdup_n_s32(0x4B18967Fu);
v110 = v15;
do
{
v22 = (cocos2d::CCNode *)sub_10024A388((__int64)a1->m_objects, v21);
v23 = sub_1000229B8((__int64 *)&v123, (__int64 *)&v22[1].m_sAdditionalTransform.c);
c = v22[2].m_sAdditionalTransform.c;
d = v22[2].m_sAdditionalTransform.d;
v26 = ((__int64 (__fastcall *)(cocos2d::CCNode *, float))v22->__vftable[1].removeComponent)(v22, v23);
v27 = v123.f32[1];
v28 = v123.f32[0];
if ( v26 )
{
if ( c >= d )
d = c;
if ( v123.f32[0] >= v123.f32[1] )
v27 = v123.f32[0];
v123.f32[0] = v27;
v123.f32[1] = v27;
v28 = v27;
c = d;
}
sub_100022990((float *)&v120, 0.0, 0.0, c + v28, d + v27);
v29.n128_u32[0] = 0;
v30.n128_u32[0] = 0;
sub_100022980(v29, v30, &v118);
cocos2d::CCNode::convertToWorldSpace(v22, (const cocos2d::CCPoint *)&v118);
v31.n128_f32[0] = v121 * -0.5;
v32.n128_f32[0] = v122 * 0.5;
sub_100022980(v31, v32, &v117);
cocos2d::CCNode::convertToWorldSpace(v22, (const cocos2d::CCPoint *)&v117);
v33.n128_f32[0] = v121 * 0.5;
v34.n128_f32[0] = v122 * 0.5;
sub_100022980(v33, v34, &v116);
cocos2d::CCNode::convertToWorldSpace(v22, (const cocos2d::CCPoint *)&v116);
v35.n128_f32[0] = v121 * -0.5;
v36.n128_f32[0] = v122 * -0.5;
sub_100022980(v35, v36, &v115);
cocos2d::CCNode::convertToWorldSpace(v22, (const cocos2d::CCPoint *)&v115);
v37.n128_f32[0] = v121 * 0.5;
v38.n128_f32[0] = v122 * -0.5;
sub_100022980(v37, v38, &v114);
v125 = cocos2d::CCNode::convertToWorldSpace(v22, (const cocos2d::CCPoint *)&v114);
v39 = (__int64 *)((__int64 (__fastcall *)(cocos2d::CCNode *, float, float))v22->getPosition)(
v22,
v125.x,
v125.y);
sub_1000229B8((__int64 *)&v114, v39);
sub_1000229F0(&v118, &v119, &v112);
sub_1000229DC(&v114, &v112, &v113);
sub_1000229D0(&v118, (double *)&v113);
sub_1000229F0(&v117, &v119, &v112);
sub_1000229DC(&v114, &v112, &v113);
sub_1000229D0(&v117, (double *)&v113);
sub_1000229F0(&v116, &v119, &v112);
sub_1000229DC(&v114, &v112, &v113);
sub_1000229D0(&v116, (double *)&v113);
sub_1000229F0(&v115, &v119, &v112);
sub_1000229DC(&v114, &v112, &v113);
sub_1000229D0(&v115, (double *)&v113);
v40 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v118, v117), (int8x8_t)v117, (int8x8_t)v118);
v41 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v40, v116), (int8x8_t)v116, (int8x8_t)v40);
v42 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v41, v115), (int8x8_t)v115, (int8x8_t)v41);
v43.n128_u64[1] = v110.n128_u64[1];
v44 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v117, v118), (int8x8_t)v117, (int8x8_t)v118);
v45 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v116, v44), (int8x8_t)v116, (int8x8_t)v44);
v46 = (float32x2_t)vbsl_s8((int8x8_t)vcgt_f32(v115, v45), (int8x8_t)v115, (int8x8_t)v45);
v47.n128_u64[1] = v109.n128_u64[1];
v47.n128_u64[0] = (unsigned __int64)vbsl_s8(
(int8x8_t)vcgt_f32(v46, (float32x2_t)v109.n128_u64[0]),
(int8x8_t)v46,
(int8x8_t)v109.n128_u64[0]);
v43.n128_u64[0] = (unsigned __int64)vbsl_s8(
(int8x8_t)vcgt_f32((float32x2_t)v110.n128_u64[0], v42),
(int8x8_t)v42,
(int8x8_t)v110.n128_u64[0]);
v109 = v47;
v110 = v43;
++v21;
}
while ( v21 < (unsigned int)sub_10024A36C((__int64)a1->m_objects) );
v15 = v109;
v16 = v110;
v18 = v109.n128_i32[1];
v19 = v110.n128_u32[1];
}
}
else
{
v16.n128_u32[0] = 1259902591;
v15.n128_u32[0] = -887581057;
}
v111 = v16;
v16.n128_u32[0] = v18;
sub_100022980(v15, v16, &v123);
v48 = (float32x2_t *)((__int64 (__fastcall *)(GJTransformControl *))a1->getPosition)(a1);
sub_1000229F0(&v123, v48, &v120);
v49.n128_u32[0] = v19;
sub_100022980(v111, v49, &v119);
v50 = (float32x2_t *)((__int64 (__fastcall *)(GJTransformControl *))a1->getPosition)(a1);
*(float32x2_t *)&v51 = sub_1000229F0(&v119, v50, &v123);
v52 = a1->m_delegate;
if ( v52 )
{
v53 = v52->__vftable;
if ( v3 )
{
v54 = (EditorUI *)((__int64 (__fastcall *)(double))v53->getUI)(v51);
EditorUI::transformObjectsActive(v54);
LABEL_22:
sub_1000229D0(&a1->m_topRight, (double *)&v120);
sub_1000229D0(&a1->m_bottomLeft, (double *)&v123);
goto LABEL_51;
}
((void (__fastcall *)(double))v53->transformRestoreRotation)(v51);
}
else if ( v3 )
{
goto LABEL_22;
}
if ( a2 )
{
sub_1000229B8((__int64 *)&v119, (__int64 *)&v120);
sub_1000229B8((__int64 *)&v118, (__int64 *)&v123);
sub_1000229F0(&v120, &v119, &v117);
sub_1000229D0(&a1->m_topRightOrigin, (double *)&v117);
sub_1000229F0(&v123, &v118, &v117);
sub_1000229D0(&a1->m_bottomLeftOrigin, (double *)&v117);
sub_1000229D0(&a1->m_topRight, (double *)&v120);
sub_1000229D0(&a1->m_bottomLeft, (double *)&v123);
__asm { FMOV V0.2S, #1.0 }
*(_QWORD *)&a1->m_scaleX = _D0;
*(_QWORD *)&a1->m_rotationX = 0;
((void (__fastcall *)(cocos2d::CCNode *, float))a1->m_mainNode->setRotation)(a1->m_mainNode, 0.0);
}
else
{
if ( a1->m_topRightOrigin.x > 0.0 )
v120.i32[0] = LODWORD(a1->m_scaleX);
if ( a1->m_bottomLeftOrigin.x < 0.0 )
v123.f32[0] = -a1->m_scaleX;
if ( a1->m_topRightOrigin.y > 0.0 )
v120.i32[1] = LODWORD(a1->m_scaleY);
if ( a1->m_bottomLeftOrigin.y < 0.0 )
v123.f32[1] = -a1->m_scaleY;
}
if ( a1->m_scaleX >= 0.0 )
v60 = v123.f32[0];
else
v60 = v120.f32[0];
if ( a1->m_scaleX >= 0.0 )
v61 = v120.f32[0];
else
v61 = v123.f32[0];
m_scaleY = a1->m_scaleY;
if ( m_scaleY >= 0.0 )
v63 = v120.f32[1];
else
v63 = v123.f32[1];
if ( m_scaleY >= 0.0 )
v64 = v123.f32[1];
else
v64 = v120.f32[1];
v65 = (float)(v120.f32[0] - v123.f32[0]) * 0.5;
v66 = (float)(v120.f32[1] - v123.f32[1]) * 0.5;
v67 = sub_10024A388((__int64)a1->m_warpSprites, 2u);
v68.n128_f32[0] = v66 + v123.f32[1];
v69.n128_f32[0] = v61;
sub_100022980(v69, v68, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v67 + 184LL))(v67, &v119);
v70 = sub_10024A388((__int64)a1->m_warpSprites, 1u);
v71.n128_f32[0] = v66 + v123.f32[1];
v72.n128_f32[0] = v60;
sub_100022980(v72, v71, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v70 + 184LL))(v70, &v119);
v73 = sub_10024A388((__int64)a1->m_warpSprites, 3u);
v74.n128_f32[0] = v65 + v123.f32[0];
v75.n128_f32[0] = v63;
sub_100022980(v74, v75, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v73 + 184LL))(v73, &v119);
v76 = sub_10024A388((__int64)a1->m_warpSprites, 4u);
v77.n128_f32[0] = v65 + v123.f32[0];
v78.n128_f32[0] = v64;
sub_100022980(v77, v78, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v76 + 184LL))(v76, &v119);
v79 = sub_10024A388((__int64)a1->m_warpSprites, 5u);
v80.n128_f32[0] = v60;
v81.n128_f32[0] = v63;
sub_100022980(v80, v81, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v79 + 184LL))(v79, &v119);
v82 = sub_10024A388((__int64)a1->m_warpSprites, 6u);
v83.n128_f32[0] = v61;
v84.n128_f32[0] = v63;
sub_100022980(v83, v84, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v82 + 184LL))(v82, &v119);
v85 = sub_10024A388((__int64)a1->m_warpSprites, 7u);
v86.n128_f32[0] = v60;
v87.n128_f32[0] = v64;
sub_100022980(v86, v87, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v85 + 184LL))(v85, &v119);
v88 = sub_10024A388((__int64)a1->m_warpSprites, 8u);
v89.n128_f32[0] = v61;
v90.n128_f32[0] = v64;
sub_100022980(v89, v90, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v88 + 184LL))(v88, &v119);
v91 = sub_10024A388((__int64)a1->m_warpSprites, 9u);
v93 = 0;
v94.n128_u32[0] = 0;
if ( !a2 )
{
v95 = sub_10024A388((__int64)a1->m_warpSprites, 9u);
v94.n128_u32[0] = *(_DWORD *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v95 + 192LL))(v95);
}
v92.n128_f32[0] = v120.f32[1] + 30.0;
sub_100022980(v94, v92, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v91 + 184LL))(v91, &v119);
v96 = sub_10024A388((__int64)a1->m_warpSprites, 0xAu);
v99 = v120.f32[0] + 30.0;
if ( !a2 )
{
v100 = sub_10024A388((__int64)a1->m_warpSprites, 0xAu);
v93 = *(_DWORD *)((*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v100 + 192LL))(v100) + 4);
}
v97.n128_f32[0] = v99;
v98.n128_u32[0] = v93;
sub_100022980(v97, v98, &v119);
(*(void (__fastcall **)(__int64, float32x2_t *))(*(_QWORD *)v96 + 184LL))(v96, &v119);
v101 = ((__int64 (__fastcall *)(CCMenuItemSpriteExtra *))a1->m_warpLockButton->getParent)(a1->m_warpLockButton);
v102.n128_f32[0] = v120.f32[0] + 40.0;
v103.n128_f32[0] = v120.f32[1] + 40.0;
sub_100022980(v102, v103, &v119);
v104 = ((__n128 (__fastcall *)(__int64, float32x2_t *))*(_QWORD *)(*(_QWORD *)v101 + 184LL))(v101, &v119);
v104.n128_f32[0] = v120.f32[0] + 60.0;
v105.n128_f32[0] = v64 + v66;
sub_100022980(v104, v105, &v119);
sub_1000229D0(&a1->m_rotatePosition, (double *)&v119);
a1->m_rotation = (float)((float)(atan2f(a1->m_rotatePosition.y, a1->m_rotatePosition.x) * -57.296) * 100.0) / 100.0;
v106 = sub_10024A388((__int64)a1->m_warpSprites, 0xBu);
cocos2d::CCNode::convertToWorldSpace(a1->m_mainNodeParent, &a1->m_rotatePosition);
v126 = cocos2d::CCNode::convertToNodeSpace(a1, (const cocos2d::CCPoint *)&v118);
(*(void (__fastcall **)(__int64, float32x2_t *, float, float))(*(_QWORD *)v106 + 184LL))(v106, &v119, v126.x, v126.y);
LABEL_51:
v107 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, float))v107->m_levelEditorLayer->m_objectLayer->setScale)(
v107->m_levelEditorLayer->m_objectLayer,
v10);
v108 = GameManager::sharedState();
((void (__fastcall *)(cocos2d::CCLayer *, __int64 *))v108->m_levelEditorLayer->m_objectLayer->setPosition)(
v108->m_levelEditorLayer->m_objectLayer,
&v124);
}