X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=loader%2Fhost.c;h=796d980262939261b96677a764a2d1709bb269d8;hp=96639640c3f2d8a3870c39d4c2f3b0e6fbb3b5ba;hb=d5a3e1bccc54036e8b659f22dc704fa257f5734d;hpb=ad439e71e25f709a1e2b6f72f36119432593f34a diff --git a/loader/host.c b/loader/host.c index 9663964..796d980 100644 --- a/loader/host.c +++ b/loader/host.c @@ -1,16 +1,24 @@ -// vim:shiftwidth=2:expandtab - -#define _GNU_SOURCE // for plat.c +/* + * GINGE - GINGE Is Not Gp2x Emulator + * (C) notaz, 2010-2011,2015 + * + * This work is licensed under the MAME license, see COPYING file for details. + */ +#define _GNU_SOURCE 1 // for plat.c #include #include +#include + +#include "../common/libpicofe/input.h" +#include "../common/libpicofe/linux/in_evdev.h" #include "header.h" #include "realfuncs.h" -#define IN_EVDEV -#include "../common/common/input.c" -#include "../common/linux/plat.c" -#include "../common/linux/in_evdev.c" +// 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" @@ -18,12 +26,12 @@ #include "host_wiz.c" #endif -// for plat.c char **g_argv; int host_init(void) { in_init(); + host_init_input(); in_probe(); return 0; @@ -39,13 +47,23 @@ 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) // might not exit properly. - system("killall ginge_sloader"); - usleep(300000); - system("killall -9 ginge_sloader"); - exit(1); + char cmd[64]; + + printf("forced exit...\n"); + + 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