-// vim:shiftwidth=2:expandtab
+/*
+ * GINGE - GINGE Is Not Gp2x Emulator
+ * (C) notaz, 2010-2011
+ *
+ * This work is licensed under the MAME license, see COPYING file for details.
+ */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
-
-#include "header.h"
-#include "../common/warm.h"
-#include "realfuncs.h"
-
+#include <linux/input.h>
+
+#include "../common/warm/warm.h"
+
+extern int memdev, probably_caanoo; // leasing from wiz_video
+
+#define BTN_JOY BTN_JOYSTICK
+
+static struct in_default_bind wiz_evdev_defbinds[] = {
+ { KEY_UP, IN_BINDTYPE_PLAYER12, GP2X_UP },
+ { KEY_DOWN, IN_BINDTYPE_PLAYER12, GP2X_DOWN },
+ { KEY_LEFT, IN_BINDTYPE_PLAYER12, GP2X_LEFT },
+ { KEY_RIGHT, IN_BINDTYPE_PLAYER12, GP2X_RIGHT },
+ { BTN_JOY + 0, IN_BINDTYPE_PLAYER12, GP2X_A },
+ { BTN_JOY + 1, IN_BINDTYPE_PLAYER12, GP2X_X },
+ { BTN_JOY + 2, IN_BINDTYPE_PLAYER12, GP2X_B },
+ { BTN_JOY + 3, IN_BINDTYPE_PLAYER12, GP2X_Y },
+ { BTN_JOY + 4, IN_BINDTYPE_PLAYER12, GP2X_L },
+ { BTN_JOY + 5, IN_BINDTYPE_PLAYER12, GP2X_R },
+ { BTN_JOY + 8, IN_BINDTYPE_PLAYER12, GP2X_START },
+ { BTN_JOY + 9, IN_BINDTYPE_PLAYER12, GP2X_SELECT },
+ { BTN_JOY + 10, IN_BINDTYPE_PLAYER12, GP2X_PUSH },
+ { BTN_JOY + 6, IN_BINDTYPE_EMU, 0 },
+ { 0, 0, 0 }
+};
+
+static const struct in_pdata wiz_evdev_pdata = {
+ .defbinds = wiz_evdev_defbinds,
+};
+
+// todo: rm when generic code works on Wiz
+#if 0
static int gpiodev = -1;
-extern int memdev; // leasing from wiz_video
int host_init(void)
{
return value;
}
+#endif
void *host_mmap_upper(void)
{
void *ret;
int r;
+ // make sure this never happens on Caanoo
+ if (probably_caanoo) {
+ err("Wiz mmap code called on Caanoo?");
+ return MAP_FAILED;
+ }
+
// Wiz GP2X
// <linux mem> 03460000-03ffffff 00ba0000
// 02aa0000-02dfffff 03100000-0345ffff 00360000
exit(1);
}
+static void host_actions(int actions[IN_BINDTYPE_COUNT])
+{
+ if (probably_caanoo && (actions[IN_BINDTYPE_EMU] & 1)) {
+ // 'home key as Fn' handling
+ int act = actions[IN_BINDTYPE_PLAYER12];
+ if (act & (1 << GP2X_START)) {
+ act &= ~(1 << GP2X_START);
+ act |= 1 << GP2X_VOL_UP;
+ }
+ if (act & (1 << GP2X_SELECT)) {
+ act &= ~(1 << GP2X_SELECT);
+ act |= 1 << GP2X_VOL_DOWN;
+ }
+ if (act & (1 << GP2X_Y))
+ host_forced_exit(1);
+ actions[IN_BINDTYPE_PLAYER12] = act;
+ }
+}
+
+static void host_init_input(void)
+{
+ in_evdev_init(&wiz_evdev_pdata);
+}
+
+// vim:shiftwidth=2:expandtab