diff --git a/.gitignore b/.gitignore index 18dc617d..d0870c9b 100644 --- a/.gitignore +++ b/.gitignore @@ -154,6 +154,12 @@ decompiled/ assembled/ disassembled/ +data/iw5_ps3/ +data/iw5_360/ +data/iw6_ps3/ +data/iw6_360/ +data/s1_ps3/ +data/s1_360/ data/iw5/ data/iw6/ data/iw7/ @@ -164,3 +170,6 @@ data/s1/ data/s2/ data/s4/ data/t6/ +data/t7/ +data/t8/ +data/t9/ diff --git a/src/experimental/iw6c/xsk/assembler.cpp b/src/experimental/iw6c/xsk/assembler.cpp index 067abb98..2bb28afa 100644 --- a/src/experimental/iw6c/xsk/assembler.cpp +++ b/src/experimental/iw6c/xsk/assembler.cpp @@ -229,7 +229,7 @@ void assembler::assemble_instruction(const instruction::ptr& inst) case opcode::OP_vector: case opcode::OP_bit_or: case opcode::OP_AddArray: -/// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_shift_right: break; case opcode::OP_GetByte: @@ -254,11 +254,10 @@ void assembler::assemble_instruction(const instruction::ptr& inst) break; case opcode::OP_GetString: case opcode::OP_GetIString: - script_->write_endian(0); + script_->write_endian(0); stack_->write_c_string(inst->data[0]); break; case opcode::OP_GetAnimation: - script_->write_endian(0); script_->write_endian(0); stack_->write_c_string(inst->data[0]); stack_->write_c_string(inst->data[1]); @@ -303,7 +302,7 @@ void assembler::assemble_instruction(const instruction::ptr& inst) case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: case opcode::OP_ScriptThreadCallPointer: -// case opcode::OP_ScriptChildThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: script_->write_endian(static_cast(std::stoi(inst->data[0]))); diff --git a/src/experimental/iw6c/xsk/compiler.cpp b/src/experimental/iw6c/xsk/compiler.cpp index bb3d3c9c..85003e58 100644 --- a/src/experimental/iw6c/xsk/compiler.cpp +++ b/src/experimental/iw6c/xsk/compiler.cpp @@ -409,8 +409,7 @@ void compiler::emit_stmt_waittillmatch(const ast::stmt_waittillmatch::ptr& stmt, emit_expr(stmt->event, blk); emit_expr(stmt->obj, blk); emit_opcode(opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size())); -// emit_opcode(opcode::OP_waittillmatch2); -// TODOOO! + emit_opcode(opcode::OP_waittillmatch2); emit_opcode(opcode::OP_clearparams); } @@ -1332,8 +1331,7 @@ void compiler::emit_expr_call_pointer(const ast::expr_pointer::ptr& expr, const emit_opcode(opcode::OP_ScriptThreadCallPointer, argcount); break; case ast::call::mode::childthread: - throw comp_error(expr->loc(), "childthread unimplemented!!"); -// emit_opcode(opcode::OP_ScriptChildThreadCallPointer, argcount); + emit_opcode(opcode::OP_ScriptChildThreadCallPointer, argcount); break; case ast::call::mode::builtin: emit_opcode(opcode::OP_CallBuiltinPointer, argcount); diff --git a/src/experimental/iw6c/xsk/decompiler.cpp b/src/experimental/iw6c/xsk/decompiler.cpp index 3c29a94e..744be181 100644 --- a/src/experimental/iw6c/xsk/decompiler.cpp +++ b/src/experimental/iw6c/xsk/decompiler.cpp @@ -724,7 +724,6 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) stack_.push(std::move(node)); break; } -/* case opcode::OP_ScriptChildThreadCallPointer: { auto args = std::make_unique(loc); @@ -743,7 +742,6 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) stack_.push(std::move(node)); break; } -*/ case opcode::OP_ScriptMethodThreadCallPointer: { auto args = std::make_unique(loc); @@ -1679,7 +1677,7 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) expr_labels_.push_back(inst->data[0]); break; } -// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_checkclearparams: case opcode::OP_CastFieldObject: case opcode::OP_CastBool: diff --git a/src/experimental/iw6c/xsk/disassembler.cpp b/src/experimental/iw6c/xsk/disassembler.cpp index a294fadb..5a47c40f 100644 --- a/src/experimental/iw6c/xsk/disassembler.cpp +++ b/src/experimental/iw6c/xsk/disassembler.cpp @@ -152,7 +152,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_vector: case opcode::OP_bit_or: case opcode::OP_AddArray: -// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_shift_right: break; case opcode::OP_GetByte: @@ -177,11 +177,11 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) break; case opcode::OP_GetString: case opcode::OP_GetIString: - script_->seek(4); + script_->seek(2); inst->data.push_back(utils::string::to_literal(stack_->read_c_string())); break; case opcode::OP_GetAnimation: - script_->seek(8); + script_->seek(4); inst->data.push_back(utils::string::quote(stack_->read_c_string(), false)); inst->data.push_back(utils::string::quote(stack_->read_c_string(), false)); break; @@ -225,7 +225,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: case opcode::OP_ScriptThreadCallPointer: -// case opcode::OP_ScriptChildThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: inst->data.push_back(utils::string::va("%i", script_->read())); diff --git a/src/experimental/iw6c/xsk/iw6c.cpp b/src/experimental/iw6c/xsk/iw6c.cpp index 2e5ce897..b02eb098 100644 --- a/src/experimental/iw6c/xsk/iw6c.cpp +++ b/src/experimental/iw6c/xsk/iw6c.cpp @@ -51,7 +51,7 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_less: case opcode::OP_greater: case opcode::OP_less_equal: - // case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_waittill: case opcode::OP_notify: case opcode::OP_endon: @@ -92,10 +92,12 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_EvalNewLocalArrayRefCached0: case opcode::OP_EvalLocalArrayRefCached: case opcode::OP_ScriptThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: + case opcode::OP_waittillmatch: case opcode::OP_SafeCreateVariableFieldCached: case opcode::OP_SafeSetVariableFieldCached: case opcode::OP_SafeSetWaittillVariableFieldCached: @@ -118,7 +120,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_endswitch: case opcode::OP_JumpOnFalse: case opcode::OP_JumpOnTrue: - case opcode::OP_waittillmatch: case opcode::OP_EvalLevelFieldVariable: case opcode::OP_EvalAnimFieldVariable: case opcode::OP_EvalSelfFieldVariable: diff --git a/src/experimental/iw6c/xsk/iw6c.hpp b/src/experimental/iw6c/xsk/iw6c.hpp index f3d8a81b..0a9c13c2 100644 --- a/src/experimental/iw6c/xsk/iw6c.hpp +++ b/src/experimental/iw6c/xsk/iw6c.hpp @@ -17,7 +17,9 @@ namespace xsk::gsc::iw6c { -constexpr std::uint16_t max_string_id = 0x8EFA; +constexpr std::uint16_t max_string_id = 0x95A1; +// ps3 0x95A1 +// 360 0x8EFA enum class opcode : std::uint8_t { @@ -41,10 +43,10 @@ enum class opcode : std::uint8_t OP_ClearLocalVariableFieldCached0 = 0x2E, OP_notify = 0x2F, OP_GetVector = 0x30, - OP_ScriptChildThreadCallPointer = 0x31, - OP_voidCodepos = 0x32, + OP_ScriptMethodChildThreadCallPointer = 0x31, + OP_PreScriptCall = 0x32, OP_GetByte = 0x33, - OP_ScriptFarMethodThreadCall = 0x34, + OP_ScriptFarThreadCall = 0x34, OP_SetSelfFieldVariableField = 0x35, OP_JumpOnFalseExpr = 0x36, OP_GetUndefined = 0x37, @@ -62,7 +64,7 @@ enum class opcode : std::uint8_t OP_GetLevel = 0x43, OP_size = 0x44, OP_SafeSetWaittillVariableFieldCached = 0x45, - OP_ScriptLocalThreadCall = 0x46, + OP_ScriptLocalMethodThreadCall = 0x46, OP_AddArray = 0x47, OP_endon = 0x48, OP_EvalFieldVariable = 0x49, @@ -71,7 +73,7 @@ enum class opcode : std::uint8_t OP_Return = 0x4C, OP_CreateLocalVariable = 0x4D, OP_SafeSetVariableFieldCached0 = 0x4E, - OP_GetBuiltinFunction = 0x4F, + OP_GetBuiltinMethod = 0x4F, OP_ScriptLocalMethodCall = 0x50, OP_CallBuiltinMethodPointer = 0x51, OP_ScriptLocalChildThreadCall = 0x52, @@ -91,14 +93,14 @@ enum class opcode : std::uint8_t OP_EvalLocalVariableCached5 = 0x60, OP_EvalLocalVariableCached = 0x61, OP_EvalNewLocalArrayRefCached0 = 0x62, - OP_ScriptMethodChildThreadCallPointer = 0x63, + OP_ScriptChildThreadCallPointer = 0x63, OP_EvalLocalVariableObjectCached = 0x64, - OP_ScriptLocalMethodThreadCall = 0x65, + OP_ScriptLocalThreadCall = 0x65, OP_GetInteger = 0x66, OP_ScriptMethodCallPointer = 0x67, OP_checkclearparams = 0x68, OP_SetAnimFieldVariableField = 0x69, - // ---- = 0x6A, + OP_waittillmatch2 = 0x6A, OP_minus = 0x6B, OP_ScriptLocalFunctionCall2 = 0x6C, OP_GetNegUnsignedShort = 0x6D, @@ -106,7 +108,7 @@ enum class opcode : std::uint8_t OP_SafeCreateVariableFieldCached = 0x6F, OP_greater_equal = 0x70, OP_vector = 0x71, - OP_GetBuiltinMethod = 0x72, + OP_GetBuiltinFunction = 0x72, OP_endswitch = 0x73, OP_ClearArray = 0x74, OP_DecTop = 0x75, @@ -122,7 +124,7 @@ enum class opcode : std::uint8_t OP_GetAnimTree = 0x7F, OP_EvalLocalArrayCached = 0x80, OP_mod = 0x81, - OP_ScriptFarThreadCall = 0x82, + OP_ScriptFarMethodThreadCall = 0x82, OP_GetUnsignedShort = 0x83, OP_clearparams = 0x84, OP_ScriptMethodThreadCallPointer = 0x85, @@ -169,7 +171,7 @@ enum class opcode : std::uint8_t OP_GetFarFunction = 0xAE, OP_CallBuiltinPointer = 0xAF, OP_jump = 0xB0, - OP_PreScriptCall = 0xB1, + OP_voidCodepos = 0xB1, OP_ScriptFarMethodCall = 0xB2, OP_inequality = 0xB3, OP_ScriptLocalFunctionCall = 0xB4, diff --git a/src/experimental/iw6c/xsk/resolver.cpp b/src/experimental/iw6c/xsk/resolver.cpp index dfe2d683..df3247c3 100644 --- a/src/experimental/iw6c/xsk/resolver.cpp +++ b/src/experimental/iw6c/xsk/resolver.cpp @@ -285,9 +285,9 @@ const std::array, 153> opcode_list { 0x2F, "OP_notify" }, { 0x30, "OP_GetVector" }, { 0x31, "OP_ScriptMethodChildThreadCallPointer" }, - { 0x32, "OP_voidCodepos" }, + { 0x32, "OP_PreScriptCall" }, { 0x33, "OP_GetByte" }, - { 0x34, "OP_ScriptFarMethodThreadCall" }, + { 0x34, "OP_ScriptFarThreadCall" }, { 0x35, "OP_SetSelfFieldVariableField" }, { 0x36, "OP_JumpOnFalseExpr" }, { 0x37, "OP_GetUndefined" }, @@ -305,7 +305,7 @@ const std::array, 153> opcode_list { 0x43, "OP_GetLevel" }, { 0x44, "OP_size" }, { 0x45, "OP_SafeSetWaittillVariableFieldCached" }, - { 0x46, "OP_ScriptLocalThreadCall" }, + { 0x46, "OP_ScriptLocalMethodThreadCall" }, { 0x47, "OP_AddArray" }, { 0x48, "OP_endon" }, { 0x49, "OP_EvalFieldVariable" }, @@ -314,7 +314,7 @@ const std::array, 153> opcode_list { 0x4C, "OP_Return" }, { 0x4D, "OP_CreateLocalVariable" }, { 0x4E, "OP_SafeSetVariableFieldCached0" }, - { 0x4F, "OP_GetBuiltinFunction" }, + { 0x4F, "OP_GetBuiltinMethod" }, { 0x50, "OP_ScriptLocalMethodCall" }, { 0x51, "OP_CallBuiltinMethodPointer" }, { 0x52, "OP_ScriptLocalChildThreadCall" }, @@ -334,14 +334,14 @@ const std::array, 153> opcode_list { 0x60, "OP_EvalLocalVariableCached5" }, { 0x61, "OP_EvalLocalVariableCached" }, { 0x62, "OP_EvalNewLocalArrayRefCached0" }, - { 0x63, "OP_ScriptMethodChildThreadCallPointer" }, + { 0x63, "OP_ScriptChildThreadCallPointer" }, { 0x64, "OP_EvalLocalVariableObjectCached" }, - { 0x65, "OP_ScriptLocalMethodThreadCall" }, + { 0x65, "OP_ScriptLocalThreadCall" }, { 0x66, "OP_GetInteger" }, { 0x67, "OP_ScriptMethodCallPointer" }, { 0x68, "OP_checkclearparams" }, { 0x69, "OP_SetAnimFieldVariableField" }, - { 0x6A, "OP_UNK_1" }, + { 0x6A, "OP_waittillmatch2" }, { 0x6B, "OP_minus" }, { 0x6C, "OP_ScriptLocalFunctionCall2" }, { 0x6D, "OP_GetNegUnsignedShort" }, @@ -349,7 +349,7 @@ const std::array, 153> opcode_list { 0x6F, "OP_SafeCreateVariableFieldCached" }, { 0x70, "OP_greater_equal" }, { 0x71, "OP_vector" }, - { 0x72, "OP_GetBuiltinMethod" }, + { 0x72, "OP_GetBuiltinFunction" }, { 0x73, "OP_endswitch" }, { 0x74, "OP_ClearArray" }, { 0x75, "OP_DecTop" }, @@ -365,7 +365,7 @@ const std::array, 153> opcode_list { 0x7F, "OP_GetAnimTree" }, { 0x80, "OP_EvalLocalArrayCached" }, { 0x81, "OP_mod" }, - { 0x82, "OP_ScriptFarThreadCall" }, + { 0x82, "OP_ScriptFarMethodThreadCall" }, { 0x83, "OP_GetUnsignedShort" }, { 0x84, "OP_clearparams" }, { 0x85, "OP_ScriptMethodThreadCallPointer" }, @@ -412,15 +412,18 @@ const std::array, 153> opcode_list { 0xAE, "OP_GetFarFunction" }, { 0xAF, "OP_CallBuiltinPointer" }, { 0xB0, "OP_jump" }, - { 0xB1, "OP_PreScriptCall" }, + { 0xB1, "OP_voidCodepos" }, { 0xB2, "OP_ScriptFarMethodCall" }, { 0xB3, "OP_inequality" }, { 0xB4, "OP_ScriptLocalFunctionCall" }, { 0xB5, "OP_bit_ex_or" }, }}; -const std::array, 0> function_list +const std::array, 3> function_list {{ + { 0x12, "isdefined" }, + { 0xB7, "getfirstarraykey" }, + { 0xB8, "getnextarraykey" }, }}; const std::array, 0> method_list diff --git a/src/experimental/s1c/xsk/assembler.cpp b/src/experimental/s1c/xsk/assembler.cpp index 8418560b..61d879f9 100644 --- a/src/experimental/s1c/xsk/assembler.cpp +++ b/src/experimental/s1c/xsk/assembler.cpp @@ -230,7 +230,7 @@ void assembler::assemble_instruction(const instruction::ptr& inst) case opcode::OP_vector: case opcode::OP_bit_or: case opcode::OP_AddArray: - // case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_shift_right: break; case opcode::OP_GetByte: @@ -255,11 +255,10 @@ void assembler::assemble_instruction(const instruction::ptr& inst) break; case opcode::OP_GetString: case opcode::OP_GetIString: - script_->write_endian(0); + script_->write_endian(0); stack_->write_c_string(inst->data[0]); break; case opcode::OP_GetAnimation: - script_->write_endian(0); script_->write_endian(0); stack_->write_c_string(inst->data[0]); stack_->write_c_string(inst->data[1]); @@ -304,7 +303,7 @@ void assembler::assemble_instruction(const instruction::ptr& inst) case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: case opcode::OP_ScriptThreadCallPointer: -// case opcode::OP_ScriptChildThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: script_->write_endian(static_cast(std::stoi(inst->data[0]))); diff --git a/src/experimental/s1c/xsk/compiler.cpp b/src/experimental/s1c/xsk/compiler.cpp index 92672efa..fb28c3ea 100644 --- a/src/experimental/s1c/xsk/compiler.cpp +++ b/src/experimental/s1c/xsk/compiler.cpp @@ -412,8 +412,7 @@ void compiler::emit_stmt_waittillmatch(const ast::stmt_waittillmatch::ptr& stmt, emit_expr(stmt->event, blk); emit_expr(stmt->obj, blk); emit_opcode(opcode::OP_waittillmatch, utils::string::va("%d", stmt->args->list.size())); -// emit_opcode(opcode::OP_waittillmatch2); -// TODO!! + emit_opcode(opcode::OP_waittillmatch2); emit_opcode(opcode::OP_clearparams); } @@ -1340,8 +1339,7 @@ void compiler::emit_expr_call_pointer(const ast::expr_pointer::ptr& expr, const emit_opcode(opcode::OP_ScriptThreadCallPointer, argcount); break; case ast::call::mode::childthread: -// emit_opcode(opcode::OP_ScriptChildThreadCallPointer, argcount); -// TODO! + emit_opcode(opcode::OP_ScriptChildThreadCallPointer, argcount); break; case ast::call::mode::builtin: emit_opcode(opcode::OP_CallBuiltinPointer, argcount); diff --git a/src/experimental/s1c/xsk/decompiler.cpp b/src/experimental/s1c/xsk/decompiler.cpp index c3310740..305d994d 100644 --- a/src/experimental/s1c/xsk/decompiler.cpp +++ b/src/experimental/s1c/xsk/decompiler.cpp @@ -724,7 +724,6 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) stack_.push(std::move(node)); break; } -/* case opcode::OP_ScriptChildThreadCallPointer: { auto args = std::make_unique(loc); @@ -743,7 +742,6 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) stack_.push(std::move(node)); break; } -*/ case opcode::OP_ScriptMethodThreadCallPointer: { auto args = std::make_unique(loc); @@ -1685,7 +1683,7 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) expr_labels_.push_back(inst->data[0]); break; } -// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_checkclearparams: case opcode::OP_CastFieldObject: case opcode::OP_CastBool: diff --git a/src/experimental/s1c/xsk/disassembler.cpp b/src/experimental/s1c/xsk/disassembler.cpp index a3617dbb..d445c96f 100644 --- a/src/experimental/s1c/xsk/disassembler.cpp +++ b/src/experimental/s1c/xsk/disassembler.cpp @@ -153,7 +153,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_vector: case opcode::OP_bit_or: case opcode::OP_AddArray: -// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_shift_right: break; case opcode::OP_GetByte: @@ -178,11 +178,11 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) break; case opcode::OP_GetString: case opcode::OP_GetIString: - script_->seek(4); + script_->seek(2); inst->data.push_back(utils::string::to_literal(stack_->read_c_string())); break; case opcode::OP_GetAnimation: - script_->seek(8); + script_->seek(4); inst->data.push_back(utils::string::quote(stack_->read_c_string(), false)); inst->data.push_back(utils::string::quote(stack_->read_c_string(), false)); break; @@ -226,7 +226,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: case opcode::OP_ScriptThreadCallPointer: -// case opcode::OP_ScriptChildThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: inst->data.push_back(utils::string::va("%i", script_->read_endian())); diff --git a/src/experimental/s1c/xsk/resolver.cpp b/src/experimental/s1c/xsk/resolver.cpp index d8128306..a59334ff 100644 --- a/src/experimental/s1c/xsk/resolver.cpp +++ b/src/experimental/s1c/xsk/resolver.cpp @@ -320,7 +320,7 @@ const std::array, 154> opcode_list { 0x31, "OP_ScriptMethodChildThreadCallPointer" }, { 0x32, "OP_PreScriptCall" }, { 0x33, "OP_GetByte" }, - { 0x34, "OP_ScriptFarMethodThreadCall" }, + { 0x34, "OP_ScriptFarThreadCall" }, { 0x35, "OP_SetSelfFieldVariableField" }, { 0x36, "OP_JumpOnFalseExpr" }, { 0x37, "OP_GetUndefined" }, @@ -338,7 +338,7 @@ const std::array, 154> opcode_list { 0x43, "OP_GetLevel" }, { 0x44, "OP_size" }, { 0x45, "OP_SafeSetWaittillVariableFieldCached" }, - { 0x46, "OP_ScriptLocalThreadCall" }, + { 0x46, "OP_ScriptLocalMethodThreadCall" }, { 0x47, "OP_AddArray" }, { 0x48, "OP_endon" }, { 0x49, "OP_EvalFieldVariable" }, @@ -347,7 +347,7 @@ const std::array, 154> opcode_list { 0x4C, "OP_Return" }, { 0x4D, "OP_CreateLocalVariable" }, { 0x4E, "OP_SafeSetVariableFieldCached0" }, - { 0x4F, "OP_GetBuiltinFunction" }, + { 0x4F, "OP_GetBuiltinMethod" }, { 0x50, "OP_ScriptLocalMethodCall" }, { 0x51, "OP_CallBuiltinMethodPointer" }, { 0x52, "OP_ScriptLocalChildThreadCall" }, @@ -367,22 +367,22 @@ const std::array, 154> opcode_list { 0x60, "OP_EvalLocalVariableCached5" }, { 0x61, "OP_EvalLocalVariableCached" }, { 0x62, "OP_EvalNewLocalArrayRefCached0" }, - { 0x63, "OP_ScriptMethodChildThreadCallPointer" }, + { 0x63, "OP_ScriptChildThreadCallPointer" }, { 0x64, "OP_EvalLocalVariableObjectCached" }, - { 0x65, "OP_ScriptLocalMethodThreadCall" }, + { 0x65, "OP_ScriptLocalThreadCall" }, { 0x66, "OP_GetInteger" }, { 0x67, "OP_ScriptMethodCallPointer" }, { 0x68, "OP_checkclearparams" }, { 0x69, "OP_SetAnimFieldVariableField" }, - { 0x6A, "OP_UNK_1" }, - { 0x6B, "OP_minus " }, + { 0x6A, "OP_waittillmatch2" }, + { 0x6B, "OP_minus" }, { 0x6C, "OP_ScriptLocalFunctionCall2" }, { 0x6D, "OP_GetNegUnsignedShort" }, { 0x6E, "OP_GetNegByte" }, { 0x6F, "OP_SafeCreateVariableFieldCached" }, { 0x70, "OP_greater_equal" }, { 0x71, "OP_vector" }, - { 0x72, "OP_GetBuiltinMethod" }, + { 0x72, "OP_GetBuiltinFunction" }, { 0x73, "OP_endswitch" }, { 0x74, "OP_ClearArray" }, { 0x75, "OP_DecTop" }, @@ -398,7 +398,7 @@ const std::array, 154> opcode_list { 0x7F, "OP_GetAnimTree" }, { 0x80, "OP_EvalLocalArrayCached" }, { 0x81, "OP_mod" }, - { 0x82, "OP_ScriptFarThreadCall" }, + { 0x82, "OP_ScriptFarMethodThreadCall" }, { 0x83, "OP_GetUnsignedShort" }, { 0x84, "OP_clearparams" }, { 0x85, "OP_ScriptMethodThreadCallPointer" }, @@ -453,8 +453,11 @@ const std::array, 154> opcode_list { 0xB6, "OP_bit_ex_or" }, }}; -const std::array, 0> function_list +const std::array, 3> function_list {{ + { 0x12, "isdefined" }, + { 0xC0, "getfirstarraykey" }, + { 0xC1, "getnextarraykey" }, }}; const std::array, 0> method_list diff --git a/src/experimental/s1c/xsk/s1c.cpp b/src/experimental/s1c/xsk/s1c.cpp index 8870bc01..23f5ee79 100644 --- a/src/experimental/s1c/xsk/s1c.cpp +++ b/src/experimental/s1c/xsk/s1c.cpp @@ -18,6 +18,7 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_GetUndefined: case opcode::OP_GetZero: case opcode::OP_waittillFrameEnd: + case opcode::OP_waitFrame: case opcode::OP_EvalLocalVariableCached0: case opcode::OP_EvalLocalVariableCached1: case opcode::OP_EvalLocalVariableCached2: @@ -51,7 +52,7 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_less: case opcode::OP_greater: case opcode::OP_less_equal: -// case opcode::OP_waittillmatch2: + case opcode::OP_waittillmatch2: case opcode::OP_waittill: case opcode::OP_notify: case opcode::OP_endon: @@ -92,10 +93,12 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_EvalNewLocalArrayRefCached0: case opcode::OP_EvalLocalArrayRefCached: case opcode::OP_ScriptThreadCallPointer: + case opcode::OP_ScriptChildThreadCallPointer: case opcode::OP_ScriptMethodThreadCallPointer: case opcode::OP_ScriptMethodChildThreadCallPointer: case opcode::OP_CallBuiltinPointer: case opcode::OP_CallBuiltinMethodPointer: + case opcode::OP_waittillmatch: case opcode::OP_SafeCreateVariableFieldCached: case opcode::OP_SafeSetVariableFieldCached: case opcode::OP_SafeSetWaittillVariableFieldCached: @@ -118,7 +121,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_endswitch: case opcode::OP_JumpOnFalse: case opcode::OP_JumpOnTrue: - case opcode::OP_waittillmatch: case opcode::OP_EvalLevelFieldVariable: case opcode::OP_EvalAnimFieldVariable: case opcode::OP_EvalSelfFieldVariable: diff --git a/src/experimental/s1c/xsk/s1c.hpp b/src/experimental/s1c/xsk/s1c.hpp index 287735c5..0881ba94 100644 --- a/src/experimental/s1c/xsk/s1c.hpp +++ b/src/experimental/s1c/xsk/s1c.hpp @@ -18,6 +18,8 @@ namespace xsk::gsc::s1c { constexpr std::uint16_t max_string_id = 0xA51D; +// ps3 ?? +// 360 0xA51D enum class opcode : std::uint8_t { @@ -41,10 +43,10 @@ enum class opcode : std::uint8_t OP_ClearLocalVariableFieldCached0 = 0x2E, OP_notify = 0x2F, OP_GetVector = 0x30, - OP_ScriptChildThreadCallPointer = 0x31, + OP_ScriptMethodChildThreadCallPointer = 0x31, OP_PreScriptCall = 0x32, OP_GetByte = 0x33, - OP_ScriptFarMethodThreadCall = 0x34, + OP_ScriptFarThreadCall = 0x34, OP_SetSelfFieldVariableField = 0x35, OP_JumpOnFalseExpr = 0x36, OP_GetUndefined = 0x37, @@ -62,7 +64,7 @@ enum class opcode : std::uint8_t OP_GetLevel = 0x43, OP_size = 0x44, OP_SafeSetWaittillVariableFieldCached = 0x45, - OP_ScriptLocalThreadCall = 0x46, + OP_ScriptLocalMethodThreadCall = 0x46, OP_AddArray = 0x47, OP_endon = 0x48, OP_EvalFieldVariable = 0x49, @@ -71,7 +73,7 @@ enum class opcode : std::uint8_t OP_Return = 0x4C, OP_CreateLocalVariable = 0x4D, OP_SafeSetVariableFieldCached0 = 0x4E, - OP_GetBuiltinFunction = 0x4F, + OP_GetBuiltinMethod = 0x4F, OP_ScriptLocalMethodCall = 0x50, OP_CallBuiltinMethodPointer = 0x51, OP_ScriptLocalChildThreadCall = 0x52, @@ -91,14 +93,14 @@ enum class opcode : std::uint8_t OP_EvalLocalVariableCached5 = 0x60, OP_EvalLocalVariableCached = 0x61, OP_EvalNewLocalArrayRefCached0 = 0x62, - OP_ScriptMethodChildThreadCallPointer = 0x63, + OP_ScriptChildThreadCallPointer = 0x63, OP_EvalLocalVariableObjectCached = 0x64, - OP_ScriptLocalMethodThreadCall = 0x65, + OP_ScriptLocalThreadCall = 0x65, OP_GetInteger = 0x66, OP_ScriptMethodCallPointer = 0x67, OP_checkclearparams = 0x68, OP_SetAnimFieldVariableField = 0x69, - // ---- = 0x6A, + OP_waittillmatch2 = 0x6A, OP_minus = 0x6B, OP_ScriptLocalFunctionCall2 = 0x6C, OP_GetNegUnsignedShort = 0x6D, @@ -106,7 +108,7 @@ enum class opcode : std::uint8_t OP_SafeCreateVariableFieldCached = 0x6F, OP_greater_equal = 0x70, OP_vector = 0x71, - OP_GetBuiltinMethod = 0x72, + OP_GetBuiltinFunction = 0x72, OP_endswitch = 0x73, OP_ClearArray = 0x74, OP_DecTop = 0x75, @@ -122,7 +124,7 @@ enum class opcode : std::uint8_t OP_GetAnimTree = 0x7F, OP_EvalLocalArrayCached = 0x80, OP_mod = 0x81, - OP_ScriptFarThreadCall = 0x82, + OP_ScriptFarMethodThreadCall = 0x82, OP_GetUnsignedShort = 0x83, OP_clearparams = 0x84, OP_ScriptMethodThreadCallPointer = 0x85, diff --git a/src/tool/xsk/main.cpp b/src/tool/xsk/main.cpp index 61f1ef1b..91ff2128 100644 --- a/src/tool/xsk/main.cpp +++ b/src/tool/xsk/main.cpp @@ -627,7 +627,7 @@ void print_usage() { std::cout << "usage: gsc-tool.exe \n"; std::cout << "\t* modes: asm, disasm, comp, decomp\n"; - std::cout << "\t* games: iw5c, iw5, iw6, iw7, iw8, s1, s2, s4, h1, h2, t6\n"; + std::cout << "\t* games: iw5c, iw6c, s1c, iw5, iw6, iw7, iw8, s1, s2, s4, h1, h2, t6\n"; std::cout << "\t* paths: file or directory (recursive)\n"; } /*