//
// SetupItemEditTriggerPopup::updateOpButton from 0x14046c1c0 to 0x14046c414 (596 bytes)
//
// 3 xrefs:
// > SetupItemEditTriggerPopup::init @ 0x14046bb53
// > SetupItemEditTriggerPopup::onOpButton @ 0x14046be00
// > ??> @ 0x1406db1f8
//
// 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 SetupItemEditTriggerPopup::updateOpButton(
SetupItemEditTriggerPopup *a1,
CCMenuItemSpriteExtra *a2,
int a3,
int a4)
{
cocos2d::CCComponentContainer *m_pComponentContainer; // rsi
__int64 v7; // rbx
void *v8; // rcx
int v9; // ebx
int v10; // ebx
int v11; // ebx
__int16 v12; // ax
void **v13; // rdx
void *v14; // rcx
__int128 v15; // [rsp+28h] [rbp-48h] BYREF
__m128i v16; // [rsp+38h] [rbp-38h]
void *Block[2]; // [rsp+48h] [rbp-28h] BYREF
__m128i si128; // [rsp+58h] [rbp-18h]
m_pComponentContainer = a2->getNormalImage(a2)[1].m_pComponentContainer;
*(_OWORD *)Block = 0;
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( (unsigned int)(a4 - 485) <= 1 )
{
v15 = 0;
v16.m128i_i64[1] = 15;
if ( a3 )
{
v10 = a3 - 1;
if ( v10 )
{
v11 = v10 - 1;
if ( v11 )
{
if ( v11 != 1 )
{
v16.m128i_i64[0] = 1;
LOWORD(v15) = 63;
LABEL_28:
si128 = v16;
*(_OWORD *)Block = v15;
goto LABEL_29;
}
v12 = 25955;
}
else
{
v12 = 27750;
}
}
else
{
v12 = 28274;
}
}
else
{
v12 = 24942;
}
BYTE2(v15) = 0;
LOWORD(v15) = v12;
v16.m128i_i64[0] = 2;
goto LABEL_28;
}
if ( (unsigned int)(a4 - 578) <= 1 )
{
v15 = 0;
v16.m128i_i64[0] = 1;
v16.m128i_i64[1] = 15;
if ( a3 )
{
v9 = a3 - 1;
if ( v9 )
{
if ( v9 == 1 )
LOWORD(v15) = 110;
else
LOWORD(v15) = 63;
}
else
{
LOWORD(v15) = 97;
}
}
else
{
LOWORD(v15) = 32;
}
goto LABEL_28;
}
v7 = sub_14046BE30((__int64)&v15, a3);
if ( Block != (void **)v7 )
{
if ( si128.m128i_i64[1] > 0xFuLL )
{
v8 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v8);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
*(_OWORD *)Block = *(_OWORD *)v7;
si128 = *(__m128i *)(v7 + 16);
*(_QWORD *)(v7 + 16) = 0;
*(_QWORD *)(v7 + 24) = 15;
*(_BYTE *)v7 = 0;
}
sub_14003A830((__int64)&v15);
LABEL_29:
v13 = Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v13 = (void **)Block[0];
((void (__fastcall *)(cocos2d::CCComponentContainer *, void **))m_pComponentContainer[15].~CCComponentContainer)(
&m_pComponentContainer[15],
v13);
if ( (unsigned int)(a4 - 485) <= 1 || (unsigned int)(a4 - 578) <= 1 )
cocos2d::CCLabelBMFont::limitLabelWidth((cocos2d::CCLabelBMFont *)m_pComponentContainer, 50.0, 0.80000001, 0.0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v14 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v14 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v14 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v14);
}
}