//
// NumberInputLayer::deleteLast from 0x100492fa0 to 0x10049316a (458 bytes)
//
// 1 xrefs:
// > NumberInputLayer::onNumber @ 0x100492e95
//
// 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 NumberInputLayer::deleteLast(NumberInputLayer *a1)
{
double v1; // xmm0_8
unsigned int sizex2; // r14d
size_t size; // r14
std::array *longStorage; // rsi
size_t v6; // rax
std::string *p_m_inputString; // r15
char *v8; // r12
unsigned int v9; // eax
std::size_t v10; // rax
bool v11; // r14
size_t v12; // r13
ButtonSprite *v13; // rax
cocos2d::CCLabelBMFont *m_inputLabel; // rdi
std::array *p_shortStorage; // rbx
__int128 __dst; // [rsp+0h] [rbp-40h] BYREF
char *v17; // [rsp+10h] [rbp-30h]
sizex2 = a1->m_inputString.m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
size = a1->m_inputString.m_data.m_long.size;
if ( !size )
return;
longStorage = (std::array *)a1->m_inputString.m_data.m_long.longStorage;
}
else
{
if ( !a1->m_inputString.m_data.m_short.sizex2 )
return;
size = sizex2 >> 1;
longStorage = &a1->m_inputString.m_data.m_short.shortStorage;
}
v6 = size - 1;
if ( size )
--size;
if ( size >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v1);
p_m_inputString = &a1->m_inputString;
if ( size >= 0x17 )
{
v12 = 26;
if ( (size | 7) != 0x17 )
v12 = (size | 7) + 1;
v8 = (char *)operator new(v12);
v17 = v8;
*(_QWORD *)&__dst = v12 + 1;
*((_QWORD *)&__dst + 1) = size;
}
else
{
LOBYTE(__dst) = 2 * size;
v8 = (char *)&__dst + 1;
if ( !v6 )
{
*((_BYTE *)&__dst + size + 1) = 0;
if ( (p_m_inputString->m_data.m_short.sizex2 & 1) == 0 )
goto LABEL_13;
goto LABEL_12;
}
}
memmove(v8, longStorage, size);
v8[size] = 0;
if ( (p_m_inputString->m_data.m_short.sizex2 & 1) != 0 )
LABEL_12:
operator delete(a1->m_inputString.m_data.m_long.longStorage);
LABEL_13:
a1->m_inputString.m_data.m_long.longStorage = v17;
*(_OWORD *)&p_m_inputString->m_data.m_short.sizex2 = __dst;
v9 = p_m_inputString->m_data.m_short.sizex2;
if ( (v9 & 1) != 0 )
{
v10 = a1->m_inputString.m_data.m_long.size;
if ( a1->m_minimum <= (int)v10 )
goto LABEL_15;
LABEL_23:
v11 = 0;
goto LABEL_24;
}
LODWORD(v10) = v9 >> 1;
if ( a1->m_minimum > (int)v10 )
goto LABEL_23;
LABEL_15:
v11 = a1->m_maximum >= (int)v10;
LABEL_24:
v13 = (ButtonSprite *)((__int64 (__fastcall *)(CCMenuItemSpriteExtra *, std::array *))a1->m_okButton->getNormalImage)(
a1->m_okButton,
longStorage);
ButtonSprite::setColor(v13, (cocos2d::ccColor3B)(v11 ? -1 : 0xFFA6A6A6));
((void (__fastcall *)(CCMenuItemSpriteExtra *, bool))a1->m_okButton->setEnabled)(a1->m_okButton, v11);
m_inputLabel = a1->m_inputLabel;
if ( (a1->m_inputString.m_data.m_short.sizex2 & 1) != 0 )
p_shortStorage = (std::array *)a1->m_inputString.m_data.m_long.longStorage;
else
p_shortStorage = &a1->m_inputString.m_data.m_short.shortStorage;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::array *))m_inputLabel->setString)(
m_inputLabel,
p_shortStorage);
}