fix missing syms in ginge_dyn
[ginge.git] / loader / host.c
index 546839c..796d980 100644 (file)
 #include "header.h"
 #include "realfuncs.h"
 
 #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
 
 #ifdef PND
 #include "host_pnd.c"
 #elif defined(WIZ)
 #include "host_wiz.c"
 #endif
 
-// for plat.c
 char **g_argv;
 
 int host_init(void)
 char **g_argv;
 
 int host_init(void)
@@ -43,15 +47,23 @@ int host_read_btns(void)
   return actions[IN_BINDTYPE_PLAYER12];
 }
 
   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.
 {
   // 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
 }
 
 // vim:shiftwidth=2:expandtab