//
// GJScaleControl::loadValues from 0x6ba114 to 0x6ba4c4 (944 bytes)
//
// 4 xrefs:
// > EditorUI::updateScaleControl @ 0x6ba534
// > EditorUI::updateScaleControl @ 0x6ba57c
// > EditorUI::updateScaleControl @ 0x6ba5ac
// > ??> @ 0xa3590
//
// 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)
{
int v7; // w0
float v8; // s10
unsigned int v9; // w25
float v10; // s9
__int64 v11; // x19
char *v12; // x0
float v13; // s3
float v14; // s2
float v15; // s1
float v16; // s0
Slider *m_sliderX; // x19
GJScaleControl *v18; // x0
float v19; // s8
float v20; // s0
float v21; // s0
Slider *m_sliderY; // x19
float v23; // s0
float v24; // s10
Slider *m_sliderXY; // x19
float v26; // s0
Slider *v27; // x0
void (__fastcall *setVisible)(cocos2d::CCNode *__hidden, bool); // x2
cocos2d::CCNode *v29; // x20
Slider *v30; // x2
Slider *v31; // x0
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x21
__int64 v33; // x0
__int64 v34; // x23
unsigned int v35; // w25
unsigned int v36; // w1
GameObject *v37; // x26
GameObjectEditorState *v38; // x19
float v39; // s0
GameObject *v40; // [xsp+78h] [xbp+78h]
cocos2d::CCPoint v41; // [xsp+88h] [xbp+88h] BYREF
__int64 v42; // [xsp+90h] [xbp+90h] BYREF
a1->m_scale1Lock = 1;
if ( a3 )
{
v40 = a2;
v7 = cocos2d::CCArray::count(a3);
a2 = v40;
if ( v7 )
{
v8 = -1.0;
v9 = 0;
v10 = -1.0;
while ( 1 )
{
if ( v9 >= (unsigned int)cocos2d::CCArray::count(a3) )
{
v19 = v8;
if ( v10 == -2.0 )
v10 = 1.0;
if ( v8 == -2.0 )
v19 = 1.0;
v35 = 0;
while ( v35 < (unsigned int)cocos2d::CCArray::count(a3) )
{
v36 = v35++;
v37 = (GameObject *)cocos2d::CCArray::objectAtIndex(a3, v36);
LODWORD(v42) = v37->m_uniqueID;
v38 = (GameObjectEditorState *)std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
(__int64)a4,
(int *)&v42);
GameObjectEditorState::loadValues(v38, v37);
v39 = v38->m_scaleY / v19;
v38->m_scaleX = v38->m_scaleX / v10;
v38->m_scaleY = v39;
}
v20 = v10;
m_sliderX = a1->m_sliderX;
v18 = a1;
LABEL_16:
v21 = GJScaleControl::valueFromScale(v18, v20);
Slider::setValue(m_sliderX, v21);
m_sliderY = a1->m_sliderY;
v23 = GJScaleControl::valueFromScale(a1, v19);
Slider::setValue(m_sliderY, v23);
v24 = v19;
if ( v10 >= v19 )
v24 = v10;
goto LABEL_18;
}
v11 = cocos2d::CCArray::objectAtIndex(a3, v9);
LODWORD(v42) = *(_DWORD *)(v11 + 900);
v12 = std::__detail::_Map_base,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
(__int64)a4,
(int *)&v42);
v13 = *(float *)(v11 + 1296);
v14 = *(float *)(v11 + 1300);
v15 = *(float *)(v11 + 1136) / v13;
v16 = *(float *)(v11 + 1140) / v14;
if ( v10 == -1.0 )
{
v10 = *(float *)(v11 + 1136) / v13;
if ( v8 == -1.0 )
goto LABEL_13;
}
else
{
if ( v10 != v15 )
v10 = -2.0;
if ( v8 == -1.0 )
{
LABEL_13:
v8 = *(float *)(v11 + 1140) / v14;
goto LABEL_9;
}
}
if ( v8 != v16 )
v8 = -2.0;
LABEL_9:
++v9;
*((float *)v12 + 2) = v15;
*((float *)v12 + 3) = v16;
}
}
}
if ( a2 )
{
m_sliderX = a1->m_sliderX;
v18 = a1;
v10 = a2->m_scaleX / a2->m_pixelScaleX;
v19 = a2->m_scaleY / a2->m_pixelScaleY;
v20 = v10;
goto LABEL_16;
}
v19 = -1.0;
v10 = -1.0;
v24 = -1.0;
LABEL_18:
m_sliderXY = a1->m_sliderXY;
v26 = GJScaleControl::valueFromScale(a1, v24);
Slider::setValue(m_sliderXY, v26);
GJScaleControl::updateLabelX(a1, v10);
GJScaleControl::updateLabelY(a1, v19);
GJScaleControl::updateLabelXY(a1, v24);
v27 = a1->m_sliderXY;
LODWORD(m_sliderXY) = a1->m_senderTag == 30;
setVisible = v27->setVisible;
a1->m_valueX = v10;
a1->m_valueY = v19;
setVisible(v27, (unsigned int)m_sliderXY != 1);
a1->m_scaleLabel->setVisible(a1->m_scaleLabel, (unsigned int)m_sliderXY != 1);
a1->m_sliderX->setVisible(a1->m_sliderX, (bool)m_sliderXY);
a1->m_scaleXLabel->setVisible(a1->m_scaleXLabel, (bool)m_sliderXY);
a1->m_sliderY->setVisible(a1->m_sliderY, (bool)m_sliderXY);
a1->m_scaleYLabel->setVisible(a1->m_scaleYLabel, (bool)m_sliderXY);
v29 = a1->m_scaleLockButton->getParent(a1->m_scaleLockButton);
v30 = a1->m_sliderY;
v31 = a1->m_sliderXY;
setPosition = v29->setPosition;
if ( (_DWORD)m_sliderXY )
v33 = (__int64)v30->getPosition(v30);
else
v33 = (__int64)v31->getPosition(v31);
v34 = v33;
cocos2d::CCPoint::CCPoint(&v41, 0.0, 60.0);
cocos2d::CCPoint::operator+(&v42, v34, &v41);
setPosition(v29, (const cocos2d::CCPoint *)&v42);
}