git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 0f31c7a1ba828f125fab1f5775964376c6e787bc
parent a524cc310534bbb81d5041f33e9c806a4344ebc3
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 24 Jul 2022 02:35:46 +0300

Lag minimization bounce optimization

Diffstat:
MCore/joypad.c7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Core/joypad.c b/Core/joypad.c @@ -11,12 +11,12 @@ static inline uint16_t bounce_for_key(GB_gameboy_t *gb, GB_key_t key) { if (gb->model > GB_MODEL_CGB_E) { // AGB are less bouncy - return 0xC00; + return 0xBFF; } if (key == GB_KEY_START || key == GB_KEY_SELECT) { - return 0x2000; + return 0x1FFF; } - return 0x1000; + return 0xFFF; } static inline bool get_input(GB_gameboy_t *gb, uint8_t player, GB_key_t key) @@ -27,6 +27,7 @@ static inline bool get_input(GB_gameboy_t *gb, uint8_t player, GB_key_t key) bool ret = gb->keys[player][key]; if (likely(gb->key_bounce_timing[key] == 0)) return ret; + if (likely((gb->key_bounce_timing[key] & 0x3FF) > 0x300)) return ret; uint16_t semi_random = ((((key << 5) + gb->div_counter) * 17) ^ ((gb->apu.apu_cycles + gb->display_cycles) * 13)); semi_random >>= 3; if (semi_random < gb->key_bounce_timing[key]) {

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.