//
// GameManager::checkSteamAchievementUnlock from 0x140279180 to 0x1402797e3 (1635 bytes)
//
// 3 xrefs:
// > GameManager::reportPercentageForLevel @ 0x140278fb6
// > GameManager::dataLoaded @ 0x1402849ed
// > ??> @ 0x14091ce08
//
// 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:28:56 +0000
//
// Hidden C++ exception states: #wind=4
int __cdecl GameManager::checkSteamAchievementUnlock(int C, int Type, _locale_t Locale)
{
__int64 v3; // rbx
cocos2d::CCString *v4; // rax
__int64 v5; // rcx
int v6; // ebx
__int64 v7; // r8
unsigned __int64 v8; // rdx
void *v9; // r8
__int64 v10; // rbx
cocos2d::CCString *v11; // rax
int v12; // ebx
void *v13; // r8
__int64 v14; // rbx
cocos2d::CCString *v15; // rax
int v16; // ebx
void *v17; // r8
__int64 v18; // rdi
__int64 v19; // rbx
cocos2d::CCString *v20; // rax
int v21; // ebx
void *v22; // r8
__int64 v23; // rdx
__int64 v24; // rcx
__int64 v25; // r8
__int64 v26; // rax
__int64 v27; // rbx
cocos2d::CCString *v28; // rax
int result; // eax
__int64 v30; // rcx
__int64 v31; // r8
int v32; // ebx
unsigned __int64 v33; // rdx
void *v34; // r8
__int64 v35; // rdi
__int64 v36; // rbx
cocos2d::CCString *v37; // rax
int v38; // ebx
void *v39; // r8
__int64 v40; // rdx
__int64 v41; // rcx
__int64 v42; // r8
__int64 v43; // rax
void *v44; // [rsp+30h] [rbp-50h]
void *v45; // [rsp+30h] [rbp-50h]
void *Block[2]; // [rsp+38h] [rbp-48h] BYREF
__int64 v47; // [rsp+48h] [rbp-38h]
unsigned __int64 v48; // [rsp+50h] [rbp-30h]
void *v49[2]; // [rsp+58h] [rbp-28h] BYREF
__int64 v50; // [rsp+68h] [rbp-18h]
unsigned __int64 v51; // [rsp+70h] [rbp-10h]
v3 = AchievementManager::sharedState(C, Type, Locale);
*(_OWORD *)Block = 0;
Block[0] = sub_14003D460(0x20u);
v47 = 21;
v48 = 31;
strcpy((char *)Block[0], "geometry.ach.level01b");
v4 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v3 + 352), Block);
v6 = cocos2d::CCString::intValue(v4);
v8 = v48;
if ( v48 > 0xF )
{
v9 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
if ( v6 >= 100 )
{
v10 = AchievementManager::sharedState(v5, v8, v7);
*(_OWORD *)Block = 0;
v47 = 0;
v48 = 0;
Block[0] = sub_14003D460(0x20u);
v47 = 21;
v48 = 31;
strcpy((char *)Block[0], "geometry.ach.level02b");
v11 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v10 + 352), Block);
v12 = cocos2d::CCString::intValue(v11);
v8 = v48;
if ( v48 > 0xF )
{
v13 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v13 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v13 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v13);
}
if ( v12 >= 100 )
{
v14 = AchievementManager::sharedState(v5, v8, v7);
*(_OWORD *)Block = 0;
v47 = 0;
v48 = 0;
Block[0] = sub_14003D460(0x20u);
v47 = 21;
v48 = 31;
strcpy((char *)Block[0], "geometry.ach.level03b");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v14 + 352), Block);
v16 = cocos2d::CCString::intValue(v15);
v8 = v48;
if ( v48 > 0xF )
{
v17 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
v47 = 0;
v48 = 15;
LOBYTE(Block[0]) = 0;
if ( v16 >= 100 )
{
v18 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v44 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v44);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v18 = qword_14090BFD0;
}
v19 = AchievementManager::sharedState(v5, v8, v7);
*(_OWORD *)v49 = 0;
v50 = 0;
v51 = 0;
v49[0] = sub_14003D460(0x20u);
v50 = 20;
v51 = 31;
strcpy((char *)v49[0], "geometry.ach.steam01");
v20 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v19 + 352), v49);
v21 = cocos2d::CCString::intValue(v20);
v8 = v51;
if ( v51 > 0xF )
{
v22 = v49[0];
if ( v51 + 1 >= 0x1000 )
{
v22 = *((void **)v49[0] - 1);
if ( (unsigned __int64)((char *)v49[0] - (char *)v22 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v22);
}
if ( v21 < 100 )
{
*(_OWORD *)v49 = 0;
v50 = 0;
v51 = 0;
v49[0] = sub_14003D460(0x20u);
v50 = 20;
v51 = 31;
strcpy((char *)v49[0], "geometry.ach.steam01");
GameManager::completedAchievement(v18, (__int64)v49);
v26 = AchievementManager::sharedState(v24, v23, v25);
AchievementManager::reportAchievementWithID(v26, (__int64)"geometry.ach.steam01", 100);
}
}
}
}
v27 = AchievementManager::sharedState(v5, v8, v7);
*(_OWORD *)Block = 0;
v47 = 0;
v48 = 0;
Block[0] = sub_14003D460(0x20u);
v47 = 21;
v48 = 31;
strcpy((char *)Block[0], "geometry.ach.level14b");
v28 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v27 + 352), Block);
result = cocos2d::CCString::intValue(v28);
v32 = result;
v33 = v48;
if ( v48 > 0xF )
{
v34 = Block[0];
if ( v48 + 1 >= 0x1000 )
{
v34 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v34 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v34);
}
v47 = 0;
v48 = 15;
LOBYTE(Block[0]) = 0;
if ( v32 >= 100 )
{
v35 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v45 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v45);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v35 = qword_14090BFD0;
}
v36 = AchievementManager::sharedState(v30, v33, v31);
*(_OWORD *)v49 = 0;
v50 = 0;
v51 = 0;
v49[0] = sub_14003D460(0x20u);
v50 = 20;
v51 = 31;
strcpy((char *)v49[0], "geometry.ach.steam02");
v37 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v36 + 352), v49);
result = cocos2d::CCString::intValue(v37);
v38 = result;
if ( v51 > 0xF )
{
v39 = v49[0];
if ( v51 + 1 >= 0x1000 )
{
v39 = *((void **)v49[0] - 1);
if ( (unsigned __int64)((char *)v49[0] - (char *)v39 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v39);
}
if ( v38 < 100 )
{
*(_OWORD *)v49 = 0;
v50 = 0;
v51 = 0;
v49[0] = sub_14003D460(0x20u);
v50 = 20;
v51 = 31;
strcpy((char *)v49[0], "geometry.ach.steam02");
GameManager::completedAchievement(v35, (__int64)v49);
v43 = AchievementManager::sharedState(v41, v40, v42);
AchievementManager::reportAchievementWithID(v43, (__int64)"geometry.ach.steam02", 100);
}
}
return result;
}