[Core/IO] improved Japanese Paddle emulation (fixes Paddle support on control port #2)

This commit is contained in:
ekeeke 2023-11-10 15:21:11 +01:00
parent a42843bf6c
commit 6f0ac9a668
6 changed files with 16 additions and 7 deletions

View File

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

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

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

View File

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