... | ... |
@@ -16,6 +16,9 @@ |
16 | 16 |
#include "devices/controller.h" |
17 | 17 |
#include "devices/mouse.h" |
18 | 18 |
#include "devices/datetime.h" |
19 |
+#ifdef _WIN32 |
|
20 |
+#include <processthreadsapi.h> |
|
21 |
+#endif |
|
19 | 22 |
#pragma GCC diagnostic pop |
20 | 23 |
#pragma clang diagnostic pop |
21 | 24 |
|
... | ... |
@@ -40,6 +43,7 @@ static SDL_Texture *gTexture; |
40 | 43 |
static SDL_Renderer *gRenderer; |
41 | 44 |
static SDL_AudioDeviceID audio_id; |
42 | 45 |
static SDL_Rect gRect; |
46 |
+static SDL_Thread *stdin_thread; |
|
43 | 47 |
|
44 | 48 |
/* devices */ |
45 | 49 |
|
... | ... |
@@ -179,7 +183,7 @@ init(void) |
179 | 183 |
audio0_event = SDL_RegisterEvents(POLYPHONY); |
180 | 184 |
redraw_event = SDL_RegisterEvents(1); |
181 | 185 |
interrupt_event = SDL_RegisterEvents(1); |
182 |
- SDL_DetachThread(SDL_CreateThread(stdin_handler, "stdin", NULL)); |
|
186 |
+ SDL_DetachThread(stdin_thread = SDL_CreateThread(stdin_handler, "stdin", NULL)); |
|
183 | 187 |
SDL_DetachThread(SDL_CreateThread(redraw_handler, "redraw", NULL)); |
184 | 188 |
SDL_StartTextInput(); |
185 | 189 |
SDL_ShowCursor(SDL_DISABLE); |
... | ... |
@@ -507,7 +511,12 @@ main(int argc, char **argv) |
507 | 511 |
if(!loaded && !start(&u, "launcher.rom")) |
508 | 512 |
return error("usage", "uxnemu [-s scale] file.rom"); |
509 | 513 |
run(&u); |
514 |
+#ifdef _WIN32 |
|
515 |
+#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" |
|
516 |
+ TerminateThread((HANDLE)SDL_GetThreadID(stdin_thread), 0); |
|
517 |
+#else |
|
510 | 518 |
close(0); /* make stdin thread exit */ |
519 |
+#endif |
|
511 | 520 |
SDL_Quit(); |
512 | 521 |
return 0; |
513 | 522 |
} |