X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=ginge.git;a=blobdiff_plain;f=loader%2Fhost_wiz.c;h=18d7b1c28d35f1818d30df1e803ea087ccc06d6c;hp=dccd8416618ca1a6cace84a5dce65c4d2beac3e4;hb=499bf01c2f0e075caeb23714e3376a641c04eb7c;hpb=4d0451847a77d420284c7fb0f50b1f167c1118ee diff --git a/loader/host_wiz.c b/loader/host_wiz.c index dccd841..18d7b1c 100644 --- a/loader/host_wiz.c +++ b/loader/host_wiz.c @@ -1,16 +1,43 @@ -// 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 #include #include #include #include - -#include "header.h" -#include "../common/warm.h" -#include "realfuncs.h" - +#include + +#include "../common/warm/warm.h" + +extern int memdev, probably_caanoo; // leasing from wiz_video + +#define BTN_JOY BTN_JOYSTICK + +struct in_default_bind in_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 } +}; + +// 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) { @@ -37,12 +64,19 @@ int host_read_btns(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 // 03460000-03ffffff 00ba0000 // 02aa0000-02dfffff 03100000-0345ffff 00360000 @@ -81,3 +115,23 @@ fail: 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(); + actions[IN_BINDTYPE_PLAYER12] = act; + } +} + +// vim:shiftwidth=2:expandtab