From 32bc395dfdc00b7c04b2d9c3590d23762a92f139 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Fri, 15 Aug 2014 15:09:06 +0200 Subject: [PATCH 1/6] [Win32/SDL] renamed Makefile --- sdl/{Makefile.sdl => Makefile} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sdl/{Makefile.sdl => Makefile} (99%) diff --git a/sdl/Makefile.sdl b/sdl/Makefile similarity index 99% rename from sdl/Makefile.sdl rename to sdl/Makefile index 1dd05ce..3dbce0c 100644 --- a/sdl/Makefile.sdl +++ b/sdl/Makefile @@ -55,7 +55,7 @@ OBJECTS += $(OBJDIR)/input.o \ $(OBJDIR)/lightgun.o \ $(OBJDIR)/mouse.o \ $(OBJDIR)/activator.o \ - $(OBJDIR)/xe_a1p.o \ + $(OBJDIR)/xe_1ap.o \ $(OBJDIR)/teamplayer.o \ $(OBJDIR)/paddle.o \ $(OBJDIR)/sportspad.o \ From 7064f4e90d0634280d22ae939ee6109208eacb2b Mon Sep 17 00:00:00 2001 From: EkeEke Date: Fri, 15 Aug 2014 15:09:23 +0200 Subject: [PATCH 2/6] [Wii] added Wiimote pointer calibration in Menu settings (user request) --- gx/config.c | 26 +++++++++++++++++--------- gx/config.h | 2 ++ gx/gui/menu.c | 28 +++++++++++++++++++++++++--- gx/gx_input.c | 16 ++++++++++------ 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/gx/config.c b/gx/config.c index 668fa3a..2c6b9f2 100644 --- a/gx/config.c +++ b/gx/config.c @@ -162,6 +162,8 @@ void config_default(void) #ifdef HW_RVL config.trap = 0; config.gamma = VI_GM_1_0 / 10.0; +#else + config.v_prog = 1; #endif /* NTSC filter options */ @@ -183,25 +185,31 @@ void config_default(void) /* menu options */ config.autoload = 0; config.autocheat = 0; -#ifdef HW_RVL config.s_auto = 1; - config.autosleep = 1; -#else - config.s_auto = 0; - config.v_prog = 1; -#endif config.s_default = 1; config.s_device = 0; config.bg_overlay = 0; config.screen_w = 658; config.bgm_volume = 100.0; config.sfx_volume = 100.0; +#ifdef HW_RVL + config.autosleep = 1; + config.calx = 0; + config.caly = 0; +#endif /* default ROM directories */ #ifdef HW_RVL - char dir[16]; - getcwd(dir, 16); - config.l_device = strstr(dir, "sd") ? TYPE_SD : TYPE_USB; + DIR *dir = opendir("sd:/"); + if (dir) + { + config.l_device = TYPE_SD; + closedir(dir); + } + else + { + config.l_device = TYPE_USB; + } sprintf (config.lastdir[0][TYPE_SD], "sd:%s/roms/", DEFAULT_PATH); sprintf (config.lastdir[1][TYPE_SD], "sd:%s/roms/", DEFAULT_PATH); sprintf (config.lastdir[2][TYPE_SD], "sd:%s/roms/", DEFAULT_PATH); diff --git a/gx/config.h b/gx/config.h index ddf1fb1..30b6be4 100644 --- a/gx/config.h +++ b/gx/config.h @@ -98,6 +98,8 @@ typedef struct #ifdef HW_RVL uint32 wpad_keymap[4*3][MAX_KEYS]; uint8 autosleep; + int32 calx; + int32 caly; #endif uint8 autoload; uint8 autocheat; diff --git a/gx/gui/menu.c b/gx/gui/menu.c index 233ba4c..50c7867 100644 --- a/gx/gui/menu.c +++ b/gx/gui/menu.c @@ -401,7 +401,7 @@ static gui_item items_video[16] = /* Menu options */ #ifdef HW_RVL -static gui_item items_prefs[12] = +static gui_item items_prefs[13] = #else static gui_item items_prefs[11] = #endif @@ -419,6 +419,7 @@ static gui_item items_prefs[11] = {NULL,NULL,"Show FPS: OFF", "Enable/disable FPS counter", 56,132,276,48}, #ifdef HW_RVL {NULL,NULL,"Wiimote Timeout: OFF","Enable/disable Wii remote automatic shutodwn", 56,132,276,48}, + {NULL,NULL,"Wiimote Calibration: AUTO","Calibrate Wii remote pointer", 56,132,276,48}, #endif }; @@ -698,8 +699,10 @@ static void prefmenu () sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF"); sprintf (items[10].text, "Show FPS: %s", config.fps ? "ON":"OFF"); #ifdef HW_RVL - sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min"); - m->max_items = 12; + sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5 MIN":"30 MIN"); + sprintf (items[12].text, "Wiimote Calibration: %s", ((config.calx * config.caly) != 0) ? "MANUAL":"AUTO"); + sprintf (items[12].comment, "%s", ((config.calx * config.caly) != 0) ? "Reset default Wii remote pointer calibration":"Calibrate Wii remote pointer"); + m->max_items = 13; #else m->max_items = 11; #endif @@ -803,6 +806,25 @@ static void prefmenu () sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min"); WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800); break; + + case 12: /*** Wii remote pointer calibration ***/ + if ((config.calx * config.caly) == 0) + { + sprintf (items[12].text, "Wiimote Calibration: MANUAL"); + sprintf (items[12].comment, "Reset default Wii remote pointer calibration"); + GUI_WaitConfirm("Pointer Calibration","Aim center of TV screen"); + config.calx = 320 - m_input.ir.x; + config.caly = 240 - m_input.ir.y; + m_input.ir.x = 320; + m_input.ir.y = 240; + } + else + { + sprintf (items[12].text, "Wiimote Calibration: AUTO"); + sprintf (items[12].comment, "Calibrate Wii remote pointer"); + config.calx = config.caly = 0; + } + break; #endif case -1: diff --git a/gx/gx_input.c b/gx/gx_input.c index b0eeda3..3f9af41 100644 --- a/gx/gx_input.c +++ b/gx/gx_input.c @@ -858,8 +858,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp) if (ir.valid) { /* screen position */ - input.analog[i][0] = (ir.x * bitmap.viewport.w) / 640; - input.analog[i][1] = (ir.y * bitmap.viewport.h) / 480; + input.analog[i][0] = ((ir.x + config.calx) * bitmap.viewport.w) / 640; + input.analog[i][1] = ((ir.y + config.caly) * bitmap.viewport.h) / 480; } else { @@ -968,8 +968,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp) WPAD_IR(chan, &ir); if (ir.valid) { - input.analog[0][0] = 0x3c + (ir.x * (0x17c - 0x3c + 1)) / 640; - input.analog[0][1] = 0x1fc + (ir.y * (0x3f3 - 0x1fc + 1)) / 480; + input.analog[0][0] = 0x3c + ((ir.x + config.calx) * (0x17c - 0x3c + 1)) / 640; + input.analog[0][1] = 0x1fc + ((ir.y + config.caly) * (0x3f3 - 0x1fc + 1)) / 480; } } @@ -1004,8 +1004,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp) WPAD_IR(chan, &ir); if (ir.valid) { - input.analog[0][0] = (ir.x * 250) / 640; - input.analog[0][1] = (ir.y * 250) / 480; + input.analog[0][0] = ((ir.x + config.calx) * 250) / 640; + input.analog[0][1] = ((ir.y + config.caly) * 250) / 480; } } @@ -1582,6 +1582,10 @@ void gx_input_UpdateMenu(void) else if (pw & (WPAD_BUTTON_DOWN|WPAD_CLASSIC_BUTTON_DOWN)) pp |= PAD_BUTTON_DOWN; else if (pw & (WPAD_BUTTON_LEFT|WPAD_CLASSIC_BUTTON_LEFT)) pp |= PAD_BUTTON_LEFT; else if (pw & (WPAD_BUTTON_RIGHT|WPAD_CLASSIC_BUTTON_RIGHT)) pp |= PAD_BUTTON_RIGHT; + + /* Wiimote pointer user calibration */ + m_input.ir.x += config.calx; + m_input.ir.y += config.caly; } else { From 7ff002e0d8e9caa4d2e8df969cea2e21bef5a693 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Fri, 15 Aug 2014 15:50:26 +0200 Subject: [PATCH 3/6] [Wii] refactored Wiimote pointer calibration menu --- gx/gui/menu.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gx/gui/menu.c b/gx/gui/menu.c index 50c7867..a380fb8 100644 --- a/gx/gui/menu.c +++ b/gx/gui/menu.c @@ -810,13 +810,15 @@ static void prefmenu () case 12: /*** Wii remote pointer calibration ***/ if ((config.calx * config.caly) == 0) { - sprintf (items[12].text, "Wiimote Calibration: MANUAL"); - sprintf (items[12].comment, "Reset default Wii remote pointer calibration"); - GUI_WaitConfirm("Pointer Calibration","Aim center of TV screen"); - config.calx = 320 - m_input.ir.x; - config.caly = 240 - m_input.ir.y; - m_input.ir.x = 320; - m_input.ir.y = 240; + if (GUI_WaitConfirm("Pointer Calibration","Aim center of TV screen")) + { + sprintf (items[12].text, "Wiimote Calibration: MANUAL"); + sprintf (items[12].comment, "Reset default Wii remote pointer calibration"); + config.calx = 320 - m_input.ir.x; + config.caly = 240 - m_input.ir.y; + m_input.ir.x = 320; + m_input.ir.y = 240; + } } else { From c7f9ff9ffd94b7163ab7ff29cf85e43c4d342716 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Sun, 17 Aug 2014 13:16:45 +0200 Subject: [PATCH 4/6] [libretro] improved LightGun, Terebi Oekaki & Pico pointer precision --- libretro/libretro.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/libretro/libretro.c b/libretro/libretro.c index e45ec75..6255d68 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -248,17 +248,8 @@ void osd_input_update(void) case DEVICE_LIGHTGUN: { - input.analog[i][0] += (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_X) / 2); - input.analog[i][1] += (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_Y) / 2); - - if (input.analog[i][0] < 0) - input.analog[i][0] = 0; - else if (input.analog[i][0] > bitmap.viewport.w) - input.analog[i][0] = bitmap.viewport.w; - if (input.analog[i][1] < 0) - input.analog[i][1] = 0; - else if (input.analog[i][1] > bitmap.viewport.h) - input.analog[i][1] = bitmap.viewport.h; + input.analog[i][0] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) + 0x7fff) * bitmap.viewport.w) / 0xfffe; + input.analog[i][1] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * bitmap.viewport.h) / 0xfffe; if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER)) temp |= INPUT_A; @@ -304,17 +295,8 @@ void osd_input_update(void) case DEVICE_PICO: { - input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); - input.analog[i][1] += input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); - - if (input.analog[0][0] < 0x17c) - input.analog[0][0] = 0x17c; - else if (input.analog[0][0] > 0x3c) - input.analog[0][0] = 0x3c; - if (input.analog[0][1] < 0x1fc) - input.analog[0][1] = 0x1fc; - else if (input.analog[0][1] > 0x3f3) - input.analog[0][1] = 0x3f3; + input.analog[i][0] = 0x03c + ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) + 0x7fff) * (0x17c-0x03c)) / 0xfffe; + input.analog[i][1] = 0x1fc + ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * (0x2f7-0x1fc)) / 0xfffe; if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT)) temp |= INPUT_PICO_PEN; @@ -339,8 +321,8 @@ void osd_input_update(void) case DEVICE_TEREBI: { - input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); - input.analog[i][1] += input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); + input.analog[i][0] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X) + 0x7fff) * 250) / 0xfffe; + input.analog[i][1] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * 250) / 0xfffe; if (input.analog[0][0] < 0) input.analog[0][0] = 0; From d5e0a78d93388b183f6a93f92119305d654eb3b2 Mon Sep 17 00:00:00 2001 From: EkeEke Date: Sun, 17 Aug 2014 13:18:37 +0200 Subject: [PATCH 5/6] [Gamecube/Wii] fixed PICO pointer bug --- gx/gx_input.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gx/gx_input.c b/gx/gx_input.c index 3f9af41..50b400b 100644 --- a/gx/gx_input.c +++ b/gx/gx_input.c @@ -381,10 +381,10 @@ static void pad_update(s8 chan, u8 i) input.analog[0][1] -= y / ANALOG_SENSITIVITY; /* Limits */ - if (input.analog[0][0] < 0x17c) input.analog[0][0] = 0x17c; - else if (input.analog[0][0] > 0x3c) input.analog[0][0] = 0x3c; + if (input.analog[0][0] > 0x17c) input.analog[0][0] = 0x17c; + else if (input.analog[0][0] < 0x3c) input.analog[0][0] = 0x3c; if (input.analog[0][1] < 0x1fc) input.analog[0][1] = 0x1fc; - else if (input.analog[0][1] > 0x3f3) input.analog[0][1] = 0x3f3; + else if (input.analog[0][1] > 0x2f7) input.analog[0][1] = 0x2f7; /* PEN button */ if (p & pad_keymap[KEY_BUTTONA]) input.pad[0] |= INPUT_PICO_RED; @@ -956,10 +956,10 @@ static void wpad_update(s8 chan, u8 i, u32 exp) input.analog[0][1] -= y / ANALOG_SENSITIVITY; /* Limits */ - if (input.analog[0][0] < 0x17c) input.analog[0][0] = 0x17c; - else if (input.analog[0][0] > 0x3c) input.analog[0][0] = 0x3c; + if (input.analog[0][0] > 0x17c) input.analog[0][0] = 0x17c; + else if (input.analog[0][0] < 0x3c) input.analog[0][0] = 0x3c; if (input.analog[0][1] < 0x1fc) input.analog[0][1] = 0x1fc; - else if (input.analog[0][1] > 0x3f3) input.analog[0][1] = 0x3f3; + else if (input.analog[0][1] > 0x2f7) input.analog[0][1] = 0x2f7; /* Wiimote IR */ if (exp != WPAD_EXP_CLASSIC) @@ -969,7 +969,7 @@ static void wpad_update(s8 chan, u8 i, u32 exp) if (ir.valid) { input.analog[0][0] = 0x3c + ((ir.x + config.calx) * (0x17c - 0x3c + 1)) / 640; - input.analog[0][1] = 0x1fc + ((ir.y + config.caly) * (0x3f3 - 0x1fc + 1)) / 480; + input.analog[0][1] = 0x1fc + ((ir.y + config.caly) * (0x2f7 - 0x1fc + 1)) / 480; } } From bb1984a12d64762b92beafc4d36eb11b7deb2d6b Mon Sep 17 00:00:00 2001 From: EkeEke Date: Sun, 17 Aug 2014 17:22:15 +0200 Subject: [PATCH 6/6] [libretro] fixed MD Mouse Y-axis & added support for XE-1AP second stick (bi-directional) --- libretro/libretro.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libretro/libretro.c b/libretro/libretro.c index 6255d68..8668399 100644 --- a/libretro/libretro.c +++ b/libretro/libretro.c @@ -222,7 +222,7 @@ void osd_input_update(void) case DEVICE_MOUSE: { input.analog[i][0] = input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); - input.analog[i][1] = input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); + input.analog[i][1] = -input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); if (input.analog[i][0] < -255) input.analog[i][0] = -255; @@ -266,7 +266,7 @@ void osd_input_update(void) case DEVICE_PADDLE: { - input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; + input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B)) temp |= INPUT_BUTTON1; @@ -279,8 +279,8 @@ void osd_input_update(void) case DEVICE_SPORTSPAD: { - input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; - input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8; + input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; + input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8; if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B)) temp |= INPUT_BUTTON1; @@ -344,8 +344,18 @@ void osd_input_update(void) case DEVICE_XE_1AP: { - input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; - input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8; + int rx = input.analog[i][0] = input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_X); + int ry = input.analog[i][1] = input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y); + if (abs(rx) > abs(ry)) + { + input.analog[i+1][0] = (rx + 0x8000) >> 8; + } + else + { + input.analog[i+1][0] = (0x7fff - ry) >> 8; + } + input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_X) + 0x8000) >> 8; + input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, RETRO_DEVICE_INDEX_ANALOG_LEFT, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8; if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R)) temp |= INPUT_XE_A;