//
// cocos2d::extension::CCControlPotentiometer::potentiometerMoved from 0x1800095c0 to 0x180009711 (337 bytes)
//
// 3 xrefs:
// > cocos2d::extension::CCControlPotentiometer::ccTouchMoved @ 0x180009457
// > ??> @ 0x18002fdf8
// > ??> @ 0x1800499f0
//
// 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
//
double __fastcall cocos2d::extension::CCControlPotentiometer::potentiometerMoved(
__int64 a1,
const struct cocos2d::CCPoint *a2)
{
float *v4; // rsi
const struct cocos2d::CCPoint *v5; // rax
float *v6; // rdi
float *v7; // rbx
const struct cocos2d::CCPoint *v8; // rax
float *v9; // rax
float v10; // xmm6_4
float v11; // xmm2_4
_BYTE v13[16]; // [rsp+20h] [rbp-48h] BYREF
char v14; // [rsp+70h] [rbp+8h] BYREF
char v15; // [rsp+80h] [rbp+18h] BYREF
char v16; // [rsp+88h] [rbp+20h] BYREF
v4 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v14, (const struct cocos2d::CCPoint *)(a1 + 488));
v5 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 200LL))(*(_QWORD *)(a1 + 480));
v6 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v15, v5);
v7 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v16, a2);
v8 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 480) + 200LL))(*(_QWORD *)(a1 + 480));
v9 = (float *)cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v13, v8);
v10 = atan2f(*v7 - *v9, v7[1] - v9[1]);
v11 = (float)((float)(v10 - atan2f(*v4 - *v6, v4[1] - v6[1])) * 180.0) / 3.141592653589793;
if ( v11 <= 180.0 )
{
if ( v11 < -180.0 )
v11 = v11 + 360.0;
}
else
{
v11 = v11 + -360.0;
}
cocos2d::extension::CCControlPotentiometer::setValue(
(cocos2d::extension::CCControlPotentiometer *)a1,
(float)((float)(*(float *)(a1 + 504) - *(float *)(a1 + 500)) * (float)(v11 / 360.0)) + *(float *)(a1 + 496));
return cocos2d::CCPoint::operator=(a1 + 488, a2);
}