//
// SetupItemEditTriggerPopup::updateFormulaLabel from 0x10057f7a0 to 0x1005800d5 (2357 bytes)
//
// 4 xrefs:
// > SetupItemEditTriggerPopup::init @ 0x10057f306
// > SetupItemEditTriggerPopup::onOpButton @ 0x10057f570
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0x10058088a
// > SetupItemEditTriggerPopup::valueDidChange @ 0x1005808b5
//
// 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 SetupItemEditTriggerPopup::updateFormulaLabel(SetupItemEditTriggerPopup *a1)
{
int v2; // eax
int v3; // r14d
int v4; // eax
int v5; // ecx
int v6; // r12d
int v7; // r14d
bool v8; // r15
bool v9; // r12
_BYTE *v10; // r14
int v11; // r13d
int v12; // eax
std::string::size_type v13; // rdx
_BYTE *v14; // rax
int v15; // ecx
_BYTE *v16; // rax
std::string::size_type v17; // rdx
const std::string::value_type *data; // rsi
std::string::size_type size; // rdx
_BYTE *v20; // rax
std::string::size_type v21; // rdx
std::string::size_type v22; // rdx
int v23; // r14d
_BYTE *v24; // rax
std::string::size_type v25; // rdx
bool v26; // r13
const std::string::value_type *v27; // rsi
std::string::size_type v28; // rdx
_BYTE *v29; // rax
std::string::size_type v30; // rdx
const std::string::value_type *v31; // rsi
std::string::size_type v32; // rdx
_BYTE *v33; // rax
std::string::size_type v34; // rdx
cocos2d::CCString *v35; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *m_formulaLabel; // rdi
std::string::pointer v38; // rsi
int v39; // [rsp+0h] [rbp-E0h]
int v40; // [rsp+8h] [rbp-D8h]
std::string v41; // [rsp+10h] [rbp-D0h] BYREF
std::string __str; // [rsp+28h] [rbp-B8h] BYREF
std::string v43; // [rsp+40h] [rbp-A0h] BYREF
float v44; // [rsp+58h] [rbp-88h]
float v45; // [rsp+5Ch] [rbp-84h]
float v46; // [rsp+60h] [rbp-80h]
float v47; // [rsp+64h] [rbp-7Ch]
float v48; // [rsp+68h] [rbp-78h]
float v49; // [rsp+6Ch] [rbp-74h]
float v50; // [rsp+70h] [rbp-70h]
float v51; // [rsp+74h] [rbp-6Ch]
float v52; // [rsp+78h] [rbp-68h]
float v53; // [rsp+7Ch] [rbp-64h]
std::string v54; // [rsp+80h] [rbp-60h] BYREF
int v55; // [rsp+9Ch] [rbp-44h]
int __s; // [rsp+A0h] [rbp-40h] BYREF
_BYTE v57[12]; // [rsp+A4h] [rbp-3Ch] BYREF
void *__p; // [rsp+B0h] [rbp-30h]
*(_WORD *)&v54.__r_.__value_.__l.0 = 0;
v51 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 80);
v52 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 95);
*(float *)&v55 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 51);
v44 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 476);
v45 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 477);
v53 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 478);
v46 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 480);
v2 = (int)((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 481);
v3 = 1;
if ( v2 >= 2 )
v3 = v2;
v4 = (int)((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 482);
v5 = 3;
if ( v4 >= 4 )
v5 = v4;
v40 = v5;
v49 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 485);
v47 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 486);
v50 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 578);
v39 = v3;
v48 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 579);
if ( (int)*(float *)&v55 <= 0 && (int)v53 != 3 )
{
std::string::assign(&v54, "Select a target");
goto LABEL_117;
}
v6 = (int)v44;
v55 = (int)v51;
sub_100580580(&v41);
v7 = (int)v45;
LODWORD(v53) = (int)v52;
sub_100580580(&__str);
sub_100580580(&v43);
if ( v6 )
{
v8 = 1;
if ( v55 <= 0 )
v8 = (unsigned int)(v6 - 3) < 3;
if ( !v7 )
goto LABEL_16;
}
else
{
v8 = 0;
if ( !v7 )
goto LABEL_16;
}
v9 = SLODWORD(v53) > 0 || (unsigned int)(v7 - 3) < 3;
if ( v8 || !v9 )
goto LABEL_17;
std::string::operator=(&v41, &__str);
v8 = 1;
LABEL_16:
v9 = 0;
LABEL_17:
std::string::operator=(&v54, &v43);
std::string::append(&v54, " ");
std::string::append(&v54, "= ");
v10 = v57;
v11 = (int)v46;
v12 = (int)v48;
LOBYTE(v53) = (int)v48 > 0 && (int)v46 != 0;
if ( LOBYTE(v53) != 1 )
goto LABEL_27;
if ( v12 == 2 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "neg", 3);
}
else
{
if ( v12 != 1 )
{
v14 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v13 = 1;
goto LABEL_24;
}
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "abs", 3);
}
v13 = 3;
v14 = v57;
LABEL_24:
*v14 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v13);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, "(");
LABEL_27:
v15 = (int)v47;
LOBYTE(v51) = v11 != 0 && (int)v47 > 0;
if ( LOBYTE(v51) == 1 )
{
v16 = v57;
switch ( v15 )
{
case 3:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "cei", 3);
v17 = 3;
break;
case 2:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "flr", 3);
v17 = 3;
break;
case 1:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "rnd", 3);
v17 = 3;
break;
default:
v16 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v17 = 1;
break;
}
*v16 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v17);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, "(");
}
else if ( !v11 )
{
goto LABEL_52;
}
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
{
data = v43.__r_.__value_.__l.__data_;
size = v43.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v43.__r_.__value_.__l.0 >> 1;
data = v43.__r_.__value_.__s.__data_;
}
std::string::append(&v54, data, size);
std::string::append(&v54, " ");
v20 = (char *)&__s + 2;
switch ( v11 )
{
case 1:
LOWORD(__s) = 11010;
v21 = 1;
break;
case 2:
LOWORD(__s) = 11522;
v21 = 1;
break;
case 3:
v20 = v57;
__s = -1568611834;
v21 = 3;
break;
case 4:
LOWORD(__s) = 12034;
v21 = 1;
break;
default:
v20 = (char *)&__s + 3;
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 16718;
v21 = 2;
break;
}
*v20 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v21);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, " ");
LABEL_52:
v55 = (int)v50;
if ( (int)v50 > 0 )
{
if ( v55 == 2 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "neg", 3);
v22 = 3;
}
else if ( v55 == 1 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "abs", 3);
v22 = 3;
}
else
{
v10 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v22 = 1;
}
*v10 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v22);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, "(");
}
v23 = (int)v49;
if ( (int)v49 > 0 )
{
v24 = v57;
switch ( v23 )
{
case 3:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "cei", 3);
v25 = 3;
break;
case 2:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "flr", 3);
v25 = 3;
break;
case 1:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "rnd", 3);
v25 = 3;
break;
default:
v24 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v25 = 1;
break;
}
*v24 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v25);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, "(");
}
v52 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 479);
v26 = v52 != 1.0 || (unsigned int)(v40 - 5) < 0xFFFFFFFE;
if ( v9 && v26 )
std::string::append(&v54, "(");
if ( !v8 )
{
if ( !v9 )
{
LABEL_104:
v35 = (cocos2d::CCString *)sub_1007AB580("%.03f", v39);
CString = cocos2d::CCString::getCString(v35);
std::string::append(&v54, CString);
goto LABEL_105;
}
LABEL_81:
std::string::append(&v54, " ");
v29 = (char *)&__s + 2;
switch ( v39 )
{
case 1:
LOWORD(__s) = 11010;
v30 = 1;
break;
case 2:
LOWORD(__s) = 11522;
v30 = 1;
break;
case 3:
v29 = v57;
__s = -1568611834;
v30 = 3;
break;
case 4:
LOWORD(__s) = 12034;
v30 = 1;
break;
default:
v29 = (char *)&__s + 3;
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 16718;
v30 = 2;
break;
}
*v29 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v30);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, " ");
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) != 0 )
{
v31 = __str.__r_.__value_.__l.__data_;
v32 = __str.__r_.__value_.__l.__size_;
}
else
{
v32 = *(_BYTE *)&__str.__r_.__value_.__l.0 >> 1;
v31 = __str.__r_.__value_.__s.__data_;
}
std::string::append(&v54, v31, v32);
if ( v26 )
{
std::string::append(&v54, ")");
goto LABEL_96;
}
goto LABEL_105;
}
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
{
v27 = v41.__r_.__value_.__l.__data_;
v28 = v41.__r_.__value_.__l.__size_;
}
else
{
v28 = *(_BYTE *)&v41.__r_.__value_.__l.0 >> 1;
v27 = v41.__r_.__value_.__s.__data_;
}
std::string::append(&v54, v27, v28);
if ( v9 )
goto LABEL_81;
if ( v26 )
{
LABEL_96:
std::string::append(&v54, " ");
if ( v40 == 4 )
{
v33 = (char *)&__s + 2;
LOWORD(__s) = 12034;
v34 = 1;
}
else if ( v40 == 3 )
{
v33 = v57;
__s = -1568611834;
v34 = 3;
}
else
{
v33 = (char *)&__s + 3;
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 16718;
v34 = 2;
}
*v33 = 0;
std::string::append(&v54, (const std::string::value_type *)&__s + 1, v34);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v54, " ");
goto LABEL_104;
}
LABEL_105:
if ( v23 > 0 )
std::string::append(&v54, ")");
if ( v55 > 0 )
std::string::append(&v54, ")");
if ( LOBYTE(v51) )
std::string::append(&v54, ")");
if ( LOBYTE(v53) )
std::string::append(&v54, ")");
if ( (*(_BYTE *)&v43.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v43.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_115:
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_117;
goto LABEL_116;
}
}
else if ( (*(_BYTE *)&__str.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_115;
}
operator delete(__str.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v41.__r_.__value_.__s.0 & 1) != 0 )
LABEL_116:
operator delete(v41.__r_.__value_.__l.__data_);
LABEL_117:
m_formulaLabel = a1->m_formulaLabel;
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
v38 = v54.__r_.__value_.__l.__data_;
else
v38 = v54.__r_.__value_.__s.__data_;
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string::pointer))m_formulaLabel->setString)(m_formulaLabel, v38);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 400.0, 0.80000001, 0.0);
if ( (*(_BYTE *)&v54.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v54.__r_.__value_.__l.__data_);
}