//
// GJBaseGameLayer::speedForShaderTarget from 0x140223600 to 0x140223700 (256 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::updateShaderLayer @ 0x1402226ba
// > GJBaseGameLayer::updateShaderLayer @ 0x1402226e1
// > ??> @ 0x1406cd5a8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
cocos2d::CCPoint GJBaseGameLayer::speedForShaderTarget(GJBaseGameLayer *a1, int a2)
{
int v2; // r8d
int v4; // ebx
cocos2d::CCPoint v5; // rdi
PlayerObject *m_player2; // rbx
GameObject *MainObject; // rax
GameObject *v8; // rbx
__int64 v9; // rax
char *v10; // rdx
char *v11; // rax
char *v12; // rax
__int64 v13; // rax
cocos2d::CCPoint v15; // [rsp+20h] [rbp-18h] BYREF
char v16; // [rsp+48h] [rbp+10h] BYREF
char v17; // [rsp+58h] [rbp+20h] BYREF
v4 = v2;
v5 = *(cocos2d::CCPoint *)&a2;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)a2);
if ( v4 == -1 )
goto LABEL_10;
if ( v4 == -2 )
{
if ( a1->m_gameState.m_isDualMode )
{
m_player2 = a1->m_player2;
LABEL_11:
v13 = (__int64)m_player2->getPosition_0(m_player2);
cocos2d::CCPoint::operator-(v13, &v16, &m_player2->m_lastPosition);
v10 = &v16;
goto LABEL_12;
}
LABEL_10:
m_player2 = a1->m_player1;
goto LABEL_11;
}
if ( v4 < 1 )
{
cocos2d::CCPoint::operator-(&a1->m_gameState.m_cameraStepDiff, &v16);
v10 = v12;
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject(a1, v4);
v8 = MainObject;
if ( MainObject )
{
v9 = ((__int64 (__fastcall *)(GameObject *, char *))MainObject->getRealPosition)(MainObject, &v17);
cocos2d::CCPoint::operator-(v9, &v16, &v8->m_lastPosition);
v10 = &v16;
}
else
{
cocos2d::CCPoint::CCPoint(&v15);
v10 = v11;
}
}
LABEL_12:
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(v5, v10);
return v5;
}