//
// SetupItemEditTriggerPopup::updateFormulaLabel from 0x57a3f4 to 0x57a962 (1390 bytes)
//
// 4 xrefs:
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0x57ab46
// > SetupItemEditTriggerPopup::valueDidChange @ 0x57ab60
// > SetupItemEditTriggerPopup::init @ 0x57b524
// > SetupItemEditTriggerPopup::onOpButton @ 0x57b702
//
// 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 SetupItemEditTriggerPopup::updateFormulaLabel(SetupItemEditTriggerPopup *a1)
{
int v2; // s17
int v3; // r10
int v4; // r8
int v5; // r5
int v6; // r6
int v7; // r7
int v8; // r3
int v9; // r3
int v10; // r11
int v11; // s16
int v12; // r6
int v13; // r8
int v14; // r9
float v15; // s16
int v16; // r0
const char *v17; // r1
int v18; // r10
cocos2d::CCString *v19; // r0
char *CString; // r1
const char *v21; // r1
cocos2d::CCString *v22; // r0
int v23; // [sp+0h] [bp-4Ch]
int v24; // [sp+4h] [bp-48h]
int v25; // [sp+8h] [bp-44h]
int v26; // [sp+Ch] [bp-40h]
int v27; // [sp+10h] [bp-3Ch]
const unsigned __int8 *v28; // [sp+18h] [bp-34h] BYREF
_BYTE v29[4]; // [sp+1Ch] [bp-30h] BYREF
_BYTE v30[4]; // [sp+20h] [bp-2Ch] BYREF
_BYTE v31[4]; // [sp+24h] [bp-28h] BYREF
_BYTE v32[4]; // [sp+28h] [bp-24h] BYREF
_BYTE v33[4]; // [sp+2Ch] [bp-20h] BYREF
_BYTE v34[4]; // [sp+30h] [bp-1Ch] BYREF
_BYTE v35[4]; // [sp+34h] [bp-18h] BYREF
_BYTE v36[4]; // [sp+38h] [bp-14h] BYREF
_BYTE v37[4]; // [sp+3Ch] [bp-10h] BYREF
_BYTE v38[4]; // [sp+40h] [bp-Ch] BYREF
sub_776584((int)&v28, (char *)&unk_939830);
v2 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 80));
v3 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 95));
v4 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 51));
v25 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 476));
v5 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 477));
v6 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 478));
v7 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 480));
v8 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 481));
if ( v8 < 1 )
v8 = 1;
v24 = v8;
v9 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 482));
if ( v9 < 3 )
v9 = 3;
v23 = v9;
v26 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 485));
v10 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 486));
v27 = (int)COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 578));
v11 = (int)a1->getValue(a1, 579);
if ( v6 <= 0 )
{
if ( v4 <= 0 )
{
LABEL_8:
sub_7753D4((int)&v28, "Select a target");
goto LABEL_42;
}
v6 = 1;
}
else if ( v4 <= 0 && v6 != 3 )
{
goto LABEL_8;
}
getItemVarName((int)v29, v25, v2);
getItemVarName((int)v30, v5, v3);
getItemVarName((int)v31, v6, v4);
if ( v25 && (v2 > 0 || isSpecialItemType(v25)) )
{
if ( !v5 )
{
LABEL_44:
v5 = 0;
LABEL_45:
v12 = 1;
goto LABEL_19;
}
if ( v3 > 0 )
goto LABEL_59;
v12 = 1;
LABEL_17:
if ( !isSpecialItemType(v5) )
{
v5 = 0;
goto LABEL_19;
}
if ( !v12 )
goto LABEL_62;
LABEL_59:
v5 = 1;
goto LABEL_45;
}
if ( v5 )
{
if ( v3 > 0 )
{
LABEL_62:
sub_775D40(v29, v30);
goto LABEL_44;
}
v12 = 0;
goto LABEL_17;
}
v12 = 0;
LABEL_19:
sub_775D40(&v28, v31);
sub_774544((int)&v28, " ");
sub_774544((int)&v28, "= ");
if ( v11 <= 0 )
{
v13 = 0;
}
else
{
if ( !v7 )
{
v13 = 0;
v14 = 0;
goto LABEL_25;
}
signKeyToString((int)v32, v11, 0);
sub_77441C(&v28, v32);
sub_774008(v32);
sub_774544((int)&v28, "(");
v13 = 1;
}
if ( v10 <= 0 )
{
v14 = 0;
if ( !v7 )
goto LABEL_25;
}
else
{
if ( !v7 )
{
v14 = 0;
goto LABEL_25;
}
roundKeyToString((int)v33, v10, 0);
sub_77441C(&v28, v33);
sub_774008(v33);
sub_774544((int)&v28, "(");
v14 = 1;
}
sub_77441C(&v28, v31);
sub_774544((int)&v28, " ");
opKeyToString((int)v34, v7);
sub_77441C(&v28, v34);
sub_774008(v34);
sub_774544((int)&v28, " ");
LABEL_25:
if ( v27 > 0 )
{
signKeyToString((int)v35, v27, 0);
sub_77441C(&v28, v35);
sub_774008(v35);
sub_774544((int)&v28, "(");
}
if ( v26 > 0 )
{
roundKeyToString((int)v36, v26, 0);
sub_77441C(&v28, v36);
sub_774008(v36);
sub_774544((int)&v28, "(");
}
v15 = COERCE_FLOAT(((int (__fastcall *)(SetupItemEditTriggerPopup *, int))a1->getValue)(a1, 479));
v16 = isOpValid(v23, v15);
v18 = v16;
if ( v5 )
{
if ( !v16 )
{
if ( !v12 )
goto LABEL_32;
goto LABEL_31;
}
sub_774544((int)&v28, "(");
}
if ( !v12 )
{
if ( !v5 )
{
v19 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%.03f", v17, v15);
CString = (char *)cocos2d::CCString::getCString(v19);
LABEL_55:
sub_774544((int)&v28, CString);
goto LABEL_33;
}
goto LABEL_32;
}
LABEL_31:
sub_77441C(&v28, v29);
if ( !v5 )
{
if ( !v18 )
goto LABEL_33;
goto LABEL_57;
}
LABEL_32:
sub_774544((int)&v28, " ");
opKeyToString((int)v37, v24);
sub_77441C(&v28, v37);
sub_774008(v37);
sub_774544((int)&v28, " ");
sub_77441C(&v28, v30);
if ( v18 )
{
sub_774544((int)&v28, ")");
LABEL_57:
sub_774544((int)&v28, " ");
opKeyToString((int)v38, v23);
sub_77441C(&v28, v38);
sub_774008(v38);
sub_774544((int)&v28, " ");
v22 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%.03f", v21, v15);
CString = (char *)cocos2d::CCString::getCString(v22);
goto LABEL_55;
}
LABEL_33:
if ( v26 > 0 )
sub_774544((int)&v28, ")");
if ( v27 > 0 )
sub_774544((int)&v28, ")");
if ( v14 )
sub_774544((int)&v28, ")");
if ( v13 )
sub_774544((int)&v28, ")");
sub_774008(v31);
sub_774008(v30);
sub_774008(v29);
LABEL_42:
a1->m_formulaLabel->setString(a1->m_formulaLabel, v28);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 400.0, 0.8, 0.0);
sub_774008(&v28);
}