diff --git a/.eslintrc.json b/.eslintrc.json index f8b0f502..e69d317a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,6 +32,7 @@ "no-console": "warn", "no-constant-condition": ["warn", { "checkLoops": false }], "no-empty": "warn", + "no-useless-escape": "warn", "prettier/prettier": "warn", "react/no-unescaped-entities": "off", "@typescript-eslint/no-non-null-assertion": "off" diff --git a/craco.config.js b/craco.config.js index 2f9b458a..8efe82e0 100644 --- a/craco.config.js +++ b/craco.config.js @@ -1,8 +1,16 @@ const CracoAntDesignPlugin = require("craco-antd"); +const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); module.exports = { - plugins: [{ plugin: CracoAntDesignPlugin }], + plugins: [ + { plugin: CracoAntDesignPlugin }, + { + plugin: new MonacoWebpackPlugin({ + languages: [] + }) + } + ], eslint: { mode: "file" } -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index b6898978..14e1daac 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,8 @@ "mobx": "^5.11.0", "mobx-react": "^6.1.1", "moment": "^2.24.0", + "monaco-editor": "^0.17.1", + "monaco-editor-webpack-plugin": "^1.7.0", "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "^3.0.1", diff --git a/src/data_formats/cursor/ResizableBufferCursor.ts b/src/data_formats/cursor/ResizableBufferCursor.ts index 8184c441..5f4b9aec 100644 --- a/src/data_formats/cursor/ResizableBufferCursor.ts +++ b/src/data_formats/cursor/ResizableBufferCursor.ts @@ -309,7 +309,7 @@ export class ResizableBufferCursor implements Cursor { const max_pos = Math.min(this.position + max_byte_length, this.size); for (let i = this.position; i < max_pos; ++i) { - if (this.dv.getUint8(i) === value) { + if (this.dv.getUint8(this.offset + i) === value) { return i; } } @@ -321,7 +321,7 @@ export class ResizableBufferCursor implements Cursor { const max_pos = Math.min(this.position + max_byte_length, this.size); for (let i = this.position; i < max_pos; i += 2) { - if (this.dv.getUint16(i, this.little_endian) === value) { + if (this.dv.getUint16(this.offset + i, this.little_endian) === value) { return i; } } diff --git a/src/data_formats/parsing/quest/bin.ts b/src/data_formats/parsing/quest/bin.ts index 71b7ae55..ff9896ab 100644 --- a/src/data_formats/parsing/quest/bin.ts +++ b/src/data_formats/parsing/quest/bin.ts @@ -1,98 +1,45 @@ import Logger from "js-logger"; -import { Cursor } from "../../cursor/Cursor"; -import { WritableArrayBufferCursor } from "../../cursor/WritableArrayBufferCursor"; import { Endianness } from "../.."; import { ArrayBufferCursor } from "../../cursor/ArrayBufferCursor"; +import { Cursor } from "../../cursor/Cursor"; +import { WritableArrayBufferCursor } from "../../cursor/WritableArrayBufferCursor"; const logger = Logger.get("data_formats/parsing/quest/bin"); -export type BinFile = { - quest_id: number; - language: number; - quest_name: string; - short_description: string; - long_description: string; - function_offsets: number[]; - instructions: Instruction[]; - object_code: ArrayBuffer; - unknown: ArrayBuffer; -}; +export class BinFile { + constructor( + readonly quest_id: number, + readonly language: number, + readonly quest_name: string, + readonly short_description: string, + readonly long_description: string, + /** + * Map of labels to instruction indices. + */ + readonly labels: Map, + readonly instructions: Instruction[], + readonly object_code: ArrayBuffer, + readonly unknown: ArrayBuffer + ) {} -export function parse_bin(cursor: Cursor, lenient: boolean = false): BinFile { - const object_code_offset = cursor.u32(); // Always 4652 - const function_offset_table_offset = cursor.u32(); // Relative offsets - const size = cursor.u32(); - cursor.seek(4); // Always seems to be 0xFFFFFFFF - const quest_id = cursor.u32(); - const language = cursor.u32(); - const quest_name = cursor.string_utf16(64, true, true); - const short_description = cursor.string_utf16(256, true, true); - const long_description = cursor.string_utf16(576, true, true); + get_label_instructions(label: number): Instruction[] | undefined { + const index = this.labels.get(label); - if (size !== cursor.size) { - logger.warn(`Value ${size} in bin size field does not match actual size ${cursor.size}.`); + if (index == null || index > this.instructions.length) return undefined; + + const instructions: Instruction[] = []; + + for (let i = index; i < this.instructions.length; i++) { + const instruction = this.instructions[i]; + instructions.push(instruction); + + if (instruction.opcode === OP_RET) { + break; + } + } + + return instructions; } - - const unknown = cursor.take(object_code_offset - cursor.position).array_buffer(); - - const object_code = cursor - .seek_start(object_code_offset) - .take(function_offset_table_offset - object_code_offset); - - const instructions = parse_object_code(object_code, lenient); - - const function_offset_count = Math.floor((cursor.size - function_offset_table_offset) / 4); - - cursor.seek_start(function_offset_table_offset); - const function_offsets = []; - - for (let i = 0; i < function_offset_count; ++i) { - function_offsets.push(cursor.i32()); - } - - return { - quest_id, - language, - quest_name, - short_description, - long_description, - function_offsets, - instructions, - object_code: object_code.seek_start(0).array_buffer(), - unknown, - }; -} - -export function write_bin(bin: BinFile): ArrayBuffer { - const object_code_offset = 4652; - const buffer = new ArrayBuffer( - object_code_offset + bin.object_code.byteLength + 4 * bin.function_offsets.length - ); - const cursor = new WritableArrayBufferCursor(buffer, Endianness.Little); - - cursor.write_u32(object_code_offset); - cursor.write_u32(object_code_offset + bin.object_code.byteLength); - cursor.write_u32(buffer.byteLength); - cursor.write_u32(0xffffffff); - cursor.write_u32(bin.quest_id); - cursor.write_u32(bin.language); - cursor.write_string_utf16(bin.quest_name, 64); - cursor.write_string_utf16(bin.short_description, 256); - cursor.write_string_utf16(bin.long_description, 576); - - cursor.write_cursor(new ArrayBufferCursor(bin.unknown, Endianness.Little)); - - while (cursor.position < object_code_offset) { - cursor.write_u8(0); - } - - cursor.write_cursor(new ArrayBufferCursor(bin.object_code, Endianness.Little)); - - for (const function_offset of bin.function_offsets) { - cursor.write_i32(function_offset); - } - - return buffer; } /** @@ -171,36 +118,169 @@ export type Arg = { size: number; }; +export function parse_bin(cursor: Cursor, lenient: boolean = false): BinFile { + const object_code_offset = cursor.u32(); // Always 4652 + const label_offset_table_offset = cursor.u32(); // Relative offsets + const size = cursor.u32(); + cursor.seek(4); // Always seems to be 0xFFFFFFFF + const quest_id = cursor.u32(); + const language = cursor.u32(); + const quest_name = cursor.string_utf16(64, true, true); + const short_description = cursor.string_utf16(256, true, true); + const long_description = cursor.string_utf16(576, true, true); + + if (size !== cursor.size) { + logger.warn(`Value ${size} in bin size field does not match actual size ${cursor.size}.`); + } + + const unknown = cursor.take(object_code_offset - cursor.position).array_buffer(); + + const object_code = cursor + .seek_start(object_code_offset) + .take(label_offset_table_offset - object_code_offset); + + const instructions = parse_object_code(object_code, lenient); + + let instruction_size = 0; + + for (const instruction of instructions) { + instruction_size += instruction.size; + } + + if (object_code.size !== instruction_size) { + throw new Error( + `Expected to parse ${object_code.size} bytes but parsed ${instruction_size} instead.` + ); + } + + const label_offset_count = Math.floor((cursor.size - label_offset_table_offset) / 4); + cursor.seek_start(label_offset_table_offset); + + const labels = new Map(); + + for (let label = 0; label < label_offset_count; ++label) { + const offset = cursor.i32(); + + if (offset >= 0) { + let size = 0; + let index = 0; + + for (const instruction of instructions) { + if (offset === size) { + break; + } else if (offset < size) { + logger.warn( + `Label ${label} offset ${offset} does not point to the start of an instruction.` + ); + break; + } + + size += instruction.size; + index++; + } + + labels.set(label, index); + } + } + + return new BinFile( + quest_id, + language, + quest_name, + short_description, + long_description, + labels, + instructions, + object_code.seek_start(0).array_buffer(), + unknown + ); +} + +export function write_bin(bin: BinFile): ArrayBuffer { + const labels: number[] = [...bin.labels.entries()].reduce((ls, [l, i]) => { + ls[l] = i; + return ls; + }, new Array()); + + const object_code_offset = 4652; + const buffer = new ArrayBuffer( + object_code_offset + bin.object_code.byteLength + 4 * labels.length + ); + const cursor = new WritableArrayBufferCursor(buffer, Endianness.Little); + + cursor.write_u32(object_code_offset); + cursor.write_u32(object_code_offset + bin.object_code.byteLength); + cursor.write_u32(buffer.byteLength); + cursor.write_u32(0xffffffff); + cursor.write_u32(bin.quest_id); + cursor.write_u32(bin.language); + cursor.write_string_utf16(bin.quest_name, 64); + cursor.write_string_utf16(bin.short_description, 256); + cursor.write_string_utf16(bin.long_description, 576); + + cursor.write_cursor(new ArrayBufferCursor(bin.unknown, Endianness.Little)); + + while (cursor.position < object_code_offset) { + cursor.write_u8(0); + } + + cursor.write_cursor(new ArrayBufferCursor(bin.object_code, Endianness.Little)); + + for (let label = 0; label < labels.length; label++) { + const index = labels[label]; + + if (index == null) { + cursor.write_i32(-1); + } else { + let offset = 0; + + for (let j = 0; j < bin.instructions.length; j++) { + const instruction = bin.instructions[j]; + + if (j === index) { + break; + } else { + offset += instruction.size; + } + } + + cursor.write_i32(offset); + } + } + + return buffer; +} + function parse_object_code(cursor: Cursor, lenient: boolean): Instruction[] { const instructions: Instruction[] = []; try { while (cursor.bytes_left) { const main_opcode = cursor.u8(); - let code; - let opcode_list; + let opcode_index; switch (main_opcode) { case 0xf8: - code = cursor.u8(); - opcode_list = f8_opcodes; + opcode_index = 0x100 + cursor.u8(); break; case 0xf9: - code = cursor.u8(); - opcode_list = f9_opcodes; + opcode_index = 0x200 + cursor.u8(); break; default: - code = main_opcode; - opcode_list = opcodes; + opcode_index = main_opcode; break; } - let opcode = opcode_list[code]; + let opcode = OPCODES[opcode_index]; try { const args = parse_instruction_arguments(cursor, opcode); instructions.push(new Instruction(opcode, args)); } catch (e) { + logger.warn( + `Exception occurred while parsing arguments for instruction ${opcode.mnemonic}.`, + e + ); instructions.push(new Instruction(opcode, [])); } } @@ -243,8 +323,8 @@ function parse_instruction_arguments(cursor: Cursor, opcode: Opcode): Arg[] { break; case Type.SwitchData: { - const arg_size = 2 * cursor.u8(); - arg = cursor.u8_array(arg_size); + const arg_size = cursor.u8(); + arg = cursor.u16_array(arg_size); } break; case Type.JumpData: @@ -254,7 +334,7 @@ function parse_instruction_arguments(cursor: Cursor, opcode: Opcode): Arg[] { } break; case Type.String: - arg = cursor.string_utf16(1024, true, false); + arg = cursor.string_utf16(Math.min(4096, cursor.bytes_left), true, false); break; default: throw new Error(`Parameter type ${Type[param]} (${param}) not implemented.`); @@ -266,7 +346,7 @@ function parse_instruction_arguments(cursor: Cursor, opcode: Opcode): Arg[] { return args; } -const opcodes: Opcode[] = [ +export const OPCODES: Opcode[] = [ new Opcode(0x00, "nop", [], false, []), new Opcode(0x01, "ret", [], false, []), new Opcode(0x02, "sync", [], false, []), @@ -277,12 +357,12 @@ const opcodes: Opcode[] = [ new Opcode(0x07, "va_call", [Type.U16], false, []), new Opcode(0x08, "let", [Type.Register, Type.Register], false, []), new Opcode(0x09, "leti", [Type.Register, Type.I32], false, []), - new Opcode(0x0a, "unknown", [], false, []), - new Opcode(0x0b, "unknown", [], false, []), - new Opcode(0x0c, "unknown", [], false, []), - new Opcode(0x0d, "unknown", [], false, []), - new Opcode(0x0e, "unknown", [], false, []), - new Opcode(0x0f, "unknown", [], false, []), + new Opcode(0x0a, "unknown_0a", [], false, []), + new Opcode(0x0b, "unknown_0b", [], false, []), + new Opcode(0x0c, "unknown_0c", [], false, []), + new Opcode(0x0d, "unknown_0d", [], false, []), + new Opcode(0x0e, "unknown_0e", [], false, []), + new Opcode(0x0f, "unknown_0f", [], false, []), new Opcode(0x10, "set", [Type.Register], false, []), new Opcode(0x11, "clear", [Type.Register], false, []), new Opcode(0x12, "rev", [Type.Register], false, []), @@ -337,24 +417,24 @@ const opcodes: Opcode[] = [ new Opcode(0x43, "stack_pop", [Type.Register], false, []), new Opcode(0x44, "stack_pushm", [Type.Register, Type.U32], false, []), new Opcode(0x45, "stack_popm", [Type.Register, Type.U32], false, []), - new Opcode(0x46, "unknown", [], false, []), - new Opcode(0x47, "unknown", [], false, []), + new Opcode(0x46, "unknown_46", [], false, []), + new Opcode(0x47, "unknown_47", [], false, []), new Opcode(0x48, "arg_pushr", [Type.Register], true, []), new Opcode(0x49, "arg_pushl", [Type.I32], true, []), new Opcode(0x4a, "arg_pushb", [Type.U8], true, []), new Opcode(0x4b, "arg_pushw", [Type.U16], true, []), - new Opcode(0x4c, "unknown", [], false, []), - new Opcode(0x4d, "unknown", [], false, []), + new Opcode(0x4c, "unknown_4c", [], false, []), + new Opcode(0x4d, "unknown_4d", [], false, []), new Opcode(0x4e, "arg_pushs", [Type.String], true, []), - new Opcode(0x4f, "unknown4F", [Type.Register, Type.Register], false, []), + new Opcode(0x4f, "unknown_4f", [Type.Register, Type.Register], false, []), new Opcode(0x50, "message", [], false, [Type.U32, Type.String]), new Opcode(0x51, "list", [], false, [Type.Register, Type.String]), new Opcode(0x52, "fadein", [], false, []), new Opcode(0x53, "fadeout", [], false, []), new Opcode(0x54, "se", [], false, [Type.U32]), new Opcode(0x55, "bgm", [], false, [Type.U32]), - new Opcode(0x56, "unknown", [], false, []), - new Opcode(0x57, "unknown", [], false, []), + new Opcode(0x56, "unknown_56", [], false, []), + new Opcode(0x57, "unknown_57", [], false, []), new Opcode(0x58, "enable", [], false, [Type.U32]), new Opcode(0x59, "disable", [], false, [Type.U32]), new Opcode(0x5a, "window_msg", [], false, [Type.String]), @@ -362,23 +442,23 @@ const opcodes: Opcode[] = [ new Opcode(0x5c, "mesend", [], false, []), new Opcode(0x5d, "gettime", [Type.Register], false, []), new Opcode(0x5e, "winend", [], false, []), - new Opcode(0x5f, "unknown", [], false, []), - new Opcode(0x60, "npc_crt_V3", [Type.Register], false, []), + new Opcode(0x5f, "unknown_5f", [], false, []), + new Opcode(0x60, "npc_crt_v3", [Type.Register], false, []), new Opcode(0x61, "npc_stop", [], false, [Type.Register]), new Opcode(0x62, "npc_play", [], false, [Type.U32]), new Opcode(0x63, "npc_kill", [], false, [Type.Register]), new Opcode(0x64, "npc_nont", [], false, []), new Opcode(0x65, "npc_talk", [], false, []), - new Opcode(0x66, "npc_crp_V3", [Type.Register], false, []), - new Opcode(0x67, "unknown", [], false, []), + new Opcode(0x66, "npc_crp_v3", [Type.Register], false, []), + new Opcode(0x67, "unknown_67", [], false, []), new Opcode(0x68, "create_pipe", [], false, [Type.U32]), - new Opcode(0x69, "p_hpstat_V3", [], false, [Type.Register, Type.U32]), - new Opcode(0x6a, "p_dead_V3", [], false, [Type.Register, Type.U32]), + new Opcode(0x69, "p_hpstat_v3", [], false, [Type.Register, Type.U32]), + new Opcode(0x6a, "p_dead_v3", [], false, [Type.Register, Type.U32]), new Opcode(0x6b, "p_disablewarp", [], false, []), new Opcode(0x6c, "p_enablewarp", [], false, []), - new Opcode(0x6d, "p_move_V3", [Type.Register], false, []), + new Opcode(0x6d, "p_move_v3", [Type.Register], false, []), new Opcode(0x6e, "p_look", [], false, [Type.U32]), - new Opcode(0x6f, "unknown", [], false, []), + new Opcode(0x6f, "unknown_6f", [], false, []), new Opcode(0x70, "p_action_disable", [], false, []), new Opcode(0x71, "p_action_enable", [], false, []), new Opcode(0x72, "disable_movement1", [], false, [Type.Register]), @@ -388,21 +468,21 @@ const opcodes: Opcode[] = [ new Opcode(0x76, "p_setpos", [], false, [Type.Register, Type.Register]), new Opcode(0x77, "p_return_guild", [], false, []), new Opcode(0x78, "p_talk_guild", [], false, [Type.U32]), - new Opcode(0x79, "npc_talk_pl_V3", [Type.Register], false, []), + new Opcode(0x79, "npc_talk_pl_v3", [Type.Register], false, []), new Opcode(0x7a, "npc_talk_kill", [], false, [Type.U32]), - new Opcode(0x7b, "npc_crtpk_V3", [Type.Register], false, []), - new Opcode(0x7c, "npc_crppk_V3", [Type.Register], false, []), + new Opcode(0x7b, "npc_crtpk_v3", [Type.Register], false, []), + new Opcode(0x7c, "npc_crppk_v3", [Type.Register], false, []), new Opcode(0x7d, "npc_crptalk_v3", [Type.Register], false, []), - new Opcode(0x7e, "p_look_at_V1", [], false, [Type.U32, Type.U32]), - new Opcode(0x7f, "npc_crp_id_V3", [Type.Register], false, []), + new Opcode(0x7e, "p_look_at_v1", [], false, [Type.U32, Type.U32]), + new Opcode(0x7f, "npc_crp_id_v3", [Type.Register], false, []), new Opcode(0x80, "cam_quake", [], false, []), new Opcode(0x81, "cam_adj", [], false, []), new Opcode(0x82, "cam_zmin", [], false, []), new Opcode(0x83, "cam_zmout", [], false, []), - new Opcode(0x84, "cam_pan_V3", [Type.Register], false, []), + new Opcode(0x84, "cam_pan_v3", [Type.Register], false, []), new Opcode(0x85, "game_lev_super", [], false, []), new Opcode(0x86, "game_lev_reset", [], false, []), - new Opcode(0x87, "pos_pipe_V3", [Type.Register], false, []), + new Opcode(0x87, "pos_pipe_v3", [Type.Register], false, []), new Opcode(0x88, "if_zone_clear", [Type.Register, Type.Register], false, []), new Opcode(0x89, "chk_ene_num", [Type.Register], false, []), new Opcode(0x8a, "unhide_obj", [Type.Register], false, []), @@ -423,26 +503,26 @@ const opcodes: Opcode[] = [ new Opcode(0x99, "hud_show", [], false, []), new Opcode(0x9a, "cine_enable", [], false, []), new Opcode(0x9b, "cine_disable", [], false, []), - new Opcode(0x9c, "unknown", [], false, []), - new Opcode(0x9d, "unknown", [], false, []), - new Opcode(0x9e, "unknown", [], false, []), - new Opcode(0x9f, "unknown", [], false, []), - new Opcode(0xa0, "unknown", [], false, []), + new Opcode(0x9c, "unknown_9c", [], false, []), + new Opcode(0x9d, "unknown_9d", [], false, []), + new Opcode(0x9e, "unknown_9e", [], false, []), + new Opcode(0x9f, "unknown_9f", [], false, []), + new Opcode(0xa0, "unknown_a0", [], false, []), new Opcode(0xa1, "set_qt_failure", [Type.U16], false, []), new Opcode(0xa2, "set_qt_success", [Type.U16], false, []), new Opcode(0xa3, "clr_qt_failure", [], false, []), new Opcode(0xa4, "clr_qt_success", [], false, []), new Opcode(0xa5, "set_qt_cancel", [Type.U16], false, []), new Opcode(0xa6, "clr_qt_cancel", [], false, []), - new Opcode(0xa7, "unknown", [], false, []), - new Opcode(0xa8, "pl_walk_V3", [Type.Register], false, []), - new Opcode(0xa9, "unknown", [], false, []), - new Opcode(0xaa, "unknown", [], false, []), - new Opcode(0xab, "unknown", [], false, []), - new Opcode(0xac, "unknown", [], false, []), - new Opcode(0xad, "unknown", [], false, []), - new Opcode(0xae, "unknown", [], false, []), - new Opcode(0xaf, "unknown", [], false, []), + new Opcode(0xa7, "unknown_a7", [], false, []), + new Opcode(0xa8, "pl_walk_v3", [Type.Register], false, []), + new Opcode(0xa9, "unknown_a9", [], false, []), + new Opcode(0xaa, "unknown_aa", [], false, []), + new Opcode(0xab, "unknown_ab", [], false, []), + new Opcode(0xac, "unknown_ac", [], false, []), + new Opcode(0xad, "unknown_ad", [], false, []), + new Opcode(0xae, "unknown_ae", [], false, []), + new Opcode(0xaf, "unknown_af", [], false, []), new Opcode(0xb0, "pl_add_meseta", [], false, [Type.U32, Type.U32]), new Opcode(0xb1, "thread_stg", [Type.U16], false, []), new Opcode(0xb2, "del_obj_param", [Type.Register], false, []), @@ -455,11 +535,11 @@ const opcodes: Opcode[] = [ new Opcode(0xb9, "get_difflvl", [Type.Register], false, []), new Opcode(0xba, "set_qt_exit", [Type.U16], false, []), new Opcode(0xbb, "clr_qt_exit", [], false, []), - new Opcode(0xbc, "unknown", [], false, []), - new Opcode(0xbd, "unknown", [], false, []), - new Opcode(0xbe, "unknown", [], false, []), - new Opcode(0xbf, "unknown", [], false, []), - new Opcode(0xc0, "particle_V3", [Type.Register], false, []), + new Opcode(0xbc, "unknown_bc", [], false, []), + new Opcode(0xbd, "unknown_bd", [], false, []), + new Opcode(0xbe, "unknown_be", [], false, []), + new Opcode(0xbf, "unknown_bf", [], false, []), + new Opcode(0xc0, "particle_v3", [Type.Register], false, []), new Opcode(0xc1, "npc_text", [], false, [Type.U32, Type.String]), new Opcode(0xc2, "npc_chkwarp", [], false, []), new Opcode(0xc3, "pl_pkoff", [], false, []), @@ -472,8 +552,8 @@ const opcodes: Opcode[] = [ new Opcode(0xca, "getmtime", [Type.Register], false, []), new Opcode(0xcb, "set_quest_board_handler", [], false, [Type.U32, Type.U16, Type.String]), new Opcode(0xcc, "clear_quest_board_handler", [], false, [Type.U32]), - new Opcode(0xcd, "particle_id_V3", [Type.Register], false, []), - new Opcode(0xce, "npc_crptalk_id_V3", [Type.Register], false, []), + new Opcode(0xcd, "particle_id_v3", [Type.Register], false, []), + new Opcode(0xce, "npc_crptalk_id_v3", [Type.Register], false, []), new Opcode(0xcf, "npc_lang_clean", [], false, []), new Opcode(0xd0, "pl_pkon", [], false, []), new Opcode(0xd1, "pl_chk_item2", [Type.Register, Type.Register], false, []), @@ -489,11 +569,11 @@ const opcodes: Opcode[] = [ new Opcode(0xdb, "set_returncity", [], false, []), new Opcode(0xdc, "load_pvr", [], false, []), new Opcode(0xdd, "load_midi", [], false, []), - new Opcode(0xde, "unknown", [], false, []), - new Opcode(0xdf, "npc_param_V3", [], false, [Type.Register, Type.U32]), + new Opcode(0xde, "unknown_de", [], false, []), + new Opcode(0xdf, "npc_param_v3", [], false, [Type.Register, Type.U32]), new Opcode(0xe0, "pad_dragon", [], false, []), new Opcode(0xe1, "clear_mainwarp", [], false, [Type.U32]), - new Opcode(0xe2, "pcam_param_V3", [Type.Register], false, []), + new Opcode(0xe2, "pcam_param_v3", [Type.Register], false, []), new Opcode(0xe3, "start_setevt_v3", [], false, [Type.Register, Type.U32]), new Opcode(0xe4, "warp_on", [], false, []), new Opcode(0xe5, "warp_off", [], false, []), @@ -501,251 +581,248 @@ const opcodes: Opcode[] = [ new Opcode(0xe7, "get_servernumber", [Type.Register], false, []), new Opcode(0xe8, "set_eventflag2", [], false, [Type.U32, Type.Register]), new Opcode(0xe9, "res", [Type.Register, Type.Register], false, []), - new Opcode(0xea, "unknownEA", [Type.Register, Type.U32], false, []), + new Opcode(0xea, "unknown_ea", [Type.Register, Type.U32], false, []), new Opcode(0xeb, "enable_bgmctrl", [], false, [Type.U32]), new Opcode(0xec, "sw_send", [Type.Register], false, []), new Opcode(0xed, "create_bgmctrl", [], false, []), new Opcode(0xee, "pl_add_meseta2", [], false, [Type.U32]), new Opcode(0xef, "sync_register", [], false, [Type.Register, Type.U32]), new Opcode(0xf0, "send_regwork", [], false, []), - new Opcode(0xf1, "leti_fixed_camera_V3", [Type.Register], false, []), + new Opcode(0xf1, "leti_fixed_camera_v3", [Type.Register], false, []), new Opcode(0xf2, "default_camera_pos1", [], false, []), - new Opcode(0xf3, "unknown", [], false, []), - new Opcode(0xf4, "unknown", [], false, []), - new Opcode(0xf5, "unknown", [], false, []), - new Opcode(0xf6, "unknown", [], false, []), - new Opcode(0xf7, "unknown", [], false, []), - new Opcode(0xf8, "unknownF8", [Type.Register], false, []), - new Opcode(0xf9, "unknown", [], false, []), + new Opcode(0xf3, "unknown_f3", [], false, []), + new Opcode(0xf4, "unknown_f4", [], false, []), + new Opcode(0xf5, "unknown_f5", [], false, []), + new Opcode(0xf6, "unknown_f6", [], false, []), + new Opcode(0xf7, "unknown_f7", [], false, []), + new Opcode(0xf8, "unknown_f8", [Type.Register], false, []), + new Opcode(0xf9, "unknown_f9", [], false, []), new Opcode(0xfa, "get_gc_number", [Type.Register], false, []), - new Opcode(0xfb, "unknownFB", [Type.U16], false, []), - new Opcode(0xfc, "unknown", [], false, []), - new Opcode(0xfd, "unknown", [], false, []), - new Opcode(0xfe, "unknown", [], false, []), - new Opcode(0xff, "unknownFF", [], false, []), -]; - -const f8_opcodes = [ - new Opcode(0x00f8, "unknown", [], false, []), - new Opcode(0x01f8, "set_chat_callback?", [], false, [Type.Register, Type.String]), - new Opcode(0x02f8, "unknown", [], false, []), - new Opcode(0x03f8, "unknown", [], false, []), - new Opcode(0x04f8, "unknown", [], false, []), - new Opcode(0x05f8, "unknown", [], false, []), - new Opcode(0x06f8, "unknown", [], false, []), - new Opcode(0x07f8, "unknown", [], false, []), - new Opcode(0x08f8, "get_difficulty_level2", [Type.Register], false, []), - new Opcode(0x09f8, "get_number_of_player1", [Type.Register], false, []), - new Opcode(0x0af8, "get_coord_of_player", [Type.Register, Type.Register], false, []), - new Opcode(0x0bf8, "unknownF80B", [], false, []), - new Opcode(0x0cf8, "unknownF80C", [], false, []), - new Opcode(0x0df8, "map_designate_ex", [Type.Register], false, []), - new Opcode(0x0ef8, "unknownF80E", [], false, [Type.U32]), - new Opcode(0x0ff8, "unknownF80F", [], false, [Type.U32]), - new Opcode(0x10f8, "ba_initial_floor", [], false, [Type.U32]), - new Opcode(0x11f8, "set_ba_rules", [], false, []), - new Opcode(0x12f8, "unknownF812", [], false, [Type.U32]), - new Opcode(0x13f8, "unknownF813", [], false, [Type.U32]), - new Opcode(0x14f8, "unknownF814", [], false, [Type.U32]), - new Opcode(0x15f8, "unknownF815", [], false, [Type.U32]), - new Opcode(0x16f8, "unknownF816", [], false, [Type.U32]), - new Opcode(0x17f8, "unknownF817", [], false, [Type.U32]), - new Opcode(0x18f8, "unknownF818", [], false, [Type.U32]), - new Opcode(0x19f8, "unknownF819", [], false, [Type.U32]), - new Opcode(0x1af8, "unknownF81A", [], false, [Type.U32]), - new Opcode(0x1bf8, "unknownF81B", [], false, [Type.U32]), - new Opcode(0x1cf8, "ba_disp_msg", [], false, [Type.String]), - new Opcode(0x1df8, "death_lvl_up", [], false, [Type.U32]), - new Opcode(0x1ef8, "death_tech_lvl_up", [], false, [Type.U32]), - new Opcode(0x1ff8, "unknown", [], false, []), - new Opcode(0x20f8, "cmode_stage", [], false, [Type.U32]), - new Opcode(0x21f8, "unknown", [], false, []), - new Opcode(0x22f8, "unknown", [], false, []), - new Opcode(0x23f8, "unknownF823", [], false, [Type.U32]), - new Opcode(0x24f8, "unknownF824", [], false, [Type.U32]), - new Opcode(0x25f8, "exp_multiplication", [Type.Register], false, []), - new Opcode(0x26f8, "exp_division?", [Type.Register], false, []), - new Opcode(0x27f8, "get_user_is_dead?", [Type.Register], false, []), - new Opcode(0x28f8, "go_floor", [Type.Register, Type.Register], false, []), - new Opcode(0x29f8, "unknown", [], false, []), - new Opcode(0x2af8, "unknown", [], false, []), - new Opcode(0x2bf8, "unlock_door2", [], false, [Type.U32, Type.U32]), - new Opcode(0x2cf8, "lock_door2", [], false, [Type.U32, Type.U32]), - new Opcode(0x2df8, "if_switch_not_pressed", [Type.Register], false, []), - new Opcode(0x2ef8, "if_switch_pressed", [Type.Register], false, []), - new Opcode(0x2ff8, "unknownF82F", [], false, [Type.U32, Type.U32]), - new Opcode(0x30f8, "control_dragon", [Type.Register], false, []), - new Opcode(0x31f8, "release_dragon", [], false, []), - new Opcode(0x32f8, "unknown", [], false, []), - new Opcode(0x33f8, "unknown", [], false, []), - new Opcode(0x34f8, "unknown", [], false, []), - new Opcode(0x35f8, "unknown", [], false, []), - new Opcode(0x36f8, "unknown", [], false, []), - new Opcode(0x37f8, "unknown", [], false, []), - new Opcode(0x38f8, "shrink", [Type.Register], false, []), - new Opcode(0x39f8, "unshrink", [Type.Register], false, []), - new Opcode(0x3af8, "unknown", [], false, []), - new Opcode(0x3bf8, "unknown", [], false, []), - new Opcode(0x3cf8, "display_clock2?", [Type.Register], false, []), - new Opcode(0x3df8, "unknownF83D", [], false, [Type.U32]), - new Opcode(0x3ef8, "delete_area_title?", [], false, [Type.U32]), - new Opcode(0x3ff8, "unknown", [], false, []), - new Opcode(0x40f8, "load_npc_data", [], false, []), - new Opcode(0x41f8, "get_npc_data", [Type.U16], false, []), - new Opcode(0x42f8, "unknown", [], false, []), - new Opcode(0x43f8, "unknown", [], false, []), - new Opcode(0x44f8, "unknown", [], false, []), - new Opcode(0x45f8, "unknown", [], false, []), - new Opcode(0x46f8, "unknown", [], false, []), - new Opcode(0x47f8, "unknown", [], false, []), - new Opcode(0x48f8, "give_damage_score", [Type.Register], false, []), - new Opcode(0x49f8, "take_damage_score", [Type.Register], false, []), - new Opcode(0x4af8, "unk_score_F84A", [Type.Register], false, []), - new Opcode(0x4bf8, "unk_score_F84B", [Type.Register], false, []), - new Opcode(0x4cf8, "kill_score", [Type.Register], false, []), - new Opcode(0x4df8, "death_score", [Type.Register], false, []), - new Opcode(0x4ef8, "unk_score_F84E", [Type.Register], false, []), - new Opcode(0x4ff8, "enemy_death_score", [Type.Register], false, []), - new Opcode(0x50f8, "meseta_score", [Type.Register], false, []), - new Opcode(0x51f8, "unknownF851", [Type.Register], false, []), - new Opcode(0x52f8, "unknownF852", [], false, [Type.U32]), - new Opcode(0x53f8, "reverse_warps", [], false, []), - new Opcode(0x54f8, "unreverse_warps", [], false, []), - new Opcode(0x55f8, "set_ult_map", [], false, []), - new Opcode(0x56f8, "unset_ult_map", [], false, []), - new Opcode(0x57f8, "set_area_title", [], false, [Type.String]), - new Opcode(0x58f8, "unknownF858", [], false, []), - new Opcode(0x59f8, "unknown", [], false, []), - new Opcode(0x5af8, "equip_item", [Type.Register], false, []), - new Opcode(0x5bf8, "unequip_item", [], false, [Type.U32, Type.U32]), - new Opcode(0x5cf8, "unknown", [], false, []), - new Opcode(0x5df8, "unknown", [], false, []), - new Opcode(0x5ef8, "unknownF85E", [], false, [Type.U32]), - new Opcode(0x5ff8, "unknownF85F", [], false, [Type.U32]), - new Opcode(0x60f8, "unknownF860", [], false, []), - new Opcode(0x61f8, "unknownF861", [], false, [Type.U32]), - new Opcode(0x62f8, "unknown", [], false, []), - new Opcode(0x63f8, "unknown", [], false, []), - new Opcode(0x64f8, "cmode_rank", [], false, [Type.U32, Type.String]), - new Opcode(0x65f8, "award_item_name?", [], false, []), - new Opcode(0x66f8, "award_item_select?", [], false, []), - new Opcode(0x67f8, "award_item_give_to?", [Type.Register], false, []), - new Opcode(0x68f8, "unknownF868", [Type.Register, Type.Register], false, []), - new Opcode(0x69f8, "unknownF869", [Type.Register, Type.Register], false, []), - new Opcode(0x6af8, "item_create_cmode", [Type.Register, Type.Register], false, []), - new Opcode(0x6bf8, "unknownF86B", [Type.Register], false, []), - new Opcode(0x6cf8, "award_item_ok?", [Type.Register], false, []), - new Opcode(0x6df8, "unknownF86D", [], false, []), - new Opcode(0x6ef8, "unknownF86E", [], false, []), - new Opcode(0x6ff8, "ba_set_lives", [], false, [Type.U32]), - new Opcode(0x70f8, "ba_set_tech_lvl", [], false, [Type.U32]), - new Opcode(0x71f8, "ba_set_lvl", [], false, [Type.U32]), - new Opcode(0x72f8, "ba_set_time_limit", [], false, [Type.U32]), - new Opcode(0x73f8, "boss_is_dead?", [Type.Register], false, []), - new Opcode(0x74f8, "unknown", [], false, []), - new Opcode(0x75f8, "unknown", [], false, []), - new Opcode(0x76f8, "unknown", [], false, []), - new Opcode(0x77f8, "enable_techs", [Type.Register], false, []), - new Opcode(0x78f8, "disable_techs", [Type.Register], false, []), - new Opcode(0x79f8, "get_gender", [Type.Register, Type.Register], false, []), - new Opcode(0x7af8, "get_chara_class", [Type.Register, Type.Register], false, []), - new Opcode(0x7bf8, "take_slot_meseta", [Type.Register, Type.Register], false, []), - new Opcode(0x7cf8, "unknown", [], false, []), - new Opcode(0x7df8, "unknown", [], false, []), - new Opcode(0x7ef8, "unknown", [], false, []), - new Opcode(0x7ff8, "read_guildcard_flag", [Type.Register, Type.Register], false, []), - new Opcode(0x80f8, "unknownF880", [Type.Register], false, []), - new Opcode(0x81f8, "get_pl_name?", [Type.Register], false, []), - new Opcode(0x82f8, "unknown", [], false, []), - new Opcode(0x83f8, "unknownF883", [Type.Register, Type.Register], false, []), - new Opcode(0x84f8, "unknown", [], false, []), - new Opcode(0x85f8, "unknown", [], false, []), - new Opcode(0x86f8, "unknown", [], false, []), - new Opcode(0x87f8, "unknown", [], false, []), - new Opcode(0x88f8, "ba_close_msg", [], false, []), - new Opcode(0x89f8, "unknown", [], false, []), - new Opcode(0x8af8, "get_player_status", [Type.Register, Type.Register], false, []), - new Opcode(0x8bf8, "send_mail", [], false, [Type.Register, Type.String]), - new Opcode(0x8cf8, "online_check", [Type.Register], false, []), - new Opcode(0x8df8, "chl_set_timerecord?", [Type.Register], false, []), - new Opcode(0x8ef8, "chl_get_timerecord?", [Type.Register], false, []), - new Opcode(0x8ff8, "unknownF88F", [Type.Register], false, []), - new Opcode(0x90f8, "unknownF890", [], false, []), - new Opcode(0x91f8, "load_enemy_data", [], false, [Type.U32]), - new Opcode(0x92f8, "get_physical_data", [Type.U16], false, []), - new Opcode(0x93f8, "get_attack_data", [Type.U16], false, []), - new Opcode(0x94f8, "get_resist_data", [Type.U16], false, []), - new Opcode(0x95f8, "get_movement_data", [Type.U16], false, []), - new Opcode(0x96f8, "unknown", [], false, []), - new Opcode(0x97f8, "unknown", [], false, []), - new Opcode(0x98f8, "shift_left", [Type.Register, Type.Register], false, []), - new Opcode(0x99f8, "shift_right", [Type.Register, Type.Register], false, []), - new Opcode(0x9af8, "get_random", [Type.Register, Type.Register], false, []), - new Opcode(0x9bf8, "reset_map", [], false, []), - new Opcode(0x9cf8, "disp_chl_retry_menu", [Type.Register], false, []), - new Opcode(0x9df8, "chl_reverser?", [], false, []), - new Opcode(0x9ef8, "unknownF89E", [], false, [Type.U32]), - new Opcode(0x9ff8, "unknownF89F", [Type.Register], false, []), - new Opcode(0xa0f8, "unknownF8A0", [], false, []), - new Opcode(0xa1f8, "unknownF8A1", [], false, []), - new Opcode(0xa2f8, "unknown", [], false, []), - new Opcode(0xa3f8, "unknown", [], false, []), - new Opcode(0xa4f8, "unknown", [], false, []), - new Opcode(0xa5f8, "unknown", [], false, []), - new Opcode(0xa6f8, "unknown", [], false, []), - new Opcode(0xa7f8, "unknown", [], false, []), - new Opcode(0xa8f8, "unknownF8A8", [], false, [Type.U32]), - new Opcode(0xa9f8, "unknownF8A9", [Type.Register], false, []), - new Opcode(0xaaf8, "unknown", [], false, []), - new Opcode(0xabf8, "unknown", [], false, []), - new Opcode(0xacf8, "unknown", [], false, []), - new Opcode(0xadf8, "get_number_of_player2", [Type.Register], false, []), - new Opcode(0xaef8, "unknown", [], false, []), - new Opcode(0xaff8, "unknown", [], false, []), - new Opcode(0xb0f8, "unknown", [], false, []), - new Opcode(0xb1f8, "unknown", [], false, []), - new Opcode(0xb2f8, "unknown", [], false, []), - new Opcode(0xb3f8, "unknown", [], false, []), - new Opcode(0xb4f8, "unknown", [], false, []), - new Opcode(0xb5f8, "unknown", [], false, []), - new Opcode(0xb6f8, "unknown", [], false, []), - new Opcode(0xb7f8, "unknown", [], false, []), - new Opcode(0xb8f8, "unknownF8B8", [], false, []), - new Opcode(0xb9f8, "chl_recovery?", [], false, []), - new Opcode(0xbaf8, "unknown", [], false, []), - new Opcode(0xbbf8, "unknown", [], false, []), - new Opcode(0xbcf8, "set_episode", [Type.U32], false, []), - new Opcode(0xbdf8, "unknown", [], false, []), - new Opcode(0xbef8, "unknown", [], false, []), - new Opcode(0xbff8, "unknown", [], false, []), - new Opcode(0xc0f8, "file_dl_req", [], false, [Type.U32, Type.String]), - new Opcode(0xc1f8, "get_dl_status", [Type.Register], false, []), - new Opcode(0xc2f8, "gba_unknown4?", [], false, []), - new Opcode(0xc3f8, "get_gba_state?", [Type.Register], false, []), - new Opcode(0xc4f8, "unknownF8C4", [Type.Register], false, []), - new Opcode(0xc5f8, "unknownF8C5", [Type.Register], false, []), - new Opcode(0xc6f8, "QEXIT", [], false, []), - new Opcode(0xc7f8, "use_animation", [Type.Register, Type.Register], false, []), - new Opcode(0xc8f8, "stop_animation", [Type.Register], false, []), - new Opcode(0xc9f8, "run_to_coord", [Type.Register, Type.Register], false, []), - new Opcode(0xcaf8, "set_slot_invincible", [Type.Register, Type.Register], false, []), - new Opcode(0xcbf8, "unknownF8CB", [Type.Register], false, []), - new Opcode(0xccf8, "set_slot_poison", [Type.Register], false, []), - new Opcode(0xcdf8, "set_slot_paralyze", [Type.Register], false, []), - new Opcode(0xcef8, "set_slot_shock", [Type.Register], false, []), - new Opcode(0xcff8, "set_slot_freeze", [Type.Register], false, []), - new Opcode(0xd0f8, "set_slot_slow", [Type.Register], false, []), - new Opcode(0xd1f8, "set_slot_confuse", [Type.Register], false, []), - new Opcode(0xd2f8, "set_slot_shifta", [Type.Register], false, []), - new Opcode(0xd3f8, "set_slot_deband", [Type.Register], false, []), - new Opcode(0xd4f8, "set_slot_jellen", [Type.Register], false, []), - new Opcode(0xd5f8, "set_slot_zalure", [Type.Register], false, []), - new Opcode(0xd6f8, "fleti_fixed_camera", [], false, [Type.Register]), - new Opcode(0xd7f8, "fleti_locked_camera", [], false, [Type.U32, Type.Register]), - new Opcode(0xd8f8, "default_camera_pos2", [], false, []), - new Opcode(0xd9f8, "set_motion_blur", [], false, []), - new Opcode(0xdaf8, "set_screen_b&w", [], false, []), - new Opcode(0xdbf8, "unknownF8DB", [], false, [ + new Opcode(0xfb, "unknown_fb", [Type.U16], false, []), + new Opcode(0xfc, "unknown_fc", [], false, []), + new Opcode(0xfd, "unknown_fd", [], false, []), + new Opcode(0xfe, "unknown_fe", [], false, []), + new Opcode(0xff, "unknown_ff", [], false, []), + new Opcode(0xf800, "unknown_f800", [], false, []), + new Opcode(0xf801, "set_chat_callback", [], false, [Type.Register, Type.String]), + new Opcode(0xf802, "unknown_f802", [], false, []), + new Opcode(0xf803, "unknown_f803", [], false, []), + new Opcode(0xf804, "unknown_f804", [], false, []), + new Opcode(0xf805, "unknown_f805", [], false, []), + new Opcode(0xf806, "unknown_f806", [], false, []), + new Opcode(0xf807, "unknown_f807", [], false, []), + new Opcode(0xf808, "get_difficulty_level2", [Type.Register], false, []), + new Opcode(0xf809, "get_number_of_player1", [Type.Register], false, []), + new Opcode(0xf80a, "get_coord_of_player", [Type.Register, Type.Register], false, []), + new Opcode(0xf80b, "unknown_f80b", [], false, []), + new Opcode(0xf80c, "unknown_f80c", [], false, []), + new Opcode(0xf80d, "map_designate_ex", [Type.Register], false, []), + new Opcode(0xf80e, "unknown_f80e", [], false, [Type.U32]), + new Opcode(0xf80f, "unknown_f80f", [], false, [Type.U32]), + new Opcode(0xf810, "ba_initial_floor", [], false, [Type.U32]), + new Opcode(0xf811, "set_ba_rules", [], false, []), + new Opcode(0xf812, "unknown_f812", [], false, [Type.U32]), + new Opcode(0xf813, "unknown_f813", [], false, [Type.U32]), + new Opcode(0xf814, "unknown_f814", [], false, [Type.U32]), + new Opcode(0xf815, "unknown_f815", [], false, [Type.U32]), + new Opcode(0xf816, "unknown_f816", [], false, [Type.U32]), + new Opcode(0xf817, "unknown_f817", [], false, [Type.U32]), + new Opcode(0xf818, "unknown_f818", [], false, [Type.U32]), + new Opcode(0xf819, "unknown_f819", [], false, [Type.U32]), + new Opcode(0xf81a, "unknown_f81a", [], false, [Type.U32]), + new Opcode(0xf81b, "unknown_f81b", [], false, [Type.U32]), + new Opcode(0xf81c, "ba_disp_msg", [], false, [Type.String]), + new Opcode(0xf81d, "death_lvl_up", [], false, [Type.U32]), + new Opcode(0xf81e, "death_tech_lvl_up", [], false, [Type.U32]), + new Opcode(0xf81f, "unknown_f81f", [], false, []), + new Opcode(0xf820, "cmode_stage", [], false, [Type.U32]), + new Opcode(0xf821, "unknown_f821", [], false, []), + new Opcode(0xf822, "unknown_f822", [], false, []), + new Opcode(0xf823, "unknown_f823", [], false, [Type.U32]), + new Opcode(0xf824, "unknown_f824", [], false, [Type.U32]), + new Opcode(0xf825, "exp_multiplication", [Type.Register], false, []), + new Opcode(0xf826, "exp_division", [Type.Register], false, []), + new Opcode(0xf827, "get_user_is_dead", [Type.Register], false, []), + new Opcode(0xf828, "go_floor", [Type.Register, Type.Register], false, []), + new Opcode(0xf829, "unknown_f829", [], false, []), + new Opcode(0xf82a, "unknown_f82a", [], false, []), + new Opcode(0xf82b, "unlock_door2", [], false, [Type.U32, Type.U32]), + new Opcode(0xf82c, "lock_door2", [], false, [Type.U32, Type.U32]), + new Opcode(0xf82d, "if_switch_not_pressed", [Type.Register], false, []), + new Opcode(0xf82e, "if_switch_pressed", [Type.Register], false, []), + new Opcode(0xf82f, "unknown_f82f", [], false, [Type.U32, Type.U32]), + new Opcode(0xf830, "control_dragon", [Type.Register], false, []), + new Opcode(0xf831, "release_dragon", [], false, []), + new Opcode(0xf832, "unknown_f832", [], false, []), + new Opcode(0xf833, "unknown_f833", [], false, []), + new Opcode(0xf834, "unknown_f834", [], false, []), + new Opcode(0xf835, "unknown_f835", [], false, []), + new Opcode(0xf836, "unknown_f836", [], false, []), + new Opcode(0xf837, "unknown_f837", [], false, []), + new Opcode(0xf838, "shrink", [Type.Register], false, []), + new Opcode(0xf839, "unshrink", [Type.Register], false, []), + new Opcode(0xf83a, "unknown_f83a", [], false, []), + new Opcode(0xf83b, "unknown_f83b", [], false, []), + new Opcode(0xf83c, "display_clock2", [Type.Register], false, []), + new Opcode(0xf83d, "unknown_f83d", [], false, [Type.U32]), + new Opcode(0xf83e, "delete_area_title", [], false, [Type.U32]), + new Opcode(0xf83f, "unknown_f83f", [], false, []), + new Opcode(0xf840, "load_npc_data", [], false, []), + new Opcode(0xf841, "get_npc_data", [Type.U16], false, []), + new Opcode(0xf842, "unknown_f842", [], false, []), + new Opcode(0xf843, "unknown_f843", [], false, []), + new Opcode(0xf844, "unknown_f844", [], false, []), + new Opcode(0xf845, "unknown_f845", [], false, []), + new Opcode(0xf846, "unknown_f846", [], false, []), + new Opcode(0xf847, "unknown_f847", [], false, []), + new Opcode(0xf848, "give_damage_score", [Type.Register], false, []), + new Opcode(0xf849, "take_damage_score", [Type.Register], false, []), + new Opcode(0xf84a, "unk_score_f84a", [Type.Register], false, []), + new Opcode(0xf84b, "unk_score_f84b", [Type.Register], false, []), + new Opcode(0xf84c, "kill_score", [Type.Register], false, []), + new Opcode(0xf84d, "death_score", [Type.Register], false, []), + new Opcode(0xf84e, "unk_score_f84e", [Type.Register], false, []), + new Opcode(0xf84f, "enemy_death_score", [Type.Register], false, []), + new Opcode(0xf850, "meseta_score", [Type.Register], false, []), + new Opcode(0xf851, "unknown_f851", [Type.Register], false, []), + new Opcode(0xf852, "unknown_f852", [], false, [Type.U32]), + new Opcode(0xf853, "reverse_warps", [], false, []), + new Opcode(0xf854, "unreverse_warps", [], false, []), + new Opcode(0xf855, "set_ult_map", [], false, []), + new Opcode(0xf856, "unset_ult_map", [], false, []), + new Opcode(0xf857, "set_area_title", [], false, [Type.String]), + new Opcode(0xf858, "unknown_f858", [], false, []), + new Opcode(0xf859, "unknown_f859", [], false, []), + new Opcode(0xf85a, "equip_item", [Type.Register], false, []), + new Opcode(0xf85b, "unequip_item", [], false, [Type.U32, Type.U32]), + new Opcode(0xf85c, "unknown_f85c", [], false, []), + new Opcode(0xf85d, "unknown_f85d", [], false, []), + new Opcode(0xf85e, "unknown_f85e", [], false, [Type.U32]), + new Opcode(0xf85f, "unknown_f85f", [], false, [Type.U32]), + new Opcode(0xf860, "unknown_f860", [], false, []), + new Opcode(0xf861, "unknown_f861", [], false, [Type.U32]), + new Opcode(0xf862, "unknown_f862", [], false, []), + new Opcode(0xf863, "unknown_f863", [], false, []), + new Opcode(0xf864, "cmode_rank", [], false, [Type.U32, Type.String]), + new Opcode(0xf865, "award_item_name", [], false, []), + new Opcode(0xf866, "award_item_select", [], false, []), + new Opcode(0xf867, "award_item_give_to", [Type.Register], false, []), + new Opcode(0xf868, "unknown_f868", [Type.Register, Type.Register], false, []), + new Opcode(0xf869, "unknown_f869", [Type.Register, Type.Register], false, []), + new Opcode(0xf86a, "item_create_cmode", [Type.Register, Type.Register], false, []), + new Opcode(0xf86b, "unknown_f86b", [Type.Register], false, []), + new Opcode(0xf86c, "award_item_ok", [Type.Register], false, []), + new Opcode(0xf86d, "unknown_f86d", [], false, []), + new Opcode(0xf86e, "unknown_f86e", [], false, []), + new Opcode(0xf86f, "ba_set_lives", [], false, [Type.U32]), + new Opcode(0xf870, "ba_set_tech_lvl", [], false, [Type.U32]), + new Opcode(0xf871, "ba_set_lvl", [], false, [Type.U32]), + new Opcode(0xf872, "ba_set_time_limit", [], false, [Type.U32]), + new Opcode(0xf873, "boss_is_dead", [Type.Register], false, []), + new Opcode(0xf874, "unknown_f874", [], false, []), + new Opcode(0xf875, "unknown_f875", [], false, []), + new Opcode(0xf876, "unknown_f876", [], false, []), + new Opcode(0xf877, "enable_techs", [Type.Register], false, []), + new Opcode(0xf878, "disable_techs", [Type.Register], false, []), + new Opcode(0xf879, "get_gender", [Type.Register, Type.Register], false, []), + new Opcode(0xf87a, "get_chara_class", [Type.Register, Type.Register], false, []), + new Opcode(0xf87b, "take_slot_meseta", [Type.Register, Type.Register], false, []), + new Opcode(0xf87c, "unknown_f87c", [], false, []), + new Opcode(0xf87d, "unknown_f87d", [], false, []), + new Opcode(0xf87e, "unknown_f87e", [], false, []), + new Opcode(0xf87f, "read_guildcard_flag", [Type.Register, Type.Register], false, []), + new Opcode(0xf880, "unknown_f880", [Type.Register], false, []), + new Opcode(0xf881, "get_pl_name", [Type.Register], false, []), + new Opcode(0xf882, "unknown_f882", [], false, []), + new Opcode(0xf883, "unknown_f883", [Type.Register, Type.Register], false, []), + new Opcode(0xf884, "unknown_f884", [], false, []), + new Opcode(0xf885, "unknown_f885", [], false, []), + new Opcode(0xf886, "unknown_f886", [], false, []), + new Opcode(0xf887, "unknown_f887", [], false, []), + new Opcode(0xf888, "ba_close_msg", [], false, []), + new Opcode(0xf889, "unknown_f889", [], false, []), + new Opcode(0xf88a, "get_player_status", [Type.Register, Type.Register], false, []), + new Opcode(0xf88b, "send_mail", [], false, [Type.Register, Type.String]), + new Opcode(0xf88c, "online_check", [Type.Register], false, []), + new Opcode(0xf88d, "chl_set_timerecord", [Type.Register], false, []), + new Opcode(0xf88e, "chl_get_timerecord", [Type.Register], false, []), + new Opcode(0xf88f, "unknown_f88f", [Type.Register], false, []), + new Opcode(0xf890, "unknown_f890", [], false, []), + new Opcode(0xf891, "load_enemy_data", [], false, [Type.U32]), + new Opcode(0xf892, "get_physical_data", [Type.U16], false, []), + new Opcode(0xf893, "get_attack_data", [Type.U16], false, []), + new Opcode(0xf894, "get_resist_data", [Type.U16], false, []), + new Opcode(0xf895, "get_movement_data", [Type.U16], false, []), + new Opcode(0xf896, "unknown_f896", [], false, []), + new Opcode(0xf897, "unknown_f897", [], false, []), + new Opcode(0xf898, "shift_left", [Type.Register, Type.Register], false, []), + new Opcode(0xf899, "shift_right", [Type.Register, Type.Register], false, []), + new Opcode(0xf89a, "get_random", [Type.Register, Type.Register], false, []), + new Opcode(0xf89b, "reset_map", [], false, []), + new Opcode(0xf89c, "disp_chl_retry_menu", [Type.Register], false, []), + new Opcode(0xf89d, "chl_reverser", [], false, []), + new Opcode(0xf89e, "unknown_f89e", [], false, [Type.U32]), + new Opcode(0xf89f, "unknown_f89f", [Type.Register], false, []), + new Opcode(0xf8a0, "unknown_f8a0", [], false, []), + new Opcode(0xf8a1, "unknown_f8a1", [], false, []), + new Opcode(0xf8a2, "unknown_f8a2", [], false, []), + new Opcode(0xf8a3, "unknown_f8a3", [], false, []), + new Opcode(0xf8a4, "unknown_f8a4", [], false, []), + new Opcode(0xf8a5, "unknown_f8a5", [], false, []), + new Opcode(0xf8a6, "unknown_f8a6", [], false, []), + new Opcode(0xf8a7, "unknown_f8a7", [], false, []), + new Opcode(0xf8a8, "unknown_f8a8", [], false, [Type.U32]), + new Opcode(0xf8a9, "unknown_f8a9", [Type.Register], false, []), + new Opcode(0xf8aa, "unknown_f8aa", [], false, []), + new Opcode(0xf8ab, "unknown_f8ab", [], false, []), + new Opcode(0xf8ac, "unknown_f8ac", [], false, []), + new Opcode(0xf8ad, "get_number_of_player2", [Type.Register], false, []), + new Opcode(0xf8ae, "unknown_f8ae", [], false, []), + new Opcode(0xf8af, "unknown_f8af", [], false, []), + new Opcode(0xf8b0, "unknown_f8b0", [], false, []), + new Opcode(0xf8b1, "unknown_f8b1", [], false, []), + new Opcode(0xf8b2, "unknown_f8b2", [], false, []), + new Opcode(0xf8b3, "unknown_f8b3", [], false, []), + new Opcode(0xf8b4, "unknown_f8b4", [], false, []), + new Opcode(0xf8b5, "unknown_f8b5", [], false, []), + new Opcode(0xf8b6, "unknown_f8b6", [], false, []), + new Opcode(0xf8b7, "unknown_f8b7", [], false, []), + new Opcode(0xf8b8, "unknown_f8b8", [], false, []), + new Opcode(0xf8b9, "chl_recovery", [], false, []), + new Opcode(0xf8ba, "unknown_f8ba", [], false, []), + new Opcode(0xf8bb, "unknown_f8bb", [], false, []), + new Opcode(0xf8bc, "set_episode", [Type.U32], false, []), + new Opcode(0xf8bd, "unknown_f8bd", [], false, []), + new Opcode(0xf8be, "unknown_f8be", [], false, []), + new Opcode(0xf8bf, "unknown_f8bf", [], false, []), + new Opcode(0xf8c0, "file_dl_req", [], false, [Type.U32, Type.String]), + new Opcode(0xf8c1, "get_dl_status", [Type.Register], false, []), + new Opcode(0xf8c2, "gba_unknown4", [], false, []), + new Opcode(0xf8c3, "get_gba_state", [Type.Register], false, []), + new Opcode(0xf8c4, "unknown_f8c4", [Type.Register], false, []), + new Opcode(0xf8c5, "unknown_f8c5", [Type.Register], false, []), + new Opcode(0xf8c6, "qexit", [], false, []), + new Opcode(0xf8c7, "use_animation", [Type.Register, Type.Register], false, []), + new Opcode(0xf8c8, "stop_animation", [Type.Register], false, []), + new Opcode(0xf8c9, "run_to_coord", [Type.Register, Type.Register], false, []), + new Opcode(0xf8ca, "set_slot_invincible", [Type.Register, Type.Register], false, []), + new Opcode(0xf8cb, "unknown_f8cb", [Type.Register], false, []), + new Opcode(0xf8cc, "set_slot_poison", [Type.Register], false, []), + new Opcode(0xf8cd, "set_slot_paralyze", [Type.Register], false, []), + new Opcode(0xf8ce, "set_slot_shock", [Type.Register], false, []), + new Opcode(0xf8cf, "set_slot_freeze", [Type.Register], false, []), + new Opcode(0xf8d0, "set_slot_slow", [Type.Register], false, []), + new Opcode(0xf8d1, "set_slot_confuse", [Type.Register], false, []), + new Opcode(0xf8d2, "set_slot_shifta", [Type.Register], false, []), + new Opcode(0xf8d3, "set_slot_deband", [Type.Register], false, []), + new Opcode(0xf8d4, "set_slot_jellen", [Type.Register], false, []), + new Opcode(0xf8d5, "set_slot_zalure", [Type.Register], false, []), + new Opcode(0xf8d6, "fleti_fixed_camera", [], false, [Type.Register]), + new Opcode(0xf8d7, "fleti_locked_camera", [], false, [Type.U32, Type.Register]), + new Opcode(0xf8d8, "default_camera_pos2", [], false, []), + new Opcode(0xf8d9, "set_motion_blur", [], false, []), + new Opcode(0xf8da, "set_screen_bw", [], false, []), + new Opcode(0xf8db, "unknown_f8db", [], false, [ Type.U32, Type.U32, Type.U32, @@ -753,29 +830,29 @@ const f8_opcodes = [ Type.Register, Type.U16, ]), - new Opcode(0xdcf8, "NPC_action_string", [Type.Register, Type.Register, Type.U16], false, []), - new Opcode(0xddf8, "get_pad_cond", [Type.Register, Type.Register], false, []), - new Opcode(0xdef8, "get_button_cond", [Type.Register, Type.Register], false, []), - new Opcode(0xdff8, "freeze_enemies", [], false, []), - new Opcode(0xe0f8, "unfreeze_enemies", [], false, []), - new Opcode(0xe1f8, "freeze_everything", [], false, []), - new Opcode(0xe2f8, "unfreeze_everything", [], false, []), - new Opcode(0xe3f8, "restore_hp", [Type.Register], false, []), - new Opcode(0xe4f8, "restore_tp", [Type.Register], false, []), - new Opcode(0xe5f8, "close_chat_bubble", [Type.Register], false, []), - new Opcode(0xe6f8, "unknownF8E6", [Type.Register, Type.Register], false, []), - new Opcode(0xe7f8, "unknownF8E7", [Type.Register, Type.Register], false, []), - new Opcode(0xe8f8, "unknownF8E8", [Type.Register, Type.Register], false, []), - new Opcode(0xe9f8, "unknownF8E9", [Type.Register, Type.Register], false, []), - new Opcode(0xeaf8, "unknownF8EA", [Type.Register, Type.Register], false, []), - new Opcode(0xebf8, "unknownF8EB", [Type.Register, Type.Register], false, []), - new Opcode(0xecf8, "unknownF8EC", [Type.Register, Type.Register], false, []), - new Opcode(0xedf8, "animation_check", [Type.Register, Type.Register], false, []), - new Opcode(0xeef8, "call_image_data", [], false, [Type.U32, Type.U16]), - new Opcode(0xeff8, "unknownF8EF", [], false, []), - new Opcode(0xf0f8, "turn_off_bgm_p2", [], false, []), - new Opcode(0xf1f8, "turn_on_bgm_p2", [], false, []), - new Opcode(0xf2f8, "load_unk_data", [], false, [ + new Opcode(0xf8dc, "npc_action_string", [Type.Register, Type.Register, Type.U16], false, []), + new Opcode(0xf8dd, "get_pad_cond", [Type.Register, Type.Register], false, []), + new Opcode(0xf8de, "get_button_cond", [Type.Register, Type.Register], false, []), + new Opcode(0xf8df, "freeze_enemies", [], false, []), + new Opcode(0xf8e0, "unfreeze_enemies", [], false, []), + new Opcode(0xf8e1, "freeze_everything", [], false, []), + new Opcode(0xf8e2, "unfreeze_everything", [], false, []), + new Opcode(0xf8e3, "restore_hp", [Type.Register], false, []), + new Opcode(0xf8e4, "restore_tp", [Type.Register], false, []), + new Opcode(0xf8e5, "close_chat_bubble", [Type.Register], false, []), + new Opcode(0xf8e6, "unknown_f8e6", [Type.Register, Type.Register], false, []), + new Opcode(0xf8e7, "unknown_f8e7", [Type.Register, Type.Register], false, []), + new Opcode(0xf8e8, "unknown_f8e8", [Type.Register, Type.Register], false, []), + new Opcode(0xf8e9, "unknown_f8e9", [Type.Register, Type.Register], false, []), + new Opcode(0xf8ea, "unknown_f8ea", [Type.Register, Type.Register], false, []), + new Opcode(0xf8eb, "unknown_f8eb", [Type.Register, Type.Register], false, []), + new Opcode(0xf8ec, "unknown_f8ec", [Type.Register, Type.Register], false, []), + new Opcode(0xf8ed, "animation_check", [Type.Register, Type.Register], false, []), + new Opcode(0xf8ee, "call_image_data", [], false, [Type.U32, Type.U16]), + new Opcode(0xf8ef, "unknown_f8ef", [], false, []), + new Opcode(0xf8f0, "turn_off_bgm_p2", [], false, []), + new Opcode(0xf8f1, "turn_on_bgm_p2", [], false, []), + new Opcode(0xf8f2, "load_unk_data", [], false, [ Type.U32, Type.U32, Type.U32, @@ -783,75 +860,72 @@ const f8_opcodes = [ Type.Register, Type.U16, ]), - new Opcode(0xf3f8, "particle2", [], false, [Type.Register, Type.U32, Type.F32]), - new Opcode(0xf4f8, "unknown", [], false, []), - new Opcode(0xf5f8, "unknown", [], false, []), - new Opcode(0xf6f8, "unknown", [], false, []), - new Opcode(0xf7f8, "unknown", [], false, []), - new Opcode(0xf8f8, "unknown", [], false, []), - new Opcode(0xf9f8, "unknown", [], false, []), - new Opcode(0xfaf8, "unknown", [], false, []), - new Opcode(0xfbf8, "unknown", [], false, []), - new Opcode(0xfcf8, "unknown", [], false, []), - new Opcode(0xfdf8, "unknown", [], false, []), - new Opcode(0xfef8, "unknown", [], false, []), - new Opcode(0xfff8, "unknown", [], false, []), -]; - -const f9_opcodes = [ - new Opcode(0x00f9, "unknown", [], false, []), - new Opcode(0x01f9, "dec2float", [Type.Register, Type.Register], false, []), - new Opcode(0x02f9, "float2dec", [Type.Register, Type.Register], false, []), - new Opcode(0x03f9, "flet", [Type.Register, Type.Register], false, []), - new Opcode(0x04f9, "fleti", [Type.Register, Type.F32], false, []), - new Opcode(0x05f9, "unknown", [], false, []), - new Opcode(0x06f9, "unknown", [], false, []), - new Opcode(0x07f9, "unknown", [], false, []), - new Opcode(0x08f9, "fadd", [Type.Register, Type.Register], false, []), - new Opcode(0x09f9, "faddi", [Type.Register, Type.F32], false, []), - new Opcode(0x0af9, "fsub", [Type.Register, Type.Register], false, []), - new Opcode(0x0bf9, "fsubi", [Type.Register, Type.F32], false, []), - new Opcode(0x0cf9, "fmul", [Type.Register, Type.Register], false, []), - new Opcode(0x0df9, "fmuli", [Type.Register, Type.F32], false, []), - new Opcode(0x0ef9, "fdiv", [Type.Register, Type.Register], false, []), - new Opcode(0x0ff9, "fdivi", [Type.Register, Type.F32], false, []), - new Opcode(0x10f9, "get_unknown_count?", [], false, [Type.U32, Type.Register]), - new Opcode(0x11f9, "get_stackable_item_count", [Type.Register, Type.Register], false, []), - new Opcode(0x12f9, "freeze_and_hide_equip", [], false, []), - new Opcode(0x13f9, "thaw_and_show_equip", [], false, []), - new Opcode(0x14f9, "set_paletteX_callback", [], false, [Type.Register, Type.U16]), - new Opcode(0x15f9, "activate_paletteX", [], false, [Type.Register]), - new Opcode(0x16f9, "enable_paletteX", [], false, [Type.Register]), - new Opcode(0x17f9, "restore_paletteX", [], false, [Type.U32]), - new Opcode(0x18f9, "disable_paletteX", [], false, [Type.U32]), - new Opcode(0x19f9, "get_paletteX_activated", [], false, [Type.U32, Type.Register]), - new Opcode(0x1af9, "get_unknown_paletteX_status?", [], false, [Type.U32, Type.Register]), - new Opcode(0x1bf9, "disable_movement2", [], false, [Type.Register]), - new Opcode(0x1cf9, "enable_movement2", [], false, [Type.Register]), - new Opcode(0x1df9, "get_time_played", [Type.Register], false, []), - new Opcode(0x1ef9, "get_guildcard_total", [Type.Register], false, []), - new Opcode(0x1ff9, "get_slot_meseta", [Type.Register], false, []), - new Opcode(0x20f9, "get_player_level", [], false, [Type.U32, Type.Register]), - new Opcode(0x21f9, "get_Section_ID", [], false, [Type.U32, Type.Register]), - new Opcode(0x22f9, "get_player_hp", [], false, [Type.Register, Type.Register]), - new Opcode(0x23f9, "get_floor_number", [], false, [Type.Register, Type.Register]), - new Opcode(0x24f9, "get_coord_player_detect", [Type.Register, Type.Register], false, []), - new Opcode(0x25f9, "read_global_flag", [], false, [Type.U8, Type.Register]), - new Opcode(0x26f9, "write_global_flag", [], false, [Type.U8, Type.Register]), - new Opcode(0x27f9, "unknownF927", [Type.Register, Type.Register], false, []), - new Opcode(0x28f9, "floor_player_detect", [Type.Register], false, []), - new Opcode(0x29f9, "read_disk_file?", [], false, [Type.String]), - new Opcode(0x2af9, "open_pack_select", [], false, []), - new Opcode(0x2bf9, "item_select", [Type.Register], false, []), - new Opcode(0x2cf9, "get_item_id", [Type.Register], false, []), - new Opcode(0x2df9, "color_change", [], false, [ + new Opcode(0xf8f3, "particle2", [], false, [Type.Register, Type.U32, Type.F32]), + new Opcode(0xf8f4, "unknown_f8f4", [], false, []), + new Opcode(0xf8f5, "unknown_f8f5", [], false, []), + new Opcode(0xf8f6, "unknown_f8f6", [], false, []), + new Opcode(0xf8f7, "unknown_f8f7", [], false, []), + new Opcode(0xf8f8, "unknown_f8f8", [], false, []), + new Opcode(0xf8f9, "unknown_f8f9", [], false, []), + new Opcode(0xf8fa, "unknown_f8fa", [], false, []), + new Opcode(0xf8fb, "unknown_f8fb", [], false, []), + new Opcode(0xf8fc, "unknown_f8fc", [], false, []), + new Opcode(0xf8fd, "unknown_f8fd", [], false, []), + new Opcode(0xf8fe, "unknown_f8fe", [], false, []), + new Opcode(0xf8ff, "unknown_f8ff", [], false, []), + new Opcode(0xf900, "unknown_f900", [], false, []), + new Opcode(0xf901, "dec2float", [Type.Register, Type.Register], false, []), + new Opcode(0xf902, "float2dec", [Type.Register, Type.Register], false, []), + new Opcode(0xf903, "flet", [Type.Register, Type.Register], false, []), + new Opcode(0xf904, "fleti", [Type.Register, Type.F32], false, []), + new Opcode(0xf905, "unknown_f905", [], false, []), + new Opcode(0xf906, "unknown_f906", [], false, []), + new Opcode(0xf907, "unknown_f907", [], false, []), + new Opcode(0xf908, "fadd", [Type.Register, Type.Register], false, []), + new Opcode(0xf909, "faddi", [Type.Register, Type.F32], false, []), + new Opcode(0xf90a, "fsub", [Type.Register, Type.Register], false, []), + new Opcode(0xf90b, "fsubi", [Type.Register, Type.F32], false, []), + new Opcode(0xf90c, "fmul", [Type.Register, Type.Register], false, []), + new Opcode(0xf90d, "fmuli", [Type.Register, Type.F32], false, []), + new Opcode(0xf90e, "fdiv", [Type.Register, Type.Register], false, []), + new Opcode(0xf90f, "fdivi", [Type.Register, Type.F32], false, []), + new Opcode(0xf910, "get_unknown_count", [], false, [Type.U32, Type.Register]), + new Opcode(0xf911, "get_stackable_item_count", [Type.Register, Type.Register], false, []), + new Opcode(0xf912, "freeze_and_hide_equip", [], false, []), + new Opcode(0xf913, "thaw_and_show_equip", [], false, []), + new Opcode(0xf914, "set_palettex_callback", [], false, [Type.Register, Type.U16]), + new Opcode(0xf915, "activate_palettex", [], false, [Type.Register]), + new Opcode(0xf916, "enable_palettex", [], false, [Type.Register]), + new Opcode(0xf917, "restore_palettex", [], false, [Type.U32]), + new Opcode(0xf918, "disable_palettex", [], false, [Type.U32]), + new Opcode(0xf919, "get_palettex_activated", [], false, [Type.U32, Type.Register]), + new Opcode(0xf91a, "get_unknown_palettex_status", [], false, [Type.U32, Type.Register]), + new Opcode(0xf91b, "disable_movement2", [], false, [Type.Register]), + new Opcode(0xf91c, "enable_movement2", [], false, [Type.Register]), + new Opcode(0xf91d, "get_time_played", [Type.Register], false, []), + new Opcode(0xf91e, "get_guildcard_total", [Type.Register], false, []), + new Opcode(0xf91f, "get_slot_meseta", [Type.Register], false, []), + new Opcode(0xf920, "get_player_level", [], false, [Type.U32, Type.Register]), + new Opcode(0xf921, "get_section_id", [], false, [Type.U32, Type.Register]), + new Opcode(0xf922, "get_player_hp", [], false, [Type.Register, Type.Register]), + new Opcode(0xf923, "get_floor_number", [], false, [Type.Register, Type.Register]), + new Opcode(0xf924, "get_coord_player_detect", [Type.Register, Type.Register], false, []), + new Opcode(0xf925, "read_global_flag", [], false, [Type.U8, Type.Register]), + new Opcode(0xf926, "write_global_flag", [], false, [Type.U8, Type.Register]), + new Opcode(0xf927, "unknown_f927", [Type.Register, Type.Register], false, []), + new Opcode(0xf928, "floor_player_detect", [Type.Register], false, []), + new Opcode(0xf929, "read_disk_file", [], false, [Type.String]), + new Opcode(0xf92a, "open_pack_select", [], false, []), + new Opcode(0xf92b, "item_select", [Type.Register], false, []), + new Opcode(0xf92c, "get_item_id", [Type.Register], false, []), + new Opcode(0xf92d, "color_change", [], false, [ Type.Register, Type.Register, Type.Register, Type.Register, Type.Register, ]), - new Opcode(0x2ef9, "send_statistic?", [], false, [ + new Opcode(0xf92e, "send_statistic", [], false, [ Type.U32, Type.U32, Type.U32, @@ -861,8 +935,8 @@ const f9_opcodes = [ Type.U32, Type.U32, ]), - new Opcode(0x2ff9, "unknownF92F", [], false, [Type.U32, Type.U32]), - new Opcode(0x30f9, "chat_box", [], false, [ + new Opcode(0xf92f, "unknown_f92f", [], false, [Type.U32, Type.U32]), + new Opcode(0xf930, "chat_box", [], false, [ Type.U32, Type.U32, Type.U32, @@ -870,10 +944,10 @@ const f9_opcodes = [ Type.U32, Type.String, ]), - new Opcode(0x31f9, "chat_bubble", [], false, [Type.U32, Type.String]), - new Opcode(0x32f9, "unknown", [], false, []), - new Opcode(0x33f9, "unknownF933", [Type.Register], false, []), - new Opcode(0x34f9, "scroll_text", [], false, [ + new Opcode(0xf931, "chat_bubble", [], false, [Type.U32, Type.String]), + new Opcode(0xf932, "unknown_f932", [], false, []), + new Opcode(0xf933, "unknown_f933", [Type.Register], false, []), + new Opcode(0xf934, "scroll_text", [], false, [ Type.U32, Type.U32, Type.U32, @@ -883,37 +957,37 @@ const f9_opcodes = [ Type.Register, Type.String, ]), - new Opcode(0x35f9, "gba_unknown1", [], false, []), - new Opcode(0x36f9, "gba_unknown2", [], false, []), - new Opcode(0x37f9, "gba_unknown3", [], false, []), - new Opcode(0x38f9, "add_damage_to?", [], false, [Type.U32, Type.U32]), - new Opcode(0x39f9, "item_delete2", [], false, [Type.U32]), - new Opcode(0x3af9, "get_item_info", [], false, [Type.U32, Type.Register]), - new Opcode(0x3bf9, "item_packing1", [], false, [Type.U32]), - new Opcode(0x3cf9, "item_packing2", [], false, [Type.U32, Type.U32]), - new Opcode(0x3df9, "get_lang_setting?", [], false, [Type.Register]), - new Opcode(0x3ef9, "prepare_statistic?", [], false, [Type.U32, Type.U16, Type.U16]), - new Opcode(0x3ff9, "keyword_detect", [], false, []), - new Opcode(0x40f9, "Keyword", [], false, [Type.Register, Type.U32, Type.String]), - new Opcode(0x41f9, "get_guildcard_num", [], false, [Type.U32, Type.Register]), - new Opcode(0x42f9, "unknown", [], false, []), - new Opcode(0x43f9, "unknown", [], false, []), - new Opcode(0x44f9, "get_wrap_status", [], false, [Type.U32, Type.Register]), - new Opcode(0x45f9, "initial_floor", [], false, [Type.U32]), - new Opcode(0x46f9, "sin", [], false, [Type.Register, Type.U32]), - new Opcode(0x47f9, "cos", [], false, [Type.Register, Type.U32]), - new Opcode(0x48f9, "unknown", [], false, []), - new Opcode(0x49f9, "unknown", [], false, []), - new Opcode(0x4af9, "boss_is_dead2?", [Type.Register], false, []), - new Opcode(0x4bf9, "unknownF94B", [Type.Register], false, []), - new Opcode(0x4cf9, "unknownF94C", [Type.Register], false, []), - new Opcode(0x4df9, "is_there_cardbattle", [Type.Register], false, []), - new Opcode(0x4ef9, "unknown", [], false, []), - new Opcode(0x4ff9, "unknown", [], false, []), - new Opcode(0x50f9, "BB_p2_menu", [], false, [Type.U32]), - new Opcode(0x51f9, "BB_Map_Designate", [Type.U8, Type.U16, Type.U8, Type.U8], false, []), - new Opcode(0x52f9, "BB_get_number_in_pack", [Type.Register], false, []), - new Opcode(0x53f9, "BB_swap_item", [], false, [ + new Opcode(0xf935, "gba_unknown1", [], false, []), + new Opcode(0xf936, "gba_unknown2", [], false, []), + new Opcode(0xf937, "gba_unknown3", [], false, []), + new Opcode(0xf938, "add_damage_to", [], false, [Type.U32, Type.U32]), + new Opcode(0xf939, "item_delete2", [], false, [Type.U32]), + new Opcode(0xf93a, "get_item_info", [], false, [Type.U32, Type.Register]), + new Opcode(0xf93b, "item_packing1", [], false, [Type.U32]), + new Opcode(0xf93c, "item_packing2", [], false, [Type.U32, Type.U32]), + new Opcode(0xf93d, "get_lang_setting", [], false, [Type.Register]), + new Opcode(0xf93e, "prepare_statistic", [], false, [Type.U32, Type.U16, Type.U16]), + new Opcode(0xf93f, "keyword_detect", [], false, []), + new Opcode(0xf940, "keyword", [], false, [Type.Register, Type.U32, Type.String]), + new Opcode(0xf941, "get_guildcard_num", [], false, [Type.U32, Type.Register]), + new Opcode(0xf942, "unknown_f942", [], false, []), + new Opcode(0xf943, "unknown_f943", [], false, []), + new Opcode(0xf944, "get_wrap_status", [], false, [Type.U32, Type.Register]), + new Opcode(0xf945, "initial_floor", [], false, [Type.U32]), + new Opcode(0xf946, "sin", [], false, [Type.Register, Type.U32]), + new Opcode(0xf947, "cos", [], false, [Type.Register, Type.U32]), + new Opcode(0xf948, "unknown_f948", [], false, []), + new Opcode(0xf949, "unknown_f949", [], false, []), + new Opcode(0xf94a, "boss_is_dead2", [Type.Register], false, []), + new Opcode(0xf94b, "unknown_f94b", [Type.Register], false, []), + new Opcode(0xf94c, "unknown_f94c", [Type.Register], false, []), + new Opcode(0xf94d, "is_there_cardbattle", [Type.Register], false, []), + new Opcode(0xf94e, "unknown_f94e", [], false, []), + new Opcode(0xf94f, "unknown_f94f", [], false, []), + new Opcode(0xf950, "bb_p2_menu", [], false, [Type.U32]), + new Opcode(0xf951, "bb_map_designate", [Type.U8, Type.U16, Type.U8, Type.U8], false, []), + new Opcode(0xf952, "bb_get_number_in_pack", [Type.Register], false, []), + new Opcode(0xf953, "bb_swap_item", [], false, [ Type.U32, Type.U32, Type.U32, @@ -923,15 +997,15 @@ const f9_opcodes = [ Type.U16, Type.U16, ]), - new Opcode(0x54f9, "BB_check_wrap", [], false, [Type.Register, Type.Register]), - new Opcode(0x55f9, "BB_exchange_PD_item", [], false, [ + new Opcode(0xf954, "bb_check_wrap", [], false, [Type.Register, Type.Register]), + new Opcode(0xf955, "bb_exchange_pd_item", [], false, [ Type.Register, Type.Register, Type.Register, Type.U16, Type.U16, ]), - new Opcode(0x56f9, "BB_exchange_PD_srank", [], false, [ + new Opcode(0xf956, "bb_exchange_pd_srank", [], false, [ Type.Register, Type.Register, Type.Register, @@ -940,7 +1014,7 @@ const f9_opcodes = [ Type.U16, Type.U16, ]), - new Opcode(0x57f9, "BB_exchange_PD_special", [], false, [ + new Opcode(0xf957, "bb_exchange_pd_special", [], false, [ Type.Register, Type.Register, Type.Register, @@ -950,7 +1024,7 @@ const f9_opcodes = [ Type.U16, Type.U16, ]), - new Opcode(0x58f9, "BB_exchange_PD_percent", [], false, [ + new Opcode(0xf958, "bb_exchange_pd_percent", [], false, [ Type.Register, Type.Register, Type.Register, @@ -960,181 +1034,181 @@ const f9_opcodes = [ Type.U16, Type.U16, ]), - new Opcode(0x59f9, "unknownF959", [], false, [Type.U32]), - new Opcode(0x5af9, "unknown", [], false, []), - new Opcode(0x5bf9, "unknown", [], false, []), - new Opcode(0x5cf9, "BB_exchange_SLT", [], false, [Type.U32, Type.Register, Type.U16, Type.U16]), - new Opcode(0x5df9, "BB_exchange_PC", [], false, []), - new Opcode(0x5ef9, "BB_box_create_BP", [], false, [Type.U32, Type.F32, Type.F32]), - new Opcode(0x5ff9, "BB_exchange_PT", [], false, [ + new Opcode(0xf959, "unknown_f959", [], false, [Type.U32]), + new Opcode(0xf95a, "unknown_f95a", [], false, []), + new Opcode(0xf95b, "unknown_f95b", [], false, []), + new Opcode(0xf95c, "bb_exchange_slt", [], false, [Type.U32, Type.Register, Type.U16, Type.U16]), + new Opcode(0xf95d, "bb_exchange_pc", [], false, []), + new Opcode(0xf95e, "bb_box_create_bp", [], false, [Type.U32, Type.F32, Type.F32]), + new Opcode(0xf95f, "bb_exchange_pt", [], false, [ Type.Register, Type.Register, Type.U32, Type.U16, Type.U16, ]), - new Opcode(0x60f9, "unknownF960", [], false, [Type.U32]), - new Opcode(0x61f9, "unknownF961", [], false, []), - new Opcode(0x62f9, "unknown", [], false, []), - new Opcode(0x63f9, "unknown", [], false, []), - new Opcode(0x64f9, "unknown", [], false, []), - new Opcode(0x65f9, "unknown", [], false, []), - new Opcode(0x66f9, "unknown", [], false, []), - new Opcode(0x67f9, "unknown", [], false, []), - new Opcode(0x68f9, "unknown", [], false, []), - new Opcode(0x69f9, "unknown", [], false, []), - new Opcode(0x6af9, "unknown", [], false, []), - new Opcode(0x6bf9, "unknown", [], false, []), - new Opcode(0x6cf9, "unknown", [], false, []), - new Opcode(0x6df9, "unknown", [], false, []), - new Opcode(0x6ef9, "unknown", [], false, []), - new Opcode(0x6ff9, "unknown", [], false, []), - new Opcode(0x70f9, "unknown", [], false, []), - new Opcode(0x71f9, "unknown", [], false, []), - new Opcode(0x72f9, "unknown", [], false, []), - new Opcode(0x73f9, "unknown", [], false, []), - new Opcode(0x74f9, "unknown", [], false, []), - new Opcode(0x75f9, "unknown", [], false, []), - new Opcode(0x76f9, "unknown", [], false, []), - new Opcode(0x77f9, "unknown", [], false, []), - new Opcode(0x78f9, "unknown", [], false, []), - new Opcode(0x79f9, "unknown", [], false, []), - new Opcode(0x7af9, "unknown", [], false, []), - new Opcode(0x7bf9, "unknown", [], false, []), - new Opcode(0x7cf9, "unknown", [], false, []), - new Opcode(0x7df9, "unknown", [], false, []), - new Opcode(0x7ef9, "unknown", [], false, []), - new Opcode(0x7ff9, "unknown", [], false, []), - new Opcode(0x80f9, "unknown", [], false, []), - new Opcode(0x81f9, "unknown", [], false, []), - new Opcode(0x82f9, "unknown", [], false, []), - new Opcode(0x83f9, "unknown", [], false, []), - new Opcode(0x84f9, "unknown", [], false, []), - new Opcode(0x85f9, "unknown", [], false, []), - new Opcode(0x86f9, "unknown", [], false, []), - new Opcode(0x87f9, "unknown", [], false, []), - new Opcode(0x88f9, "unknown", [], false, []), - new Opcode(0x89f9, "unknown", [], false, []), - new Opcode(0x8af9, "unknown", [], false, []), - new Opcode(0x8bf9, "unknown", [], false, []), - new Opcode(0x8cf9, "unknown", [], false, []), - new Opcode(0x8df9, "unknown", [], false, []), - new Opcode(0x8ef9, "unknown", [], false, []), - new Opcode(0x8ff9, "unknown", [], false, []), - new Opcode(0x90f9, "unknown", [], false, []), - new Opcode(0x91f9, "unknown", [], false, []), - new Opcode(0x92f9, "unknown", [], false, []), - new Opcode(0x93f9, "unknown", [], false, []), - new Opcode(0x94f9, "unknown", [], false, []), - new Opcode(0x95f9, "unknown", [], false, []), - new Opcode(0x96f9, "unknown", [], false, []), - new Opcode(0x97f9, "unknown", [], false, []), - new Opcode(0x98f9, "unknown", [], false, []), - new Opcode(0x99f9, "unknown", [], false, []), - new Opcode(0x9af9, "unknown", [], false, []), - new Opcode(0x9bf9, "unknown", [], false, []), - new Opcode(0x9cf9, "unknown", [], false, []), - new Opcode(0x9df9, "unknown", [], false, []), - new Opcode(0x9ef9, "unknown", [], false, []), - new Opcode(0x9ff9, "unknown", [], false, []), - new Opcode(0xa0f9, "unknown", [], false, []), - new Opcode(0xa1f9, "unknown", [], false, []), - new Opcode(0xa2f9, "unknown", [], false, []), - new Opcode(0xa3f9, "unknown", [], false, []), - new Opcode(0xa4f9, "unknown", [], false, []), - new Opcode(0xa5f9, "unknown", [], false, []), - new Opcode(0xa6f9, "unknown", [], false, []), - new Opcode(0xa7f9, "unknown", [], false, []), - new Opcode(0xa8f9, "unknown", [], false, []), - new Opcode(0xa9f9, "unknown", [], false, []), - new Opcode(0xaaf9, "unknown", [], false, []), - new Opcode(0xabf9, "unknown", [], false, []), - new Opcode(0xacf9, "unknown", [], false, []), - new Opcode(0xadf9, "unknown", [], false, []), - new Opcode(0xaef9, "unknown", [], false, []), - new Opcode(0xaff9, "unknown", [], false, []), - new Opcode(0xb0f9, "unknown", [], false, []), - new Opcode(0xb1f9, "unknown", [], false, []), - new Opcode(0xb2f9, "unknown", [], false, []), - new Opcode(0xb3f9, "unknown", [], false, []), - new Opcode(0xb4f9, "unknown", [], false, []), - new Opcode(0xb5f9, "unknown", [], false, []), - new Opcode(0xb6f9, "unknown", [], false, []), - new Opcode(0xb7f9, "unknown", [], false, []), - new Opcode(0xb8f9, "unknown", [], false, []), - new Opcode(0xb9f9, "unknown", [], false, []), - new Opcode(0xbaf9, "unknown", [], false, []), - new Opcode(0xbbf9, "unknown", [], false, []), - new Opcode(0xbcf9, "unknown", [], false, []), - new Opcode(0xbdf9, "unknown", [], false, []), - new Opcode(0xbef9, "unknown", [], false, []), - new Opcode(0xbff9, "unknown", [], false, []), - new Opcode(0xc0f9, "unknown", [], false, []), - new Opcode(0xc1f9, "unknown", [], false, []), - new Opcode(0xc2f9, "unknown", [], false, []), - new Opcode(0xc3f9, "unknown", [], false, []), - new Opcode(0xc4f9, "unknown", [], false, []), - new Opcode(0xc5f9, "unknown", [], false, []), - new Opcode(0xc6f9, "unknown", [], false, []), - new Opcode(0xc7f9, "unknown", [], false, []), - new Opcode(0xc8f9, "unknown", [], false, []), - new Opcode(0xc9f9, "unknown", [], false, []), - new Opcode(0xcaf9, "unknown", [], false, []), - new Opcode(0xcbf9, "unknown", [], false, []), - new Opcode(0xccf9, "unknown", [], false, []), - new Opcode(0xcdf9, "unknown", [], false, []), - new Opcode(0xcef9, "unknown", [], false, []), - new Opcode(0xcff9, "unknown", [], false, []), - new Opcode(0xd0f9, "unknown", [], false, []), - new Opcode(0xd1f9, "unknown", [], false, []), - new Opcode(0xd2f9, "unknown", [], false, []), - new Opcode(0xd3f9, "unknown", [], false, []), - new Opcode(0xd4f9, "unknown", [], false, []), - new Opcode(0xd5f9, "unknown", [], false, []), - new Opcode(0xd6f9, "unknown", [], false, []), - new Opcode(0xd7f9, "unknown", [], false, []), - new Opcode(0xd8f9, "unknown", [], false, []), - new Opcode(0xd9f9, "unknown", [], false, []), - new Opcode(0xdaf9, "unknown", [], false, []), - new Opcode(0xdbf9, "unknown", [], false, []), - new Opcode(0xdcf9, "unknown", [], false, []), - new Opcode(0xddf9, "unknown", [], false, []), - new Opcode(0xdef9, "unknown", [], false, []), - new Opcode(0xdff9, "unknown", [], false, []), - new Opcode(0xe0f9, "unknown", [], false, []), - new Opcode(0xe1f9, "unknown", [], false, []), - new Opcode(0xe2f9, "unknown", [], false, []), - new Opcode(0xe3f9, "unknown", [], false, []), - new Opcode(0xe4f9, "unknown", [], false, []), - new Opcode(0xe5f9, "unknown", [], false, []), - new Opcode(0xe6f9, "unknown", [], false, []), - new Opcode(0xe7f9, "unknown", [], false, []), - new Opcode(0xe8f9, "unknown", [], false, []), - new Opcode(0xe9f9, "unknown", [], false, []), - new Opcode(0xeaf9, "unknown", [], false, []), - new Opcode(0xebf9, "unknown", [], false, []), - new Opcode(0xecf9, "unknown", [], false, []), - new Opcode(0xedf9, "unknown", [], false, []), - new Opcode(0xeef9, "unknown", [], false, []), - new Opcode(0xeff9, "unknown", [], false, []), - new Opcode(0xf0f9, "unknown", [], false, []), - new Opcode(0xf1f9, "unknown", [], false, []), - new Opcode(0xf2f9, "unknown", [], false, []), - new Opcode(0xf3f9, "unknown", [], false, []), - new Opcode(0xf4f9, "unknown", [], false, []), - new Opcode(0xf5f9, "unknown", [], false, []), - new Opcode(0xf6f9, "unknown", [], false, []), - new Opcode(0xf7f9, "unknown", [], false, []), - new Opcode(0xf8f9, "unknown", [], false, []), - new Opcode(0xf9f9, "unknown", [], false, []), - new Opcode(0xfaf9, "unknown", [], false, []), - new Opcode(0xfbf9, "unknown", [], false, []), - new Opcode(0xfcf9, "unknown", [], false, []), - new Opcode(0xfdf9, "unknown", [], false, []), - new Opcode(0xfef9, "unknown", [], false, []), - new Opcode(0xfff9, "unknown", [], false, []), + new Opcode(0xf960, "unknown_f960", [], false, [Type.U32]), + new Opcode(0xf961, "unknown_f961", [], false, []), + new Opcode(0xf962, "unknown_f962", [], false, []), + new Opcode(0xf963, "unknown_f963", [], false, []), + new Opcode(0xf964, "unknown_f964", [], false, []), + new Opcode(0xf965, "unknown_f965", [], false, []), + new Opcode(0xf966, "unknown_f966", [], false, []), + new Opcode(0xf967, "unknown_f967", [], false, []), + new Opcode(0xf968, "unknown_f968", [], false, []), + new Opcode(0xf969, "unknown_f969", [], false, []), + new Opcode(0xf96a, "unknown_f96a", [], false, []), + new Opcode(0xf96b, "unknown_f96b", [], false, []), + new Opcode(0xf96c, "unknown_f96c", [], false, []), + new Opcode(0xf96d, "unknown_f96d", [], false, []), + new Opcode(0xf96e, "unknown_f96e", [], false, []), + new Opcode(0xf96f, "unknown_f96f", [], false, []), + new Opcode(0xf970, "unknown_f970", [], false, []), + new Opcode(0xf971, "unknown_f971", [], false, []), + new Opcode(0xf972, "unknown_f972", [], false, []), + new Opcode(0xf973, "unknown_f973", [], false, []), + new Opcode(0xf974, "unknown_f974", [], false, []), + new Opcode(0xf975, "unknown_f975", [], false, []), + new Opcode(0xf976, "unknown_f976", [], false, []), + new Opcode(0xf977, "unknown_f977", [], false, []), + new Opcode(0xf978, "unknown_f978", [], false, []), + new Opcode(0xf979, "unknown_f979", [], false, []), + new Opcode(0xf97a, "unknown_f97a", [], false, []), + new Opcode(0xf97b, "unknown_f97b", [], false, []), + new Opcode(0xf97c, "unknown_f97c", [], false, []), + new Opcode(0xf97d, "unknown_f97d", [], false, []), + new Opcode(0xf97e, "unknown_f97e", [], false, []), + new Opcode(0xf97f, "unknown_f97f", [], false, []), + new Opcode(0xf980, "unknown_f980", [], false, []), + new Opcode(0xf981, "unknown_f981", [], false, []), + new Opcode(0xf982, "unknown_f982", [], false, []), + new Opcode(0xf983, "unknown_f983", [], false, []), + new Opcode(0xf984, "unknown_f984", [], false, []), + new Opcode(0xf985, "unknown_f985", [], false, []), + new Opcode(0xf986, "unknown_f986", [], false, []), + new Opcode(0xf987, "unknown_f987", [], false, []), + new Opcode(0xf988, "unknown_f988", [], false, []), + new Opcode(0xf989, "unknown_f989", [], false, []), + new Opcode(0xf98a, "unknown_f98a", [], false, []), + new Opcode(0xf98b, "unknown_f98b", [], false, []), + new Opcode(0xf98c, "unknown_f98c", [], false, []), + new Opcode(0xf98d, "unknown_f98d", [], false, []), + new Opcode(0xf98e, "unknown_f98e", [], false, []), + new Opcode(0xf98f, "unknown_f98f", [], false, []), + new Opcode(0xf990, "unknown_f990", [], false, []), + new Opcode(0xf991, "unknown_f991", [], false, []), + new Opcode(0xf992, "unknown_f992", [], false, []), + new Opcode(0xf993, "unknown_f993", [], false, []), + new Opcode(0xf994, "unknown_f994", [], false, []), + new Opcode(0xf995, "unknown_f995", [], false, []), + new Opcode(0xf996, "unknown_f996", [], false, []), + new Opcode(0xf997, "unknown_f997", [], false, []), + new Opcode(0xf998, "unknown_f998", [], false, []), + new Opcode(0xf999, "unknown_f999", [], false, []), + new Opcode(0xf99a, "unknown_f99a", [], false, []), + new Opcode(0xf99b, "unknown_f99b", [], false, []), + new Opcode(0xf99c, "unknown_f99c", [], false, []), + new Opcode(0xf99d, "unknown_f99d", [], false, []), + new Opcode(0xf99e, "unknown_f99e", [], false, []), + new Opcode(0xf99f, "unknown_f99f", [], false, []), + new Opcode(0xf9a0, "unknown_f9a0", [], false, []), + new Opcode(0xf9a1, "unknown_f9a1", [], false, []), + new Opcode(0xf9a2, "unknown_f9a2", [], false, []), + new Opcode(0xf9a3, "unknown_f9a3", [], false, []), + new Opcode(0xf9a4, "unknown_f9a4", [], false, []), + new Opcode(0xf9a5, "unknown_f9a5", [], false, []), + new Opcode(0xf9a6, "unknown_f9a6", [], false, []), + new Opcode(0xf9a7, "unknown_f9a7", [], false, []), + new Opcode(0xf9a8, "unknown_f9a8", [], false, []), + new Opcode(0xf9a9, "unknown_f9a9", [], false, []), + new Opcode(0xf9aa, "unknown_f9aa", [], false, []), + new Opcode(0xf9ab, "unknown_f9ab", [], false, []), + new Opcode(0xf9ac, "unknown_f9ac", [], false, []), + new Opcode(0xf9ad, "unknown_f9ad", [], false, []), + new Opcode(0xf9ae, "unknown_f9ae", [], false, []), + new Opcode(0xf9af, "unknown_f9af", [], false, []), + new Opcode(0xf9b0, "unknown_f9b0", [], false, []), + new Opcode(0xf9b1, "unknown_f9b1", [], false, []), + new Opcode(0xf9b2, "unknown_f9b2", [], false, []), + new Opcode(0xf9b3, "unknown_f9b3", [], false, []), + new Opcode(0xf9b4, "unknown_f9b4", [], false, []), + new Opcode(0xf9b5, "unknown_f9b5", [], false, []), + new Opcode(0xf9b6, "unknown_f9b6", [], false, []), + new Opcode(0xf9b7, "unknown_f9b7", [], false, []), + new Opcode(0xf9b8, "unknown_f9b8", [], false, []), + new Opcode(0xf9b9, "unknown_f9b9", [], false, []), + new Opcode(0xf9ba, "unknown_f9ba", [], false, []), + new Opcode(0xf9bb, "unknown_f9bb", [], false, []), + new Opcode(0xf9bc, "unknown_f9bc", [], false, []), + new Opcode(0xf9bd, "unknown_f9bd", [], false, []), + new Opcode(0xf9be, "unknown_f9be", [], false, []), + new Opcode(0xf9bf, "unknown_f9bf", [], false, []), + new Opcode(0xf9c0, "unknown_f9c0", [], false, []), + new Opcode(0xf9c1, "unknown_f9c1", [], false, []), + new Opcode(0xf9c2, "unknown_f9c2", [], false, []), + new Opcode(0xf9c3, "unknown_f9c3", [], false, []), + new Opcode(0xf9c4, "unknown_f9c4", [], false, []), + new Opcode(0xf9c5, "unknown_f9c5", [], false, []), + new Opcode(0xf9c6, "unknown_f9c6", [], false, []), + new Opcode(0xf9c7, "unknown_f9c7", [], false, []), + new Opcode(0xf9c8, "unknown_f9c8", [], false, []), + new Opcode(0xf9c9, "unknown_f9c9", [], false, []), + new Opcode(0xf9ca, "unknown_f9ca", [], false, []), + new Opcode(0xf9cb, "unknown_f9cb", [], false, []), + new Opcode(0xf9cc, "unknown_f9cc", [], false, []), + new Opcode(0xf9cd, "unknown_f9cd", [], false, []), + new Opcode(0xf9ce, "unknown_f9ce", [], false, []), + new Opcode(0xf9cf, "unknown_f9cf", [], false, []), + new Opcode(0xf9d0, "unknown_f9d0", [], false, []), + new Opcode(0xf9d1, "unknown_f9d1", [], false, []), + new Opcode(0xf9d2, "unknown_f9d2", [], false, []), + new Opcode(0xf9d3, "unknown_f9d3", [], false, []), + new Opcode(0xf9d4, "unknown_f9d4", [], false, []), + new Opcode(0xf9d5, "unknown_f9d5", [], false, []), + new Opcode(0xf9d6, "unknown_f9d6", [], false, []), + new Opcode(0xf9d7, "unknown_f9d7", [], false, []), + new Opcode(0xf9d8, "unknown_f9d8", [], false, []), + new Opcode(0xf9d9, "unknown_f9d9", [], false, []), + new Opcode(0xf9da, "unknown_f9da", [], false, []), + new Opcode(0xf9db, "unknown_f9db", [], false, []), + new Opcode(0xf9dc, "unknown_f9dc", [], false, []), + new Opcode(0xf9dd, "unknown_f9dd", [], false, []), + new Opcode(0xf9de, "unknown_f9de", [], false, []), + new Opcode(0xf9df, "unknown_f9df", [], false, []), + new Opcode(0xf9e0, "unknown_f9e0", [], false, []), + new Opcode(0xf9e1, "unknown_f9e1", [], false, []), + new Opcode(0xf9e2, "unknown_f9e2", [], false, []), + new Opcode(0xf9e3, "unknown_f9e3", [], false, []), + new Opcode(0xf9e4, "unknown_f9e4", [], false, []), + new Opcode(0xf9e5, "unknown_f9e5", [], false, []), + new Opcode(0xf9e6, "unknown_f9e6", [], false, []), + new Opcode(0xf9e7, "unknown_f9e7", [], false, []), + new Opcode(0xf9e8, "unknown_f9e8", [], false, []), + new Opcode(0xf9e9, "unknown_f9e9", [], false, []), + new Opcode(0xf9ea, "unknown_f9ea", [], false, []), + new Opcode(0xf9eb, "unknown_f9eb", [], false, []), + new Opcode(0xf9ec, "unknown_f9ec", [], false, []), + new Opcode(0xf9ed, "unknown_f9ed", [], false, []), + new Opcode(0xf9ee, "unknown_f9ee", [], false, []), + new Opcode(0xf9ef, "unknown_f9ef", [], false, []), + new Opcode(0xf9f0, "unknown_f9f0", [], false, []), + new Opcode(0xf9f1, "unknown_f9f1", [], false, []), + new Opcode(0xf9f2, "unknown_f9f2", [], false, []), + new Opcode(0xf9f3, "unknown_f9f3", [], false, []), + new Opcode(0xf9f4, "unknown_f9f4", [], false, []), + new Opcode(0xf9f5, "unknown_f9f5", [], false, []), + new Opcode(0xf9f6, "unknown_f9f6", [], false, []), + new Opcode(0xf9f7, "unknown_f9f7", [], false, []), + new Opcode(0xf9f8, "unknown_f9f8", [], false, []), + new Opcode(0xf9f9, "unknown_f9f9", [], false, []), + new Opcode(0xf9fa, "unknown_f9fa", [], false, []), + new Opcode(0xf9fb, "unknown_f9fb", [], false, []), + new Opcode(0xf9fc, "unknown_f9fc", [], false, []), + new Opcode(0xf9fd, "unknown_f9fd", [], false, []), + new Opcode(0xf9fe, "unknown_f9fe", [], false, []), + new Opcode(0xf9ff, "unknown_f9ff", [], false, []), ]; -export const OP_RET = opcodes[0x01]; -export const SET_EPISODE = f8_opcodes[0xbc]; -export const BB_MAP_DESIGNATE = f9_opcodes[0x51]; +export const OP_RET = OPCODES[0x01]; +export const SET_EPISODE = OPCODES[0x01bc]; +export const BB_MAP_DESIGNATE = OPCODES[0x0251]; diff --git a/src/data_formats/parsing/quest/index.ts b/src/data_formats/parsing/quest/index.ts index a822d9c2..44305eb4 100644 --- a/src/data_formats/parsing/quest/index.ts +++ b/src/data_formats/parsing/quest/index.ts @@ -7,7 +7,7 @@ import { ArrayBufferCursor } from "../../cursor/ArrayBufferCursor"; import { Cursor } from "../../cursor/Cursor"; import { ResizableBufferCursor } from "../../cursor/ResizableBufferCursor"; import { Vec3 } from "../../vector"; -import { BB_MAP_DESIGNATE, Instruction, OP_RET, parse_bin, SET_EPISODE, write_bin } from "./bin"; +import { BB_MAP_DESIGNATE, Instruction, parse_bin, SET_EPISODE, write_bin, BinFile } from "./bin"; import { DatFile, DatNpc, DatObject, parse_dat, write_dat } from "./dat"; import { parse_qst, QstContainedFile, write_qst } from "./qst"; @@ -58,17 +58,21 @@ export function parse_quest(cursor: Cursor, lenient: boolean = false): Quest | u let episode = 1; let area_variants: AreaVariant[] = []; - if (bin.function_offsets.length) { - const func_0_ops = get_func_instructions(bin.instructions, bin.function_offsets[0]); + if (bin.labels.size) { + if (bin.labels.has(0)) { + const label_0_instructions = bin.get_label_instructions(0); - if (func_0_ops) { - episode = get_episode(func_0_ops); - area_variants = get_area_variants(dat, episode, func_0_ops, lenient); + if (label_0_instructions) { + episode = get_episode(label_0_instructions); + area_variants = get_area_variants(dat, episode, label_0_instructions, lenient); + } else { + logger.warn(`Index ${bin.labels.get(0)} for label 0 is invalid.`); + } } else { - logger.warn(`Offset ${bin.function_offsets[0]} for function 0 is invalid.`); + logger.warn(`Label 0 not found.`); } } else { - logger.warn("File contains no functions."); + logger.warn("File contains no labels."); } return new Quest( @@ -82,7 +86,8 @@ export function parse_quest(cursor: Cursor, lenient: boolean = false): Quest | u parse_obj_data(dat.objs), parse_npc_data(episode, dat.npcs), dat.unknowns, - bin.function_offsets, + bin.labels, + bin.instructions, bin.object_code, bin.unknown ); @@ -94,17 +99,19 @@ export function write_quest_qst(quest: Quest, file_name: string): ArrayBuffer { npcs: npcs_to_dat_data(quest.npcs), unknowns: quest.dat_unknowns, }); - const bin = write_bin({ - quest_id: quest.id, - language: quest.language, - quest_name: quest.name, - short_description: quest.short_description, - long_description: quest.long_description, - function_offsets: quest.function_offsets, - instructions: [], - object_code: quest.object_code, - unknown: quest.bin_unknown, - }); + const bin = write_bin( + new BinFile( + quest.id, + quest.language, + quest.name, + quest.short_description, + quest.long_description, + quest.labels, + [], + quest.object_code, + quest.bin_unknown + ) + ); const ext_start = file_name.lastIndexOf("."); const base_file_name = ext_start === -1 ? file_name.slice(0, 12) : file_name.slice(0, Math.min(12, ext_start)); @@ -194,34 +201,6 @@ function get_area_variants( return area_variants_array.sort((a, b) => a.area.order - b.area.order || a.id - b.id); } -function get_func_instructions( - instructions: Instruction[], - func_offset: number -): Instruction[] | undefined { - let position = 0; - let func_found = false; - const func_ops: Instruction[] = []; - - for (const instruction of instructions) { - if (position === func_offset) { - func_found = true; - } - - if (func_found) { - func_ops.push(instruction); - - // Break when ret is encountered. - if (instruction.opcode === OP_RET) { - break; - } - } - - position += instruction.size; - } - - return func_found ? func_ops : undefined; -} - function parse_obj_data(objs: DatObject[]): QuestObject[] { return objs.map(obj_data => { return new QuestObject( diff --git a/src/domain/index.ts b/src/domain/index.ts index a9dda19a..8e75ed7e 100644 --- a/src/domain/index.ts +++ b/src/domain/index.ts @@ -5,6 +5,7 @@ import { enum_values } from "../enums"; import { ItemType } from "./items"; import { NpcType } from "./NpcType"; import { ObjectType } from "./ObjectType"; +import { Instruction } from "../data_formats/parsing/quest/bin"; export * from "./items"; export * from "./NpcType"; @@ -92,7 +93,8 @@ export class Quest { * (Partial) raw DAT data that can't be parsed yet by Phantasmal. */ dat_unknowns: DatUnknown[]; - function_offsets: number[]; + labels: Map; + instructions: Instruction[]; object_code: ArrayBuffer; bin_unknown: ArrayBuffer; @@ -107,7 +109,8 @@ export class Quest { objects: QuestObject[], npcs: QuestNpc[], dat_unknowns: DatUnknown[], - function_offsets: number[], + labels: Map, + instructions: Instruction[], object_code: ArrayBuffer, bin_unknown: ArrayBuffer ) { @@ -119,7 +122,8 @@ export class Quest { if (!objects || !(objects instanceof Array)) throw new Error("objs is required."); if (!npcs || !(npcs instanceof Array)) throw new Error("npcs is required."); if (!dat_unknowns) throw new Error("dat_unknowns is required."); - if (!function_offsets) throw new Error("function_offsets is required."); + if (!labels) throw new Error("labels is required."); + if (!instructions) throw new Error("instructions is required."); if (!object_code) throw new Error("object_code is required."); if (!bin_unknown) throw new Error("bin_unknown is required."); @@ -133,7 +137,8 @@ export class Quest { this.objects = objects; this.npcs = npcs; this.dat_unknowns = dat_unknowns; - this.function_offsets = function_offsets; + this.labels = labels; + this.instructions = instructions; this.object_code = object_code; this.bin_unknown = bin_unknown; } diff --git a/src/stores/QuestEditorStore.ts b/src/stores/QuestEditorStore.ts index a0db7b39..338f8d09 100644 --- a/src/stores/QuestEditorStore.ts +++ b/src/stores/QuestEditorStore.ts @@ -18,6 +18,7 @@ class QuestEditorStore { @observable current_quest_filename?: string; @observable current_quest?: Quest; @observable current_area?: Area; + @observable selected_entity?: QuestEntity; @observable save_dialog_filename?: string; diff --git a/src/stores/quest_creation.ts b/src/stores/quest_creation.ts index 8f02a445..4bc39cca 100644 --- a/src/stores/quest_creation.ts +++ b/src/stores/quest_creation.ts @@ -1,6 +1,6 @@ -import { Quest, ObjectType, QuestObject, Episode, QuestNpc, NpcType } from "../domain"; -import { area_store } from "./AreaStore"; import { Vec3 } from "../data_formats/vector"; +import { Episode, NpcType, ObjectType, Quest, QuestNpc, QuestObject } from "../domain"; +import { area_store } from "./AreaStore"; export function create_new_quest(episode: Episode): Quest { if (episode === Episode.II) throw new Error("Episode II not yet supported."); @@ -16,6 +16,7 @@ export function create_new_quest(episode: Episode): Quest { create_default_objects(), create_default_npcs(), [], + new Map(), [], new ArrayBuffer(0), new ArrayBuffer(0) diff --git a/src/ui/RendererComponent.less b/src/ui/RendererComponent.less deleted file mode 100644 index 8e96a712..00000000 --- a/src/ui/RendererComponent.less +++ /dev/null @@ -1,3 +0,0 @@ -.RendererComponent { - overflow: hidden; -} diff --git a/src/ui/RendererComponent.tsx b/src/ui/RendererComponent.tsx index 24f5fe83..90bf8c62 100644 --- a/src/ui/RendererComponent.tsx +++ b/src/ui/RendererComponent.tsx @@ -1,33 +1,31 @@ import React, { Component, ReactNode } from "react"; -import { Renderer } from "../rendering/Renderer"; -import "./RendererComponent.less"; import { Camera } from "three"; +import { Renderer } from "../rendering/Renderer"; type Props = { renderer: Renderer; + width: number; + height: number; debug?: boolean; - className?: string; on_will_unmount?: () => void; }; export class RendererComponent extends Component { render(): ReactNode { - let className = "RendererComponent"; - if (this.props.className) className += " " + this.props.className; - - return
; + return
; } - componentWillReceiveProps(props: Props): void { - this.props.renderer.debug = !!props.debug; - } + UNSAFE_componentWillReceiveProps(props: Props): void { + if (this.props.debug !== props.debug) { + this.props.renderer.debug = !!props.debug; + } - componentDidMount(): void { - window.addEventListener("resize", this.onResize); + if (this.props.width !== props.width || this.props.height !== props.height) { + this.props.renderer.set_size(props.width, props.height); + } } componentWillUnmount(): void { - window.removeEventListener("resize", this.onResize); this.props.on_will_unmount && this.props.on_will_unmount(); } @@ -35,15 +33,10 @@ export class RendererComponent extends Component { return false; } - private modifyDom = (div: HTMLDivElement | null) => { + private modify_dom = (div: HTMLDivElement | null) => { if (div) { - this.props.renderer.set_size(div.clientWidth, div.clientHeight); + this.props.renderer.set_size(this.props.width, this.props.height); div.appendChild(this.props.renderer.dom_element); } }; - - private onResize = () => { - const wrapper_div = this.props.renderer.dom_element.parentNode as HTMLDivElement; - this.props.renderer.set_size(wrapper_div.clientWidth, wrapper_div.clientHeight); - }; } diff --git a/src/ui/quest_editor/QuestEditorComponent.css b/src/ui/quest_editor/QuestEditorComponent.css deleted file mode 100644 index d98f6895..00000000 --- a/src/ui/quest_editor/QuestEditorComponent.css +++ /dev/null @@ -1,14 +0,0 @@ -.qe-QuestEditorComponent { - display: flex; - flex-direction: column; -} - -.qe-QuestEditorComponent-main { - flex: 1; - display: flex; - overflow: hidden; -} - -.qe-QuestEditorComponent-main > div:nth-child(2) { - flex: 1; -} \ No newline at end of file diff --git a/src/ui/quest_editor/QuestEditorComponent.less b/src/ui/quest_editor/QuestEditorComponent.less new file mode 100644 index 00000000..72f08f89 --- /dev/null +++ b/src/ui/quest_editor/QuestEditorComponent.less @@ -0,0 +1,31 @@ +.qe-QuestEditorComponent { + display: flex; + flex-direction: column; +} + +.qe-QuestEditorComponent-main { + flex: 1; + display: flex; + overflow: hidden; +} + +.qe-QuestEditorComponent-tabcontainer { + flex: 1; + display: flex; + flex-direction: column; + + & > .ant-tabs-content { + flex: 1; + display: flex; + flex-direction: column; + } +} + +.qe-QuestEditorComponent-tab.ant-tabs-tabpane-active { + flex: 1; + display: flex; +} + +.qe-QuestEditorComponent-tab-main { + flex: 1; +} diff --git a/src/ui/quest_editor/QuestEditorComponent.tsx b/src/ui/quest_editor/QuestEditorComponent.tsx index a4692408..eff4fe87 100644 --- a/src/ui/quest_editor/QuestEditorComponent.tsx +++ b/src/ui/quest_editor/QuestEditorComponent.tsx @@ -5,9 +5,12 @@ import { application_store } from "../../stores/ApplicationStore"; import { quest_editor_store } from "../../stores/QuestEditorStore"; import { RendererComponent } from "../RendererComponent"; import { EntityInfoComponent } from "./EntityInfoComponent"; -import "./QuestEditorComponent.css"; +import "./QuestEditorComponent.less"; import { QuestInfoComponent } from "./QuestInfoComponent"; import { Toolbar } from "./Toolbar"; +import { Tabs } from "antd"; +import { ScriptEditorComponent } from "./ScriptEditorComponent"; +import { AutoSizer } from "react-virtualized"; @observer export class QuestEditorComponent extends Component<{}, { debug: boolean }> { @@ -25,8 +28,34 @@ export class QuestEditorComponent extends Component<{}, { debug: boolean }> {
- - + + +
+ + {({ width, height }) => ( + + )} + +
+ +
+ + + +
); diff --git a/src/ui/quest_editor/ScriptEditorComponent.less b/src/ui/quest_editor/ScriptEditorComponent.less new file mode 100644 index 00000000..e69de29b diff --git a/src/ui/quest_editor/ScriptEditorComponent.tsx b/src/ui/quest_editor/ScriptEditorComponent.tsx new file mode 100644 index 00000000..34571c53 --- /dev/null +++ b/src/ui/quest_editor/ScriptEditorComponent.tsx @@ -0,0 +1,178 @@ +import { editor, languages } from "monaco-editor"; +import React, { Component, createRef, ReactNode } from "react"; +import { AutoSizer } from "react-virtualized"; +import { OPCODES } from "../../data_formats/parsing/quest/bin"; +import { quest_editor_store } from "../../stores/QuestEditorStore"; +import "./ScriptEditorComponent.less"; +import { disassemble } from "../scripting/disassembly"; +import { IReactionDisposer, autorun } from "mobx"; + +const ASM_SYNTAX: languages.IMonarchLanguage = { + defaultToken: "invalid", + + tokenizer: { + root: [ + // Identifiers. + [/[a-z][\w=<>!]*/, "identifier"], + + // Labels. + [/^\d+:/, "tag"], + + // Registers. + [/r\d+/, "predefined"], + + // Whitespace. + [/[ \t\r\n]+/, "white"], + [/\/\*/, "comment", "@comment"], + [/\/\/.*$/, "comment"], + + // Numbers. + [/-?\d*\.\d+([eE][-+]?\d+)?/, "number.float"], + [/-?0[xX][0-9a-fA-F]+/, "number.hex"], + [/-?\d+/, "number"], + + // Delimiters. + [/,/, "delimiter"], + + // Strings. + [/"([^"\\]|\\.)*$/, "string.invalid"], // Unterminated string. + [/"/, { token: "string.quote", bracket: "@open", next: "@string" }], + ], + + comment: [ + [/[^/*]+/, "comment"], + [/\/\*/, "comment", "@push"], // Nested comment. + [/\*\//, "comment", "@pop"], + [/[/*]/, "comment"], + ], + + string: [ + [/[^\\"]+/, "string"], + [/\\(?:[n\\"])/, "string.escape"], + [/\\./, "string.escape.invalid"], + [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }], + ], + }, +}; + +const INSTRUCTION_SUGGESTIONS = OPCODES.map(opcode => { + return ({ + label: opcode.mnemonic, + kind: languages.CompletionItemKind.Function, + insertText: opcode.mnemonic, + } as any) as languages.CompletionItem; +}); + +languages.register({ id: "psoasm" }); +languages.setMonarchTokensProvider("psoasm", ASM_SYNTAX); +languages.registerCompletionItemProvider("psoasm", { + provideCompletionItems: (model, position) => { + const value = model.getValueInRange({ + startLineNumber: position.lineNumber, + endLineNumber: position.lineNumber, + startColumn: 1, + endColumn: position.column + 1, + }); + const suggest = /^\s*([a-z][\w=<>!]*)?$/.test(value); + + return { + suggestions: suggest ? INSTRUCTION_SUGGESTIONS : [], + incomplete: false, + }; + }, +}); +languages.setLanguageConfiguration("psoasm", { + indentationRules: { + increaseIndentPattern: /\d+:/, + decreaseIndentPattern: /\d+/, + }, + autoClosingPairs: [{ open: '"', close: '"' }], + surroundingPairs: [{ open: '"', close: '"' }], +}); + +editor.defineTheme("phantasmal-world", { + base: "vs-dark", + inherit: true, + rules: [{ token: "", background: "151c21" }], + colors: { + "editor.background": "#151c21", + "editor.lineHighlightBackground": "#1a2228", + }, +}); + +export class ScriptEditorComponent extends Component<{ className?: string }> { + render(): ReactNode { + let className = "qe-ScriptEditorComponent"; + if (this.props.className) className += " " + this.props.className; + + return ( +
+ + {({ width, height }) => } + +
+ ); + } +} + +type MonacoProps = { + width: number; + height: number; +}; + +class MonacoComponent extends Component { + private div_ref = createRef(); + private editor?: editor.IStandaloneCodeEditor; + private disposer?: IReactionDisposer; + + render(): ReactNode { + return
; + } + + componentDidMount(): void { + if (this.div_ref.current) { + // model.onDidChangeContent(e => { + // e.changes[0].range + // }) + + this.editor = editor.create(this.div_ref.current, { + theme: "phantasmal-world", + scrollBeyondLastLine: false, + autoIndent: true, + }); + + this.disposer = autorun(() => { + const quest = quest_editor_store.current_quest; + const model = quest && editor.createModel(disassemble(quest), "psoasm"); + + if (model && this.editor) { + this.editor.setModel(model); + } + }); + } + } + + componentWillUnmount(): void { + if (this.editor) { + const model = this.editor.getModel(); + if (model) model.dispose(); + + this.editor.dispose(); + } + + if (this.disposer) this.disposer(); + } + + shouldComponentUpdate(): boolean { + return false; + } + + UNSAFE_componentWillReceiveProps(props: MonacoProps): void { + if ( + (this.props.width !== props.width || this.props.height !== props.height) && + this.editor + ) { + this.editor.layout(props); + } + } +} diff --git a/src/ui/scripting/disassembly.ts b/src/ui/scripting/disassembly.ts new file mode 100644 index 00000000..3a07a662 --- /dev/null +++ b/src/ui/scripting/disassembly.ts @@ -0,0 +1,68 @@ +import { Arg, Type } from "../../data_formats/parsing/quest/bin"; +import { Quest } from "../../domain"; + +export function disassemble(quest: Quest, manual_stack: boolean = false): string { + const lines: string[] = []; + const index_to_label = [...quest.labels.entries()].reduce( + (map, [l, i]) => map.set(i, l), + new Map() + ); + + const stack: Arg[] = []; + + for (let i = 0; i < quest.instructions.length; ++i) { + const ins = quest.instructions[i]; + const label = index_to_label.get(i); + + if (!manual_stack && ins.opcode.push_stack) { + stack.push(...ins.args); + } else { + let args: string[] = []; + + for (let j = 0; j < ins.opcode.params.length; j++) { + const param_type = ins.opcode.params[j]; + const arg = ins.args[j]; + args.push(...arg_to_strings(param_type, arg)); + } + + if (!manual_stack) { + for (let j = ins.opcode.stack_params.length - 1; j >= 0; j--) { + const param_type = ins.opcode.stack_params[j]; + const arg = stack.pop(); + + if (!arg) { + break; + } + + args.push(...arg_to_strings(param_type, arg)); + } + } + + if (label != null) { + lines.push(`${label}:`); + } + + lines.push(" " + ins.opcode.mnemonic + (args.length ? " " + args.join(", ") : "")); + } + } + + return lines.join("\n"); +} + +function arg_to_strings(param_type: Type, arg: Arg): string[] { + switch (param_type) { + case Type.U8: + case Type.U16: + case Type.U32: + case Type.I32: + case Type.F32: + return [arg.value.toString()]; + case Type.Register: + return ["r" + arg.value]; + case Type.SwitchData: + case Type.JumpData: + return arg.value.map(String); + case Type.String: + return [JSON.stringify(arg.value)]; + } +} diff --git a/src/ui/viewer/models/ModelViewerComponent.less b/src/ui/viewer/models/ModelViewerComponent.less index ed01420b..4304aef3 100644 --- a/src/ui/viewer/models/ModelViewerComponent.less +++ b/src/ui/viewer/models/ModelViewerComponent.less @@ -28,8 +28,8 @@ flex: 1; display: flex; overflow: hidden; - - & > div:nth-child(3) { - flex: 1; - } +} + +.v-m-ModelViewerComponent-renderer { + flex: 1; } diff --git a/src/ui/viewer/models/ModelViewerComponent.tsx b/src/ui/viewer/models/ModelViewerComponent.tsx index 943a85e2..06208c75 100644 --- a/src/ui/viewer/models/ModelViewerComponent.tsx +++ b/src/ui/viewer/models/ModelViewerComponent.tsx @@ -3,12 +3,13 @@ import { UploadChangeParam } from "antd/lib/upload"; import { UploadFile } from "antd/lib/upload/interface"; import { observer } from "mobx-react"; import React, { Component, ReactNode } from "react"; +import { AutoSizer } from "react-virtualized"; +import { get_model_renderer } from "../../../rendering/ModelRenderer"; import { model_viewer_store } from "../../../stores/ModelViewerStore"; +import { RendererComponent } from "../../RendererComponent"; import { AnimationSelectionComponent } from "./AnimationSelectionComponent"; import { ModelSelectionComponent } from "./ModelSelectionComponent"; import "./ModelViewerComponent.less"; -import { get_model_renderer } from "../../../rendering/ModelRenderer"; -import { RendererComponent } from "../../RendererComponent"; @observer export class ModelViewerComponent extends Component { @@ -25,10 +26,18 @@ export class ModelViewerComponent extends Component {
- +
+ + {({ width, height }) => ( + + )} + +
); diff --git a/src/ui/viewer/textures/TextureViewerComponent.tsx b/src/ui/viewer/textures/TextureViewerComponent.tsx index 9d486f47..b897be47 100644 --- a/src/ui/viewer/textures/TextureViewerComponent.tsx +++ b/src/ui/viewer/textures/TextureViewerComponent.tsx @@ -6,16 +6,24 @@ import { get_texture_renderer } from "../../../rendering/TextureRenderer"; import { texture_viewer_store } from "../../../stores/TextureViewerStore"; import { RendererComponent } from "../../RendererComponent"; import "./TextureViewerComponent.less"; +import { AutoSizer } from "react-virtualized"; export class TextureViewerComponent extends Component { render(): ReactNode { return (
- +
+ + {({ width, height }) => ( + + )} + +
); } diff --git a/yarn.lock b/yarn.lock index 03ec3361..fb9495ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1270,6 +1270,11 @@ "@svgr/plugin-svgo" "^4.0.3" loader-utils "^1.1.0" +"@types/anymatch@*": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" + integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== + "@types/babel__core@^7.1.0": version "7.1.2" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f" @@ -1426,11 +1431,23 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/tapable@*": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370" + integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ== + "@types/text-encoding@^0.0.35": version "0.0.35" resolved "https://registry.yarnpkg.com/@types/text-encoding/-/text-encoding-0.0.35.tgz#6f14474e0b232bc70c59677aadc65dcc5a99c3a9" integrity sha512-jfo/A88XIiAweUa8np+1mPbm3h2w0s425YrI8t3wk5QxhH6UI7w517MboNVnGDeMSuoFwA8Rwmklno+FicvV4g== +"@types/uglify-js@*": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082" + integrity sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ== + dependencies: + source-map "^0.6.1" + "@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e" @@ -1453,6 +1470,17 @@ "@types/unist" "*" "@types/vfile-message" "*" +"@types/webpack@^4.4.19": + version "4.32.0" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.32.0.tgz#bd4a149964cd471538f2781f2be5f9815175463b" + integrity sha512-kpz5wHDyG/WEpzX9gcwFp/w0oSsq0n/rmFdJelk/QBMHmNIOZdiTDInV0Lj8itGKBahQrBgJGJRss/6UHgLuKg== + dependencies: + "@types/anymatch" "*" + "@types/node" "*" + "@types/tapable" "*" + "@types/uglify-js" "*" + source-map "^0.6.0" + "@types/yargs@^12.0.2", "@types/yargs@^12.0.9": version "12.0.12" resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.12.tgz#45dd1d0638e8c8f153e87d296907659296873916" @@ -6851,6 +6879,18 @@ moment@2.x, moment@^2.24.0: resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== +monaco-editor-webpack-plugin@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/monaco-editor-webpack-plugin/-/monaco-editor-webpack-plugin-1.7.0.tgz#920cbeecca25f15d70d568a7e11b0ba4daf1ae83" + integrity sha512-oItymcnlL14Sjd7EF7q+CMhucfwR/2BxsqrXIBrWL6LQplFfAfV+grLEQRmVHeGSBZ/Gk9ptzfueXnWcoEcFuA== + dependencies: + "@types/webpack" "^4.4.19" + +monaco-editor@^0.17.1: + version "0.17.1" + resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.17.1.tgz#8fbe96ca54bfa75262706e044f8f780e904aa45c" + integrity sha512-JAc0mtW7NeO+0SwPRcdkfDbWLgkqL9WfP1NbpP9wNASsW6oWqgZqNIWt4teymGjZIXTElx3dnQmUYHmVrJ7HxA== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"