Atari7800Hawk: Fix Controller detection

This commit is contained in:
alyosha-tas 2017-07-22 21:33:21 -04:00 committed by GitHub
parent b696aaea4c
commit 133d92cb6e
4 changed files with 41 additions and 7 deletions

View File

@ -31,6 +31,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public bool right_toggle;
public bool left_was_pressed;
public bool right_was_pressed;
public bool p1_is_2button;
public bool p2_is_2button;
// there are 4 maria cycles in a CPU cycle (fast access, both NTSC and PAL)
// if the 6532 or TIA are accessed (PC goes to one of those addresses) the next access will be slower by 1/2 a CPU cycle
@ -167,6 +169,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
p2_fire = _controllerDeck.ReadFire2(controller);
p1_fire_2x = _controllerDeck.ReadFire1_2x(controller);
p2_fire_2x = _controllerDeck.ReadFire2_2x(controller);
p1_is_2button = _controllerDeck.Is_2_button1(controller);
p2_is_2button = _controllerDeck.Is_2_button2(controller);
}
public void GetConsoleState(IController controller)

View File

@ -80,6 +80,16 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return Port2.ReadFire2x(c);
}
public bool Is_2_button1(IController c)
{
return Port1.Is_2_button(c);
}
public bool Is_2_button2(IController c)
{
return Port2.Is_2_button(c);
}
public ControllerDefinition Definition { get; }
public void SyncState(Serializer ser)

View File

@ -9,7 +9,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
{
/// <summary>
/// Represents a controller plugged into a controller port on the intellivision
/// Represents a controller plugged into a controller port on the A7800
/// </summary>
public interface IPort
{
@ -19,6 +19,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
byte ReadFire2x(IController c);
bool Is_2_button(IController c);
ControllerDefinition Definition { get; }
void SyncState(Serializer ser);
@ -53,6 +55,11 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return 0;
}
public bool Is_2_button(IController c)
{
return false;
}
public ControllerDefinition Definition { get; }
public void SyncState(Serializer ser)
@ -113,8 +120,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return 0; // only applicable for 2 button mode
}
public ControllerDefinition Definition { get; }
public bool Is_2_button(IController c)
{
return false;
}
public ControllerDefinition Definition { get; }
public void SyncState(Serializer ser)
{
@ -172,7 +183,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
public byte ReadFire(IController c)
{
return 0x80;
byte result = 0x80;
if (c.IsPressed(Definition.BoolButtons[4]) || c.IsPressed(Definition.BoolButtons[5]))
{
result = 0x00; // zero means fire is pressed
}
return result;
}
public byte ReadFire2x(IController c)
@ -189,8 +205,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
return result;
}
public ControllerDefinition Definition { get; }
public bool Is_2_button(IController c)
{
return true;
}
public ControllerDefinition Definition { get; }
public void SyncState(Serializer ser)
{

View File

@ -219,7 +219,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
if (cycle == 453 && !sl_DMA_complete && do_dma && (DMA_phase == DMA_GRAPHICS || DMA_phase == DMA_HEADER))
{
overrun_dma = true;
Console.WriteLine(scanline);
//Console.WriteLine(scanline);
if (current_DLL_offset == 0)
{
DMA_phase = DMA_SHUTDOWN_LAST;
@ -402,13 +402,13 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
if (Core.Maria_regs[0x1C].Bit(4))
{
graphics_read_time = 9 * GFX_Objects[GFX_index, header_counter].width + 3;
graphics_read_time = 9 * GFX_Objects[GFX_index, header_counter].width;
ch_size = 2;
GFX_Objects[GFX_index, header_counter].width *= 2;
}
else
{
graphics_read_time = 6 * GFX_Objects[GFX_index, header_counter].width + 3;
graphics_read_time = 6 * GFX_Objects[GFX_index, header_counter].width;
ch_size = 1;
}