//
// GameStatsManager::checkCoinAchievement from 0x100032440 to 0x10003289c (1116 bytes)
//
// 4 xrefs:
// > PlayLayer::levelComplete @ 0x1000814b3
// > GameManager::dataLoaded @ 0x100374383
// > GameManager::dataLoaded @ 0x1003743aa
// > GameManager::dataLoaded @ 0x1003743d1
//
// 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 12:19:31 +0000
//
__m128 __fastcall GameStatsManager::checkCoinAchievement(__int64 a1, _DWORD *a2)
{
int v2; // eax
__int64 CoinKey_1; // rax
unsigned __int8 v4; // al
int v5; // r15d
__int64 v6; // rax
unsigned __int8 v7; // al
int v8; // r12d
__int64 v9; // rsi
unsigned __int8 v10; // al
int v11; // ebx
__int64 v12; // rdx
__int64 v13; // rax
__m128 v14; // xmm0
__int64 v15; // rdx
const char *v16; // rsi
__int64 v17; // rax
unsigned __int8 v18; // al
int v19; // r15d
__int64 v20; // rax
unsigned __int8 v21; // al
int v22; // r12d
__int64 v23; // rsi
__m128 v24; // xmm0
unsigned __int8 v25; // al
unsigned int v26; // ebx
__int64 v27; // rdx
__int64 v28; // rax
__int64 v29; // rax
int v30; // r15d
__int64 v31; // rax
int v32; // r12d
__int64 v33; // rsi
__m128 v34; // xmm0
unsigned __int8 v35; // al
__int64 v36; // rdx
__int64 v37; // rax
unsigned __int8 v38; // al
int v39; // r15d
__int64 v40; // rax
unsigned __int8 v41; // al
int v42; // r12d
__int64 v43; // rsi
unsigned __int8 v44; // al
int v45; // ebx
__int64 v46; // rdx
__m128 v47; // xmm0
__int64 v48; // rax
unsigned __int8 v49; // al
int v50; // r15d
__int64 v51; // rax
unsigned __int8 v52; // al
int v53; // r12d
__int64 v54; // rsi
unsigned __int8 v55; // al
int v56; // ebx
__int64 v57; // rdx
__m128 v58; // xmm0
__int64 v59; // rax
unsigned __int8 v60; // al
int v61; // r15d
__int64 v62; // rax
unsigned __int8 v63; // al
int v64; // r12d
__int64 v65; // rsi
unsigned __int8 v66; // al
int v67; // ebx
__int64 v68; // rdx
__m128 v69; // xmm0
__int64 v70; // rdi
__int64 v71; // rax
unsigned __int8 v72; // al
int v73; // r15d
__int64 v74; // rax
unsigned __int8 v75; // al
int v76; // r12d
__int64 v77; // rsi
__m128 v78; // xmm0
unsigned __int8 v79; // al
__int64 v80; // rdx
__m128 result; // xmm0
if ( a2[285] == 1 )
{
v2 = a2[82] - a2[83];
if ( v2 > 5000 )
{
switch ( v2 )
{
case 5001:
CoinKey_1 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, CoinKey_1);
v5 = v4;
v6 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v6);
v8 = v5 + v7;
v9 = GJGameLevel::getCoinKey_1(a2, 3);
GameStatsManager::hasSecretCoin(a1, v9);
v11 = v8 + v10;
v14 = GameManager::sharedState(a1, v9, v12);
v14.f32[0] = (float)((float)v11 / 3.0) * 100.0;
v15 = (unsigned int)(int)_mm_round_ss(v14, v14, 9).f32[0];
v16 = "geometry.ach.tower01Coin";
goto LABEL_14;
case 5002:
v59 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, v59);
v61 = v60;
v62 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v62);
v64 = v61 + v63;
v65 = GJGameLevel::getCoinKey_1(a2, 3);
GameStatsManager::hasSecretCoin(a1, v65);
v67 = v64 + v66;
v69 = GameManager::sharedState(a1, v65, v68);
v69.f32[0] = (float)((float)v67 / 3.0) * 100.0;
v15 = (unsigned int)(int)_mm_round_ss(v69, v69, 9).f32[0];
v16 = "geometry.ach.tower02Coin";
goto LABEL_14;
case 5003:
v37 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, v37);
v39 = v38;
v40 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v40);
v42 = v39 + v41;
v43 = GJGameLevel::getCoinKey_1(a2, 3);
GameStatsManager::hasSecretCoin(a1, v43);
v45 = v42 + v44;
v47 = GameManager::sharedState(a1, v43, v46);
v47.f32[0] = (float)((float)v45 / 3.0) * 100.0;
v15 = (unsigned int)(int)_mm_round_ss(v47, v47, 9).f32[0];
v16 = "geometry.ach.tower03Coin";
goto LABEL_14;
case 5004:
v48 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, v48);
v50 = v49;
v51 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v51);
v53 = v50 + v52;
v54 = GJGameLevel::getCoinKey_1(a2, 3);
GameStatsManager::hasSecretCoin(a1, v54);
v56 = v53 + v55;
v58 = GameManager::sharedState(a1, v54, v57);
v58.f32[0] = (float)((float)v56 / 3.0) * 100.0;
v15 = (unsigned int)(int)_mm_round_ss(v58, v58, 9).f32[0];
v16 = "geometry.ach.tower04Coin";
LABEL_14:
v70 = v13;
return GameManager::reportAchievementWithID(v70, v16, v15, 0);
default:
return result;
}
}
switch ( v2 )
{
case 14:
v29 = GJGameLevel::getCoinKey_1(a2, 1);
v30 = (unsigned __int8)((__int64 (__fastcall *)(__int64, __int64))GameStatsManager::hasSecretCoin)(a1, v29);
v31 = GJGameLevel::getCoinKey_1(a2, 2);
v32 = v30
+ (unsigned __int8)((__int64 (__fastcall *)(__int64, __int64))GameStatsManager::hasSecretCoin)(a1, v31);
v33 = GJGameLevel::getCoinKey_1(a2, 3);
v34 = GameStatsManager::hasSecretCoin(a1, v33);
v34.f32[0] = (float)((float)(v32 + v35) / 3.0) * 100.0;
v26 = (int)fminf(_mm_round_ss(v34, v34, 9).f32[0], 100.0);
GameManager::sharedState(a1, v33, v36);
v16 = "geometry.ach.demoncoin01";
break;
case 18:
v71 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, v71);
v73 = v72;
v74 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v74);
v76 = v73 + v75;
v77 = GJGameLevel::getCoinKey_1(a2, 3);
v78 = GameStatsManager::hasSecretCoin(a1, v77);
v78.f32[0] = (float)((float)(v76 + v79) / 3.0) * 100.0;
v26 = (int)fminf(_mm_round_ss(v78, v78, 9).f32[0], 100.0);
GameManager::sharedState(a1, v77, v80);
v16 = "geometry.ach.demoncoin02";
break;
case 20:
v17 = GJGameLevel::getCoinKey_1(a2, 1);
GameStatsManager::hasSecretCoin(a1, v17);
v19 = v18;
v20 = GJGameLevel::getCoinKey_1(a2, 2);
GameStatsManager::hasSecretCoin(a1, v20);
v22 = v19 + v21;
v23 = GJGameLevel::getCoinKey_1(a2, 3);
v24 = GameStatsManager::hasSecretCoin(a1, v23);
v24.f32[0] = (float)((float)(v22 + v25) / 3.0) * 100.0;
v26 = (int)fminf(_mm_round_ss(v24, v24, 9).f32[0], 100.0);
GameManager::sharedState(a1, v23, v27);
v16 = "geometry.ach.demoncoin03";
break;
default:
return result;
}
v70 = v28;
v15 = v26;
return GameManager::reportAchievementWithID(v70, v16, v15, 0);
}
return result;
}