//
// PlayerObject::toggleRobotMode from 0x759184 to 0x7594f4 (880 bytes)
//
// 8 xrefs:
// > PlayerObject::switchedToMode @ 0x759554
// > PlayerObject::switchedToMode @ 0x7595b4
// > PlayerObject::switchedToMode @ 0x7595f4
// > PlayerObject::copyAttributes @ 0x75d470
// > MenuGameLayer::resetPlayer @ 0x7da6c4
// > GJBaseGameLayer::switchToRobotMode @ 0x99dda4
// > GJBaseGameLayer::switchToRobotMode @ 0x99ddbc
// > ??> @ 0xd3720
//
// 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:52:59 +0000
//
__int64 __fastcall PlayerObject::toggleRobotMode(PlayerObject *this, unsigned __int8 a2, unsigned __int8 a3)
{
int v4; // w22
__int64 v5; // x0
__int64 v6; // x3
GameManager *v8; // x0
__int64 v9; // x1
cocos2d::CCString *v10; // x0
size_t v11; // x0
cocos2d::CCSpriteFrameCache **v12; // x23
void (__fastcall *v13)(cocos2d::CCSpriteFrameCache **, __int64); // x24
cocos2d::CCSpriteFrameCache *v14; // x0
char *v15; // x1
__int64 v16; // x0
char v17; // w0
__int64 v18; // x23
__int64 v19; // x0
__int64 v20; // x1
__int64 v21; // x23
char *CString; // [xsp+48h] [xbp+48h]
int v23; // [xsp+58h] [xbp+58h]
__int64 v24[2]; // [xsp+60h] [xbp+60h] BYREF
char *v25; // [xsp+70h] [xbp+70h]
__int64 v26[2]; // [xsp+78h] [xbp+78h] BYREF
void *v27; // [xsp+88h] [xbp+88h]
__int64 v28; // [xsp+90h] [xbp+90h] BYREF
__int64 v29; // [xsp+98h] [xbp+98h]
void *v30; // [xsp+A0h] [xbp+A0h]
v4 = a3;
if ( *((unsigned __int8 *)this + 2421) != a2 )
{
v5 = *((_QWORD *)this + 328);
*((_BYTE *)this + 2421) = a2;
v6 = *((_QWORD *)this + 170);
*((_QWORD *)this + 245) = v5;
if ( a2 )
{
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v6 + 464LL))(v6, *((_QWORD *)this + 372), 2);
PlayerObject::switchedToMode(this, 27);
*((double *)this + 256) = 1.5;
PlayerObject::stopRotation(this);
v8 = (GameManager *)(*(__int64 (__fastcall **)(PlayerObject *, float))(*(_QWORD *)this + 360LL))(this, 0.0);
v9 = GameManager::sharedState(v8);
LODWORD(v9) = *(_DWORD *)(v9 + 776) - *(_DWORD *)(v9 + 780);
if ( (int)v9 > 68 )
LODWORD(v9) = 68;
if ( (int)v9 <= 0 )
v9 = 1;
else
v9 = (unsigned int)v9;
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"robot_%02d_01_001.png",
(const char *)v9);
v24[0] = 0;
CString = (char *)cocos2d::CCString::getCString(v10);
v24[1] = 0;
v25 = nullptr;
v11 = strlen(CString);
std::string::__init(v24, CString, v11);
v12 = *((cocos2d::CCSpriteFrameCache ***)this + 225);
v13 = *((void (__fastcall **)(cocos2d::CCSpriteFrameCache **, __int64))*v12 + 145);
v14 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(*v12);
v15 = (char *)v24 + 1;
if ( (v24[0] & 1) != 0 )
v15 = v25;
v16 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, v15);
v13(v12, v16);
if ( *((_BYTE *)this + 2832) && *((double *)this + 339) == 0.0 )
{
v21 = *((_QWORD *)this + 267);
v26[0] = 0;
v26[1] = 0;
v27 = nullptr;
std::string::__init(v26, "idle01", 6u);
CCAnimatedSprite::runAnimation(v21, (char *)v26);
if ( (v26[0] & 1) != 0 )
operator delete(v27);
}
else
{
v17 = *((_BYTE *)this + 2944);
v28 = 0;
v29 = 0;
v30 = nullptr;
v18 = *((_QWORD *)this + 267);
if ( (v17 & 1) != 0 )
{
std::string::__init(&v28, *((void **)this + 370), *((_QWORD *)this + 369));
}
else
{
v19 = *((_QWORD *)this + 368);
v20 = *((_QWORD *)this + 369);
v30 = *((void **)this + 370);
v28 = v19;
v29 = v20;
}
CCAnimatedSprite::runAnimation(v18, (char *)&v28);
if ( (v28 & 1) != 0 )
operator delete(v30);
}
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 225) + 344LL))(*((_QWORD *)this + 225), 0);
if ( !v4 )
{
LOWORD(v23) = 13055;
BYTE2(v23) = 50;
PlayerObject::spawnPortalCircle((__int64)this, v23, 50.0);
}
PlayerObject::updatePlayerScale((GJActionManager **)this);
if ( (v24[0] & 1) != 0 )
operator delete(v25);
PlayerObject::updatePlayerGlow(this);
PlayerObject::stopRotation(this);
PlayerObject::modeDidChange(this);
}
else
{
(*(void (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v6 + 552LL))(v6, *((_QWORD *)this + 372), 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 225) + 344LL))(*((_QWORD *)this + 225), 1);
SpriteAnimationManager::stopAnimations(*(SpriteAnimationManager **)(*((_QWORD *)this + 267) + 648LL));
if ( *((float *)this + 618) != 1.0 && *((_BYTE *)this + 2648) )
PlayerObject::updatePlayerFrame(this, 0);
else
PlayerObject::updatePlayerFrame(this, *((_DWORD *)this + 390));
PlayerObject::updatePlayerGlow(this);
PlayerObject::stopRotation(this);
}
}
return _stack_chk_guard;
}