//
// EndLevelLayer::getCoinString from 0x1004c1b80 to 0x1004c1d83 (515 bytes)
//
// 1 xrefs:
// > EndLevelLayer::customSetup @ 0x1004c0cea
//
// 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 __fastcall EndLevelLayer::getCoinString(__int64 a1, __int64 a2)
{
__int64 v2; // rax
int *v4; // rsi
int v5; // r13d
int v6; // r12d
int v7; // r15d
char v8; // al
cocos2d::CCString *v9; // rax
const char *CString; // r14
size_t v11; // rax
size_t v12; // r15
_BYTE *v13; // r12
size_t v15; // r13
std::string v16; // [rsp+0h] [rbp-40h] BYREF
v2 = *(_QWORD *)(a2 + 608);
if ( !v2 )
{
*(_WORD *)a1 = 0;
return a1;
}
strcpy((char *)&v16, "\"all coins");
v4 = *(int **)(v2 + 1936);
v5 = v4[223] - v4[224];
v6 = v4[226] - v4[227];
v7 = v4[229] - v4[230];
if ( v4[212] >= 2 && (v7 == 1 || v6 == 1 || v5 == 1) )
{
std::string::assign(&v16, "coin ");
v8 = 1;
if ( v5 != 1 )
{
std::string::append(&v16, "1");
v8 = 0;
}
if ( v6 != 1 )
{
if ( !v8 )
std::string::append(&v16, ", ");
std::string::append(&v16, "2");
v8 = 0;
}
if ( v7 != 1 && *(int *)(*(_QWORD *)(*(_QWORD *)(a2 + 608) + 1936LL) + 848LL) >= 3 )
{
if ( !v8 )
std::string::append(&v16, ", ");
std::string::append(&v16, "3");
}
}
v9 = (cocos2d::CCString *)sub_1007AB580(
"You need to collect %s to verify the level!",
*(_BYTE *)&v16.__r_.__value_.__l.0);
CString = cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(1.232666695551938e-17);
v12 = v11;
if ( v11 >= 0x17 )
{
v15 = 26;
if ( (v11 | 7) != 0x17 )
v15 = (v11 | 7) + 1;
v13 = operator new(v15);
*(_QWORD *)(a1 + 16) = v13;
*(_QWORD *)a1 = v15 | 1;
*(_QWORD *)(a1 + 8) = v12;
LABEL_26:
memmove(v13, CString, v12);
v13[v12] = 0;
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) == 0 )
return a1;
goto LABEL_21;
}
*(_BYTE *)a1 = 2 * v11;
v13 = (_BYTE *)(a1 + 1);
if ( v11 )
goto LABEL_26;
*v13 = 0;
if ( (*(_BYTE *)&v16.__r_.__value_.__s.0 & 1) != 0 )
LABEL_21:
operator delete(v16.__r_.__value_.__l.__data_);
return a1;
}