Shut down RTG thread with emulator

This commit is contained in:
beeanyew
2021-05-12 05:46:06 +02:00
parent 37ef237ba1
commit 0463d4b6c0
2 changed files with 14 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ extern uint8_t gayle_emulation_enabled;
extern uint8_t gayle_a4k_int;
extern volatile unsigned int *gpio;
extern volatile uint16_t srdata;
extern uint8_t realtime_graphics_debug;
extern uint8_t realtime_graphics_debug, emulator_exiting;
extern uint8_t rtg_on;
uint8_t realtime_disassembly, int2_enabled = 0;
uint32_t do_disasm = 0, old_level;
@@ -431,6 +431,11 @@ void sigint_handler(int sig_num) {
cfg->platform->shutdown(cfg);
}
while (!emulator_exiting) {
emulator_exiting = 1;
usleep(0);
}
printf("IRQs triggered: %lld\n", trig_irq);
printf("IRQs serviced: %lld\n", serv_irq);
@@ -639,6 +644,11 @@ switch_config:
// wait for cpu task to end before closing up and finishing
pthread_join(cpu_tid, NULL);
while (!emulator_exiting) {
emulator_exiting = 1;
usleep(0);
}
if (load_new_config == 0)
printf("[MAIN] All threads appear to have concluded; ending process\n");

View File

@@ -23,7 +23,7 @@
#define DEBUG(...)
#endif
uint8_t busy = 0, rtg_on = 0, rtg_initialized = 0;
uint8_t busy = 0, rtg_on = 0, rtg_initialized = 0, emulator_exiting = 0;
extern uint8_t *rtg_mem;
extern uint32_t framebuffer_addr;
extern uint32_t framebuffer_addr_adj;
@@ -289,9 +289,9 @@ reinit_raylib:;
reinit = 1;
goto shutdown_raylib;
}
/*if (!rtg_on) {
if (!emulator_exiting) {
goto shutdown_raylib;
}*/
}
}
rtg_initialized = 0;