Unverified Commit 80ba8ad3 authored by kps501's avatar kps501 Committed by GitHub
Browse files

libretro: cleanups, revert polling

parent b14f83a8
......@@ -44,13 +44,13 @@
char g_rom_dir[1024];
char g_basename[1024];
bool hires_blend = false;
bool overclock_cycles = false;
bool reduce_sprite_flicker = false;
bool randomize_memory = false;
int interlace_speed;
int one_c, slow_one_c, two_c;
int macsrifle_adjust_x, macsrifle_adjust_y;
bool hires_blend = false;
retro_log_printf_t log_cb = NULL;
static retro_video_refresh_t video_cb = NULL;
......@@ -200,7 +200,6 @@ void update_geometry(void)
static void update_variables(void)
{
bool reset_sfx = false;
bool geometry_update = false;
char key[256];
struct retro_variable var;
......@@ -219,7 +218,7 @@ static void update_variables(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var))
{
int newval;
if(sscanf(var.value,"%d%",&newval))
if(sscanf(var.value,"%d%%",&newval))
Settings.SuperFXClockMultiplier = newval;
}
......@@ -290,7 +289,6 @@ static void update_variables(void)
}
S9xSetSoundControl(disabled_channels^0xFF);
int disabled_layers=0;
strcpy(key, "snes9x_layer_x");
for (int i=0;i<5;i++)
......@@ -731,7 +729,9 @@ bool retro_load_game(const struct retro_game_info *game)
Memory.match_id("ACT") ||
Memory.match_id("AC9J") /* Chrono Trigger (Sample) */
)
{
ChronoTriggerFrameHack = true;
}
lufia2_credits_hack = false;
if (Memory.match_id("E9ANIE") ||
......@@ -741,7 +741,9 @@ bool retro_load_game(const struct retro_game_info *game)
Memory.match_id("01ANIH") ||
Memory.match_id("01ANID")
)
{
lufia2_credits_hack = true;
}
struct retro_memory_map map={ memorydesc+MAX_MAPS-memorydesc_c, memorydesc_c };
if (rom_loaded) environ_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &map);
......@@ -1022,7 +1024,6 @@ static void map_buttons()
MAP_BUTTON(MAKE_BUTTON(PAD_5, BTN_RIGHT), "Joypad5 Right");
MAP_BUTTON(MAKE_BUTTON(PAD_5, BTN_UP), "Joypad5 Up");
MAP_BUTTON(MAKE_BUTTON(PAD_5, BTN_DOWN), "Joypad5 Down");
}
// libretro uses relative values for analogue devices.
......@@ -1036,19 +1037,8 @@ static int16_t snes_macsrifle_state[2] = {0};
static void report_buttons()
{
int _x, _y;
int offset = snes_devices[0] == RETRO_DEVICE_JOYPAD_MULTITAP ? 4 : 1;
int runahead_poll = 0;
int result = -1;
if(environ_cb(RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE, &result))
{
// runahead off: 3
// runahead secondary off: 0,0,0,0,0,3
runahead_poll = (result & 0x0b)==3;
// runahead secondary on: 2,8,8,8,8,9 (messy sync problems)
}
for (int port = 0; port <= 1; port++)
{
switch (snes_devices[port])
......@@ -1068,22 +1058,18 @@ static void report_buttons()
break;
case RETRO_DEVICE_MOUSE:
if(runahead_poll)
{
snes_mouse_state[port][0] = input_state_cb(port, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
snes_mouse_state[port][1] = input_state_cb(port, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
}
_x = input_state_cb(port, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_X);
_y = input_state_cb(port, RETRO_DEVICE_MOUSE, 0, RETRO_DEVICE_ID_MOUSE_Y);
snes_mouse_state[port][0] += _x;
snes_mouse_state[port][1] += _y;
S9xReportPointer(BTN_POINTER + port, snes_mouse_state[port][0], snes_mouse_state[port][1]);
for (int i = MOUSE_LEFT; i <= MOUSE_LAST; i++)
S9xReportButton(MAKE_BUTTON(port + 1, i), input_state_cb(port, RETRO_DEVICE_MOUSE, 0, i));
break;
case RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE:
if(runahead_poll)
{
snes_scope_state[0] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE, 0, RETRO_DEVICE_ID_LIGHTGUN_X);
snes_scope_state[1] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE, 0, RETRO_DEVICE_ID_LIGHTGUN_Y);
}
if (snes_scope_state[0] < 0) snes_scope_state[0] = 0;
else if (snes_scope_state[0] > (SNES_WIDTH-1)) snes_scope_state[0] = SNES_WIDTH-1;
if (snes_scope_state[1] < 0) snes_scope_state[1] = 0;
......@@ -1095,11 +1081,8 @@ static void report_buttons()
case RETRO_DEVICE_LIGHTGUN_JUSTIFIER:
case RETRO_DEVICE_LIGHTGUN_JUSTIFIERS:
if(runahead_poll)
{
snes_justifier_state[port][0] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_JUSTIFIER, 0, RETRO_DEVICE_ID_LIGHTGUN_X);
snes_justifier_state[port][1] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_JUSTIFIER, 0, RETRO_DEVICE_ID_LIGHTGUN_Y);
}
if (snes_justifier_state[port][0] < 0) snes_justifier_state[port][0] = 0;
else if (snes_justifier_state[port][0] > (SNES_WIDTH-1)) snes_justifier_state[port][0] = SNES_WIDTH-1;
if (snes_justifier_state[port][1] < 0) snes_justifier_state[port][1] = 0;
......@@ -1110,11 +1093,8 @@ static void report_buttons()
break;
case RETRO_DEVICE_LIGHTGUN_MACSRIFLE:
if(runahead_poll)
{
snes_macsrifle_state[0] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_MACSRIFLE, 0, RETRO_DEVICE_ID_LIGHTGUN_X);
snes_macsrifle_state[1] += input_state_cb(port, RETRO_DEVICE_LIGHTGUN_MACSRIFLE, 0, RETRO_DEVICE_ID_LIGHTGUN_Y);
}
if (snes_macsrifle_state[0] < 0) snes_macsrifle_state[0] = 0;
else if (snes_macsrifle_state[0] > (SNES_WIDTH-1)) snes_macsrifle_state[0] = SNES_WIDTH-1;
if (snes_macsrifle_state[1] < 0) snes_macsrifle_state[1] = 0;
......@@ -1320,7 +1300,6 @@ bool8 S9xDeinitUpdate(int width, int height)
}
}
if(width==MAX_SNES_WIDTH && hires_blend)
{
#define AVERAGE_565(el0, el1) (((el0) & (el1)) + ((((el0) ^ (el1)) & 0xF7DE) >> 1))
......@@ -1344,7 +1323,6 @@ bool8 S9xDeinitUpdate(int width, int height)
}
}
video_cb(GFX.Screen, width, height, GFX.Pitch);
return TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment