//
// SecretLayer5::onSubmit from 0x10047b450 to 0x10047b96f (1311 bytes)
//
// 1 xrefs:
// > SecretLayer5::init @ 0x10047aa58
//
// 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 SecretLayer5::onSubmit(SecretLayer5 *a1, cocos2d::CCObject *a2)
{
__m128 v2; // xmm0
CCTextInputNode *m_textInput; // rdi
CCTextInputNode *v5; // rdi
FMODAudioEngine *v6; // r14
__m128 v7; // xmm0
__int64 v8; // r14
unsigned __int64 *v9; // r15
__int64 m_chatIndex; // rax
std::__vector_base::pointer begin; // r13
std::__vector_base::pointer end; // r14
__int64 v13; // r12
unsigned __int64 v14; // r15
unsigned int v15; // eax
std::__vector_base::pointer i; // r14
__int64 v17; // rax
int v18; // ecx
cocos2d::CCDelayTime *v19; // r14
cocos2d::CCCallFunc *v20; // rax
cocos2d::CCSequence *v21; // rax
cocos2d::CCDelayTime *v22; // r14
cocos2d::CCCallFunc *v23; // rax
cocos2d::CCSequence *v24; // rax
cocos2d::extension::CCScale9Sprite *m_inputBackground; // r14
cocos2d::CCFadeTo *v26; // rax
GameLevelManager *v27; // r14
cocos2d::CCDelayTime *v28; // r14
cocos2d::CCCallFunc *v29; // rax
cocos2d::CCSequence *v30; // rax
_WORD v31[8]; // [rsp+0h] [rbp-F0h] BYREF
void *__p; // [rsp+10h] [rbp-E0h]
std::string v33; // [rsp+18h] [rbp-D8h] BYREF
unsigned __int64 v34[2]; // [rsp+30h] [rbp-C0h] BYREF
__int128 v35; // [rsp+40h] [rbp-B0h] BYREF
void *data; // [rsp+50h] [rbp-A0h]
__int128 v37; // [rsp+60h] [rbp-90h] BYREF
void *v38; // [rsp+70h] [rbp-80h]
__int128 v39; // [rsp+78h] [rbp-78h] BYREF
void *v40; // [rsp+88h] [rbp-68h]
std::string v41; // [rsp+90h] [rbp-60h] BYREF
unsigned int v42; // [rsp+A8h] [rbp-48h] BYREF
int v43; // [rsp+ACh] [rbp-44h]
__int64 v44; // [rsp+B0h] [rbp-40h] BYREF
__int64 v45; // [rsp+B8h] [rbp-38h]
void *v46; // [rsp+C0h] [rbp-30h]
if ( !a1->m_loading && !a1->m_uiLocked )
{
a1->m_rewardStatus = 0;
std::string::assign((std::string *)&a1->m_chestID, "");
a1->m_loading = 1;
CCTextInputNode::getString(&v39, (__int64)a1->m_textInput, *(double *)v2.i64);
m_textInput = a1->m_textInput;
v31[0] = 0;
CCTextInputNode::setString(m_textInput, (__int64)v31, v2);
if ( (v31[0] & 1) != 0 )
operator delete(__p);
v5 = a1->m_textInput;
*(_WORD *)&v33.__r_.__value_.__l.0 = 8194;
v33.__r_.__value_.__s.__data_[1] = 0;
CCTextInputNode::updateLabel(v5, &v33, *(double *)v2.i64);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33.__r_.__value_.__l.__data_);
MusicDownloadManager::sharedState();
v2.f32[0] = (float)rand() * 4.6566129e-10;
MusicDownloadManager::pathForSFX(&v41);
v6 = FMODAudioEngine::sharedEngine();
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v35, v41.__r_.__value_.__l.__data_, v41.__r_.__value_.__l.__size_, *(double *)v2.i64);
}
else
{
data = v41.__r_.__value_.__l.__data_;
v35 = *(_OWORD *)&v41.__r_.__value_.__l.0;
}
v7 = 0;
v7.f32[0] = (float)((float)((float)rand() * 4.6566129e-10) * 0.1) + 0.89999998;
FMODAudioEngine::playEffect((__int64)v6, (__int64)&v35, v7, 0.0, 0.5);
if ( (v35 & 1) != 0 )
operator delete(data);
v46 = operator new(0xB8u);
v44 = 185;
v45 = 179;
strcpy(
(char *)v46,
"40a0.21a0.81a0.2a180a90a10a12a6a90a12a0a0a0a0a0a0a25a10a0a10a0a0a0.815686a0a1a0a1a0a4a1a0a0a0.733333a0a0a0a1a0a1a0"
"a0a0a0.2a0a0a0a0a0a0a0a0a2a1a1a0a0a26a0a0a0a0a0a0a0a0a0a0a0a0a0a0");
v8 = GameToolbox::particleFromString(&v44, 0, 0);
if ( (v44 & 1) != 0 )
operator delete(v46);
((void (__fastcall *)(SecretLayer5 *, __int64, __int64))a1->addChild_0)(a1, v8, 30);
v9 = (unsigned __int64 *)((__int64 (__fastcall *)(CCTextInputNode *))a1->m_textInput->getPosition)(a1->m_textInput);
sub_10028CBE0((float *)v34, 0.0, 0.0);
sub_10028CCE0((double *)&v44, v9, v34);
(*(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v8 + 184LL))(v8, &v44);
m_chatIndex = a1->m_chatIndex;
a1->m_chatIndex = m_chatIndex + 1;
begin = a1->m_soundEffects.__begin_;
end = a1->m_soundEffects.__end_;
v13 = end - begin;
v14 = v13 - 1;
if ( v13 - 1 < (unsigned __int64)(m_chatIndex + 1) )
{
v43 = begin[m_chatIndex];
v15 = rand();
v42 = v15
+ (v15 + ((v15 / 0x7FFFFFFF) | ((v15 / 0x7FFFFFFF) << 31)) == 0)
+ ((v15 / 0x7FFFFFFF) | ((v15 / 0x7FFFFFFF) << 31));
if ( v13 >= 2 )
{
v44 = 0;
v45 = 0x7FFFFFFFFFFFFFFFLL;
for ( i = end - 1; begin < i; --v14 )
{
v34[0] = 0;
v34[1] = v14;
v17 = sub_100480CE0(&v44, &v42, v34);
if ( v17 )
{
v18 = *begin;
*begin = begin[v17];
begin[v17] = v18;
}
++begin;
}
}
a1->m_chatIndex = 0;
a1->m_chatIndex = *a1->m_soundEffects.__begin_ == v43;
}
v19 = cocos2d::CCDelayTime::create(0.30000001);
v20 = cocos2d::CCCallFunc::create(a1, (cocos2d::SEL_CallFunc)(unsigned __int64)SecretLayer5::fadeInSubmitMessage);
v21 = sub_1003B5760(v19, v20, 0);
cocos2d::CCNode::runAction(a1, v21);
v22 = cocos2d::CCDelayTime::create(0.0);
v23 = cocos2d::CCCallFunc::create(a1, (cocos2d::SEL_CallFunc)(unsigned __int64)SecretLayer5::animateHead);
v24 = sub_1003B5760(v22, v23, 0);
cocos2d::CCNode::runAction(a1, v24);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_textInput->setTouchEnabled)(a1->m_textInput, 0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_textInput->onClickTrackNode)(a1->m_textInput, 0);
((void (__fastcall *)(CCTextInputNode *, _QWORD))a1->m_textInput->setVisible)(a1->m_textInput, 0);
cocos2d::CCNode::stopAllActions(a1->m_inputBackground);
m_inputBackground = a1->m_inputBackground;
v26 = cocos2d::CCFadeTo::create(0.5, 0);
cocos2d::CCNode::runAction(m_inputBackground, v26);
LoadingCircleSprite::fadeInCircle(a1->m_circleSprite, 0, 0.80000001, 150.0);
((void (__fastcall *)(CCMenuItemSpriteExtra *, _QWORD))a1->m_wraithButton->setEnabled)(a1->m_wraithButton, 0);
v27 = GameLevelManager::sharedState();
if ( (v39 & 1) != 0 )
{
sub_100006B70(&v37, v40, *((unsigned __int64 *)&v39 + 1), COERCE_DOUBLE(1061997773));
}
else
{
v38 = v40;
v37 = v39;
}
GameLevelManager::getGJSecretReward(v27, &v37);
if ( (v37 & 1) != 0 )
operator delete(v38);
v28 = cocos2d::CCDelayTime::create(4.0);
v29 = cocos2d::CCCallFunc::create(a1, (cocos2d::SEL_CallFunc)(unsigned __int64)SecretLayer5::finishLoadingState);
v30 = sub_1003B5760(v28, v29, 0);
cocos2d::CCNode::runAction(a1, v30);
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v41.__r_.__value_.__l.__data_);
if ( (v39 & 1) != 0 )
operator delete(v40);
}
}