diff --git a/src/iw9/xsk/decompiler.cpp b/src/iw9/xsk/decompiler.cpp index 38308308..14fa7644 100644 --- a/src/iw9/xsk/decompiler.cpp +++ b/src/iw9/xsk/decompiler.cpp @@ -1360,6 +1360,17 @@ void decompiler::decompile_instruction(const instruction::ptr& inst) case opcode::OP_CastFieldObject: case opcode::OP_CastBool: break; + case opcode::OP_unk_134: // eval something + case opcode::OP_unk_133: // eval something + case opcode::OP_unk_135: // eval something + case opcode::OP_unk_136: // OP_GetDvar + case opcode::OP_unk_137: // eval something + case opcode::OP_unk_138: // eval something + { + auto node = std::make_unique(loc, utils::string::va("data_%s", inst->data[0].data())); + stack_.push(std::move(node)); + break; + } // case opcode::OP_ClearVariableField // case opcode::OP_EvalNewLocalVariableRefCached0 default: diff --git a/src/iw9/xsk/disassembler.cpp b/src/iw9/xsk/disassembler.cpp index 1ace6d54..9143e52d 100644 --- a/src/iw9/xsk/disassembler.cpp +++ b/src/iw9/xsk/disassembler.cpp @@ -130,6 +130,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_EvalLocalVariableCached5: case opcode::OP_ScriptMethodCallPointer: case opcode::OP_checkclearparams: + case opcode::OP_waittillmatch2: case opcode::OP_minus: case opcode::OP_greater_equal: case opcode::OP_vector: @@ -161,7 +162,6 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_voidCodepos: case opcode::OP_inequality: case opcode::OP_bit_ex_or: - case opcode::OP_unk_139: case opcode::OP_BoolNotAfterAnd: case opcode::OP_IsDefined: case opcode::OP_IsTrue: @@ -200,7 +200,6 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) inst->data.push_back(utils::string::quote(stack_->read_c_string(), false)); break; case opcode::OP_waittillmatch: - inst->data.push_back(utils::string::va("%i", script_->read())); inst->data.push_back(utils::string::va("%i", script_->read())); break; case opcode::OP_EvalSelfFieldVariableRef: @@ -294,7 +293,7 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_SetNewLocalVariableFieldCached0_Precompiled: case opcode::OP_CreateLocalVariable_Precompiled: case opcode::OP_SafeCreateVariableFieldCached_Precompiled: - script_->seek(8); // TODO: skipped data + inst->data.push_back(resolver::hash_name(script_->read())); break;*/ case opcode::OP_NativeGetFarFunction: case opcode::OP_NativeFarFunctionCall: @@ -311,15 +310,15 @@ void disassembler::dissasemble_instruction(const instruction::ptr& inst) case opcode::OP_FormalParams_Precompiled: disassemble_formal_params(inst); break; - case opcode::OP_unk_134: - case opcode::OP_unk_137: - script_->seek(4); + case opcode::OP_unk_134: // eval xhash + case opcode::OP_unk_137: // eval something + inst->data.push_back(utils::string::va("%08X", script_->read())); break; - case opcode::OP_unk_133: // eval something - case opcode::OP_unk_135: - case opcode::OP_unk_136: - case opcode::OP_unk_138: - inst->data.push_back(resolver::hash_name(script_->read())); + case opcode::OP_unk_133: // eval xhash + case opcode::OP_unk_135: // eval xhash + case opcode::OP_unk_136: // eval xhash OP_GetDvar? + case opcode::OP_unk_138: // eval something + inst->data.push_back(utils::string::va("%016llX", script_->read())); break; default: throw disasm_error(utils::string::va("unhandled opcode 0x%X at index '%04X'!", inst->opcode, inst->index)); @@ -385,14 +384,13 @@ void disassembler::disassemble_far_call(const instruction::ptr& inst, bool threa if (file == 0) { - + inst->data.emplace(inst->data.begin(), utils::string::va("%X", inst->index + 1 + offs)); inst->data.emplace(inst->data.begin(), ""); - inst->data.push_back(utils::string::va("%X", offs + inst->index + 1)); } else { - inst->data.emplace(inst->data.begin(), resolver::hash_name(file)); inst->data.emplace(inst->data.begin(), resolver::hash_name(name)); + inst->data.emplace(inst->data.begin(), resolver::hash_name(file)); } } diff --git a/src/iw9/xsk/iw9.cpp b/src/iw9/xsk/iw9.cpp index 0d14f55a..afbb0c77 100644 --- a/src/iw9/xsk/iw9.cpp +++ b/src/iw9/xsk/iw9.cpp @@ -49,6 +49,7 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_EvalLocalVariableCached5: case opcode::OP_ScriptMethodCallPointer: case opcode::OP_checkclearparams: + case opcode::OP_waittillmatch2: case opcode::OP_minus: case opcode::OP_greater_equal: case opcode::OP_vector: @@ -80,13 +81,13 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_voidCodepos: case opcode::OP_inequality: case opcode::OP_bit_ex_or: - case opcode::OP_unk_139: case opcode::OP_BoolNotAfterAnd: case opcode::OP_IsDefined: case opcode::OP_IsTrue: return 1; case opcode::OP_SetLocalVariableFieldCached: case opcode::OP_RemoveLocalVariables: + case opcode::OP_waittillmatch: case opcode::OP_ScriptMethodChildThreadCallPointer: case opcode::OP_GetByte: case opcode::OP_SafeSetWaittillVariableFieldCached: @@ -108,7 +109,6 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t case opcode::OP_FormalParams: case opcode::OP_FormalParams_Precompiled: return 2; - case opcode::OP_waittillmatch: case opcode::OP_JumpOnTrue: case opcode::OP_JumpOnFalseExpr: case opcode::OP_jumpback: @@ -177,9 +177,9 @@ auto opcode_size(std::uint8_t id) -> std::uint32_t return 9; case opcode::OP_GetVector: return 13; - case opcode::OP_waittillmatch2: case opcode::OP_ClearVariableField: case opcode::OP_EvalNewLocalVariableRefCached0: + case opcode::OP_unk_139: case opcode::OP_unk_140: case opcode::OP_unk_141: case opcode::OP_unk_142: diff --git a/src/iw9/xsk/resolver.cpp b/src/iw9/xsk/resolver.cpp index d1d424bc..966d3e0a 100644 --- a/src/iw9/xsk/resolver.cpp +++ b/src/iw9/xsk/resolver.cpp @@ -251,8 +251,6 @@ auto resolver::hash_id(const std::string& name) -> std::uint64_t { byte += 32; } - - printf("%c", byte); hash = (uint64_t)0x10000000233 * ((uint64_t)byte ^ hash); }