diff --git a/HISTORY.txt b/HISTORY.txt index 01008bf..6fc5d49 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -94,6 +94,7 @@ Genesis Plus GX 1.7.5 (xx/xx/xxxx) (Eke-Eke) * improved HVC latch behavior for gun emulation (fixes "Gunfight - 3 in 1" randomization when using Justifier) * improved control pad emulation accuracy (verified on real hardware) * 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) [Core/VDP] diff --git a/core/input_hw/mouse.c b/core/input_hw/mouse.c index c1db5d6..4fdda28 100644 --- a/core/input_hw/mouse.c +++ b/core/input_hw/mouse.c @@ -1,8 +1,8 @@ /*************************************************************************************** * Genesis Plus - * Sega Mouse support + * Sega/Mega Mouse support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: @@ -113,15 +113,15 @@ unsigned char mouse_read() /* TL = busy status */ if (mouse.Wait) { - /* wait before ACK, fix some buggy mouse routine (Cannon Fodder, Shangai 2, Wack World,...) */ - mouse.Wait = 0; + /* wait before acknowledging handshake request */ + mouse.Wait--; - /* TL = !TR */ - temp |= (~mouse.State & 0x20) >> 1; + /* TL = !TR (handshake in progress) */ + temp |= (~mouse.State & 0x20) >> 1;; } else { - /* TL = TR (data is ready) */ + /* TL = TR (handshake completed) */ temp |= (mouse.State & 0x20) >> 1; } @@ -133,25 +133,25 @@ void mouse_write(unsigned char data, unsigned char mask) /* update bits set as output only */ data = (mouse.State & ~mask) | (data & mask); - /* TH transition */ - if ((mouse.State ^ data) & 0x40) - { - /* start (TH=0) or stop (TH=1) acquisition */ - mouse.Counter = 1 - ((data & 0x40) >> 6); - } - /* TR transition */ if ((mouse.State ^ data) & 0x20) { - /* acquisition in progress */ - if ((mouse.Counter > 0) && (mouse.Counter < 10)) + /* check if acquisition is started */ + if ((mouse.Counter > 0) && (mouse.Counter < 9)) { /* increment phase */ mouse.Counter++; } - /* TL handshake latency */ - mouse.Wait = 1; + /* TL handshake latency (fix buggy mouse routine in Cannon Fodder, Shangai 2, Wacky World, Star Blade, ...) */ + mouse.Wait = 2; + } + + /* TH transition */ + if ((mouse.State ^ data) & 0x40) + { + /* start (TH=1->0) or stop (TH=0->1) data acquisition */ + mouse.Counter = (mouse.State >> 6) & 1; } /* update internal state */ diff --git a/core/input_hw/mouse.h b/core/input_hw/mouse.h index 6657d2a..baff23c 100644 --- a/core/input_hw/mouse.h +++ b/core/input_hw/mouse.h @@ -1,8 +1,8 @@ /*************************************************************************************** * Genesis Plus - * Sega Mouse support + * Sega/Mega Mouse support * - * Copyright (C) 2007-2011 Eke-Eke (Genesis Plus GX) + * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) * * Redistribution and use of this code or any derivative works are permitted * provided that the following conditions are met: