//
// EndPortalObject::updateEndPos from 0x507ff8 to 0x5081fc (516 bytes)
//
// 2 xrefs:
// > PlayLayer::checkForEnd @ 0x3ff632
// > EndPortalObject::setVisible @ 0x508228
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:51:25 +0000
//
int __fastcall EndPortalObject::updateEndPos(EndPortalObject *this, int a2)
{
GameManager *WinSize; // r0
float v5; // s16
GameManager *v6; // r0
GameManager *v7; // r0
float v8; // s16
float v9; // s17
float v10; // s15
GameManager *v11; // r0
float v12; // s18
float v13; // s17
void (__fastcall *v14)(EndPortalObject *, _BYTE *); // r8
float *v15; // r0
GameManager *v16; // r0
int v17; // r6
int (__fastcall *v18)(int, _DWORD); // r7
float v19; // s16
int v20; // r0
int (__fastcall *v21)(EndPortalObject *, _DWORD); // r6
float v22; // s16
int v23; // r0
GameManager *v24; // r0
int (__fastcall *v25)(EndPortalObject *, _DWORD); // r6
int v26; // r0
GameManager *v27; // r0
int v28; // r3
float v29; // s16
void (__fastcall *v30)(_DWORD, _DWORD); // r6
int v31; // r0
float v32; // r1
int (__fastcall *v33)(EndPortalObject *, int); // r6
int v34; // r0
_BYTE v36[4]; // [sp+4h] [bp-1Ch] BYREF
float v37; // [sp+8h] [bp-18h]
_BYTE v38[4]; // [sp+Ch] [bp-14h] BYREF
float v39; // [sp+10h] [bp-10h]
_BYTE v40[4]; // [sp+14h] [bp-Ch] BYREF
float v41; // [sp+18h] [bp-8h]
cocos2d::CCDirector::sharedDirector(this);
WinSize = (GameManager *)cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v36);
if ( *((_BYTE *)this + 1173) )
{
v5 = 225.0;
(*(void (__fastcall **)(_BYTE *, EndPortalObject *))(*(_DWORD *)this + 908))(v38, this);
if ( v39 > 225.0 )
{
(*(void (__fastcall **)(_BYTE *, EndPortalObject *))(*(_DWORD *)this + 908))(v40, this);
v5 = v41;
}
}
else
{
v6 = (GameManager *)GameManager::sharedState(WinSize);
if ( *(_BYTE *)(*(_DWORD *)(*((_DWORD *)v6 + 101) + 2076) + 1953)
|| (v7 = (GameManager *)GameManager::sharedState(v6),
v8 = v37 * 0.5,
v9 = *(float *)(*((_DWORD *)v7 + 101) + 1000),
v6 = (GameManager *)GameManager::sharedState(v7),
v10 = v8 / *(float *)(*((_DWORD *)v6 + 101) + 328),
v5 = 225.0,
(float)(v9 + v10) > 225.0) )
{
v11 = (GameManager *)GameManager::sharedState(v6);
v12 = v37 * 0.5;
v13 = *(float *)(*((_DWORD *)v11 + 101) + 1000);
v5 = v13 + (float)(v12 / *(float *)(*(_DWORD *)(GameManager::sharedState(v11) + 404) + 328));
}
}
v14 = *(void (__fastcall **)(EndPortalObject *, _BYTE *))(*(_DWORD *)this + 684);
v15 = (float *)(*(int (__fastcall **)(EndPortalObject *))(*(_DWORD *)this + 96))(this);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v40, *v15, v5);
v14(this, v40);
v16 = *((GameManager **)this + 165);
if ( v16 )
{
if ( a2 )
v16 = (GameManager *)(*(int (__fastcall **)(GameManager *, float))(*(_DWORD *)v16 + 20))(v16, 1.0);
v17 = *((_DWORD *)this + 165);
v18 = *(int (__fastcall **)(int, _DWORD))(*(_DWORD *)v17 + 80);
v19 = 1.0;
if ( *((_BYTE *)this + 1172) )
v19 = -1.0;
v20 = GameManager::sharedState(v16);
v16 = (GameManager *)v18(v17, v19 / *(float *)(*(_DWORD *)(v20 + 404) + 332));
}
v21 = *(int (__fastcall **)(EndPortalObject *, _DWORD))(*(_DWORD *)this + 64);
if ( *((_BYTE *)this + 1172) )
v22 = -1.0;
else
v22 = 1.0;
v23 = GameManager::sharedState(v16);
v24 = (GameManager *)v21(this, v22 / *(float *)(*(_DWORD *)(v23 + 404) + 332));
v25 = *(int (__fastcall **)(EndPortalObject *, _DWORD))(*(_DWORD *)this + 72);
v26 = GameManager::sharedState(v24);
v27 = (GameManager *)v25(this, 1.0 / *(float *)(*(_DWORD *)(v26 + 404) + 332));
v28 = *((_DWORD *)this + 292);
if ( v28 )
{
v29 = v37;
v30 = *(void (__fastcall **)(_DWORD, _DWORD))(*(_DWORD *)v28 + 72);
v31 = GameManager::sharedState(v27);
v30(
*((_DWORD *)this + 292),
(float)((float)(v29 / *(float *)(*(_DWORD *)(v31 + 404) + 332)) * 1.5) / *(float *)(*((_DWORD *)this + 292) + 348));
if ( *((_BYTE *)this + 1172) )
v32 = -1.0;
else
v32 = 1.0;
(*(void (__fastcall **)(_DWORD, float))(**((_DWORD **)this + 292) + 64))(
*((_DWORD *)this + 292),
COERCE_FLOAT(LODWORD(v32)));
}
v33 = *(int (__fastcall **)(EndPortalObject *, int))(*(_DWORD *)this + 92);
v34 = (*(int (__fastcall **)(EndPortalObject *))(*(_DWORD *)this + 96))(this);
return v33(this, v34);
}