//
// GJGarageLayer::onSelect from 0x50c9f4 to 0x50cde0 (1004 bytes)
//
// 0 xrefs:
//
// 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:28 +0000
//
GameManager *__fastcall GJGarageLayer::onSelect(SimplePlayer **this, cocos2d::CCObject *a2)
{
GameManager *v4; // r0
signed int v5; // r5
int v6; // r4
int v7; // r0
GameManager *isIconUnlocked; // r0
int (__fastcall *v9)(SimplePlayer **, int, int); // r7
int v10; // r0
int v11; // r0
GameManager *result; // r0
GameManager *v13; // r0
int v14; // r0
int v15; // r9
int v16; // s15
int v17; // r0
int v18; // r9
int v19; // s15
int v20; // r0
int v21; // r9
int v22; // s15
int v23; // r0
int v24; // r9
int v25; // s15
int v26; // r0
int v27; // r9
int v28; // s15
int v29; // r0
int v30; // r9
int v31; // s15
int v32; // r9
int v33; // s15
int v34; // r0
int v35; // r9
int v36; // s15
int v37; // r9
int v38; // s15
int v39; // r0
int v40; // r9
int v41; // s15
int v42; // r0
int v43; // r9
int v44; // s15
int v45; // r0
int v46; // r9
int v47; // s15
int v48; // r1
int v49; // r2
bool v50; // r3
int v51; // r9
void (__fastcall *v52)(int, _BYTE *); // r10
const cocos2d::CCPoint *v53; // r11
GameManager *updated; // r0
GameManager *v55; // r0
int v56; // r7
int (__fastcall *v57)(int, _DWORD); // r9
float v58; // r1
int (__fastcall *v59)(SimplePlayer **, int, int); // r7
int v60; // r0
int v61; // r0
_BYTE v62[8]; // [sp+4h] [bp-10h] BYREF
v4 = (GameManager *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 32))(a2);
v5 = *((_DWORD *)a2 + 96);
v6 = (int)v4;
v7 = GameManager::sharedState(v4);
isIconUnlocked = (GameManager *)GameManager::isIconUnlocked(v7, v6, v5);
if ( !isIconUnlocked )
{
v9 = *((int (__fastcall **)(SimplePlayer **, int, int))*this + 148);
v10 = GameManager::sharedState(nullptr);
v11 = GameManager::iconTypeToUnlockType(v10, v5);
return (GameManager *)v9(this, v6, v11);
}
v13 = (GameManager *)GameManager::sharedState(isIconUnlocked);
*((_BYTE *)v13 + 460) = 0;
if ( v5 == 5 )
{
v34 = GameManager::sharedState(v13);
*(_DWORD *)(v34 + 584) = v6;
v35 = v34;
v36 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v35 + 580) = v36;
*(_DWORD *)(v35 + 576) = v36 + v6;
}
else if ( v5 > 5 )
{
if ( v5 == 8 )
{
v42 = GameManager::sharedState(v13);
*(_DWORD *)(v42 + 692) = v6;
v43 = v42;
v44 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v43 + 688) = v44;
*(_DWORD *)(v43 + 684) = v44 + v6;
}
else if ( v5 > 8 )
{
switch ( v5 )
{
case 'c':
v39 = GameManager::sharedState(v13);
*(_DWORD *)(v39 + 656) = v6;
v40 = v39;
v41 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v40 + 652) = v41;
*(_DWORD *)(v40 + 648) = v41 + v6;
break;
case 'e':
v45 = GameManager::sharedState(v13);
*(_DWORD *)(v45 + 668) = v6;
v46 = v45;
v47 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v46 + 664) = v47;
*(_DWORD *)(v46 + 660) = v47 + v6;
break;
case 'b':
v23 = GameManager::sharedState(v13);
*(_DWORD *)(v23 + 680) = v6;
v24 = v23;
v25 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v24 + 676) = v25;
*(_DWORD *)(v24 + 672) = v25 + v6;
break;
}
}
else
{
v20 = GameManager::sharedState(v13);
if ( v5 == 6 )
{
*(_DWORD *)(v20 + 596) = v6;
v37 = v20;
v38 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v37 + 592) = v38;
*(_DWORD *)(v37 + 588) = v38 + v6;
}
else
{
*(_DWORD *)(v20 + 608) = v6;
v21 = v20;
v22 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v21 + 604) = v22;
*(_DWORD *)(v21 + 600) = v22 + v6;
}
}
}
else if ( v5 == 2 )
{
v29 = GameManager::sharedState(v13);
*(_DWORD *)(v29 + 548) = v6;
v30 = v29;
v31 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v30 + 544) = v31;
*(_DWORD *)(v30 + 540) = v31 + v6;
}
else if ( v5 > 2 )
{
v17 = GameManager::sharedState(v13);
if ( v5 == 3 )
{
*(_DWORD *)(v17 + 560) = v6;
v32 = v17;
v33 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v32 + 556) = v33;
*(_DWORD *)(v32 + 552) = v33 + v6;
}
else
{
*(_DWORD *)(v17 + 572) = v6;
v18 = v17;
v19 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v18 + 568) = v19;
*(_DWORD *)(v18 + 564) = v19 + v6;
}
}
else if ( v5 )
{
if ( v5 == 1 )
{
v14 = GameManager::sharedState(v13);
*(_DWORD *)(v14 + 536) = v6;
v15 = v14;
v16 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v15 + 532) = v16;
*(_DWORD *)(v15 + 528) = v16 + v6;
}
}
else
{
v26 = GameManager::sharedState(v13);
*(_DWORD *)(v26 + 524) = v6;
v27 = v26;
v28 = (int)(float)(vcvts_n_f32_s32(rand(), 0x1Fu) * 1000.0);
*(_DWORD *)(v27 + 520) = v28;
*(_DWORD *)(v27 + 516) = v28 + v6;
}
SimplePlayer::updateColors(*(this + 87));
if ( v5 == 99 )
{
if ( v6 == 2 )
GJGarageLayer::playRainbowEffect((GJGarageLayer *)this, v48, v49, v50);
goto LABEL_33;
}
if ( v5 != 101 )
{
LABEL_33:
v51 = (int)*(this + 97);
goto LABEL_34;
}
v51 = (int)*(this + 98);
LABEL_34:
v52 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)v51 + 92);
v53 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 256))(a2);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_DWORD *)a2 + 96))(a2);
cocos2d::CCNode::convertToWorldSpace((cocos2d::CCNode *)v62, v53);
v52(v51, v62);
result = (GameManager *)(*(int (__fastcall **)(int, int))(*(_DWORD *)v51 + 172))(v51, 1);
if ( (unsigned int)v5 <= 8 )
{
updated = (GameManager *)SimplePlayer::updatePlayerFrame((int)*(this + 87), v6, (int)*(this + 93));
v55 = (GameManager *)GameManager::sharedState(updated);
*((_DWORD *)v55 + 179) = *(this + 93);
v56 = (int)*(this + 87);
v57 = *(int (__fastcall **)(int, _DWORD))(*(_DWORD *)v56 + 80);
if ( *(_DWORD *)(GameManager::sharedState(v55) + 716) == 8 )
v58 = 1.5;
else
v58 = 1.6;
result = (GameManager *)v57(v56, LODWORD(v58));
}
if ( *(this + 104) == (SimplePlayer *)v6 && *(this + 105) == (SimplePlayer *)v5 )
{
v59 = *((int (__fastcall **)(SimplePlayer **, int, int))*this + 148);
v60 = GameManager::sharedState(result);
v61 = GameManager::iconTypeToUnlockType(v60, v5);
result = (GameManager *)v59(this, v6, v61);
}
*(this + 104) = (SimplePlayer *)v6;
*(this + 105) = (SimplePlayer *)v5;
return result;
}