//
// SetupItemEditTriggerPopup::updateFormulaLabel from 0x10040c9d0 to 0x10040d160 (1936 bytes)
//
// 4 xrefs:
// > SetupItemEditTriggerPopup::init @ 0x10040c5ec
// > SetupItemEditTriggerPopup::onOpButton @ 0x10040c898
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0x10040d5e4
// > SetupItemEditTriggerPopup::valueDidChange @ 0x10040d618
//
// 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)
{
float v2; // s13
float v3; // s12
float v4; // s9
float v5; // s8
float v6; // s15
float v7; // s10
float v8; // s11
int v9; // w8
__int64 v10; // x21
int v11; // w8
__int64 v12; // x20
float v13; // s14
unsigned int v14; // w8
__int64 v15; // x26
int v16; // w25
int v17; // w24
_BOOL4 v19; // w26
int v20; // w8
__int64 v21; // x22
bool v22; // zf
int v23; // w9
const char *v24; // x9
char *v25; // x1
const std::string::value_type *p_p; // x1
std::string::size_type v27; // x2
__int64 v28; // x0
bool v29; // zf
int v30; // w8
const std::string::value_type *v31; // x1
std::string::size_type v32; // x2
std::string *v33; // x1
std::string::size_type size; // x2
const std::string::value_type *v35; // x1
std::string::size_type v36; // x2
int v37; // w27
const char *v38; // x8
char *v39; // x1
const std::string::value_type *v40; // x1
std::string::size_type v41; // x2
const std::string::value_type *v42; // x1
std::string::size_type v43; // x2
float v44; // s8
_BOOL4 v46; // w23
std::string *v47; // x1
std::string::size_type v48; // x2
const std::string::value_type *v49; // x1
std::string::size_type v50; // x2
std::string *p_str; // x1
std::string::size_type v52; // x2
const std::string::value_type *v53; // x1
std::string::size_type v54; // x2
cocos2d::CCString *v55; // x0
const char *CString; // x0
std::string *v57; // x1
int v58; // [xsp+10h] [xbp-120h]
float v59; // [xsp+14h] [xbp-11Ch]
float v60; // [xsp+18h] [xbp-118h]
float v61; // [xsp+1Ch] [xbp-114h]
int v62; // [xsp+1Ch] [xbp-114h]
void *__p; // [xsp+20h] [xbp-110h] BYREF
std::string::size_type v64; // [xsp+28h] [xbp-108h]
unsigned __int8 v65; // [xsp+37h] [xbp-F9h]
std::string v66; // [xsp+38h] [xbp-F8h] BYREF
std::string __str; // [xsp+50h] [xbp-E0h] BYREF
std::string v68; // [xsp+68h] [xbp-C8h] BYREF
std::string v69; // [xsp+80h] [xbp-B0h] BYREF
sub_100009900(&v69, "");
v2 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 80);
v3 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 95);
v4 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 51);
v5 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 476);
v6 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 477);
v7 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 478);
v8 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 480);
v9 = (int)((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 481);
if ( v9 <= 1 )
v10 = 1;
else
v10 = (unsigned int)v9;
v11 = (int)((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 482);
if ( v11 <= 3 )
v12 = 3;
else
v12 = (unsigned int)v11;
v60 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 485);
v61 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 486);
v59 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 578);
v13 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 579);
v14 = (int)v7;
if ( (int)v7 <= 1 )
v15 = 1;
else
v15 = v14;
if ( (int)v4 <= 0 && v14 != 3 )
{
std::string::assign(&v69, "Select a target");
goto LABEL_166;
}
v16 = (int)v5;
sub_10040D2E8(&v68, (unsigned int)(int)v5, (unsigned int)(int)v2);
v17 = (int)v6;
sub_10040D2E8(&__str, (unsigned int)(int)v6, (unsigned int)(int)v3);
sub_10040D2E8(&v66, v15, (unsigned int)(int)v4);
if ( !(int)v5 )
{
LABEL_16:
if ( v17 )
goto LABEL_17;
LABEL_26:
v19 = 0;
goto LABEL_27;
}
if ( (int)v2 > 0 )
{
v16 = 1;
goto LABEL_16;
}
v16 = (unsigned int)(v16 - 3) < 3;
if ( !v17 )
goto LABEL_26;
LABEL_17:
v19 = (int)v3 > 0 || (unsigned int)(v17 - 3) < 3;
if ( ((v16 | !v19) & 1) == 0 )
{
std::string::operator=(&v68, &__str);
v19 = 0;
v16 = 1;
}
LABEL_27:
std::string::operator=(&v69, &v66);
std::string::append(&v69, " ");
std::string::append(&v69, "= ");
v20 = (int)v13;
v21 = (unsigned int)(int)v8;
v22 = (int)v13 <= 0 || (_DWORD)v21 == 0;
v23 = !v22;
v58 = v23;
if ( !v22 )
{
if ( v20 == 1 )
v24 = "abs";
else
v24 = "?";
if ( v20 == 2 )
v25 = "neg";
else
v25 = (char *)v24;
sub_100009900(&__p, v25);
if ( (v65 & 0x80u) == 0 )
p_p = (const std::string::value_type *)&__p;
else
p_p = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v27 = v65;
else
v27 = v64;
std::string::append(&v69, p_p, v27);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, "(");
}
v28 = (unsigned int)(int)v61;
v29 = (int)v28 <= 0 || (_DWORD)v21 == 0;
v30 = !v29;
v62 = v30;
if ( v29 )
{
if ( !(_DWORD)v21 )
goto LABEL_81;
}
else
{
sub_10040D2AC(&__p, v28, 0);
if ( (v65 & 0x80u) == 0 )
v31 = (const std::string::value_type *)&__p;
else
v31 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v32 = v65;
else
v32 = v64;
std::string::append(&v69, v31, v32);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, "(");
}
if ( (v66.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v33 = &v66;
else
v33 = (std::string *)v66.__r_.__value_.__r.__words[0];
if ( (v66.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(v66.__r_.__value_.__r.__words[2]);
else
size = v66.__r_.__value_.__l.__size_;
std::string::append(&v69, (const std::string::value_type *)v33, size);
std::string::append(&v69, " ");
sub_10040D254(&__p, v21);
if ( (v65 & 0x80u) == 0 )
v35 = (const std::string::value_type *)&__p;
else
v35 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v36 = v65;
else
v36 = v64;
std::string::append(&v69, v35, v36);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, " ");
LABEL_81:
v37 = (int)v59;
if ( (int)v59 >= 1 )
{
if ( v37 == 1 )
v38 = "abs";
else
v38 = "?";
if ( v37 == 2 )
v39 = "neg";
else
v39 = (char *)v38;
sub_100009900(&__p, v39);
if ( (v65 & 0x80u) == 0 )
v40 = (const std::string::value_type *)&__p;
else
v40 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v41 = v65;
else
v41 = v64;
std::string::append(&v69, v40, v41);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, "(");
}
if ( (int)v60 >= 1 )
{
sub_10040D2AC(&__p, (unsigned int)(int)v60, 0);
if ( (v65 & 0x80u) == 0 )
v42 = (const std::string::value_type *)&__p;
else
v42 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v43 = v65;
else
v43 = v64;
std::string::append(&v69, v42, v43);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, "(");
}
v44 = ((float (__fastcall *)(SetupItemEditTriggerPopup *, __int64))a1->getValue)(a1, 479);
v46 = v44 != 1.0 || (unsigned int)(v12 - 5) < 0xFFFFFFFE;
if ( v46 && v19 )
std::string::append(&v69, "(");
if ( v16 )
{
if ( (v68.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v47 = &v68;
else
v47 = (std::string *)v68.__r_.__value_.__r.__words[0];
if ( (v68.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v48 = HIBYTE(v68.__r_.__value_.__r.__words[2]);
else
v48 = v68.__r_.__value_.__l.__size_;
std::string::append(&v69, (const std::string::value_type *)v47, v48);
if ( !v19 )
{
if ( !v46 )
goto LABEL_152;
goto LABEL_142;
}
LABEL_126:
std::string::append(&v69, " ");
sub_10040D254(&__p, v10);
if ( (v65 & 0x80u) == 0 )
v49 = (const std::string::value_type *)&__p;
else
v49 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v50 = v65;
else
v50 = v64;
std::string::append(&v69, v49, v50);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, " ");
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_str = &__str;
else
p_str = (std::string *)__str.__r_.__value_.__r.__words[0];
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v52 = HIBYTE(__str.__r_.__value_.__r.__words[2]);
else
v52 = __str.__r_.__value_.__l.__size_;
std::string::append(&v69, (const std::string::value_type *)p_str, v52);
if ( !v46 )
goto LABEL_152;
std::string::append(&v69, ")");
LABEL_142:
std::string::append(&v69, " ");
sub_10040D254(&__p, v12);
if ( (v65 & 0x80u) == 0 )
v53 = (const std::string::value_type *)&__p;
else
v53 = (const std::string::value_type *)__p;
if ( (v65 & 0x80u) == 0 )
v54 = v65;
else
v54 = v64;
std::string::append(&v69, v53, v54);
if ( (char)v65 < 0 )
operator delete(__p);
std::string::append(&v69, " ");
goto LABEL_151;
}
if ( v19 )
goto LABEL_126;
LABEL_151:
v55 = (cocos2d::CCString *)sub_100268F4C("%.03f", v44);
CString = cocos2d::CCString::getCString(v55);
std::string::append(&v69, CString);
LABEL_152:
if ( (int)v60 >= 1 )
std::string::append(&v69, ")");
if ( v37 >= 1 )
std::string::append(&v69, ")");
if ( v62 )
std::string::append(&v69, ")");
if ( v58 )
std::string::append(&v69, ")");
if ( SHIBYTE(v66.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v66.__r_.__value_.__l.__data_);
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
if ( SHIBYTE(v68.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v68.__r_.__value_.__l.__data_);
LABEL_166:
if ( (v69.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v57 = &v69;
else
v57 = (std::string *)v69.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_formulaLabel->setString)(a1->m_formulaLabel, v57);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 400.0, 0.8, 0.0);
if ( SHIBYTE(v69.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v69.__r_.__value_.__l.__data_);
}