//
// SecretLayer2::getErrorMessage from 0x940c80 to 0x94117c (1276 bytes)
//
// 2 xrefs:
// > SecretLayer2::onSubmit @ 0x944a90
// > ??> @ 0x95250
//
// 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 SecretLayer2::getErrorMessage@(SecretLayer2 *this@, __int64 a2@)
{
char v2; // cf
char v3; // zf
int m_errorMessageIndex; // w0
int v7; // w0
double v9; // d0
cocos2d::CCString *v10; // x0
char *v11; // x0
char *v12; // x2
char *v13; // x0
unsigned int *v14; // x2
int v15; // w1
double v16; // d0
cocos2d::CCString *v17; // x0
char *CString; // x0
unsigned int *v19; // x2
double v20; // d0
cocos2d::CCString *v21; // x0
char *v22; // x0
unsigned int *v23; // x2
char *v24; // [xsp+40h] [xbp+40h] BYREF
m_errorMessageIndex = this->m_errorMessageIndex;
if ( m_errorMessageIndex < 0 )
v7 = llroundf((float)((float)rand() * 4.6566e-10) * 30.0);
else
v7 = m_errorMessageIndex + 1;
this->m_errorMessageIndex = v7;
if ( !v3 & v2 )
{
sub_D153B8(a2, "Don't touch that!");
}
else
{
switch ( v7 )
{
case 0:
goto LABEL_4;
case 1:
sub_D153B8(a2, "Swing and a miss!");
return a2;
case 2:
sub_D153B8(a2, "I told you, it wont work...");
return a2;
case 3:
sub_D153B8(a2, "Door is now open. Oh wait, no it's not.");
return a2;
case 4:
sub_D153B8(a2, "Is that actually your guess?");
return a2;
case 5:
GameManager::sharedState();
*(_QWORD *)&v16 = sub_D18D28(&v24).n128_u64[0];
v17 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"Go home %s.", v24, v16);
CString = (char *)cocos2d::CCString::getCString(v17);
sub_D153B8(a2, CString);
v12 = v24;
v13 = v24 - 24;
if ( v24 - 24 == (char *)&qword_124B6B0 )
return a2;
if ( !&pthread_create )
goto LABEL_53;
v19 = (unsigned int *)(v24 - 8);
do
v15 = __ldaxr(v19);
while ( __stlxr(v15 - 1, v19) );
break;
case 6:
sub_D153B8(a2, "Nope");
return a2;
case 7:
sub_D153B8(a2, "Give up, please");
return a2;
case 8:
sub_D153B8(a2, "Door is still locked");
return a2;
case 9:
sub_D153B8(a2, "That tickles!");
return a2;
case 10:
sub_D153B8(a2, "Try harder please");
return a2;
case 11:
sub_D153B8(a2, "Don't make me angry");
return a2;
case 12:
sub_D153B8(a2, "You won't like me when im angry...");
return a2;
case 13:
sub_D153B8(a2, "Oh no, you just unlocked... NOTHING");
return a2;
case 14:
sub_D153B8(a2, "Only 3 attempts left!");
return a2;
case 15:
sub_D153B8(a2, "Only 2 attempts left!");
return a2;
case 16:
sub_D153B8(a2, "LAST ATTEMPT!");
return a2;
case 17:
sub_D153B8(a2, "Just kidding, unlimited attempts");
return a2;
case 18:
sub_D153B8(a2, "Maybe you should do something else?");
return a2;
case 19:
sub_D153B8(a2, "This is getting ridiculus...");
return a2;
case 20:
sub_D153B8(a2, "Go collect some stars");
return a2;
case 21:
sub_D153B8(a2, "How about no?");
return a2;
case 22:
GameManager::sharedState();
*(_QWORD *)&v20 = sub_D18D28(&v24).n128_u64[0];
v21 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s, please give up...",
v24,
v20);
v22 = (char *)cocos2d::CCString::getCString(v21);
sub_D153B8(a2, v22);
v12 = v24;
v13 = v24 - 24;
if ( v24 - 24 == (char *)&qword_124B6B0 )
return a2;
if ( !&pthread_create )
goto LABEL_53;
v23 = (unsigned int *)(v24 - 8);
do
v15 = __ldaxr(v23);
while ( __stlxr(v15 - 1, v23) );
break;
case 23:
sub_D153B8(a2, "Error, error. Bad answers.");
return a2;
case 24:
sub_D153B8(a2, "Failure");
return a2;
case 25:
sub_D153B8(a2, "May I suggest thinking?");
return a2;
case 26:
sub_D153B8(a2, "WRONG");
return a2;
case 27:
sub_D153B8(a2, "You're hopeless...");
return a2;
case 28:
sub_D153B8(a2, "Really, still here?");
return a2;
case 29:
GameManager::sharedState();
*(_QWORD *)&v9 = sub_D18D28(&v24).n128_u64[0];
v10 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"What kind of name is %s anyway?",
v24,
v9);
v11 = (char *)cocos2d::CCString::getCString(v10);
sub_D153B8(a2, v11);
v12 = v24;
v13 = v24 - 24;
if ( v24 - 24 == (char *)&qword_124B6B0 )
return a2;
if ( &pthread_create )
{
v14 = (unsigned int *)(v24 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
LABEL_53:
v15 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v15 - 1;
}
break;
default:
this->m_errorMessageIndex = 0;
LABEL_4:
sub_D153B8(a2, "No, just no");
return a2;
}
if ( v15 <= 0 )
operator delete(v13);
}
return a2;
}