//
// SetTextPopup::onClose from 0x8c5888 to 0x8c59e0 (344 bytes)
//
// 5 xrefs:
// > SetTextPopup::onCancel @ 0x8c59ec
// > SetTextPopup::keyBackClicked @ 0x8c59f4
// > ??> @ 0xb09a0
// > SetTextPopup::init @ 0x8d375c
// > ??> @ 0x122e1d8
//
// 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 SetTextPopup::onClose(SetTextPopup *a1, cocos2d::CCObject *a2)
{
SetTextPopupDelegate *m_delegate; // x21
void (__fastcall *setTextPopupClosed)(SetTextPopupDelegate *__hidden, SetTextPopup *, std::string); // x22
long double v5; // q0
void *v6; // x0
unsigned int *v7; // x2
int v8; // w1
__int64 v9; // [xsp+50h] [xbp+50h] BYREF
a1->m_input->m_delegate = nullptr;
a1->m_input->onClickTrackNode(a1->m_input, 0);
m_delegate = a1->m_delegate;
if ( m_delegate )
{
if ( !a1->m_cancelled )
{
setTextPopupClosed = m_delegate->setTextPopupClosed;
*(__n128 *)&v5 = sub_D18D28(&v9);
((void (__fastcall *)(SetTextPopupDelegate *, SetTextPopup *, __int64 *, long double))setTextPopupClosed)(
m_delegate,
a1,
&v9,
v5);
v6 = (void *)(v9 - 24);
if ( (__int64 *)(v9 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(v9 - 8);
do
v8 = __ldaxr(v7);
while ( __stlxr(v8 - 1, v7) );
}
else
{
v8 = *(_DWORD *)(v9 - 8);
*(_DWORD *)(v9 - 8) = v8 - 1;
}
if ( v8 <= 0 )
operator delete(v6);
}
}
}
a1->setKeypadEnabled(a1, 0);
a1->removeFromParentAndCleanup(a1, 1);
}