[libretro] improved LightGun, Terebi Oekaki & Pico pointer precision

This commit is contained in:
EkeEke 2014-08-17 13:16:45 +02:00
parent 7ff002e0d8
commit c7f9ff9ffd

View File

@ -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;
@ -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;