//
// SecretLayer4::onSubmit from 0x100354ea4 to 0x100355858 (2484 bytes)
//
// 1 xrefs:
// > SecretLayer4::init @ 0x1003545bc
//
// 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
//
void __fastcall SecretLayer4::onSubmit(SecretLayer4 *a1, cocos2d::CCObject *a2)
{
std::string::size_type size; // x9
__int64 v4; // x19
unsigned __int64 v5; // x8
unsigned int v6; // w20
std::string *p_dst; // x8
std::string::value_type v8; // w0
std::string *v9; // x8
std::string::size_type v10; // x9
std::string::size_type v12; // x20
std::string::size_type v13; // x8
std::string *v14; // x28
std::string::size_type v15; // x27
unsigned __int64 v16; // x24
std::string::size_type v17; // x19
void **v18; // x21
signed __int64 v19; // x22
signed __int64 v20; // x9
char *v21; // x25
char *v22; // x0
int v23; // w20
char *v24; // x0
char *v25; // x23
std::string::size_type v26; // x2
const std::string::value_type *v27; // x3
std::string::size_type v28; // x4
std::string::size_type v29; // x8
CCTextInputNode *m_searchInput; // x20
_BOOL4 v31; // w0
_BOOL4 v32; // w20
AchievementManager *v33; // x0
GameManager *v34; // x0
cocos2d::CCLabelBMFont *m_messageLabel; // x0
_BOOL4 v36; // w0
_BOOL4 v37; // w20
AchievementManager *v38; // x0
GameManager *v39; // x0
cocos2d::CCLabelBMFont *v40; // x0
_BOOL4 v41; // w20
AchievementManager *v42; // x0
GameManager *v43; // x0
cocos2d::CCLabelBMFont *v44; // x0
_BOOL4 v45; // w0
_BOOL4 v46; // w20
AchievementManager *v47; // x0
GameManager *v48; // x0
cocos2d::CCLabelBMFont *v49; // x0
_BOOL4 v50; // w20
AchievementManager *v51; // x0
GameManager *v52; // x0
cocos2d::CCLabelBMFont *v53; // x0
_BOOL4 v54; // w20
AchievementManager *v55; // x0
GameManager *v56; // x0
cocos2d::CCLabelBMFont *v57; // x0
_BOOL4 v58; // w20
AchievementManager *v59; // x0
GameManager *v60; // x0
cocos2d::CCLabelBMFont *v61; // x0
std::string::size_type v62; // x8
cocos2d::CCLabelBMFont *v63; // x0
int m_selectedThread; // w19
void *v65; // x1
void *v66; // [xsp+0h] [xbp-1B0h] BYREF
char v67; // [xsp+17h] [xbp-199h]
void *v68[2]; // [xsp+18h] [xbp-198h] BYREF
char v69; // [xsp+2Fh] [xbp-181h]
void *v70[2]; // [xsp+30h] [xbp-180h] BYREF
char v71; // [xsp+47h] [xbp-169h]
void *v72[2]; // [xsp+48h] [xbp-168h] BYREF
char v73; // [xsp+5Fh] [xbp-151h]
void *v74[2]; // [xsp+60h] [xbp-150h] BYREF
char v75; // [xsp+77h] [xbp-139h]
void *v76[2]; // [xsp+78h] [xbp-138h] BYREF
char v77; // [xsp+8Fh] [xbp-121h]
void *v78[2]; // [xsp+90h] [xbp-120h] BYREF
char v79; // [xsp+A7h] [xbp-109h]
void *v80[2]; // [xsp+A8h] [xbp-108h] BYREF
char v81; // [xsp+BFh] [xbp-F1h]
void *v82[2]; // [xsp+C0h] [xbp-F0h] BYREF
char v83; // [xsp+D7h] [xbp-D9h]
void *__p[2]; // [xsp+D8h] [xbp-D8h] BYREF
char v85; // [xsp+EFh] [xbp-C1h]
std::string::value_type *v86; // [xsp+F0h] [xbp-C0h] BYREF
std::string::size_type v87; // [xsp+F8h] [xbp-B8h]
unsigned __int8 v88; // [xsp+107h] [xbp-A9h]
void **v89; // [xsp+108h] [xbp-A8h] BYREF
signed __int64 v90; // [xsp+110h] [xbp-A0h]
char v91; // [xsp+11Fh] [xbp-91h]
std::string __dst; // [xsp+120h] [xbp-90h] BYREF
std::string v93; // [xsp+140h] [xbp-70h] BYREF
CCTextInputNode::getString((__int64)a1->m_searchInput, &v93);
if ( SHIBYTE(v93.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v93.__r_.__value_.__l.__data_, v93.__r_.__value_.__l.__size_);
else
__dst = v93;
size = __dst.__r_.__value_.__l.__size_;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( size )
{
v4 = 0;
v5 = (unsigned __int64)SHIBYTE(__dst.__r_.__value_.__r.__words[2]) >> 63;
v6 = 1;
do
{
if ( (v5 & 1) != 0 )
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
else
p_dst = &__dst;
v8 = __tolower(p_dst->__r_.__value_.__s.__data_[v4]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v9 = &__dst;
else
v9 = (std::string *)__dst.__r_.__value_.__r.__words[0];
v9->__r_.__value_.__s.__data_[v4] = v8;
v4 = v6;
v10 = SHIBYTE(__dst.__r_.__value_.__r.__words[2]);
v5 = (unsigned __int64)SHIBYTE(__dst.__r_.__value_.__r.__words[2]) >> 63;
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v10 = __dst.__r_.__value_.__l.__size_;
}
while ( v10 > v6++ );
}
sub_100009900(&v89, " ");
sub_100009900(&v86, "");
v12 = 0;
v13 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &__dst;
else
v14 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v13 = __dst.__r_.__value_.__l.__size_;
v15 = v91;
v16 = (unsigned __int64)v91 >> 63;
v17 = v90;
if ( v91 >= 0 )
v18 = (void **)&v89;
else
v18 = v89;
if ( v91 >= 0 )
v19 = v91;
else
v19 = v90;
while ( !v19 )
{
LABEL_38:
if ( v12 != -1 )
{
if ( (v16 & 1) != 0 )
v26 = v17;
else
v26 = v15;
if ( (v88 & 0x80u) == 0 )
v27 = (const std::string::value_type *)&v86;
else
v27 = v86;
if ( (v88 & 0x80u) == 0 )
v28 = v88;
else
v28 = v87;
std::string::replace(&__dst, v12, v26, v27, v28);
v29 = v88;
if ( (v88 & 0x80u) != 0 )
v29 = v87;
v12 += v29;
v13 = HIBYTE(__dst.__r_.__value_.__r.__words[2]);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &__dst;
else
v14 = (std::string *)__dst.__r_.__value_.__r.__words[0];
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v13 = __dst.__r_.__value_.__l.__size_;
v15 = v91;
v16 = (unsigned __int64)v91 >> 63;
v17 = v90;
v18 = v91 >= 0 ? (void **)&v89 : v89;
v19 = v91 >= 0 ? v91 : v90;
if ( v13 >= v12 )
continue;
}
goto LABEL_62;
}
v20 = v13 - v12;
if ( (__int64)(v13 - v12) >= v19 )
{
v21 = (char *)v14 + v13;
v22 = (char *)v14 + v12;
v23 = *(char *)v18;
do
{
if ( v20 - v19 == -1 )
break;
v24 = (char *)memchr(v22, v23, v20 - v19 + 1);
if ( !v24 )
break;
v25 = v24;
if ( !memcmp(v24, v18, v19) )
{
if ( v25 == v21 )
break;
v12 = v25 - (char *)v14;
goto LABEL_38;
}
v22 = v25 + 1;
v20 = v21 - (v25 + 1);
}
while ( v20 >= v19 );
}
LABEL_62:
if ( (char)v88 < 0 )
{
operator delete(v86);
if ( (v91 & 0x80) == 0 )
goto LABEL_64;
}
else if ( (v15 & 0x80) == 0 )
{
goto LABEL_64;
}
operator delete(v89);
LABEL_64:
m_searchInput = a1->m_searchInput;
sub_100009900(__p, "");
CCTextInputNode::setString(m_searchInput, (__int64 **)__p);
if ( v85 < 0 )
operator delete(__p[0]);
sub_100009900(&v89, "darkness");
v31 = sub_1000045BC(&__dst, &v89);
v32 = v31;
if ( v91 < 0 )
{
operator delete(v89);
if ( v32 )
{
LABEL_68:
v33 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v33, "geometry.ach.v3.secret01") )
{
v34 = GameManager::sharedState();
GameManager::reportAchievementWithID(v34, "geometry.ach.v3.secret01", 100, 0);
sub_100009900(v82, "Impressive");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v82);
if ( v83 < 0 )
operator delete(v82[0]);
m_messageLabel = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))m_messageLabel->setColor)(m_messageLabel, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
LABEL_125:
a1->m_selectedThread = 0;
goto LABEL_138;
}
goto LABEL_132;
}
}
else if ( v31 )
{
goto LABEL_68;
}
sub_100009900(&v89, "silence");
v36 = sub_1000045BC(&__dst, &v89);
v37 = v36;
if ( v91 < 0 )
{
operator delete(v89);
if ( v37 )
{
LABEL_77:
v38 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v38, "geometry.ach.v3.secret02") )
{
v39 = GameManager::sharedState();
GameManager::reportAchievementWithID(v39, "geometry.ach.v3.secret02", 100, 0);
sub_100009900(v80, "Something you always ruin...");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v80);
if ( v81 < 0 )
operator delete(v80[0]);
v40 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v40->setColor)(v40, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v36 )
{
goto LABEL_77;
}
sub_100009900(&v89, "river");
if ( sub_1000045BC(&__dst, &v89) )
{
v41 = 1;
}
else
{
sub_100009900(&v86, "ariver");
v41 = sub_1000045BC(&__dst, &v86);
if ( (char)v88 < 0 )
operator delete(v86);
}
if ( v91 < 0 )
{
operator delete(v89);
if ( v41 )
{
LABEL_88:
v42 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v42, "geometry.ach.v3.secret03") )
{
v43 = GameManager::sharedState();
GameManager::reportAchievementWithID(v43, "geometry.ach.v3.secret03", 100, 0);
sub_100009900(v78, "Be like water my friend");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v78);
if ( v79 < 0 )
operator delete(v78[0]);
v44 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v44->setColor)(v44, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v41 )
{
goto LABEL_88;
}
sub_100009900(&v89, "hunger");
v45 = sub_1000045BC(&__dst, &v89);
v46 = v45;
if ( v91 < 0 )
{
operator delete(v89);
if ( v46 )
{
LABEL_95:
v47 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v47, "geometry.ach.v3.secret04") )
{
v48 = GameManager::sharedState();
GameManager::reportAchievementWithID(v48, "geometry.ach.v3.secret04", 100, 0);
sub_100009900(v76, "A pizza would be nice");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v76);
if ( v77 < 0 )
operator delete(v76[0]);
v49 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v49->setColor)(v49, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
}
else if ( v45 )
{
goto LABEL_95;
}
sub_100009900(&v89, "volcano");
if ( sub_1000045BC(&__dst, &v89) )
{
v50 = 1;
}
else
{
sub_100009900(&v86, "avolcano");
v50 = sub_1000045BC(&__dst, &v86);
if ( (char)v88 < 0 )
operator delete(v86);
}
if ( v91 < 0 )
operator delete(v89);
if ( v50 )
{
v51 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v51, "geometry.ach.v3.secret05") )
{
v52 = GameManager::sharedState();
GameManager::reportAchievementWithID(v52, "geometry.ach.v3.secret05", 100, 0);
sub_100009900(v74, "Hot answer, well done");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v74);
if ( v75 < 0 )
operator delete(v74[0]);
v53 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v53->setColor)(v53, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
sub_100009900(&v89, "backontrack");
v54 = sub_1000045BC(&__dst, &v89);
if ( v91 < 0 )
operator delete(v89);
if ( v54 )
{
v55 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v55, "geometry.ach.v3.secret06") )
{
v56 = GameManager::sharedState();
GameManager::reportAchievementWithID(v56, "geometry.ach.v3.secret06", 100, 0);
sub_100009900(v72, "That's some skill");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v72);
if ( v73 < 0 )
operator delete(v72[0]);
v57 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v57->setColor)(v57, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
sub_100009900(&v89, "givemehelper");
v58 = sub_1000045BC(&__dst, &v89);
if ( v91 < 0 )
operator delete(v89);
if ( v58 )
{
v59 = AchievementManager::sharedState();
if ( !AchievementManager::isAchievementEarned(v59, "geometry.ach.v3.secret07") )
{
v60 = GameManager::sharedState();
GameManager::reportAchievementWithID(v60, "geometry.ach.v3.secret07", 100, 0);
sub_100009900(v70, "Is that even a real thing...");
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v70);
if ( v71 < 0 )
operator delete(v70[0]);
v61 = a1->m_messageLabel;
BYTE2(v89) = -1;
LOWORD(v89) = -256;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v61->setColor)(v61, &v89);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_messageLabel, 400.0, 0.8, 0.0);
goto LABEL_125;
}
goto LABEL_132;
}
v62 = HIBYTE(v93.__r_.__value_.__r.__words[2]);
if ( (v93.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
v62 = v93.__r_.__value_.__l.__size_;
if ( !v62 )
{
LABEL_132:
m_selectedThread = a1->m_selectedThread;
SecretLayer4::getMessage(a1);
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)&v66);
if ( v67 < 0 )
operator delete(v66);
v65 = &unk_1006455AB;
if ( m_selectedThread <= 0 && a1->m_selectedThread <= 0 )
v65 = &unk_1006455A8;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void *))a1->m_messageLabel->setColor)(a1->m_messageLabel, v65);
goto LABEL_138;
}
SecretLayer4::getErrorMessage(v68, a1);
SecretLayer4::updateMessageLabel((__int64)a1, (__int64 *)v68);
if ( v69 < 0 )
operator delete(v68[0]);
a1->m_selectedThread = 0;
v63 = a1->m_messageLabel;
BYTE2(v89) = 0;
LOWORD(v89) = -26881;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, void ***))v63->setColor)(v63, &v89);
LABEL_138:
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(v93.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v93.__r_.__value_.__l.__data_);
}