//
// SongOptionsLayer::onClose from 0x1400c54d0 to 0x1400c5640 (368 bytes)
//
// 3 xrefs:
// > SongOptionsLayer::keyBackClicked @ 0x1400c5649
// > SongOptionsLayer::init @ 0x1400c4a89
// > ??> @ 0x1406c813c
//
// 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
//
// Hidden C++ exception states: #wind=1
void SongOptionsLayer::onClose(SongOptionsLayer *a1, cocos2d::CCObject *a2)
{
float m_songOffset; // xmm7_4
cocos2d::CCLabelProtocol *v4; // rcx
const char *v5; // rax
size_t v6; // r8
const char *v7; // rcx
float v8; // xmm6_4
char *v9; // rcx
_BOOL8 v10; // rdx
char *String[2]; // [rsp+28h] [rbp-50h] BYREF
__int128 v12; // [rsp+38h] [rbp-40h]
a1->m_offsetInput->onClickTrackNode(a1->m_offsetInput, 0);
m_songOffset = a1->m_delegate->getLevelSettings(a1->m_delegate)->m_songOffset;
v4 = &a1->m_offsetInput->m_textField->cocos2d::CCLabelProtocol;
v5 = v4->getString(v4);
*(_OWORD *)String = 0;
v12 = 0;
v6 = -1;
do
++v6;
while ( v5[v6] );
sub_14003A930(String, v5, v6);
v7 = (const char *)String;
if ( *((_QWORD *)&v12 + 1) > 0xFu )
v7 = String[0];
v8 = atof(v7);
a1->m_delegate->getLevelSettings(a1->m_delegate)->m_songOffset = v8;
if ( *((_QWORD *)&v12 + 1) > 0xFu )
{
v9 = String[0];
if ( (unsigned __int64)(*((_QWORD *)&v12 + 1) + 1LL) >= 0x1000 )
{
v9 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
if ( m_songOffset != a1->m_delegate->getLevelSettings(a1->m_delegate)->m_songOffset )
a1->m_delegate->getLevelSettings(a1->m_delegate)->m_guidelinesUpdated = 1;
a1->setKeypadEnabled(a1, 0);
LOBYTE(v10) = 1;
a1->removeFromParentAndCleanup(a1, v10);
}