Scobalula / Cerberus-Repo

Cal of Duty: Black Ops II/III GSC/CSC Decompiler
GNU General Public License v3.0
54 stars 7 forks source link

Executable error in Decompile Tab #13

Open jjak0b opened 5 years ago

jjak0b commented 5 years ago

I was searching some functions and i saw an error printed inside a decompiled gsc function.

Game: Black Ops 3 FF: core_patch.ff File: scripts/shared/vehicle_ai_shared.gsc function: collision_fx

function content on Decompile tab :

/*
    Name: collision_fx
    Namespace: vehicle_ai
    Checksum: 0xED4A3458
    Offset: 0x1688
    Size: 0x7B
    Parameters: 1
    Flags: None
*/
function collision_fx()
{
System.InvalidOperationException: Stack empty.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Stack`1.Pop()
   at .(ScriptOp ,  )
   at .( , Int32 )
   at ..ctor(ScriptExport , ScriptBase )
}

function content on Disassembly tab :

/*
    Name: collision_fx
    Namespace: vehicle_ai
    Checksum: 0xED4A3458
    Offset: 0x1688
    Size: 0x7B
    Parameters: 1
    Flags: None
*/
function vehicle_ai::collision_fx(...)
{
    /* IP: 0x00001688 - Size 0x0000001A */          OP_SafeCreateLocalVariables(normal, tilted, fx_origin);
    /* IP: 0x000016A2 - Size 0x00000004 */          OP_GetByte(2);
    /* IP: 0x000016A6 - Size 0x00000004 */          OP_EvalLocalVariableCached(2);
    /* IP: 0x000016AA - Size 0x00000002 */          OP_EvalArray();
    /* IP: 0x000016AC - Size 0x00000008 */          OP_GetFloat(0,6);
    /* IP: 0x000016B4 - Size 0x00000002 */          OP_LessThan();
    /* IP: 0x000016B6 - Size 0x00000004 */          OP_EvalLocalVariableRefCached(1);
    /* IP: 0x000016BA - Size 0x00000002 */          OP_SetVariableField();
    /* IP: 0x000016BC - Size 0x00000008 */          OP_EvalSelfFieldVariable(origin);
    /* IP: 0x000016C4 - Size 0x00000004 */          OP_EvalLocalVariableCached(2);
    /* IP: 0x000016C8 - Size 0x00000004 */          OP_EvalLocalVariableCached(1);
    /* IP: 0x000016CC - Size 0x00000004 */          OP_JumpOnFalse(8);
    /* IP: 0x000016D0 - Size 0x00000004 */          OP_GetByte(28);
    /* IP: 0x000016D4 - Size 0x00000004 */          OP_Jump(3);
    /* IP: 0x000016D8 - Size 0x00000004 */          OP_GetByte(10);
    /* IP: 0x000016DC - Size 0x00000002 */          OP_Multiply();
    /* IP: 0x000016DE - Size 0x00000002 */          OP_Minus();
    /* IP: 0x000016E0 - Size 0x00000004 */          OP_EvalLocalVariableRefCached(0);
    /* IP: 0x000016E4 - Size 0x00000002 */          OP_SetVariableField();
    /* IP: 0x000016E6 - Size 0x00000002 */          OP_PreScriptCall();
    /* IP: 0x000016E8 - Size 0x00000008 */          OP_GetString("veh_wasp_wall_imp");
    /* IP: 0x000016F0 - Size 0x00000002 */          OP_GetSelf();
    /* IP: 0x000016F2 - Size 0x0000000E */          OP_ScriptMethodCall(playsound);
    /* IP: 0x00001700 - Size 0x00000002 */          OP_DecTop();
    /* IP: 0x00001702 - Size 0x00000002 */          OP_End();
}
Scobalula commented 5 years ago

It seems to contain a ternary operator, which the decompiler currently doesn't handle, weird it results in a stack empty, because in theory there should actually be more items than expected on the stack. Source version in Modtools, to be looked into

image