diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp index b4cb25aa5c..698be3b246 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPInterpreter.cpp @@ -32,8 +32,7 @@ namespace DSPInterpreter { void unknown(const UDSPInstruction& opc) { //_assert_msg_(MASTER_LOG, !g_dsp.exception_in_progress_hack, "assert while exception"); - ERROR_LOG(DSPHLE, "LLE: Unrecognized opcode 0x%04x, pc 0x%04x", opc.hex, g_dsp.pc - 1); - //g_dsp.pc = g_dsp.err_pc; + ERROR_LOG(DSPHLE, "LLE: Unrecognized opcode 0x%04x, pc 0x%04x", opc.hex, g_dsp.err_pc); } // Generic call implementation @@ -68,7 +67,8 @@ void ifcc(const UDSPInstruction& opc) { if (!CheckCondition(opc.hex & 0xf)) { - dsp_fetch_code(); // skip the next opcode + // skip the next opcode - we have to lookup its size. + g_dsp.pc += opSize[dsp_peek_code()]; } } diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp index f556ea1f2f..4518437768 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.cpp @@ -91,16 +91,16 @@ DSPOPCTemplate opcodes[] = {"CALLLZ", 0x02bd, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL}, {"CALL", 0x02bf, 0xffff, DSPInterpreter::call, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL}, - {"IFNS", 0x0270, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFS", 0x0271, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFG", 0x0272, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFLE", 0x0273, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFNZ", 0x0274, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFZ", 0x0275, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFL", 0x0276, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFGE", 0x0277, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFLNZ", 0x027c, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, - {"IFLZ", 0x027d, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF NS", 0x0270, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF S", 0x0271, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF G", 0x0272, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF LE", 0x0273, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF NZ", 0x0274, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF Z", 0x0275, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF L", 0x0276, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF GE", 0x0277, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF LNZ", 0x027c, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, + {"IF LZ", 0x027d, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, {"IF", 0x027f, 0xffff, DSPInterpreter::ifcc, nop, 1, 0, {}, NULL, NULL}, // Hermes doesn't list this {"JNS", 0x0290, 0xffff, DSPInterpreter::jcc, nop, 2, 1, {{P_VAL, 2, 1, 0, 0xffff}}, NULL, NULL}, @@ -315,6 +315,7 @@ DSPOPCTemplate opcodes_ext[] = const u32 opcodes_size = sizeof(opcodes) / sizeof(DSPOPCTemplate); const u32 opcodes_ext_size = sizeof(opcodes_ext) / sizeof(DSPOPCTemplate); +u8 opSize[OPTABLE_SIZE]; dspInstFunc opTable[OPTABLE_SIZE]; dspInstFunc prologueTable[OPTABLE_SIZE]; dspInstFunc epilogueTable[OPTABLE_SIZE]; @@ -332,6 +333,7 @@ void InitInstructionTable() if ((opcodes[j].opcode_mask & i) == opcodes[j].opcode) { if (opTable[i] == DSPInterpreter::unknown) { opTable[i] = opcodes[j].interpFunc; + opSize[i] = opcodes[j].size; prologueTable[i] = opcodes[j].prologue; epilogueTable[i] = opcodes[j].epilogue; } else { diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h index 48d9b123f2..309cd9bad5 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/DSPTables.h @@ -110,6 +110,7 @@ extern DSPOPCTemplate opcodes[]; extern const u32 opcodes_size; extern DSPOPCTemplate opcodes_ext[]; extern const u32 opcodes_ext_size; +extern u8 opSize[OPTABLE_SIZE]; extern dspInstFunc opTable[]; diff --git a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp index dd06ffe6d8..8b340c35b4 100644 --- a/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE-testing/Src/gdsp_interpreter.cpp @@ -73,11 +73,6 @@ void UpdateCachedCR() //------------------------------------------------------------------------------- -void dbg_error(char* err_msg) -{ - return; -} - void gdsp_init() { // Why do we have DROM? Does it exist? Has it been dumped? @@ -242,6 +237,9 @@ void gdsp_loop_step() u16 HLE_ROM_80E7_81F8(); void hacks(); + + + void gdsp_step() { g_dsp.step_counter++; diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.cpp index 3a3c1e001f..a7ea37af89 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/gdsp_interpreter.cpp @@ -77,12 +77,6 @@ void (*dsp_op[])(uint16 opc) = dsp_opcd, dsp_opcd, dsp_ope, dsp_opf, }; -void dbg_error(char* err_msg) -{ - return; -} - - void gdsp_init() { g_dsp.irom = (uint16*)malloc(DSP_IROM_SIZE * sizeof(uint16));