Merge pull request #6 from Oggom/master

Pull latest changes
This commit is contained in:
Twinaphex 2014-08-17 17:33:16 +02:00
commit cdf21a9f32
6 changed files with 85 additions and 55 deletions

View File

@ -162,6 +162,8 @@ void config_default(void)
#ifdef HW_RVL #ifdef HW_RVL
config.trap = 0; config.trap = 0;
config.gamma = VI_GM_1_0 / 10.0; config.gamma = VI_GM_1_0 / 10.0;
#else
config.v_prog = 1;
#endif #endif
/* NTSC filter options */ /* NTSC filter options */
@ -183,25 +185,31 @@ void config_default(void)
/* menu options */ /* menu options */
config.autoload = 0; config.autoload = 0;
config.autocheat = 0; config.autocheat = 0;
#ifdef HW_RVL
config.s_auto = 1; config.s_auto = 1;
config.autosleep = 1;
#else
config.s_auto = 0;
config.v_prog = 1;
#endif
config.s_default = 1; config.s_default = 1;
config.s_device = 0; config.s_device = 0;
config.bg_overlay = 0; config.bg_overlay = 0;
config.screen_w = 658; config.screen_w = 658;
config.bgm_volume = 100.0; config.bgm_volume = 100.0;
config.sfx_volume = 100.0; config.sfx_volume = 100.0;
#ifdef HW_RVL
config.autosleep = 1;
config.calx = 0;
config.caly = 0;
#endif
/* default ROM directories */ /* default ROM directories */
#ifdef HW_RVL #ifdef HW_RVL
char dir[16]; DIR *dir = opendir("sd:/");
getcwd(dir, 16); if (dir)
config.l_device = strstr(dir, "sd") ? TYPE_SD : TYPE_USB; {
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[0][TYPE_SD], "sd:%s/roms/", DEFAULT_PATH);
sprintf (config.lastdir[1][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); sprintf (config.lastdir[2][TYPE_SD], "sd:%s/roms/", DEFAULT_PATH);

View File

@ -98,6 +98,8 @@ typedef struct
#ifdef HW_RVL #ifdef HW_RVL
uint32 wpad_keymap[4*3][MAX_KEYS]; uint32 wpad_keymap[4*3][MAX_KEYS];
uint8 autosleep; uint8 autosleep;
int32 calx;
int32 caly;
#endif #endif
uint8 autoload; uint8 autoload;
uint8 autocheat; uint8 autocheat;

View File

@ -401,7 +401,7 @@ static gui_item items_video[16] =
/* Menu options */ /* Menu options */
#ifdef HW_RVL #ifdef HW_RVL
static gui_item items_prefs[12] = static gui_item items_prefs[13] =
#else #else
static gui_item items_prefs[11] = static gui_item items_prefs[11] =
#endif #endif
@ -419,6 +419,7 @@ static gui_item items_prefs[11] =
{NULL,NULL,"Show FPS: OFF", "Enable/disable FPS counter", 56,132,276,48}, {NULL,NULL,"Show FPS: OFF", "Enable/disable FPS counter", 56,132,276,48},
#ifdef HW_RVL #ifdef HW_RVL
{NULL,NULL,"Wiimote Timeout: OFF","Enable/disable Wii remote automatic shutodwn", 56,132,276,48}, {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 #endif
}; };
@ -698,8 +699,10 @@ static void prefmenu ()
sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF"); sprintf (items[9].text, "Show CD Leds: %s", config.cd_leds ? "ON":"OFF");
sprintf (items[10].text, "Show FPS: %s", config.fps ? "ON":"OFF"); sprintf (items[10].text, "Show FPS: %s", config.fps ? "ON":"OFF");
#ifdef HW_RVL #ifdef HW_RVL
sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min"); sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5 MIN":"30 MIN");
m->max_items = 12; 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 #else
m->max_items = 11; m->max_items = 11;
#endif #endif
@ -803,6 +806,27 @@ static void prefmenu ()
sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min"); sprintf (items[11].text, "Wiimote Timeout: %s", config.autosleep ? "5min":"30min");
WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800); WPAD_SetIdleTimeout(config.autosleep ? 300 : 1800);
break; break;
case 12: /*** Wii remote pointer calibration ***/
if ((config.calx * config.caly) == 0)
{
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
{
sprintf (items[12].text, "Wiimote Calibration: AUTO");
sprintf (items[12].comment, "Calibrate Wii remote pointer");
config.calx = config.caly = 0;
}
break;
#endif #endif
case -1: case -1:

View File

@ -381,10 +381,10 @@ static void pad_update(s8 chan, u8 i)
input.analog[0][1] -= y / ANALOG_SENSITIVITY; input.analog[0][1] -= y / ANALOG_SENSITIVITY;
/* Limits */ /* Limits */
if (input.analog[0][0] < 0x17c) input.analog[0][0] = 0x17c; if (input.analog[0][0] > 0x17c) input.analog[0][0] = 0x17c;
else if (input.analog[0][0] > 0x3c) input.analog[0][0] = 0x3c; else if (input.analog[0][0] < 0x3c) input.analog[0][0] = 0x3c;
if (input.analog[0][1] < 0x1fc) input.analog[0][1] = 0x1fc; 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 */ /* PEN button */
if (p & pad_keymap[KEY_BUTTONA]) input.pad[0] |= INPUT_PICO_RED; if (p & pad_keymap[KEY_BUTTONA]) input.pad[0] |= INPUT_PICO_RED;
@ -858,8 +858,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
if (ir.valid) if (ir.valid)
{ {
/* screen position */ /* screen position */
input.analog[i][0] = (ir.x * bitmap.viewport.w) / 640; input.analog[i][0] = ((ir.x + config.calx) * bitmap.viewport.w) / 640;
input.analog[i][1] = (ir.y * bitmap.viewport.h) / 480; input.analog[i][1] = ((ir.y + config.caly) * bitmap.viewport.h) / 480;
} }
else else
{ {
@ -956,10 +956,10 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
input.analog[0][1] -= y / ANALOG_SENSITIVITY; input.analog[0][1] -= y / ANALOG_SENSITIVITY;
/* Limits */ /* Limits */
if (input.analog[0][0] < 0x17c) input.analog[0][0] = 0x17c; if (input.analog[0][0] > 0x17c) input.analog[0][0] = 0x17c;
else if (input.analog[0][0] > 0x3c) input.analog[0][0] = 0x3c; else if (input.analog[0][0] < 0x3c) input.analog[0][0] = 0x3c;
if (input.analog[0][1] < 0x1fc) input.analog[0][1] = 0x1fc; 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 */ /* Wiimote IR */
if (exp != WPAD_EXP_CLASSIC) if (exp != WPAD_EXP_CLASSIC)
@ -968,8 +968,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
WPAD_IR(chan, &ir); WPAD_IR(chan, &ir);
if (ir.valid) if (ir.valid)
{ {
input.analog[0][0] = 0x3c + (ir.x * (0x17c - 0x3c + 1)) / 640; input.analog[0][0] = 0x3c + ((ir.x + config.calx) * (0x17c - 0x3c + 1)) / 640;
input.analog[0][1] = 0x1fc + (ir.y * (0x3f3 - 0x1fc + 1)) / 480; input.analog[0][1] = 0x1fc + ((ir.y + config.caly) * (0x2f7 - 0x1fc + 1)) / 480;
} }
} }
@ -1004,8 +1004,8 @@ static void wpad_update(s8 chan, u8 i, u32 exp)
WPAD_IR(chan, &ir); WPAD_IR(chan, &ir);
if (ir.valid) if (ir.valid)
{ {
input.analog[0][0] = (ir.x * 250) / 640; input.analog[0][0] = ((ir.x + config.calx) * 250) / 640;
input.analog[0][1] = (ir.y * 250) / 480; 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_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_LEFT|WPAD_CLASSIC_BUTTON_LEFT)) pp |= PAD_BUTTON_LEFT;
else if (pw & (WPAD_BUTTON_RIGHT|WPAD_CLASSIC_BUTTON_RIGHT)) pp |= PAD_BUTTON_RIGHT; 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 else
{ {

View File

@ -222,7 +222,7 @@ void osd_input_update(void)
case DEVICE_MOUSE: case DEVICE_MOUSE:
{ {
input.analog[i][0] = input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); 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) if (input.analog[i][0] < -255)
input.analog[i][0] = -255; input.analog[i][0] = -255;
@ -248,17 +248,8 @@ void osd_input_update(void)
case DEVICE_LIGHTGUN: case DEVICE_LIGHTGUN:
{ {
input.analog[i][0] += (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_X) / 2); 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_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_Y) / 2); input.analog[i][1] = ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * bitmap.viewport.h) / 0xfffe;
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;
if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER)) if (input_state_cb(player, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER))
temp |= INPUT_A; temp |= INPUT_A;
@ -275,7 +266,7 @@ void osd_input_update(void)
case DEVICE_PADDLE: 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)) if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_BUTTON1; temp |= INPUT_BUTTON1;
@ -288,8 +279,8 @@ void osd_input_update(void)
case DEVICE_SPORTSPAD: 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][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, RETRO_DEVICE_INDEX_ANALOG_RIGHT, RETRO_DEVICE_ID_ANALOG_Y) + 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)) if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
temp |= INPUT_BUTTON1; temp |= INPUT_BUTTON1;
@ -304,17 +295,8 @@ void osd_input_update(void)
case DEVICE_PICO: case DEVICE_PICO:
{ {
input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); 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] += input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); input.analog[i][1] = 0x1fc + ((input_state_cb(player, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y) + 0x7fff) * (0x2f7-0x1fc)) / 0xfffe;
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;
if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT)) if (input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_LEFT))
temp |= INPUT_PICO_PEN; temp |= INPUT_PICO_PEN;
@ -339,8 +321,8 @@ void osd_input_update(void)
case DEVICE_TEREBI: case DEVICE_TEREBI:
{ {
input.analog[i][0] + input_state_cb(player, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X); 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_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y); 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) if (input.analog[0][0] < 0)
input.analog[0][0] = 0; input.analog[0][0] = 0;
@ -362,8 +344,18 @@ void osd_input_update(void)
case DEVICE_XE_1AP: case DEVICE_XE_1AP:
{ {
input.analog[i][0] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_X) + 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);
input.analog[i][1] = (input_state_cb(player, RETRO_DEVICE_ANALOG, 0, RETRO_DEVICE_ID_ANALOG_Y) + 0x8000) >> 8; 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)) if (input_state_cb(player, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R))
temp |= INPUT_XE_A; temp |= INPUT_XE_A;

View File

@ -55,7 +55,7 @@ OBJECTS += $(OBJDIR)/input.o \
$(OBJDIR)/lightgun.o \ $(OBJDIR)/lightgun.o \
$(OBJDIR)/mouse.o \ $(OBJDIR)/mouse.o \
$(OBJDIR)/activator.o \ $(OBJDIR)/activator.o \
$(OBJDIR)/xe_a1p.o \ $(OBJDIR)/xe_1ap.o \
$(OBJDIR)/teamplayer.o \ $(OBJDIR)/teamplayer.o \
$(OBJDIR)/paddle.o \ $(OBJDIR)/paddle.o \
$(OBJDIR)/sportspad.o \ $(OBJDIR)/sportspad.o \