Commit 63b0d6a4 authored by EkeEke's avatar EkeEke
Browse files

[Core/IO] increased Sega Mouse latency (fixes mouse support in Star Blade)

parent 07f333b1
......@@ -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]
......
/***************************************************************************************
* 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 */
......
/***************************************************************************************
* 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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment