mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Detect termination signals (#127)
This commit is contained in:
parent
fe4aab50b1
commit
db7b82fc01
1 changed files with 9 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
#include <emscripten.h>
|
||||
|
@ -260,12 +261,17 @@ void game_deinit(void) {
|
|||
}
|
||||
|
||||
void game_exit(void) {
|
||||
LOG_INFO("exiting cleanly");
|
||||
game_deinit();
|
||||
#ifndef TARGET_WEB
|
||||
exit(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void inthand(UNUSED int signum) {
|
||||
game_exit();
|
||||
}
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
static void em_main_loop(void) {
|
||||
}
|
||||
|
@ -431,6 +437,9 @@ void main_func(void) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
signal(SIGINT, inthand);
|
||||
signal(SIGQUIT, inthand);
|
||||
signal(SIGTERM, inthand);
|
||||
parse_cli_opts(argc, argv);
|
||||
main_func();
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue