X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=loader%2Fhost.c;h=796d980262939261b96677a764a2d1709bb269d8;hp=e1e9cc8a871f3bb13f30162d3050f35ae971f8b6;hb=d5a3e1bccc54036e8b659f22dc704fa257f5734d;hpb=7d4e5f8112e69eee72b501b34d47994badf9ea2c diff --git a/loader/host.c b/loader/host.c index e1e9cc8..796d980 100644 --- a/loader/host.c +++ b/loader/host.c @@ -15,13 +15,17 @@ #include "header.h" #include "realfuncs.h" +// must be affected by realfuncs.h +#include "../common/libpicofe/input.c" +#include "../common/libpicofe/linux/plat.c" +#include "../common/libpicofe/linux/in_evdev.c" + #ifdef PND #include "host_pnd.c" #elif defined(WIZ) #include "host_wiz.c" #endif -// for plat.c char **g_argv; int host_init(void) @@ -43,7 +47,7 @@ int host_read_btns(void) return actions[IN_BINDTYPE_PLAYER12]; } -void host_forced_exit(void) +void host_forced_exit(int status) { // exit() might not be enough because loader and app data is out of sync, // and other threads (which are really processes on this old glibc used) @@ -52,12 +56,14 @@ void host_forced_exit(void) printf("forced exit...\n"); - snprintf(cmd, sizeof(cmd), "killall %s", g_argv[0]); - system(cmd); - usleep(300000); - snprintf(cmd, sizeof(cmd), "killall -9 %s", g_argv[0]); - system(cmd); - exit(1); + if (g_argv != NULL) { + snprintf(cmd, sizeof(cmd), "killall %s", g_argv[0]); + system(cmd); + usleep(300000); + snprintf(cmd, sizeof(cmd), "killall -9 %s", g_argv[0]); + system(cmd); + } + exit(status); } // vim:shiftwidth=2:expandtab