mirror of https://github.com/bsnes-emu/bsnes.git
Increase input polling frequency in the Cocoa and SDL frontends, should make inputs look less synthetic and potentially reduce input lag
This commit is contained in:
parent
64879f5b02
commit
2f9de4942c
|
@ -372,7 +372,6 @@ uint8_t GB_run(GB_gameboy_t *gb)
|
|||
gb->cycles_since_run = 0;
|
||||
GB_cpu_run(gb);
|
||||
if (gb->vblank_just_occured) {
|
||||
GB_update_joyp(gb);
|
||||
GB_rtc_run(gb);
|
||||
GB_debugger_handle_async_commands(gb);
|
||||
GB_rewind_push(gb);
|
||||
|
@ -812,3 +811,8 @@ unsigned GB_get_player_count(GB_gameboy_t *gb)
|
|||
{
|
||||
return GB_is_sgb(gb)? gb->sgb->player_count : 1;
|
||||
}
|
||||
|
||||
void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback)
|
||||
{
|
||||
gb->update_input_hint_callback = callback;
|
||||
}
|
||||
|
|
|
@ -238,6 +238,7 @@ typedef void (*GB_infrared_callback_t)(GB_gameboy_t *gb, bool on, long cycles_si
|
|||
typedef void (*GB_rumble_callback_t)(GB_gameboy_t *gb, bool rumble_on);
|
||||
typedef void (*GB_serial_transfer_bit_start_callback_t)(GB_gameboy_t *gb, bool bit_to_send);
|
||||
typedef bool (*GB_serial_transfer_bit_end_callback_t)(GB_gameboy_t *gb);
|
||||
typedef void (*GB_update_input_hint_callback_t)(GB_gameboy_t *gb);
|
||||
|
||||
typedef struct {
|
||||
bool state;
|
||||
|
@ -527,6 +528,7 @@ struct GB_gameboy_internal_s {
|
|||
GB_rumble_callback_t rumble_callback;
|
||||
GB_serial_transfer_bit_start_callback_t serial_transfer_bit_start_callback;
|
||||
GB_serial_transfer_bit_end_callback_t serial_transfer_bit_end_callback;
|
||||
GB_update_input_hint_callback_t update_input_hint_callback;
|
||||
|
||||
/* IR */
|
||||
long cycles_since_ir_change; // In 8MHz units
|
||||
|
@ -674,6 +676,7 @@ void GB_set_async_input_callback(GB_gameboy_t *gb, GB_input_callback_t callback)
|
|||
void GB_set_rgb_encode_callback(GB_gameboy_t *gb, GB_rgb_encode_callback_t callback);
|
||||
void GB_set_infrared_callback(GB_gameboy_t *gb, GB_infrared_callback_t callback);
|
||||
void GB_set_rumble_callback(GB_gameboy_t *gb, GB_rumble_callback_t callback);
|
||||
void GB_set_update_input_hint_callback(GB_gameboy_t *gb, GB_update_input_hint_callback_t callback);
|
||||
|
||||
/* These APIs are used when using internal clock */
|
||||
void GB_set_serial_transfer_bit_start_callback(GB_gameboy_t *gb, GB_serial_transfer_bit_start_callback_t callback);
|
||||
|
|
|
@ -65,6 +65,7 @@ void GB_set_key_state(GB_gameboy_t *gb, GB_key_t index, bool pressed)
|
|||
{
|
||||
assert(index >= 0 && index < GB_KEY_MAX);
|
||||
gb->keys[0][index] = pressed;
|
||||
GB_update_joyp(gb);
|
||||
}
|
||||
|
||||
void GB_set_key_state_for_player(GB_gameboy_t *gb, GB_key_t index, unsigned player, bool pressed)
|
||||
|
@ -72,4 +73,5 @@ void GB_set_key_state_for_player(GB_gameboy_t *gb, GB_key_t index, unsigned play
|
|||
assert(index >= 0 && index < GB_KEY_MAX);
|
||||
assert(player < 4);
|
||||
gb->keys[player][index] = pressed;
|
||||
GB_update_joyp(gb);
|
||||
}
|
||||
|
|
|
@ -307,6 +307,7 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
|
|||
return (gb->apu.is_active[GB_NOISE] ? (gb->apu.samples[GB_NOISE] << 4) : 0) |
|
||||
(gb->apu.is_active[GB_WAVE] ? (gb->apu.samples[GB_WAVE]) : 0);
|
||||
case GB_IO_JOYP:
|
||||
GB_timing_sync(gb);
|
||||
case GB_IO_TMA:
|
||||
case GB_IO_LCDC:
|
||||
case GB_IO_SCY:
|
||||
|
|
|
@ -234,6 +234,7 @@ static void stop(GB_gameboy_t *gb, uint8_t opcode)
|
|||
|
||||
}
|
||||
else {
|
||||
GB_timing_sync(gb);
|
||||
if ((gb->io_registers[GB_IO_JOYP] & 0xF) != 0xF) {
|
||||
/* HW Bug? When STOP is executed while a button is down, the CPU halts forever
|
||||
yet the other hardware keeps running. */
|
||||
|
@ -1397,6 +1398,7 @@ void GB_cpu_run(GB_gameboy_t *gb)
|
|||
return;
|
||||
}
|
||||
if (gb->stopped) {
|
||||
GB_timing_sync(gb);
|
||||
GB_advance_cycles(gb, 4);
|
||||
if ((gb->io_registers[GB_IO_JOYP] & 0xF) != 0xF) {
|
||||
gb->stopped = false;
|
||||
|
@ -1409,6 +1411,10 @@ void GB_cpu_run(GB_gameboy_t *gb)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((gb->interrupt_enable & 0x10) && (gb->ime || gb->halted)) {
|
||||
GB_timing_sync(gb);
|
||||
}
|
||||
|
||||
if (gb->halted && !GB_is_cgb(gb) && !gb->just_halted) {
|
||||
GB_advance_cycles(gb, 2);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,9 @@ void GB_timing_sync(GB_gameboy_t *gb)
|
|||
}
|
||||
|
||||
gb->cycles_since_last_sync = 0;
|
||||
if (gb->update_input_hint_callback) {
|
||||
gb->update_input_hint_callback(gb);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
|
|
|
@ -435,6 +435,7 @@ restart:
|
|||
GB_set_color_correction_mode(&gb, configuration.color_correction_mode);
|
||||
GB_set_highpass_filter_mode(&gb, configuration.highpass_mode);
|
||||
GB_set_rewind_length(&gb, configuration.rewind_length);
|
||||
GB_set_update_input_hint_callback(&gb, handle_events);
|
||||
}
|
||||
|
||||
SDL_DestroyTexture(texture);
|
||||
|
|
Loading…
Reference in New Issue