//
// TextArea::setString from 0x3d9b70 to 0x3d9d8c (540 bytes)
//
// 57 xrefs:
// > TextArea::fitString @ 0x3d9dda
// > TextArea::fitString @ 0x3d9e88
// > TextArea::fitString @ 0x3d9ed8
// > TextArea::fitString @ 0x3d9f24
// > TextArea::init @ 0x3d9fce
// > CCTextInputNode::updateLabel @ 0x3e2fd2
// > CCTextInputNode::onTextFieldAttachWithIME @ 0x3e3752
// > AchievementCell::loadFromDict @ 0x42d00e
// > sub_431C60 @ 0x431d0c
// > UploadPopup::levelUploadFinished @ 0x4a2a76
// > UploadPopup::levelUploadFailed @ 0x4a2bcc
// > UploadPopup::init @ 0x4a3b12
// > LevelBrowserLayer::loadPage @ 0x4a67b0
// > LevelBrowserLayer::loadPage @ 0x4a6824
// > LevelBrowserLayer::loadPage @ 0x4a6898
// > EndLevelLayer::customSetup @ 0x5362a8
// > EndLevelLayer::customSetup @ 0x5362d0
// > EndLevelLayer::customSetup @ 0x5362f8
// > EndLevelLayer::customSetup @ 0x5363e4
// > EndLevelLayer::customSetup @ 0x536c10
// > EndLevelLayer::customSetup @ 0x536c32
// > EndLevelLayer::customSetup @ 0x536cc8
// > EndLevelLayer::customSetup @ 0x536cf8
// > LeaderboardsLayer::loadLeaderboardFailed @ 0x56456a
// > LeaderboardsLayer::loadLeaderboardFailed @ 0x564594
// > LeaderboardsLayer::loadLeaderboardFailed @ 0x5645ba
// > AccountLayer::backupAccountFinished @ 0x584316
// > AccountLayer::syncAccountFinished @ 0x5843ea
// > AccountLayer::syncAccountFailed @ 0x5844d2
// > AccountLayer::syncAccountFailed @ 0x584502
// > AccountLayer::syncAccountFailed @ 0x584516
// > AccountLayer::updatePage @ 0x584874
// > AccountLayer::updatePage @ 0x5848e8
// > AccountLayer::updatePage @ 0x584914
// > AccountLayer::backupAccountFailed @ 0x585104
// > AccountLayer::backupAccountFailed @ 0x585146
// > AccountLayer::backupAccountFailed @ 0x585186
// > AccountHelpLayer::updatePage @ 0x5853ac
// > AccountHelpLayer::updatePage @ 0x58541e
// > AccountHelpLayer::updatePage @ 0x58544a
// > UpdateAccountSettingsPopup::updateSettingsFinished @ 0x5d7532
// > UpdateAccountSettingsPopup::updateSettingsFailed @ 0x5d75d2
// > UploadActionPopup::showSuccessMessage @ 0x5da0be
// > UploadActionPopup::showFailMessage @ 0x5da1e6
// > GJWriteMessagePopup::updateText @ 0x5ddf74
// > GJWriteMessagePopup::updateText @ 0x5ddff4
// > LevelLeaderboard::loadLeaderboardFailed @ 0x614fb4
// > LevelLeaderboard::loadLeaderboardFailed @ 0x614fea
// > UploadListPopup::listUploadFinished @ 0x6d5e3e
// > UploadListPopup::listUploadFailed @ 0x6d9d1c
// > SecretLayer5::fadeInSubmitMessage @ 0x6e43a4
// > ThreadDescPopup::textChanged @ 0x74d5ec
// > MessageThreadsPage::applyThreadList @ 0x7513dc
// > MessageThreadsPage::threadListFailed @ 0x7514f0
// > ThreadViewPopup::measureBody @ 0x75b3a6
// > ThreadViewPopup::mountVirtualRow @ 0x75f79c
// > SoundPackDescPopup::textChanged @ 0x785bc4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:46:46 +0000
//
int __fastcall TextArea::setString(int a1, _DWORD *a2)
{
int v4; // r5
unsigned int v5; // r10
unsigned int v6; // r9
const void *v7; // r0
char *v8; // r1
size_t v9; // r2
int v10; // r5
_BOOL4 v11; // r5
char *v12; // r9
const char *v13; // r10
float v14; // r6
const cocos2d::CCPoint *v15; // r1
float v16; // s15
void (__fastcall *v17)(int, _BYTE *); // r7
int v18; // r7
float v19; // r0
int v21; // [sp+18h] [bp+0h] BYREF
unsigned int v22; // [sp+1Ch] [bp+4h]
char *v23; // [sp+20h] [bp+8h]
_BYTE v24[16]; // [sp+24h] [bp+Ch] BYREF
v21 = 0;
v22 = 0;
v23 = nullptr;
std::string::__init(&v21, &unk_B6B226, 0);
v4 = *(unsigned __int8 *)a2;
if ( (v4 & 1) != 0 )
v5 = a2[1];
else
v5 = v4 >> 1;
if ( (v21 & 1) != 0 )
v6 = v22;
else
v6 = (int)(unsigned __int8)v21 >> 1;
if ( (v4 & 1) != 0 )
v7 = (const void *)a2[2];
else
v7 = (char *)a2 + 1;
if ( (v21 & 1) != 0 )
v8 = v23;
else
v8 = (char *)&v21 + 1;
v9 = v6;
if ( v6 >= v5 )
v9 = v5;
if ( v9 && memcmp(v7, v8, v9) || v5 < v6 || v5 > v6 )
{
if ( (v4 & 1) != 0 )
v10 = a2[1];
else
v10 = v4 >> 1;
v11 = v10 == 0;
}
else
{
v11 = 1;
}
std::string::~string((int)&v21);
if ( v11 )
std::string::assign(a2, " ", 1u);
if ( *(_DWORD *)(a1 + 520) )
{
TextArea::hideAll((TextArea *)a1);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 520) + 292))(*(_DWORD *)(a1 + 520), 1);
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 520) + 264))(*(_DWORD *)(a1 + 520), 1);
*(_DWORD *)(a1 + 520) = 0;
}
if ( (*(_BYTE *)(a1 + 532) & 1) != 0 )
v12 = *(char **)(a1 + 540);
else
v12 = (char *)(a1 + 533);
std::string::basic_string(&v21, (int)a2);
v13 = *(const char **)(a1 + 564);
v14 = *(float *)(a1 + 524);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, (const cocos2d::CCPoint *)(a1 + 552));
*(_DWORD *)(a1 + 520) = MultilineBitmapFont::createWithFont(
v12,
(int)&v21,
v13,
v14,
(const cocos2d::CCPoint *)v24,
(int)*(float *)(a1 + 544),
*(_BYTE *)(a1 + 508),
*(_BYTE *)(a1 + 509),
*(_DWORD *)(a1 + 512),
*(_DWORD *)(a1 + 516));
std::string::~string((int)&v21);
v15 = (const cocos2d::CCPoint *)(*(_DWORD *)(a1 + 520) + 560);
*(_DWORD *)(a1 + 572) = *(_DWORD *)(*(_DWORD *)(a1 + 520) + 556);
*(_DWORD *)(a1 + 568) = *((_DWORD *)v15 - 2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, v15);
cocos2d::CCPoint::operator=(a1 + 580, v24);
v16 = (float)*(int *)(a1 + 568);
*(_DWORD *)(a1 + 576) = *(_DWORD *)(*(_DWORD *)(a1 + 520) + 568);
v17 = *(void (__fastcall **)(int, _BYTE *))(*(_DWORD *)a1 + 568);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v24, 0.0, 0.0, (float)*(int *)(a1 + 572), v16);
v17(a1, v24);
(*(void (__fastcall **)(int, _DWORD, int))(*(_DWORD *)a1 + 232))(a1, *(_DWORD *)(a1 + 520), 1);
v18 = roundf();
v19 = COERCE_FLOAT(roundf());
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v24, *(float *)&v18, v19 * *(float *)(a1 + 556));
return (*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(a1 + 520) + 92))(*(_DWORD *)(a1 + 520), a1 + 580);
}