// GML Script Format - THQ Australia Engine // Magic: "0lmg" (gml0 reversed) // Used by Avatar, SpongeBob, Jimmy Neutron, etc. // Big-endian root dispatcher (Xbox 360, Wii) type thqa_gml ui("GML Script", root) byteorder BE { criteria { require ascii(bytesat(0, 4)) == "0lmg"; } parse_here("thqa_gml_impl"); } // Little-endian root dispatcher (Original Xbox, GameCube) type thqa_gml_le ui("GML Script", root) byteorder LE { criteria { require ascii(bytesat(0, 4)) == "0lmg"; } parse_here("thqa_gml_impl"); } // Shared implementation - inherits byteorder from caller type thqa_gml_impl ui("GML Script") { set_name(_basename); magic = ascii(read(4)) ui("Magic"); u32 version ui("Version"); u32 header_size ui("Header Size"); u32 unknown_0c ui("Unknown 0x0C"); u32 data_size ui("Data Size"); u32 string_table_size ui("String Table Size"); // Get function count for display _saved_pos = pos(); skip(string_table_size); if (pos() + 4 <= size()) { u32 function_count ui("Function Count"); } seek(0); // Run Python decompiler on entire file _all_data = read(size()); _code = run_script("gml_decompile.py", _all_data); write_file("decompiled.gml", _code); set_preview("decompiled.txt", _code); set_viewer("text"); }