//
// GJGarageLayer::updateRate from 0x140381220 to 0x14038147a (602 bytes)
//
// 2 xrefs:
// > ??> @ 0x1407701d0
// > ??> @ 0x140922928
//
// This function is hookable on this platform (idp: pc, 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 11:31:05 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall GJGarageLayer::updateRate(__int64 a1, __int64 a2)
{
__int64 result; // rax
cocos2d::CCString *v4; // rax
const char *CString; // rsi
cocos2d::CCString *v6; // rax
const char *v7; // rbp
__int64 *v8; // rcx
__int64 v9; // rdx
_QWORD *v10; // rcx
__int64 v11; // rdi
_QWORD *v12; // rbx
__int64 v13; // rdx
cocos2d::CCSpriteFrameCache *v14; // rax
struct cocos2d::CCSpriteFrame *v15; // rax
struct cocos2d::CCSprite *v16; // rdi
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rcx
void *v20; // [rsp+48h] [rbp+10h] BYREF
void *v21; // [rsp+50h] [rbp+18h]
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v20 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
if ( *(_BYTE *)(result + 716) && *(_QWORD *)(a1 + 80) )
{
v4 = cocos2d::CCString::createWithFormat("player_%02d_001.png", 13);
CString = cocos2d::CCString::getCString(v4);
v6 = cocos2d::CCString::createWithFormat("player_%02d_2_001.png", 13);
v7 = cocos2d::CCString::getCString(v6);
v8 = *(__int64 **)(a1 + 80);
v9 = *v8;
LOBYTE(v9) = 1;
(*(void (__fastcall **)(__int64 *, __int64))(*v8 + 576))(v8, v9);
v10 = *(_QWORD **)(a1 + 80);
v11 = *v10;
v12 = v10;
v14 = (cocos2d::CCSpriteFrameCache *)cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache(v10, v13);
v15 = cocos2d::CCSpriteFrameCache::spriteFrameByName(v14, CString);
(*(void (__fastcall **)(_QWORD *, struct cocos2d::CCSpriteFrame *))(v11 + 1008))(v12, v15);
v16 = cocos2d::CCSprite::createWithSpriteFrameName(v7);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(a1 + 80) + 456LL))(
*(_QWORD *)(a1 + 80),
v16,
0xFFFFFFFFLL);
v17 = *(_QWORD *)v16;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v20,
*(float *)(*(_QWORD *)(a1 + 80) + 432LL) * 0.5,
*(float *)(*(_QWORD *)(a1 + 80) + 436LL) * 0.5);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64))(v17 + 184))(v16, v18);
LOWORD(v20) = -20561;
BYTE2(v20) = -81;
(**(void (__fastcall ***)(__int64, void **))(*(_QWORD *)(a1 + 80) + 320LL))(*(_QWORD *)(a1 + 80) + 320LL, &v20);
LOWORD(v20) = -1;
BYTE2(v20) = -1;
(**((void (__fastcall ***)(__int64, void **))v16 + 40))((__int64)v16 + 320, &v20);
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v21 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
*(_QWORD *)(result + 968) = 0;
}
if ( *(_BYTE *)(result + 717) )
{
v19 = *(_QWORD *)(a1 + 72);
if ( v19 )
{
LOBYTE(a2) = 1;
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 576LL))(v19, a2);
result = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v20 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
result = qword_14090BFD0;
}
*(_QWORD *)(result + 968) = 0;
}
}
return result;
}