fix build
[ginge.git] / loader / host.c
1 // vim:shiftwidth=2:expandtab
2
3 #define _GNU_SOURCE 1 // for plat.c
4 #include <stdio.h>
5 #include <stdarg.h>
6
7 #include "header.h"
8 #include "realfuncs.h"
9
10 #define IN_EVDEV
11 #include "../common/libpicofe/input.c"
12 #include "../common/libpicofe/linux/plat.c"
13 #include "../common/libpicofe/linux/in_evdev.c"
14
15 #ifdef PND
16 #include "host_pnd.c"
17 #elif defined(WIZ)
18 #include "host_wiz.c"
19 #endif
20
21 // for plat.c
22 char **g_argv;
23
24 int host_init(void)
25 {
26   in_init();
27   in_probe();
28
29   return 0;
30 }
31
32 int host_read_btns(void)
33 {
34   int actions[IN_BINDTYPE_COUNT] = { 0, };
35
36   in_update(actions);
37   host_actions(actions);
38
39   return actions[IN_BINDTYPE_PLAYER12];
40 }
41
42 void host_forced_exit(void)
43 {
44   // exit() might not be enough because loader and app data is out of sync,
45   // and other threads (which are really processes on this old glibc used)
46   // might not exit properly.
47   system("killall ginge_sloader");
48   usleep(300000);
49   system("killall -9 ginge_sloader");
50   exit(1);
51 }