static char *name = "retroarch.exe";
static bool use_lightrec_interpreter;
+static bool use_pcsx_interpreter;
static bool lightrec_debug;
static bool lightrec_very_debug;
static u32 lightrec_begin_cycles;
static char cache_buf[64 * 1024];
-static u32 cop0_mfc(struct lightrec_state *state, u8 reg)
+static u32 cop0_mfc(struct lightrec_state *state, u32 op, u8 reg)
{
return psxRegs.CP0.r[reg];
}
return MFC2(reg);
}
-static u32 cop2_mfc(struct lightrec_state *state, u8 reg)
+static u32 cop2_mfc(struct lightrec_state *state, u32 op, u8 reg)
{
return cop2_mfc_cfc(state, reg, false);
}
-static u32 cop2_cfc(struct lightrec_state *state, u8 reg)
+static u32 cop2_cfc(struct lightrec_state *state, u32 op, u8 reg)
{
return cop2_mfc_cfc(state, reg, true);
}
MTC2(value, reg);
}
-static void cop0_mtc(struct lightrec_state *state, u8 reg, u32 value)
+static void cop0_mtc(struct lightrec_state *state, u32 op, u8 reg, u32 value)
{
cop0_mtc_ctc(state, reg, value, false);
}
-static void cop0_ctc(struct lightrec_state *state, u8 reg, u32 value)
+static void cop0_ctc(struct lightrec_state *state, u32 op, u8 reg, u32 value)
{
cop0_mtc_ctc(state, reg, value, true);
}
-static void cop2_mtc(struct lightrec_state *state, u8 reg, u32 value)
+static void cop2_mtc(struct lightrec_state *state, u32 op, u8 reg, u32 value)
{
cop2_mtc_ctc(state, reg, value, false);
}
-static void cop2_ctc(struct lightrec_state *state, u8 reg, u32 value)
+static void cop2_ctc(struct lightrec_state *state, u32 op, u8 reg, u32 value)
{
cop2_mtc_ctc(state, reg, value, true);
}
cp2_ops[func & 0x3f](&psxRegs.CP2);
}
-static void hw_write_byte(struct lightrec_state *state, u32 mem, u8 val)
+static void hw_write_byte(struct lightrec_state *state,
+ u32 op, void *host, u32 mem, u8 val)
{
psxRegs.cycle = lightrec_current_cycle_count(state);
lightrec_reset_cycle_count(state, psxRegs.cycle);
}
-static void hw_write_half(struct lightrec_state *state, u32 mem, u16 val)
+static void hw_write_half(struct lightrec_state *state,
+ u32 op, void *host, u32 mem, u16 val)
{
psxRegs.cycle = lightrec_current_cycle_count(state);
lightrec_reset_cycle_count(state, psxRegs.cycle);
}
-static void hw_write_word(struct lightrec_state *state, u32 mem, u32 val)
+static void hw_write_word(struct lightrec_state *state,
+ u32 op, void *host, u32 mem, u32 val)
{
psxRegs.cycle = lightrec_current_cycle_count(state);
lightrec_reset_cycle_count(state, psxRegs.cycle);
}
-static u8 hw_read_byte(struct lightrec_state *state, u32 mem)
+static u8 hw_read_byte(struct lightrec_state *state, u32 op, void *host, u32 mem)
{
u8 val;
return val;
}
-static u16 hw_read_half(struct lightrec_state *state, u32 mem)
+static u16 hw_read_half(struct lightrec_state *state,
+ u32 op, void *host, u32 mem)
{
u16 val;
return val;
}
-static u32 hw_read_word(struct lightrec_state *state, u32 mem)
+static u32 hw_read_word(struct lightrec_state *state,
+ u32 op, void *host, u32 mem)
{
u32 val;
static u32 cache_ctrl;
-static void cache_ctrl_write_word(struct lightrec_state *state, u32 mem, u32 val)
+static void cache_ctrl_write_word(struct lightrec_state *state,
+ u32 op, void *host, u32 mem, u32 val)
{
cache_ctrl = val;
}
-static u32 cache_ctrl_read_word(struct lightrec_state *state, u32 mem)
+static u32 cache_ctrl_read_word(struct lightrec_state *state,
+ u32 op, void *host, u32 mem)
{
return cache_ctrl;
}
printf("\n");
}
+
+extern void intExecuteBlock();
+
static u32 old_cycle_counter;
static void lightrec_plugin_execute_block(void)
u32 old_pc = psxRegs.pc;
u32 flags;
- lightrec_reset_cycle_count(lightrec_state, psxRegs.cycle);
- lightrec_restore_registers(lightrec_state, psxRegs.GPR.r);
+ if (use_pcsx_interpreter) {
+ intExecuteBlock();
+ } else {
+ lightrec_reset_cycle_count(lightrec_state, psxRegs.cycle);
+ lightrec_restore_registers(lightrec_state, psxRegs.GPR.r);
- if (use_lightrec_interpreter)
- psxRegs.pc = lightrec_run_interpreter(lightrec_state, psxRegs.pc);
- else
- psxRegs.pc = lightrec_execute_one(lightrec_state, psxRegs.pc);
+ if (use_lightrec_interpreter)
+ psxRegs.pc = lightrec_run_interpreter(lightrec_state,
+ psxRegs.pc);
+ else
+ psxRegs.pc = lightrec_execute_one(lightrec_state,
+ psxRegs.pc);
- psxRegs.cycle = lightrec_current_cycle_count(lightrec_state);
+ psxRegs.cycle = lightrec_current_cycle_count(lightrec_state);
- lightrec_dump_registers(lightrec_state, psxRegs.GPR.r);
- flags = lightrec_exit_flags(lightrec_state);
+ lightrec_dump_registers(lightrec_state, psxRegs.GPR.r);
+ flags = lightrec_exit_flags(lightrec_state);
- if (flags & LIGHTREC_EXIT_SEGFAULT) {
- fprintf(stderr, "Exiting at cycle 0x%08x\n",
- psxRegs.cycle);
- exit(1);
- }
+ if (flags & LIGHTREC_EXIT_SEGFAULT) {
+ fprintf(stderr, "Exiting at cycle 0x%08x\n",
+ psxRegs.cycle);
+ exit(1);
+ }
- if (flags & LIGHTREC_EXIT_SYSCALL)
- psxException(0x20, 0);
+ if (flags & LIGHTREC_EXIT_SYSCALL)
+ psxException(0x20, 0);
+ }
psxBranchTest();
}
if ((psxRegs.cycle & ~0xfffffff) != old_cycle_counter) {
- printf("RAM usage: IR %u KiB, CODE %u KiB, "
+ printf("RAM usage: Lightrec %u KiB, IR %u KiB, CODE %u KiB, "
"MIPS %u KiB, TOTAL %u KiB, avg. IPI %f\n",
+ lightrec_get_mem_usage(MEM_FOR_LIGHTREC) / 1024,
lightrec_get_mem_usage(MEM_FOR_IR) / 1024,
lightrec_get_mem_usage(MEM_FOR_CODE) / 1024,
lightrec_get_mem_usage(MEM_FOR_MIPS_CODE) / 1024,