//
// CCTextInputNode::addTextArea from 0x5a38bc to 0x5a3ab8 (508 bytes)
//
// 5 xrefs:
// > EditLevelLayer::init @ 0x6e0a24
// > ShareCommentLayer::init @ 0x7e702c
// > GJWriteMessagePopup::init @ 0x8d02a4
// > GJWriteMessagePopup::init @ 0x8d05d0
// > ??> @ 0x681c0
//
// 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 CCTextInputNode::addTextArea(CCTextInputNode *a1, TextArea *a2)
{
CCTextInputNode_vtbl *v3; // x2
TextArea *m_textArea; // x22
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
char *v6; // x0
void *v7; // x0
void *v8; // x21
unsigned int *v9; // x20
int v10; // w0
unsigned int *v11; // x1
int v12; // w2
cocos2d::CCPoint v13; // [xsp+50h] [xbp+50h] BYREF
if ( !a1->m_textArea )
{
v3 = a1->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_textArea = a2;
((void (*)(void))v3->addChild)();
m_textArea = a1->m_textArea;
setPosition = m_textArea->setPosition;
cocos2d::CCPoint::CCPoint(&v13, 0.0, 0.0);
setPosition(m_textArea, &v13);
a1->m_textField->setVisible(a1->m_textField, 0);
v6 = (char *)a1->m_textField->getString(a1->m_textField);
sub_D153B8((int)&v13, v6);
CCTextInputNode::updateLabel(a1, (const void **)&v13);
v7 = (void *)(*(_QWORD *)&v13 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v13 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(*(_QWORD *)&v13 - 8LL);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(*(_QWORD *)&v13 - 8LL);
*(_DWORD *)(*(_QWORD *)&v13 - 8LL) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v7);
}
sub_D18D28(&v13, &a1->m_textArea->m_fontFile);
CCTextInputNode::updateDefaultFontValues((__int64)a1, (const void **)&v13);
v8 = (void *)(*(_QWORD *)&v13 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v13 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(*(_QWORD *)&v13 - 8LL);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(*(_QWORD *)&v13 - 8LL);
*(_DWORD *)(*(_QWORD *)&v13 - 8LL) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v8);
}
}
}