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
This commit is contained in:
parent
47d3a8dffe
commit
0a4046f2bf
1 changed files with 13 additions and 0 deletions
|
@ -722,10 +722,23 @@ void ExecuteInterpreterOpCode (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;
|
||||
|
||||
while(state->cpu_running) {
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue