//
// EndLevelLayer::getCoinString from 0x7d391c to 0x7d3b8c (624 bytes)
//
// 2 xrefs:
// > EndLevelLayer::customSetup @ 0x7d7254
// > ??> @ 0xb47e0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __usercall EndLevelLayer::getCoinString@(EndLevelLayer *this@, __int64 a2@)
{
GJGameLevel *m_level; // x0
__int64 random; // x3
bool v6; // cc
__int64 seed; // x5
__int64 v8; // x2
__int64 v9; // x4
int v10; // w1
int v11; // w0
_BOOL4 v12; // w25
_BOOL4 v13; // w24
_BOOL4 v14; // w26
cocos2d::CCString *v15; // x0
char *CString; // x0
char *v17; // x0
int v19; // w0
unsigned int *v20; // x2
int v21; // w1
char *v22; // [xsp+60h] [xbp+60h] BYREF
if ( !this->m_playLayer )
{
sub_D153B8(a2, &byte_F288A0);
return a2;
}
sub_D153B8((int)&v22, "all coins");
m_level = this->m_playLayer->m_level;
random = (unsigned int)m_level->m_firstCoinVerified.random;
v6 = m_level->m_coins <= 1;
seed = (unsigned int)m_level->m_firstCoinVerified.seed;
v8 = (unsigned int)m_level->m_secondCoinVerified.random;
v9 = (unsigned int)m_level->m_secondCoinVerified.seed;
v10 = m_level->m_thirdCoinVerified.random;
v11 = m_level->m_thirdCoinVerified.seed;
if ( !v6 )
{
random = (unsigned int)(random - seed);
v8 = (unsigned int)(v8 - v9);
v12 = random == 1;
v13 = v8 == 1;
v14 = v10 - v11 == 1;
if ( v13 || v12 || v10 - v11 == 1 )
{
sub_D1798C(&v22, "coin ", 5);
if ( v12 )
{
if ( v13 )
{
v19 = 1;
goto LABEL_11;
}
sub_D15FD4(&v22, "2", 9);
}
else
{
sub_D15FD4(&v22, "1", 9);
if ( !v13 )
{
sub_D15FD4(&v22, ", ", 2);
sub_D15FD4(&v22, "2", 9);
}
}
v19 = 0;
LABEL_11:
if ( !v14 && this->m_playLayer->m_level->m_coins > 2 )
{
if ( !v19 )
sub_D15FD4(&v22, ", ", 2);
sub_D15FD4(&v22, "3", 9);
}
}
}
v15 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"You need to collect %s to verify the level!",
v22,
v8,
random,
v9,
seed);
CString = (char *)cocos2d::CCString::getCString(v15);
sub_D153B8(a2, CString);
v17 = v22 - 24;
if ( v22 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v22 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v22 - 2);
*((_DWORD *)v22 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v17);
}
return a2;
}