//
// GJScaleControl::loadValues from 0x140129f40 to 0x14012a54b (1547 bytes)
//
// 5 xrefs:
// > EditorUI::updateScaleControl @ 0x140114f32
// > ??> @ 0x140670904
// > ??> @ 0x14067094c
// > ??> @ 0x14067095c
// > ??> @ 0x1406c9abc
//
// 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 GJScaleControl::loadValues(
GJScaleControl *a1,
GameObject *a2,
cocos2d::CCArray *a3,
std::unordered_map *a4)
{
float v8; // xmm8_4
float v9; // xmm7_4
unsigned int v10; // r14d
unsigned int v11; // edi
struct cocos2d::CCObject *v12; // rbx
__int64 v13; // rcx
float v14; // xmm0_4
float v15; // xmm1_4
struct cocos2d::CCObject *v16; // rbx
float *v17; // rdi
__int64 v18; // rax
float v19; // xmm0_4
float v20; // xmm1_4
float v21; // xmm1_4
float v22; // xmm1_4
float v23; // xmm1_4
float v24; // xmm11_4
float v25; // xmm10_4
cocos2d::CCLabelProtocol_vtbl *v26; // rbx
cocos2d::CCString *v27; // rax
const char *CString; // rax
cocos2d::CCLabelProtocol_vtbl *v29; // rbx
cocos2d::CCString *v30; // rax
const char *v31; // rax
cocos2d::CCLabelProtocol_vtbl *v32; // rbx
cocos2d::CCString *v33; // rax
const char *v34; // rax
Slider *m_sliderXY; // rcx
int m_senderTag; // esi
Slider *m_sliderY; // rsi
cocos2d::CCNode *v38; // rdi
__int64 v39; // rax
_BYTE v40[16]; // [rsp+20h] [rbp-98h] BYREF
cocos2d::CCObjectType m_eObjType; // [rsp+C0h] [rbp+8h] BYREF
cocos2d::CCPoint v42; // [rsp+D0h] [rbp+18h] BYREF
a1->m_scale1Lock = 1;
v8 = -1.0;
v9 = -1.0;
if ( a3 && cocos2d::CCArray::count(a3) )
{
v10 = 0;
v11 = 0;
if ( cocos2d::CCArray::count(a3) )
{
do
{
v12 = cocos2d::CCArray::objectAtIndex(a3, v11);
m_eObjType = v12[16].m_eObjType;
v13 = *(_QWORD *)sub_14012CF70(a4, v40, &m_eObjType);
v14 = *(float *)&v12[20].m_unknown2 / *(float *)&v12[23].m_uIndexInArray;
v15 = *(float *)&v12[20].m_nZOrder / *(float *)&v12[23].m_uUnknown;
if ( v8 == -1.0 )
{
v8 = *(float *)&v12[20].m_unknown2 / *(float *)&v12[23].m_uIndexInArray;
}
else if ( v8 != v14 )
{
v8 = -2.0;
}
if ( v9 == -1.0 )
{
v9 = *(float *)&v12[20].m_nZOrder / *(float *)&v12[23].m_uUnknown;
}
else if ( v9 != v15 )
{
v9 = -2.0;
}
*(float *)(v13 + 28) = v14;
++v11;
*(float *)(v13 + 32) = v15;
}
while ( v11 < cocos2d::CCArray::count(a3) );
if ( v8 == -2.0 )
v8 = 1.0;
if ( v9 == -2.0 )
v9 = 1.0;
}
if ( cocos2d::CCArray::count(a3) )
{
do
{
v16 = cocos2d::CCArray::objectAtIndex(a3, v10);
m_eObjType = v16[16].m_eObjType;
v17 = *(float **)sub_14012CF70(a4, v40, &m_eObjType);
v18 = ((__int64 (__fastcall *)(struct cocos2d::CCObject *))v16->__vftable[2].getTag)(v16);
cocos2d::CCPoint::operator=(v17 + 5, v18);
v17[7] = *(float *)&v16[20].m_unknown2 / *(float *)&v16[23].m_uIndexInArray;
v17[8] = *(float *)&v16[20].m_nZOrder / *(float *)&v16[23].m_uUnknown;
v17[9] = ((float (__fastcall *)(struct cocos2d::CCObject *))v16->__vftable[5].copyWithZone)(v16);
v19 = ((float (__fastcall *)(struct cocos2d::CCObject *))v16->__vftable[5].isEqual)(v16);
v20 = v17[7];
v17[10] = v19;
++v10;
v17[8] = v17[8] / v9;
v17[7] = v20 / v8;
}
while ( v10 < cocos2d::CCArray::count(a3) );
}
v21 = fminf(1.0, (float)(v8 - a1->m_lowerBound) / (float)(a1->m_upperBound - a1->m_lowerBound));
if ( v21 < 0.0 )
v21 = 0.0;
Slider::setValue(a1->m_sliderX, v21);
v22 = fminf(1.0, (float)(v9 - a1->m_lowerBound) / (float)(a1->m_upperBound - a1->m_lowerBound));
if ( v22 < 0.0 )
v22 = 0.0;
}
else
{
if ( !a2 )
goto LABEL_29;
v8 = a2->m_scaleX / a2->m_pixelScaleX;
v9 = a2->m_scaleY / a2->m_pixelScaleY;
v23 = fminf(1.0, (float)(v8 - a1->m_lowerBound) / (float)(a1->m_upperBound - a1->m_lowerBound));
if ( v23 < 0.0 )
v23 = 0.0;
Slider::setValue(a1->m_sliderX, v23);
v22 = fminf(1.0, (float)(v9 - a1->m_lowerBound) / (float)(a1->m_upperBound - a1->m_lowerBound));
if ( v22 < 0.0 )
v22 = 0.0;
}
Slider::setValue(a1->m_sliderY, v22);
LABEL_29:
v24 = fmaxf(v8, v9);
v25 = fminf(1.0, (float)(v24 - a1->m_lowerBound) / (float)(a1->m_upperBound - a1->m_lowerBound));
if ( v25 < 0.0 )
v25 = 0.0;
Slider::setValue(a1->m_sliderXY, v25);
v26 = a1->m_scaleXLabel->__vftable;
v27 = cocos2d::CCString::createWithFormat("ScaleX %.02f", v8);
CString = cocos2d::CCString::getCString(v27);
v26->setString(&a1->m_scaleXLabel->cocos2d::CCLabelProtocol, CString);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_scaleXLabel, 100.0, 0.0, 0.0);
v29 = a1->m_scaleYLabel->__vftable;
v30 = cocos2d::CCString::createWithFormat("ScaleY: %.02f", v9);
v31 = cocos2d::CCString::getCString(v30);
v29->setString(&a1->m_scaleYLabel->cocos2d::CCLabelProtocol, v31);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_scaleYLabel, 100.0, 0.0, 0.0);
v32 = a1->m_scaleLabel->__vftable;
v33 = cocos2d::CCString::createWithFormat("Scale: %.02f", v24);
v34 = cocos2d::CCString::getCString(v33);
v32->setString(&a1->m_scaleLabel->cocos2d::CCLabelProtocol, v34);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_scaleLabel, 100.0, 0.0, 0.0);
m_sliderXY = a1->m_sliderXY;
m_senderTag = a1->m_senderTag;
a1->m_valueX = v8;
a1->m_valueY = v9;
m_sliderXY->setVisible(m_sliderXY, m_senderTag != 30);
a1->m_scaleLabel->setVisible(a1->m_scaleLabel, m_senderTag != 30);
a1->m_sliderX->setVisible(a1->m_sliderX, m_senderTag == 30);
a1->m_scaleXLabel->setVisible(a1->m_scaleXLabel, m_senderTag == 30);
a1->m_sliderY->setVisible(a1->m_sliderY, m_senderTag == 30);
a1->m_scaleYLabel->setVisible(a1->m_scaleYLabel, m_senderTag == 30);
if ( m_senderTag == 30 )
m_sliderY = a1->m_sliderY;
else
m_sliderY = a1->m_sliderXY;
v38 = a1->m_scaleLockButton->getParent(a1->m_scaleLockButton);
cocos2d::CCPoint::CCPoint(&v42, 0.0, 60.0);
v39 = (__int64)m_sliderY->getPosition_0(m_sliderY);
cocos2d::CCPoint::operator+(v39, &m_eObjType);
v38->setPosition_0(v38, (const cocos2d::CCPoint *)&m_eObjType);
}