Fixed UNIX compilation
This commit is contained in:
23
lib/emu.c
23
lib/emu.c
@ -10,8 +10,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef _UNIX
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -22,7 +21,11 @@ emu_context *emu_get_context() {
|
||||
return &ctx;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD WINAPI cpu_run(void *p) {
|
||||
#else
|
||||
void *cpu_run(void *p) {
|
||||
#endif
|
||||
ppu_init();
|
||||
timer_init();
|
||||
cpu_init();
|
||||
@ -40,7 +43,7 @@ DWORD WINAPI cpu_run(void *p) {
|
||||
|
||||
if (!cpu_step()) {
|
||||
printf("CPU stopped\n");
|
||||
return -3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@ -51,9 +54,8 @@ DWORD WINAPI cpu_run(void *p) {
|
||||
void sleep_ms(int milis) {
|
||||
#ifdef _WIN32
|
||||
Sleep(milis);
|
||||
#endif
|
||||
#ifdef _UNIX
|
||||
usleep(milis * 1000);
|
||||
#else
|
||||
usleep(milis * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -67,7 +69,7 @@ int emu_run(int argc, char **argv) {
|
||||
printf("Failed to load ROM file: %s\n", argv[1]);
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
printf("Cart loaded..\n");
|
||||
|
||||
ui_init();
|
||||
@ -77,9 +79,8 @@ int emu_run(int argc, char **argv) {
|
||||
fprintf(stderr, "Unable to create main CPU thread!\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#ifdef _UNIX
|
||||
pthread_t t1;
|
||||
#else
|
||||
pthread_t t1;
|
||||
if(pthread_create(&t1, NULL, cpu_run, NULL)) {
|
||||
fprintf(stderr, "Unable to create main CPU thread!\n");
|
||||
return -1;
|
||||
@ -110,4 +111,4 @@ void emu_cycles(int cpu_cycles) {
|
||||
}
|
||||
dma_tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user