Added safety check to lazyusf for non-working sets; Now they'll fail with a useful error message instead of locking up in an infinite loop
parent
47d3a8dffe
commit
0a4046f2bf
|
@ -722,10 +722,23 @@ void ExecuteInterpreterOpCode (usf_state_t * state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartInterpreterCPU (usf_state_t * state) {
|
void StartInterpreterCPU (usf_state_t * state) {
|
||||||
|
const int safety_count_max = 20000000;
|
||||||
|
int safety_count = safety_count_max;
|
||||||
|
size_t last_sample_buffer_count = state->sample_buffer_count;
|
||||||
|
|
||||||
state->NextInstruction = NORMAL;
|
state->NextInstruction = NORMAL;
|
||||||
|
|
||||||
while(state->cpu_running) {
|
while(state->cpu_running) {
|
||||||
ExecuteInterpreterOpCode(state);
|
ExecuteInterpreterOpCode(state);
|
||||||
|
if (!--safety_count) {
|
||||||
|
if (last_sample_buffer_count == state->sample_buffer_count) {
|
||||||
|
DisplayError( state, "Emulator core is not generating any samples after 400 million instructions" );
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
safety_count = safety_count_max;
|
||||||
|
last_sample_buffer_count = state->sample_buffer_count;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state->cpu_stopped = 1;
|
state->cpu_stopped = 1;
|
||||||
|
|
Loading…
Reference in New Issue