diff --git a/HISTORY.txt b/HISTORY.txt index a044de4..612e0fd 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -133,6 +133,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke) * improved 4 Way-Play emulation (fixes multitap detection in CD games) * increased Sega Mouse latency (fixes mouse support in Star Blade) * fixed TeamPlayer emulation (fixes multitap detection in Gauntlet 4) +* improved Japanese Paddle emulation (fixes Paddle support on control port #2) [Core/VDP] --------------- diff --git a/builds/genesis_plus_gx_libretro.dll b/builds/genesis_plus_gx_libretro.dll index 024339f..b8d7bcd 100644 Binary files a/builds/genesis_plus_gx_libretro.dll and b/builds/genesis_plus_gx_libretro.dll differ diff --git a/builds/genplus_cube.dol b/builds/genplus_cube.dol index 72bbea3..059c685 100644 Binary files a/builds/genplus_cube.dol and b/builds/genplus_cube.dol differ diff --git a/builds/genplus_wii.dol b/builds/genplus_wii.dol index 8fcd125..5c9e8fe 100644 Binary files a/builds/genplus_wii.dol and b/builds/genplus_wii.dol differ diff --git a/core/input_hw/paddle.c b/core/input_hw/paddle.c index bf655c5..c46e5dd 100644 --- a/core/input_hw/paddle.c +++ b/core/input_hw/paddle.c @@ -2,7 +2,7 @@ * Genesis Plus * Sega Paddle Control support * - * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2023 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -41,12 +41,14 @@ static struct { uint8 State; + uint8 Counter; } paddle[2]; -void paddle_reset(int index) +void paddle_reset(int port) { - input.analog[index][0] = 128; - paddle[index>>2].State = 0x40; + input.analog[port][0] = 128; + paddle[port>>2].State = 0x40; + paddle[port>>2].Counter = 0; } INLINE unsigned char paddle_read(int port) @@ -63,7 +65,13 @@ INLINE unsigned char paddle_read(int port) /* Japanese model: automatic flip-flop */ if (region_code < REGION_USA) { - paddle[index].State ^= 0x40; + /* two I/O port reads are required to fully read paddles state on control ports 1 & 2 so using two read access latency for switching should be safe */ + /* note: real paddle switching time is approx. 62.5 us period according to https://www.raphnet.net/electronique/sms_paddle/index_en.php#4 */ + if (++paddle[index].Counter > 2) + { + paddle[index].Counter = 0; + paddle[index].State ^= 0x40; + } } if (paddle[index].State & 0x40) diff --git a/core/input_hw/paddle.h b/core/input_hw/paddle.h index 6097a55..6022f6e 100644 --- a/core/input_hw/paddle.h +++ b/core/input_hw/paddle.h @@ -2,7 +2,7 @@ * Genesis Plus * Sega Paddle Control support * - * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2023 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -40,7 +40,7 @@ #define _PADDLE_H_ /* Function prototypes */ -extern void paddle_reset(int index); +extern void paddle_reset(int port); extern unsigned char paddle_1_read(void); extern unsigned char paddle_2_read(void); extern void paddle_1_write(unsigned char data, unsigned char mask);