//
// GJBaseGameLayer::getSavedPosition from 0x9c6ff0 to 0x9c7294 (676 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x9ea8f4
// > ??> @ 0x6e950
//
// This function is hookable on this platform (idp: arm, 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 12:58:33 +0000
//
cocos2d::CCPoint *__usercall GJBaseGameLayer::getSavedPosition@(
GJBaseGameLayer *this@,
float a2@,
int a3@,
cocos2d::CCPoint *a4@)
{
double v6; // d0
float v7; // s8
int v8; // w23
__int64 v9; // x0
int v10; // w22
int v11; // w3
float v12; // s8
int v13; // w2
int v14; // w1
int v15; // w2
int v16; // w1
int v17; // w22
long double v18; // q0
__int64 MainObject; // x0
__int64 v21; // x1
const cocos2d::CCPoint *v22; // x0
int v23; // [xsp+8Ch] [xbp+8Ch] BYREF
char v24[8]; // [xsp+90h] [xbp+90h] BYREF
char v25[8]; // [xsp+98h] [xbp+98h] BYREF
__int64 v26; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v27; // [xsp+A8h] [xbp+A8h] BYREF
if ( a2 <= 0.0 )
{
switch ( a3 )
{
case -1:
v21 = *((_QWORD *)this + 407);
break;
case -2:
v21 = *((_QWORD *)this + 408);
break;
case -3:
cocos2d::CCPoint::CCPoint(a4, (GJBaseGameLayer *)((char *)this + 992));
return a4;
default:
MainObject = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)this, a3);
if ( MainObject )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)MainObject + 1360LL))(MainObject);
return a4;
}
goto LABEL_17;
}
v22 = (const cocos2d::CCPoint *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v21 + 192LL))(v21);
cocos2d::CCPoint::CCPoint(a4, v22);
return a4;
}
v6 = a2 / 0.00416666667 - (float)((float)(unsigned int)(*((_DWORD *)this + 241) - *((_DWORD *)this + 240)) / 1000.0);
if ( v6 <= 0.0 )
v7 = 0.0;
else
v7 = v6;
v8 = vcvtps_s32_f32(v7);
if ( v8 >= *((_DWORD *)this + 285) )
goto LABEL_17;
v23 = a3;
switch ( a3 )
{
case -1:
v10 = *(_DWORD *)(*((_QWORD *)this + 407) + 1340LL);
goto LABEL_10;
case -2:
v10 = *(_DWORD *)(*((_QWORD *)this + 408) + 1340LL);
goto LABEL_10;
case -3:
v10 = *((_DWORD *)this + 286);
goto LABEL_10;
}
v9 = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)this, a3);
if ( !v9 )
{
LABEL_17:
cocos2d::CCPoint::CCPoint(a4, (const cocos2d::CCPoint *)&unk_155D2C8);
return a4;
}
v10 = *(_DWORD *)(v9 + 1340);
v23 = *(_DWORD *)(v9 + 916);
LABEL_10:
if ( v10 < 0
|| !std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_QWORD *)this + 1654,
&v23) )
{
goto LABEL_17;
}
v11 = *(_DWORD *)std::unordered_map::operator[]((__int64)this + 13232, &v23);
v12 = (float)v8 - v7;
v13 = *((_DWORD *)this + 285) % v11 - v8;
if ( v13 < 0 )
v13 += v11;
v14 = v13 + v10;
v15 = v13 + 1;
v16 = 2 * v14;
if ( v11 <= v15 )
v15 = 0;
v17 = 2 * (v15 + v10);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v24,
*(float *)(*((_QWORD *)this + 139) + 4LL * v16),
*(float *)(*((_QWORD *)this + 139) + 4LL * (v16 + 1)));
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v25,
*(float *)(*((_QWORD *)this + 139) + 4LL * v17),
*(float *)(*((_QWORD *)this + 139) + 4LL * (v17 + 1)));
cocos2d::CCPoint::operator-(&v26, v25, v24, v18);
cocos2d::CCPoint::operator*(&v26, v12);
cocos2d::CCPoint::operator+(&v27, v24);
cocos2d::CCPoint::CCPoint(a4, (const cocos2d::CCPoint *)&v27);
return a4;
}