//
// GJBaseGameLayer::hasUniqueCoin from 0x14031dc20 to 0x14031de01 (481 bytes)
//
// 6 xrefs:
// > EnhancedGameObject::updateUserCoin @ 0x1402a39e1
// > GameObject::playDestroyObjectAnim @ 0x1402a85e0
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031cfe7
// > GJBaseGameLayer::collisionCheckObjects @ 0x14031d0d6
// > PlayLayer::loadFromCheckpoint @ 0x140516f41
// > ??> @ 0x14091ec80
//
// 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:30:21 +0000
//
// Hidden C++ exception states: #wind=3
bool __fastcall GJBaseGameLayer::hasUniqueCoin(__int64 a1, unsigned int *a2)
{
_DWORD *v4; // rcx
unsigned int v5; // eax
char *CoinKey; // rdi
__int64 v8; // rcx
__int64 v9; // rcx
void *v10; // [rsp+30h] [rbp+8h]
void *v11; // [rsp+30h] [rbp+8h]
void *v12; // [rsp+30h] [rbp+8h]
v4 = *(_DWORD **)(a1 + 2168);
if ( v4[305] == 2 )
{
if ( (*(unsigned int (__fastcall **)(unsigned int *))(*(_QWORD *)a2 + 1648LL))(a2) == 31 )
{
v5 = a2[452];
switch ( v5 )
{
case 1u:
return *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1080LL) - *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1084LL) == 1;
case 2u:
return *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1092LL) - *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1096LL) == 1;
case 3u:
return *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1104LL) - *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1108LL) == 1;
}
}
return 0;
}
CoinKey = (char *)GJGameLevel::getCoinKey((__int64)v4, a2[452], v4[248] - v4[249]);
v8 = qword_14090BFE0;
if ( *(_DWORD *)(*(_QWORD *)(a1 + 2168) + 1220LL) == 1 )
{
if ( !qword_14090BFE0 )
{
v10 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v8 = qword_14090BFE0;
}
return GameStatsManager::hasSecretCoin(v8, CoinKey);
}
else
{
if ( !qword_14090BFE0 )
{
v11 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v8 = qword_14090BFE0;
}
if ( !GameStatsManager::hasUserCoin(v8, CoinKey) )
{
v9 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v12 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v9 = qword_14090BFE0;
}
if ( !GameStatsManager::hasPendingUserCoin(v9, CoinKey) )
return 0;
}
return 1;
}
}