Updated lazyusf2

CQTexperiment
Chris Moeller 2015-05-16 21:11:55 -07:00
parent 3f55ef085a
commit d4c971f9d2
5 changed files with 3 additions and 39 deletions

View File

@ -305,8 +305,6 @@ void translate_event_queue(usf_state_t * state, unsigned int base)
} }
add_interupt_event_count(state, COMPARE_INT, state->g_cp0_regs[CP0_COMPARE_REG]); add_interupt_event_count(state, COMPARE_INT, state->g_cp0_regs[CP0_COMPARE_REG]);
add_interupt_event_count(state, SPECIAL_INT, 0); add_interupt_event_count(state, SPECIAL_INT, 0);
r4300_reset_checkpoint(state, base);
} }
int save_eventqueue_infos(usf_state_t * state, char *buf) int save_eventqueue_infos(usf_state_t * state, char *buf)
@ -505,8 +503,6 @@ static void nmi_int_handler(usf_state_t * state)
void osal_fastcall gen_interupt(usf_state_t * state) void osal_fastcall gen_interupt(usf_state_t * state)
{ {
r4300_checkpoint(state);
if (state->stop == 1) if (state->stop == 1)
{ {
state->g_gs_vi_counter = 0; // debug state->g_gs_vi_counter = 0; // debug

View File

@ -738,8 +738,5 @@ void pure_interpreter(usf_state_t * state)
state->PC = &state->interp_PC; state->PC = &state->interp_PC;
while (!state->stop) while (!state->stop)
{
r4300_checkpoint(state);
InterpretOpcode(state); InterpretOpcode(state);
}
} }

View File

@ -272,31 +272,8 @@ void r4300_begin(usf_state_t * state)
} }
} }
void r4300_reset_checkpoint(usf_state_t * state, unsigned int new_cp0_count)
{
unsigned int diff = state->g_cp0_regs[CP0_COUNT_REG] - state->g_timer_checkpoint;
state->g_timer_checkpoint = new_cp0_count - diff;
}
void r4300_checkpoint(usf_state_t * state)
{
if (state->g_cp0_regs[CP0_COUNT_REG] - state->g_timer_checkpoint >= state->count_per_op * 20000000)
{
if (state->last_sample_buffer_count == state->sample_buffer_count)
{
DebugMessage(state, 1, "Emulator appears to be stuck!");
return;
}
state->last_sample_buffer_count = state->sample_buffer_count;
state->g_timer_checkpoint = state->g_cp0_regs[CP0_COUNT_REG];
}
}
void r4300_execute(usf_state_t * state) void r4300_execute(usf_state_t * state)
{ {
state->g_timer_checkpoint = state->g_cp0_regs[CP0_COUNT_REG];
state->last_sample_buffer_count = state->sample_buffer_count;
if (state->r4300emu == CORE_PURE_INTERPRETER) if (state->r4300emu == CORE_PURE_INTERPRETER)
{ {
pure_interpreter(state); pure_interpreter(state);
@ -319,10 +296,7 @@ void r4300_execute(usf_state_t * state)
return; return;
while (!state->stop) while (!state->stop)
{
r4300_checkpoint(state);
state->PC->ops(state); state->PC->ops(state);
}
} }
} }

View File

@ -36,9 +36,6 @@ void r4300_begin(usf_state_t *);
void r4300_execute(usf_state_t *); void r4300_execute(usf_state_t *);
void r4300_end(usf_state_t *); void r4300_end(usf_state_t *);
void r4300_reset_checkpoint(usf_state_t *, unsigned int new_cp0_count);
void r4300_checkpoint(usf_state_t *);
/* Jump to the given address. This works for all r4300 emulator, but is slower. /* Jump to the given address. This works for all r4300 emulator, but is slower.
* Use this for common code which can be executed from any r4300 emulator. */ * Use this for common code which can be executed from any r4300 emulator. */
void generic_jump_to(usf_state_t *, unsigned int address); void generic_jump_to(usf_state_t *, unsigned int address);

View File

@ -631,10 +631,10 @@ void gentest_idle(usf_state_t * state)
mov_reg32_m32(state, reg, (unsigned int *)(&state->next_interupt)); mov_reg32_m32(state, reg, (unsigned int *)(&state->next_interupt));
sub_reg32_m32(state, reg, (unsigned int *)(&state->g_cp0_regs[CP0_COUNT_REG])); sub_reg32_m32(state, reg, (unsigned int *)(&state->g_cp0_regs[CP0_COUNT_REG]));
cmp_reg32_imm8(state, reg, 5); cmp_reg32_imm8(state, reg, 3);
jbe_rj(state, 18); jbe_rj(state, 12);
sub_reg32_imm32(state, reg, 2); // 6 //sub_reg32_imm32(state, reg, 2); // 6
and_reg32_imm32(state, reg, 0xFFFFFFFC); // 6 and_reg32_imm32(state, reg, 0xFFFFFFFC); // 6
add_m32_reg32(state, (unsigned int *)(&state->g_cp0_regs[CP0_COUNT_REG]), reg); // 6 add_m32_reg32(state, (unsigned int *)(&state->g_cp0_regs[CP0_COUNT_REG]), reg); // 6