Welcome to the GBF Test Portal

This was built to track decompiler and CFG progress.

Decompiler Output

Backtrace

{
  "frames": [
    {
      "line": 282,
      "file": ".\\gbf_core\\src\\decompiler\\function_decompiler_context.rs",
      "function": "gbf_core::decompiler::function_decompiler_context::FunctionDecompilerContext::pop_assignable"
    },
    {
      "line": 33,
      "function": "gbf_core::decompiler::handlers::special_two_operand::impl$0::handle_instruction",
      "file": ".\\gbf_core\\src\\decompiler\\handlers\\special_two_operand.rs"
    },
    {
      "line": 171,
      "function": "gbf_core::decompiler::function_decompiler_context::FunctionDecompilerContext::process_instruction",
      "file": ".\\gbf_core\\src\\decompiler\\function_decompiler_context.rs"
    },
    {
      "line": 467,
      "file": ".\\gbf_core\\src\\decompiler\\function_decompiler.rs",
      "function": "gbf_core::decompiler::function_decompiler::FunctionDecompiler::process_regions"
    },
    {
      "line": 286,
      "function": "gbf_core::decompiler::function_decompiler::FunctionDecompiler::decompile",
      "file": ".\\gbf_core\\src\\decompiler\\function_decompiler.rs"
    }
  ]
}

Context

{
  "current_block_id": {
    "index": 0,
    "block_type": "Entry",
    "address": 9997
  },
  "current_ast_node_stack": [
    {
      "StandaloneNode": {
        "Expression": {
          "Assignable": {
            "MemberAccess": {
              "metadata": {
                "properties": {},
                "comments": []
              },
              "node_id": 94242,
              "ptr": {
                "rhs": {
                  "Identifier": {
                    "metadata": {
                      "properties": {},
                      "comments": []
                    },
                    "ptr": {
                      "ssa_version": null,
                      "id": "texttype"
                    },
                    "node_id": 94241
                  }
                },
                "ssa_version": 3,
                "lhs": {
                  "Identifier": {
                    "metadata": {
                      "properties": {},
                      "comments": []
                    },
                    "ptr": {
                      "ssa_version": null,
                      "id": "temp"
                    },
                    "node_id": 94240
                  }
                }
              }
            }
          }
        }
      }
    }
  ],
  "current_instruction": {
    "opcode": "AccessMember",
    "operand": null,
    "address": 10056
  }
}
function onGuiRCAddScriptAddButtonPressed(obj#0)
{
    lit#8 = "_";
    builtin_fn_call#9 = obj.name.pos(lit#8);
    lit#10 = 1;
    lit#11 = -1;
    builtin_fn_call#12 = obj.name.substring(builtin_fn_call#9 + lit#10, lit#11);
    temp.identity = builtin_fn_call#12;
    lit#13 = "GuiRCAddScript_";
    temp.texttype = lit#13 @ temp.identity.texttype;
    lit#14 = "GuiRCAddScriptNameTextEdit_";
    builtin_fn_call#16 = lit#14 @ temp.identity.text.trim();
    temp.scriptname = builtin_fn_call#16;
    builtin_fn_call#17 = temp.scriptname.length();
    lit#18 = 0;
    // RegionId(1)
    if (builtin_fn_call#17 <= lit#18) 
    {
        lit#19 = 0;
        return lit#19;
    }
    // RegionId(2)
    else
    {
        lit#20 = "GuiRCAddScript_";
        lit#22 = 0;
        // RegionId(4)
        if (phi<idx=0, regions=()> : phi<idx=1, regions=()>) 
        {
            // RegionId(5)
            if (temp.scriptname == temp.existingscript) 
            {
                lit#23 = 0;
                return lit#23;
            }
            // RegionId(6)
            else
            {
                phi<idx=0, regions=()>++;
                goto RegionId(3);
            }
        }
        // RegionId(7)
        else
        {
            lit#24 = "weapon";
            lit#25 = "class";
            // RegionId(8)
            if (temp.texttype in {lit#25, lit#24}) 
            {
                lit#27 = "// Scripted by ";
                lit#29 = " (";
                lit#31 = "";
                // RegionId(8)
                // RegionId(9)
                if (player.communityname == lit#31) 
                {
                }
                // RegionId(10)
                else
                {
                }
                lit#33 = ")";
                phi<idx=2, regions=()> = (phi<idx=1, regions=()> @ phi<idx=0, regions=()>) @ lit#33;
                fn_call#36 = this.queueText(temp.texttype, temp.scriptname, {temp.credits});
                goto RegionId(21);
            }
            // RegionId(12)
            else
            {
                lit#37 = "npc";
                // RegionId(13)
                if (temp.texttype == lit#37) 
                {
                    lit#39 = "GuiRCAddScriptIDTextEdit_";
                    builtin_fn_call#40 = lit#39 @ temp.identity.text.trim();
                    temp.npcid = builtin_fn_call#40;
                    lit#42 = "GuiRCAddScriptTypeTextEdit_";
                    builtin_fn_call#43 = lit#42 @ temp.identity.text.trim();
                    temp.npctype = builtin_fn_call#43;
                    temp.scripter = player.account;
                    lit#46 = "GuiRCAddScriptLevelTextEdit_";
                    builtin_fn_call#47 = lit#46 @ temp.identity.text.trim();
                    temp.levelname = builtin_fn_call#47;
                    lit#49 = "GuiRCAddScriptXTextEdit_";
                    builtin_fn_call#50 = lit#49 @ temp.identity.text.trim();
                    temp.npcx = builtin_fn_call#50;
                    lit#52 = "GuiRCAddScriptYTextEdit_";
                    builtin_fn_call#53 = lit#52 @ temp.identity.text.trim();
                    temp.npcy = builtin_fn_call#53;
                    builtin_fn_call#54 = int(temp.npcid);
                    lit#55 = 0;
                    // RegionId(13)
                    // RegionId(14)
                    if (builtin_fn_call#54 <= lit#55) 
                    {
                        builtin_fn_call#56 = temp.npctype.length();
                        lit#57 = 0;
                        // RegionId(14)
                        // RegionId(15)
                        if (builtin_fn_call#56 <= lit#57) 
                        {
                            builtin_fn_call#58 = temp.levelname.length();
                            lit#59 = 0;
                            // RegionId(15)
                            // RegionId(16)
                            if (builtin_fn_call#58 <= lit#59) 
                            {
                                builtin_fn_call#60 = temp.npcx.length();
                                lit#61 = 0;
                                // RegionId(16)
                                // RegionId(17)
                                if (builtin_fn_call#60 <= lit#61) 
                                {
                                    builtin_fn_call#62 = temp.npcy.length();
                                    lit#63 = 0;
                                }
                            }
                        }
                    }
                    // RegionId(19)
                    if (phi<idx=0, regions=()>) 
                    {
                        lit#64 = 0;
                        return lit#64;
                    }
                    // RegionId(20)
                    else
                    {
                        lit#66 = "y=";
                        lit#67 = "x=";
                        lit#68 = "level=";
                        lit#69 = "scripter=";
                        lit#70 = "type=";
                        lit#71 = "id=";
                        lit#72 = "name=";
                        temp.npcdata = {lit#72 @ temp.scriptname, lit#71 @ temp.npcid, lit#70 @ temp.npctype, lit#69 @ temp.scripter, lit#68 @ temp.levelname, lit#67 @ temp.npcx, lit#66 @ temp.npcy};
                        lit#73 = "";
                        lit#74 = "addnpc";
                        fn_call#75 = this.queueText(lit#74, lit#73, temp.npcdata);
                        goto RegionId(21);
                    }
                }
                // RegionId(21)
                else
                {
                    lit#76 = "GuiRC";
                    fn_call#78 = getTitleByTextType#77(temp.texttype);
                    lit#79 = "List";
                    fn_call#81 = isobject#80((lit#76 @ fn_call#78) @ lit#79);
                    // RegionId(21)
                    // RegionId(22)
                    if (fn_call#81) 
                    {
                        lit#82 = "";
                        lit#83 = "list";
                        fn_call#85 = this.queueRequest(temp.texttype @ lit#83, lit#82);
                    }
                    fn_call#86 = this.queueRequest(temp.texttype, temp.scriptname);
                    lit#87 = "GuiRCAddScript_";
                    fn_call#89 = lit#87 @ temp.identity.destroy();
                    lit#90 = 0;
                    return lit#90;
                }
            }
        }
    }
}