misc cleanups in emulator core service logic
This commit is contained in:
parent
46d0818f09
commit
f83261c116
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using BizHawk.Common.NumberExtensions;
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Calculators
|
namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => TI83Controller;
|
public ControllerDefinition ControllerDefinition => TI83Controller;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
_lagged = true;
|
_lagged = true;
|
||||||
|
@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
TIM_1_int = true;
|
TIM_1_int = true;
|
||||||
_cpu.FlagI = true;
|
_cpu.FlagI = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Frame++;
|
Frame++;
|
||||||
|
@ -65,8 +65,8 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
||||||
public int Frame
|
public int Frame
|
||||||
{
|
{
|
||||||
get { return _frame; }
|
get => _frame;
|
||||||
private set { _frame = value; }
|
private set => _frame = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SystemId => "TI83";
|
public string SystemId => "TI83";
|
||||||
|
|
|
@ -10,16 +10,16 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagCount; }
|
get => _lagCount;
|
||||||
set { _lagCount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _isLag; }
|
get => _isLag;
|
||||||
set { _isLag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
||||||
private IMemoryDomains _memoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
private bool _memoryDomainsInit = false;
|
private bool _memoryDomainsInit;
|
||||||
|
|
||||||
private void SetupMemoryDomains()
|
private void SetupMemoryDomains()
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,19 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
(addr) =>
|
(addr) =>
|
||||||
{
|
{
|
||||||
if (addr < 0 || addr >= 65536)
|
if (addr < 0 || addr >= 65536)
|
||||||
|
{
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
return _cpu.ReadMemory((ushort)addr);
|
return _cpu.ReadMemory((ushort)addr);
|
||||||
},
|
},
|
||||||
(addr, value) =>
|
(addr, value) =>
|
||||||
{
|
{
|
||||||
if (addr < 0 || addr >= 65536)
|
if (addr < 0 || addr >= 65536)
|
||||||
|
{
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
|
|
||||||
_cpu.WriteMemory((ushort)addr, value);
|
_cpu.WriteMemory((ushort)addr, value);
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
@ -35,7 +41,7 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
SyncAllByteArrayDomains();
|
SyncAllByteArrayDomains();
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
_memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
|
|
||||||
_memoryDomainsInit = true;
|
_memoryDomainsInit = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
{
|
{
|
||||||
public partial class TI83 : ISettable<TI83.TI83Settings, object>
|
public partial class TI83 : ISettable<TI83.TI83Settings, object>
|
||||||
{
|
{
|
||||||
private TI83Settings Settings;
|
private TI83Settings _settings;
|
||||||
|
|
||||||
public TI83Settings GetSettings()
|
public TI83Settings GetSettings()
|
||||||
{
|
{
|
||||||
return Settings.Clone();
|
return _settings.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PutSettings(TI83Settings o)
|
public bool PutSettings(TI83Settings o)
|
||||||
{
|
{
|
||||||
Settings = o;
|
_settings = o;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,13 +29,8 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
||||||
public class TI83Settings
|
public class TI83Settings
|
||||||
{
|
{
|
||||||
public uint BGColor = 0x889778;
|
public uint BGColor { get; set; } = 0x889778;
|
||||||
public uint ForeColor = 0x36412D;
|
public uint ForeColor { get; set; } = 0x36412D;
|
||||||
|
|
||||||
public TI83Settings()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public TI83Settings Clone()
|
public TI83Settings Clone()
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,12 +40,11 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
|
|
||||||
private void SyncState(Serializer ser)
|
private void SyncState(Serializer ser)
|
||||||
{
|
{
|
||||||
byte[] core = null;
|
|
||||||
if (ser.IsWriter)
|
if (ser.IsWriter)
|
||||||
{
|
{
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
ms.Close();
|
ms.Close();
|
||||||
core = ms.ToArray();
|
ms.ToArray();
|
||||||
}
|
}
|
||||||
_cpu.SyncState(ser);
|
_cpu.SyncState(ser);
|
||||||
|
|
||||||
|
|
|
@ -22,19 +22,19 @@ namespace BizHawk.Emulation.Cores.Calculators
|
||||||
for (int x = 0; x < 96; x++)
|
for (int x = 0; x < 96; x++)
|
||||||
{
|
{
|
||||||
int offset = (y * 96) + x;
|
int offset = (y * 96) + x;
|
||||||
int bufbyte = offset >> 3;
|
int buffByte = offset >> 3;
|
||||||
int bufbit = offset & 7;
|
int buffBit = offset & 7;
|
||||||
int bit = (_vram[bufbyte] >> (7 - bufbit)) & 1;
|
int bit = (_vram[buffByte] >> (7 - buffBit)) & 1;
|
||||||
if (bit == 0)
|
if (bit == 0)
|
||||||
{
|
{
|
||||||
unchecked
|
unchecked
|
||||||
{
|
{
|
||||||
pixels[i++] = (int)Settings.BGColor;
|
pixels[i++] = (int)_settings.BGColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pixels[i++] = (int)Settings.ForeColor;
|
pixels[i++] = (int)_settings.ForeColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
{
|
{
|
||||||
public string Cpu
|
public string Cpu
|
||||||
{
|
{
|
||||||
get
|
get => "6502";
|
||||||
{
|
|
||||||
return "6502";
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
|
|
||||||
public bool DeterministicEmulation => true;
|
public bool DeterministicEmulation => true;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
FrameAdv(controller, render, rendersound);
|
FrameAdv(controller, render, renderSound);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _machine.Lagged; }
|
get => _machine.Lagged;
|
||||||
set { _machine.Lagged = value; }
|
set => _machine.Lagged = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
domains.Add(systemBusDomain);
|
domains.Add(systemBusDomain);
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(domains);
|
_memoryDomains = new MemoryDomainList(domains);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMemoryDomains _memoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
|
|
|
@ -5,8 +5,6 @@ using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
using Jellyfish.Virtu;
|
using Jellyfish.Virtu;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Bson;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,10 +4,7 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
{
|
{
|
||||||
public partial class AppleII : IVideoProvider
|
public partial class AppleII : IVideoProvider
|
||||||
{
|
{
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer() => _machine.Video.VideoService.fb;
|
||||||
{
|
|
||||||
return _machine.Video.VideoService.fb;
|
|
||||||
}
|
|
||||||
|
|
||||||
// put together, these describe a metric on the screen
|
// put together, these describe a metric on the screen
|
||||||
// they should define the smallest size that the buffer can be placed inside such that:
|
// they should define the smallest size that the buffer can be placed inside such that:
|
||||||
|
@ -22,19 +19,13 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
public int VsyncNumerator
|
public int VsyncNumerator
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented] // TODO: precise numbers or confirm the default is okay
|
[FeatureNotImplemented] // TODO: precise numbers or confirm the default is okay
|
||||||
get
|
get => NullVideo.DefaultVsyncNum;
|
||||||
{
|
|
||||||
return NullVideo.DefaultVsyncNum;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int VsyncDenominator
|
public int VsyncDenominator
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented] // TODO: precise numbers or confirm the default is okay
|
[FeatureNotImplemented] // TODO: precise numbers or confirm the default is okay
|
||||||
get
|
get => NullVideo.DefaultVsyncDen;
|
||||||
{
|
|
||||||
return NullVideo.DefaultVsyncDen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||||
{
|
{
|
||||||
var currentSelectedDisassemblable = _selectedDisassemblable;
|
var currentSelectedDisassemblable = _selectedDisassemblable;
|
||||||
_selectedDisassemblable = GetAvailableDisassemblables().FirstOrDefault(d => d.Cpu == value) ?? currentSelectedDisassemblable;
|
_selectedDisassemblable = GetAvailableDisassemblables().FirstOrDefault(d => d.Cpu == value) ?? currentSelectedDisassemblable;
|
||||||
if (_selectedDisassemblable is IDebuggable)
|
if (_selectedDisassemblable is IDebuggable debuggable)
|
||||||
{
|
{
|
||||||
_selectedDebuggable = _selectedDisassemblable as IDebuggable;
|
_selectedDebuggable = debuggable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => C64ControllerDefinition;
|
public ControllerDefinition ControllerDefinition => C64ControllerDefinition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
_board.Controller = controller;
|
_board.Controller = controller;
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||||
{
|
{
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _isLagFrame; }
|
get => _isLagFrame;
|
||||||
set { _isLagFrame = value; }
|
set => _isLagFrame = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagCount; }
|
get => _lagCount;
|
||||||
set { _lagCount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; }
|
public IInputCallbackSystem InputCallbacks { get; }
|
||||||
|
|
|
@ -3,7 +3,7 @@ using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
||||||
{
|
{
|
||||||
// adelikat: changing settings to default object until there are actually settings, as the ui depends on it to know if there are any settings avaialable
|
// adelikat: changing settings to default object until there are actually settings, as the ui depends on it to know if there are any settings available
|
||||||
public partial class C64 : ISettable<C64.C64Settings, C64.C64SyncSettings>
|
public partial class C64 : ISettable<C64.C64Settings, C64.C64SyncSettings>
|
||||||
{
|
{
|
||||||
public C64Settings GetSettings()
|
public C64Settings GetSettings()
|
||||||
|
|
|
@ -317,7 +317,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
_mapper.Core = this;
|
_mapper.Core = this;
|
||||||
|
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
Cpu = new MOS6502X<CpuLink>(new CpuLink(this));
|
Cpu = new MOS6502X<CpuLink>(new CpuLink(this));
|
||||||
|
|
||||||
if (_game["PAL"])
|
if (_game["PAL"])
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
|
|
||||||
|
@ -58,20 +58,20 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception("ERROR: Unable to resolve Frame. Please Report.");
|
throw new Exception("ERROR: Unable to resolve Frame. Please Report.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_tia.New_Frame = false;
|
_tia.New_Frame = false;
|
||||||
|
|
||||||
if (rendersound == false)
|
if (renderSound == false)
|
||||||
{
|
{
|
||||||
_tia.AudioClocks = 0; // we need this here since the async sound provider won't check in this case
|
_tia.AudioClocks = 0; // we need this here since the async sound provider won't check in this case
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_islag)
|
if (_islag)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
_tia.LineCount = 0;
|
_tia.LineCount = 0;
|
||||||
|
@ -90,7 +90,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
_islag = false;
|
_islag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,19 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagcount; }
|
get => _lagCount;
|
||||||
set { _lagcount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _islag; }
|
get => _islag;
|
||||||
set { _islag = value; }
|
set => _islag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
private bool _islag = true;
|
private bool _islag = true;
|
||||||
private int _lagcount;
|
private int _lagCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
{
|
{
|
||||||
internal IMemoryDomains MemoryDomains;
|
internal IMemoryDomains MemoryDomains;
|
||||||
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
||||||
private bool _memoryDomainsInit = false;
|
private bool _memoryDomainsInit;
|
||||||
|
|
||||||
private void SetupMemoryDomains()
|
private void SetupMemoryDomains()
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
SyncAllByteArrayDomains();
|
SyncAllByteArrayDomains();
|
||||||
|
|
||||||
MemoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
MemoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
|
((BasicServiceProvider)ServiceProvider).Register(MemoryDomains);
|
||||||
|
|
||||||
_memoryDomainsInit = true;
|
_memoryDomainsInit = true;
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
{
|
{
|
||||||
SyncByteArrayDomain("Main RAM", _ram);
|
SyncByteArrayDomain("Main RAM", _ram);
|
||||||
|
|
||||||
if (_mapper is mDPC)
|
if (_mapper is mDPC dpc)
|
||||||
{
|
{
|
||||||
SyncByteArrayDomain("DPC", (_mapper as mDPC).DspData);
|
SyncByteArrayDomain("DPC", dpc.DspData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
[DefaultValue(24)]
|
[DefaultValue(24)]
|
||||||
public int NTSCTopLine
|
public int NTSCTopLine
|
||||||
{
|
{
|
||||||
get { return _ntscTopLine; }
|
get => _ntscTopLine;
|
||||||
set { _ntscTopLine = Math.Min(64, Math.Max(value, 0)); }
|
set => _ntscTopLine = Math.Min(64, Math.Max(value, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("NTSC Bottom Line")]
|
[DisplayName("NTSC Bottom Line")]
|
||||||
|
@ -110,8 +110,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
[DefaultValue(248)]
|
[DefaultValue(248)]
|
||||||
public int NTSCBottomLine
|
public int NTSCBottomLine
|
||||||
{
|
{
|
||||||
get { return _ntscBottomLine; }
|
get => _ntscBottomLine;
|
||||||
set { _ntscBottomLine = Math.Min(260, Math.Max(value, 192)); }
|
set => _ntscBottomLine = Math.Min(260, Math.Max(value, 192));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("PAL Top Line")]
|
[DisplayName("PAL Top Line")]
|
||||||
|
@ -119,8 +119,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
[DefaultValue(24)]
|
[DefaultValue(24)]
|
||||||
public int PALTopLine
|
public int PALTopLine
|
||||||
{
|
{
|
||||||
get { return _palTopLine; }
|
get => _palTopLine;
|
||||||
set { _palTopLine = Math.Min(64, Math.Max(value, 0)); }
|
set => _palTopLine = Math.Min(64, Math.Max(value, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("PAL Bottom Line")]
|
[DisplayName("PAL Bottom Line")]
|
||||||
|
@ -128,8 +128,8 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
[DefaultValue(296)]
|
[DefaultValue(296)]
|
||||||
public int PALBottomLine
|
public int PALBottomLine
|
||||||
{
|
{
|
||||||
get { return _palBottomLine; }
|
get => _palBottomLine;
|
||||||
set { _palBottomLine = Math.Min(310, Math.Max(value, 192)); }
|
set => _palBottomLine = Math.Min(310, Math.Max(value, 192));
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("Background Color")]
|
[DisplayName("Background Color")]
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
ser.BeginSection("A2600");
|
ser.BeginSection("A2600");
|
||||||
Cpu.SyncState(ser);
|
Cpu.SyncState(ser);
|
||||||
ser.Sync("ram", ref _ram, false);
|
ser.Sync("ram", ref _ram, false);
|
||||||
ser.Sync("Lag", ref _lagcount);
|
ser.Sync("Lag", ref _lagCount);
|
||||||
ser.Sync("Frame", ref _frame);
|
ser.Sync("Frame", ref _frame);
|
||||||
ser.Sync("IsLag", ref _islag);
|
ser.Sync("IsLag", ref _islag);
|
||||||
ser.Sync(nameof(cyc_counter), ref cyc_counter);
|
ser.Sync(nameof(cyc_counter), ref cyc_counter);
|
||||||
|
|
|
@ -443,12 +443,12 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
||||||
|
|
||||||
private static bool ContainsAny(byte[] rom, IEnumerable<byte[]> signatures)
|
private static bool ContainsAny(byte[] rom, IEnumerable<byte[]> signatures)
|
||||||
{
|
{
|
||||||
return signatures.Any(signature => rom.FindBytes(signature));
|
return signatures.Any(rom.FindBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ContainsAll(byte[] rom, IEnumerable<byte[]> signatures)
|
private static bool ContainsAll(byte[] rom, IEnumerable<byte[]> signatures)
|
||||||
{
|
{
|
||||||
return signatures.All(signature => rom.FindBytes(signature));
|
return signatures.All(rom.FindBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long TotalExecutedCycles
|
public long TotalExecutedCycles => cpu.TotalExecutedCycles;
|
||||||
{
|
|
||||||
get { return cpu.TotalExecutedCycles; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
public bool slow_access = false;
|
public bool slow_access = false;
|
||||||
public int slow_countdown;
|
public int slow_countdown;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
{
|
{
|
||||||
|
@ -77,16 +77,16 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
HardReset();
|
HardReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
_islag = true;
|
_isLag = true;
|
||||||
|
|
||||||
GetControllerState(controller);
|
GetControllerState(controller);
|
||||||
GetConsoleState(controller);
|
GetConsoleState(controller);
|
||||||
|
|
||||||
maria.RunFrame();
|
maria.RunFrame();
|
||||||
|
|
||||||
if (_islag)
|
if (_isLag)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -322,8 +322,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
_islag = false;
|
_isLag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreComm CoreComm { get; }
|
public CoreComm CoreComm { get; }
|
||||||
|
|
|
@ -6,19 +6,19 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagcount; }
|
get => _lagCount;
|
||||||
set { _lagcount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _islag; }
|
get => _isLag;
|
||||||
set { _islag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
public bool _islag = true;
|
public bool _isLag = true;
|
||||||
private int _lagcount;
|
private int _lagCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
public partial class A7800Hawk
|
public partial class A7800Hawk
|
||||||
{
|
{
|
||||||
private IMemoryDomains MemoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
|
|
||||||
public void SetupMemoryDomains()
|
public void SetupMemoryDomains()
|
||||||
{
|
{
|
||||||
|
@ -65,8 +62,8 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
1)
|
1)
|
||||||
};
|
};
|
||||||
|
|
||||||
MemoryDomains = new MemoryDomainList(domains);
|
_memoryDomains = new MemoryDomainList(domains);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte PeekSystemBus(long addr)
|
private byte PeekSystemBus(long addr)
|
||||||
|
|
|
@ -15,12 +15,6 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
Buffer.BlockCopy(data, 0, _hsram, 0, data.Length);
|
Buffer.BlockCopy(data, 0, _hsram, 0, data.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveRamModified
|
public bool SaveRamModified => (_hsbios != null);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (_hsbios != null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,17 +56,14 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Filter
|
public string Filter
|
||||||
{
|
{
|
||||||
get { return _Filter; }
|
get => _Filter;
|
||||||
set
|
set => _Filter = value;
|
||||||
{
|
|
||||||
_Filter = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port1
|
public string Port1
|
||||||
{
|
{
|
||||||
get { return _port1; }
|
get => _port1;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!A7800HawkControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!A7800HawkControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
@ -81,7 +78,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port2
|
public string Port2
|
||||||
{
|
{
|
||||||
get { return _port2; }
|
get => _port2;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!A7800HawkControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!A7800HawkControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
|
|
@ -48,9 +48,9 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
pokey.SyncState(ser);
|
pokey.SyncState(ser);
|
||||||
|
|
||||||
ser.BeginSection("Atari7800");
|
ser.BeginSection("Atari7800");
|
||||||
ser.Sync("Lag", ref _lagcount);
|
ser.Sync("Lag", ref _lagCount);
|
||||||
ser.Sync("Frame", ref _frame);
|
ser.Sync("Frame", ref _frame);
|
||||||
ser.Sync("IsLag", ref _islag);
|
ser.Sync("IsLag", ref _isLag);
|
||||||
_controllerDeck.SyncState(ser);
|
_controllerDeck.SyncState(ser);
|
||||||
|
|
||||||
ser.Sync(nameof(A7800_control_register), ref A7800_control_register);
|
ser.Sync(nameof(A7800_control_register), ref A7800_control_register);
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
var registerAddr = (ushort)(addr & 0x0007);
|
var registerAddr = (ushort)(addr & 0x0007);
|
||||||
if (registerAddr == 0x00)
|
if (registerAddr == 0x00)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
|
|
||||||
// Read Output reg A
|
// Read Output reg A
|
||||||
// Combine readings from player 1 and player 2
|
// Combine readings from player 1 and player 2
|
||||||
|
@ -53,7 +53,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
|
|
||||||
if (registerAddr == 0x02)
|
if (registerAddr == 0x02)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
|
|
||||||
// Read Output reg B
|
// Read Output reg B
|
||||||
byte temp = Core.con_state;
|
byte temp = Core.con_state;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
// X = don't care
|
||||||
|
|
||||||
// X = don't care
|
|
||||||
/*
|
/*
|
||||||
1. TIA 0000 00XX 0000 0000 - 0000 00XX 0001 1111
|
1. TIA 0000 00XX 0000 0000 - 0000 00XX 0001 1111
|
||||||
2. MARIA 0000 00XX 0010 0000 - 0000 00XX 0011 1111
|
2. MARIA 0000 00XX 0010 0000 - 0000 00XX 0011 1111
|
||||||
|
@ -30,13 +28,12 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
return 0xFF; // TODO: what to return here?
|
return 0xFF; // TODO: what to return here?
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
slow_access = true;
|
||||||
slow_access = true;
|
return tia.ReadMemory((ushort)(addr & 0x1F), false);
|
||||||
return tia.ReadMemory((ushort)(addr & 0x1F), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ((addr & 0xFCE0) == 0x20)
|
|
||||||
|
if ((addr & 0xFCE0) == 0x20)
|
||||||
{
|
{
|
||||||
if ((A7800_control_register & 0x2) > 0)
|
if ((A7800_control_register & 0x2) > 0)
|
||||||
{
|
{
|
||||||
|
@ -47,54 +44,61 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
return 0x80; // TODO: What if Maria is off?
|
return 0x80; // TODO: What if Maria is off?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((addr & 0xFF80) == 0x280)
|
|
||||||
|
if ((addr & 0xFF80) == 0x280)
|
||||||
{
|
{
|
||||||
slow_access = true;
|
slow_access = true;
|
||||||
return m6532.ReadMemory(addr, false);
|
return m6532.ReadMemory(addr, false);
|
||||||
}
|
}
|
||||||
else if ((addr & 0xFE80) == 0x480)
|
|
||||||
|
if ((addr & 0xFE80) == 0x480)
|
||||||
{
|
{
|
||||||
slow_access = true;
|
slow_access = true;
|
||||||
return RAM_6532[addr & 0x7F];
|
return RAM_6532[addr & 0x7F];
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x1800) && (addr < 0x2800))
|
|
||||||
|
if ((addr >= 0x1800) && (addr < 0x2800))
|
||||||
{
|
{
|
||||||
return RAM[addr -0x1800];
|
return RAM[addr -0x1800];
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x40) && (addr < 0x100))
|
|
||||||
|
if ((addr >= 0x40) && (addr < 0x100))
|
||||||
{
|
{
|
||||||
// RAM block 0
|
// RAM block 0
|
||||||
return RAM[addr - 0x40 + 0x840];
|
return RAM[addr - 0x40 + 0x840];
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x140) && (addr < 0x200))
|
|
||||||
|
if ((addr >= 0x140) && (addr < 0x200))
|
||||||
{
|
{
|
||||||
// RAM block 1
|
// RAM block 1
|
||||||
return RAM[addr - 0x140 + 0x940];
|
return RAM[addr - 0x140 + 0x940];
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x2800) && (addr < 0x3000))
|
|
||||||
|
if ((addr >= 0x2800) && (addr < 0x3000))
|
||||||
{
|
{
|
||||||
// this mirror evidently does not exist on hardware despite being in the documentation
|
// this mirror evidently does not exist on hardware despite being in the documentation
|
||||||
return 0xFF;// RAM[(addr & 0x7FF) + 0x800];
|
return 0xFF;// RAM[(addr & 0x7FF) + 0x800];
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x3000) && (addr < 0x4000))
|
|
||||||
|
if ((addr >= 0x3000) && (addr < 0x4000))
|
||||||
{
|
{
|
||||||
// could be either RAM mirror or ROM
|
// could be either RAM mirror or ROM
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x400) && (addr < 0x480))
|
|
||||||
|
if ((addr >= 0x400) && (addr < 0x480))
|
||||||
{
|
{
|
||||||
// cartridge space available
|
// cartridge space available
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
else if ((addr >= 0x500) && (addr < 0x1800))
|
|
||||||
|
if ((addr >= 0x500) && (addr < 0x1800))
|
||||||
{
|
{
|
||||||
// cartridge space available
|
// cartridge space available
|
||||||
return mapper.ReadMemory(addr);
|
return mapper.ReadMemory(addr);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return mapper.ReadMemory(addr);
|
||||||
return mapper.ReadMemory(addr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteMemory(ushort addr, byte value)
|
public void WriteMemory(ushort addr, byte value)
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
if ((Core.m6532._outputB & 0x04) == 0 && (Core.m6532._ddRb & 0x04) == 0x04)
|
if ((Core.m6532._outputB & 0x04) == 0 && (Core.m6532._ddRb & 0x04) == 0x04)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
return (byte)(Core.p1_fire_2x & 0x80);
|
return (byte)(Core.p1_fire_2x & 0x80);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
if ((Core.m6532._outputB & 0x04) == 0 && (Core.m6532._ddRb & 0x04) == 0x04)
|
if ((Core.m6532._outputB & 0x04) == 0 && (Core.m6532._ddRb & 0x04) == 0x04)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
return (byte)((Core.p1_fire_2x & 0x40)<<1);
|
return (byte)((Core.p1_fire_2x & 0x40)<<1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -119,7 +119,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
if ((Core.m6532._outputB & 0x10) == 0 && (Core.m6532._ddRb & 0x10) == 0x10)
|
if ((Core.m6532._outputB & 0x10) == 0 && (Core.m6532._ddRb & 0x10) == 0x10)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
return (byte)(Core.p2_fire_2x & 0x80);
|
return (byte)(Core.p2_fire_2x & 0x80);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -132,7 +132,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
{
|
{
|
||||||
if ((Core.m6532._outputB & 0x10) == 0 && (Core.m6532._ddRb & 0x10) == 0x10)
|
if ((Core.m6532._outputB & 0x10) == 0 && (Core.m6532._ddRb & 0x10) == 0x10)
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
return (byte)((Core.p2_fire_2x & 0x40)<<1);
|
return (byte)((Core.p2_fire_2x & 0x40)<<1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -143,7 +143,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
|
|
||||||
if (maskedAddr == 0x0C) // INPT4
|
if (maskedAddr == 0x0C) // INPT4
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
|
|
||||||
if (!Core.p1_is_2button)
|
if (!Core.p1_is_2button)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
||||||
|
|
||||||
if (maskedAddr == 0x0D) // INPT5
|
if (maskedAddr == 0x0D) // INPT5
|
||||||
{
|
{
|
||||||
Core._islag = false;
|
Core._isLag = false;
|
||||||
if (!Core.p2_is_2button)
|
if (!Core.p2_is_2button)
|
||||||
{
|
{
|
||||||
if (!Core.p2_is_lightgun)
|
if (!Core.p2_is_lightgun)
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
public IInputCallbackSystem InputCallbacks
|
public IInputCallbackSystem InputCallbacks
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
get { throw new NotImplementedException(); }
|
get => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,12 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
new MemoryDomainIntPtr("RAM", MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), 65536, true, 2)
|
new MemoryDomainIntPtr("RAM", MemoryDomain.Endian.Little, LibLynx.GetRamPointer(Core), 65536, true, 2)
|
||||||
};
|
};
|
||||||
|
|
||||||
IntPtr p;
|
if (LibLynx.GetSaveRamPtr(Core, out var s, out var p))
|
||||||
int s;
|
|
||||||
if (LibLynx.GetSaveRamPtr(Core, out s, out p))
|
|
||||||
{
|
{
|
||||||
mms.Add(new MemoryDomainIntPtr("Save RAM", MemoryDomain.Endian.Little, p, s, true, 2));
|
mms.Add(new MemoryDomainIntPtr("Save RAM", MemoryDomain.Endian.Little, p, s, true, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
IntPtr p0, p1;
|
LibLynx.GetReadOnlyCartPtrs(Core, out var s0, out var p0, out var s1, out var p1);
|
||||||
int s0, s1;
|
|
||||||
LibLynx.GetReadOnlyCartPtrs(Core, out s0, out p0, out s1, out p1);
|
|
||||||
if (s0 > 0 && p0 != IntPtr.Zero)
|
if (s0 > 0 && p0 != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
mms.Add(new MemoryDomainIntPtr("Cart A", MemoryDomain.Endian.Little, p0, s0, false, 2));
|
mms.Add(new MemoryDomainIntPtr("Cart A", MemoryDomain.Endian.Little, p0, s0, false, 2));
|
||||||
|
@ -35,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
}
|
}
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(mms);
|
_memoryDomains = new MemoryDomainList(mms);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMemoryDomains _memoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
|
|
|
@ -9,9 +9,7 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
{
|
{
|
||||||
public byte[] CloneSaveRam()
|
public byte[] CloneSaveRam()
|
||||||
{
|
{
|
||||||
int size;
|
if (!LibLynx.GetSaveRamPtr(Core, out var size, out var data))
|
||||||
IntPtr data;
|
|
||||||
if (!LibLynx.GetSaveRamPtr(Core, out size, out data))
|
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -21,31 +19,21 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] srcdata)
|
public void StoreSaveRam(byte[] srcData)
|
||||||
{
|
{
|
||||||
int size;
|
if (!LibLynx.GetSaveRamPtr(Core, out var size, out var data))
|
||||||
IntPtr data;
|
|
||||||
if (!LibLynx.GetSaveRamPtr(Core, out size, out data))
|
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size != srcdata.Length)
|
if (size != srcData.Length)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
Marshal.Copy(srcdata, 0, data, size);
|
Marshal.Copy(srcData, 0, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveRamModified
|
public bool SaveRamModified => LibLynx.GetSaveRamPtr(Core, out int unused, out IntPtr unused2);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int unused;
|
|
||||||
IntPtr unused2;
|
|
||||||
return LibLynx.GetSaveRamPtr(Core, out unused, out unused2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,15 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
{
|
{
|
||||||
public partial class Lynx : ISoundProvider
|
public partial class Lynx : ISoundProvider
|
||||||
{
|
{
|
||||||
private readonly short[] _soundbuff = new short[2048];
|
private readonly short[] _soundBuff = new short[2048];
|
||||||
private int _numsamp;
|
private int _numSamp;
|
||||||
|
|
||||||
public bool CanProvideAsync => false;
|
public bool CanProvideAsync => false;
|
||||||
|
|
||||||
public void GetSamplesSync(out short[] samples, out int nsamp)
|
public void GetSamplesSync(out short[] samples, out int nsamp)
|
||||||
{
|
{
|
||||||
samples = _soundbuff;
|
samples = _soundBuff;
|
||||||
nsamp = _numsamp;
|
nsamp = _numSamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DiscardSamples()
|
public void DiscardSamples()
|
||||||
|
|
|
@ -38,13 +38,13 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
|
|
||||||
public void SaveStateBinary(BinaryWriter writer)
|
public void SaveStateBinary(BinaryWriter writer)
|
||||||
{
|
{
|
||||||
if (!LibLynx.BinStateSave(Core, _savebuff, _savebuff.Length))
|
if (!LibLynx.BinStateSave(Core, _saveBuff, _saveBuff.Length))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Core's {nameof(LibLynx.BinStateSave)}() returned false!");
|
throw new InvalidOperationException($"Core's {nameof(LibLynx.BinStateSave)}() returned false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.Write(_savebuff.Length);
|
writer.Write(_saveBuff.Length);
|
||||||
writer.Write(_savebuff);
|
writer.Write(_saveBuff);
|
||||||
|
|
||||||
// other variables
|
// other variables
|
||||||
writer.Write(IsLagFrame);
|
writer.Write(IsLagFrame);
|
||||||
|
@ -55,13 +55,13 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
public void LoadStateBinary(BinaryReader reader)
|
public void LoadStateBinary(BinaryReader reader)
|
||||||
{
|
{
|
||||||
int length = reader.ReadInt32();
|
int length = reader.ReadInt32();
|
||||||
if (length != _savebuff.Length)
|
if (length != _saveBuff.Length)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Save buffer size mismatch!");
|
throw new InvalidOperationException("Save buffer size mismatch!");
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Read(_savebuff, 0, length);
|
reader.Read(_saveBuff, 0, length);
|
||||||
if (!LibLynx.BinStateLoad(Core, _savebuff, _savebuff.Length))
|
if (!LibLynx.BinStateLoad(Core, _saveBuff, _saveBuff.Length))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Core's {nameof(LibLynx.BinStateLoad)}() returned false!");
|
throw new InvalidOperationException($"Core's {nameof(LibLynx.BinStateLoad)}() returned false!");
|
||||||
}
|
}
|
||||||
|
@ -74,22 +74,22 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
|
|
||||||
public byte[] SaveStateBinary()
|
public byte[] SaveStateBinary()
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream(_savebuff2, true);
|
using var ms = new MemoryStream(_saveBuff2, true);
|
||||||
using var bw = new BinaryWriter(ms);
|
using var bw = new BinaryWriter(ms);
|
||||||
SaveStateBinary(bw);
|
SaveStateBinary(bw);
|
||||||
bw.Flush();
|
bw.Flush();
|
||||||
if (ms.Position != _savebuff2.Length)
|
if (ms.Position != _saveBuff2.Length)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ms.Close();
|
ms.Close();
|
||||||
return _savebuff2;
|
return _saveBuff2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly JsonSerializer _ser = new JsonSerializer { Formatting = Formatting.Indented };
|
private readonly JsonSerializer _ser = new JsonSerializer { Formatting = Formatting.Indented };
|
||||||
private readonly byte[] _savebuff;
|
private readonly byte[] _saveBuff;
|
||||||
private readonly byte[] _savebuff2;
|
private readonly byte[] _saveBuff2;
|
||||||
|
|
||||||
private class TextStateData
|
private class TextStateData
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,12 +7,9 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
private const int Width = 160;
|
private const int Width = 160;
|
||||||
private const int Height = 102;
|
private const int Height = 102;
|
||||||
|
|
||||||
private readonly int[] _videobuff = new int[Width * Height];
|
private readonly int[] _videoBuff = new int[Width * Height];
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer() => _videoBuff;
|
||||||
{
|
|
||||||
return _videobuff;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int VirtualWidth => BufferWidth;
|
public int VirtualWidth => BufferWidth;
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
Core = LibLynx.Create(realfile, realfile.Length, bios, bios.Length, pagesize0, pagesize1, false);
|
Core = LibLynx.Create(realfile, realfile.Length, bios, bios.Length, pagesize0, pagesize1, false);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_savebuff = new byte[LibLynx.BinStateSize(Core)];
|
_saveBuff = new byte[LibLynx.BinStateSize(Core)];
|
||||||
_savebuff2 = new byte[_savebuff.Length + 13];
|
_saveBuff2 = new byte[_saveBuff.Length + 13];
|
||||||
|
|
||||||
int rot = game.OptionPresent("rotate") ? int.Parse(game.OptionValue("rotate")) : 0;
|
int rot = game.OptionPresent("rotate") ? int.Parse(game.OptionValue("rotate")) : 0;
|
||||||
LibLynx.SetRotation(Core, rot);
|
LibLynx.SetRotation(Core, rot);
|
||||||
|
@ -128,9 +128,9 @@ namespace BizHawk.Emulation.Cores.Atari.Lynx
|
||||||
LibLynx.Reset(Core);
|
LibLynx.Reset(Core);
|
||||||
}
|
}
|
||||||
|
|
||||||
int samples = _soundbuff.Length;
|
int samples = _soundBuff.Length;
|
||||||
IsLagFrame = LibLynx.Advance(Core, GetButtons(controller), _videobuff, _soundbuff, ref samples);
|
IsLagFrame = LibLynx.Advance(Core, GetButtons(controller), _videoBuff, _soundBuff, ref samples);
|
||||||
_numsamp = samples / 2; // sound provider wants number of sample pairs
|
_numSamp = samples / 2; // sound provider wants number of sample pairs
|
||||||
if (IsLagFrame)
|
if (IsLagFrame)
|
||||||
{
|
{
|
||||||
LagCount++;
|
LagCount++;
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Waterbox;
|
using BizHawk.Emulation.Cores.Waterbox;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Belogic
|
namespace BizHawk.Emulation.Cores.Consoles.Belogic
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using BizHawk.Common.NumberExtensions;
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.ColecoVision
|
namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
|
|
|
@ -70,8 +70,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
change2 = -(float)((ControllerDeck.temp_wheel2 + (360 - ControllerDeck.wheel2)) / 1.25);
|
change2 = -(float)((ControllerDeck.temp_wheel2 + (360 - ControllerDeck.wheel2)) / 1.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
int changes_1 = change1 > 0 ? (int)Math.Floor(change1) : (int)Math.Ceiling(change1);
|
int changes1 = change1 > 0 ? (int)Math.Floor(change1) : (int)Math.Ceiling(change1);
|
||||||
int changes_2 = change2 > 0 ? (int)Math.Floor(change2) : (int)Math.Ceiling(change2);
|
int changes2 = change2 > 0 ? (int)Math.Floor(change2) : (int)Math.Ceiling(change2);
|
||||||
|
|
||||||
for (int scanLine = 0; scanLine < 262; scanLine++)
|
for (int scanLine = 0; scanLine < 262; scanLine++)
|
||||||
{
|
{
|
||||||
|
@ -88,10 +88,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
for (int i = 0; i < 228; i++)
|
for (int i = 0; i < 228; i++)
|
||||||
{
|
{
|
||||||
PSG.generate_sound(1);
|
PSG.generate_sound(1);
|
||||||
if (use_SGM) { SGM_sound.generate_sound(1); }
|
if (use_SGM) { SGM_sound.generate_sound(1); }
|
||||||
_cpu.ExecuteOne();
|
_cpu.ExecuteOne();
|
||||||
|
|
||||||
// pick out sound samples from the sound devies twice per scanline
|
// pick out sound samples from the sound devices twice per scanline
|
||||||
int v = PSG.Sample();
|
int v = PSG.Sample();
|
||||||
|
|
||||||
if (use_SGM)
|
if (use_SGM)
|
||||||
|
@ -111,31 +111,31 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
// starting from scanline 20, changes to the wheel are added once per scanline (up to 144)
|
// starting from scanline 20, changes to the wheel are added once per scanline (up to 144)
|
||||||
if (scanLine > 20)
|
if (scanLine > 20)
|
||||||
{
|
{
|
||||||
if (changes_1 != 0)
|
if (changes1 != 0)
|
||||||
{
|
{
|
||||||
if (changes_1 > 0)
|
if (changes1 > 0)
|
||||||
{
|
{
|
||||||
ControllerDeck.temp_wheel1 = (float)((ControllerDeck.temp_wheel1 + 1.25) % 360);
|
ControllerDeck.temp_wheel1 = (float)((ControllerDeck.temp_wheel1 + 1.25) % 360);
|
||||||
changes_1--;
|
changes1--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ControllerDeck.temp_wheel1 = (float)((ControllerDeck.temp_wheel1 - 1.25) % 360);
|
ControllerDeck.temp_wheel1 = (float)((ControllerDeck.temp_wheel1 - 1.25) % 360);
|
||||||
changes_1++;
|
changes1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes_2 != 0)
|
if (changes2 != 0)
|
||||||
{
|
{
|
||||||
if (changes_2 > 0)
|
if (changes2 > 0)
|
||||||
{
|
{
|
||||||
ControllerDeck.temp_wheel2 = (float)((ControllerDeck.temp_wheel2 + 1.25) % 360);
|
ControllerDeck.temp_wheel2 = (float)((ControllerDeck.temp_wheel2 + 1.25) % 360);
|
||||||
changes_2--;
|
changes2--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ControllerDeck.temp_wheel2 = (float)((ControllerDeck.temp_wheel2 - 1.25) % 360);
|
ControllerDeck.temp_wheel2 = (float)((ControllerDeck.temp_wheel2 - 1.25) % 360);
|
||||||
changes_2++;
|
changes2++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,20 +7,20 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagCount; }
|
get => _lagCount;
|
||||||
set { _lagCount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _isLag; }
|
get => _isLag;
|
||||||
set { _isLag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks
|
public IInputCallbackSystem InputCallbacks
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
get { throw new NotImplementedException(); }
|
get => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _lagCount = 0;
|
private int _lagCount = 0;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
{
|
{
|
||||||
public partial class ColecoVision
|
public partial class ColecoVision
|
||||||
{
|
{
|
||||||
private MemoryDomainList memoryDomains;
|
private MemoryDomainList _memoryDomains;
|
||||||
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
||||||
private bool _memoryDomainsInit = false;
|
private bool _memoryDomainsInit = false;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
|
|
||||||
SyncAllByteArrayDomains();
|
SyncAllByteArrayDomains();
|
||||||
|
|
||||||
memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
_memoryDomains = new MemoryDomainList(_byteArrayDomains.Values.Concat(domains).ToList());
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(memoryDomains);
|
((BasicServiceProvider)ServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
||||||
|
|
||||||
_memoryDomainsInit = true;
|
_memoryDomainsInit = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,11 +54,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port1
|
public string Port1
|
||||||
{
|
{
|
||||||
get
|
get => _port1;
|
||||||
{
|
|
||||||
return _port1;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
@ -73,11 +69,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port2
|
public string Port2
|
||||||
{
|
{
|
||||||
get
|
get => _port2;
|
||||||
{
|
|
||||||
return _port2;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!ColecoVisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
|
|
@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
{
|
{
|
||||||
public partial class ColecoVision : ISoundProvider
|
public partial class ColecoVision : ISoundProvider
|
||||||
{
|
{
|
||||||
private SN76489col PSG;
|
private readonly SN76489col PSG;
|
||||||
private AY_3_8910_SGM SGM_sound;
|
private readonly AY_3_8910_SGM SGM_sound;
|
||||||
|
|
||||||
private readonly BlipBuffer _blip = new BlipBuffer(4096);
|
private readonly BlipBuffer _blip = new BlipBuffer(4096);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
for (int i = 0; i < nsamp * 2; i += 2)
|
for (int i = 0; i < nsamp * 2; i += 2)
|
||||||
{
|
{
|
||||||
samples[i + 1] = samples[i];
|
samples[i + 1] = samples[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetSamples(short[] samples)
|
public void GetSamples(short[] samples)
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
||||||
}
|
}
|
||||||
_cpu.SyncState(ser);
|
_cpu.SyncState(ser);
|
||||||
|
|
||||||
ser.BeginSection("Coleco");
|
ser.BeginSection("Coleco");
|
||||||
_vdp.SyncState(ser);
|
_vdp.SyncState(ser);
|
||||||
ControllerDeck.SyncState(ser);
|
ControllerDeck.SyncState(ser);
|
||||||
PSG.SyncState(ser);
|
PSG.SyncState(ser);
|
||||||
|
|
|
@ -7,14 +7,11 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public string Cpu
|
public string Cpu
|
||||||
{
|
{
|
||||||
get { return "CP1610"; }
|
get => "CP1610";
|
||||||
set { }
|
set { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string PCRegisterName
|
public string PCRegisterName => "PC";
|
||||||
{
|
|
||||||
get { return "PC"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> AvailableCpus
|
public IEnumerable<string> AvailableCpus
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
|
||||||
_cpu.PendingCycles = 14934 - 3791 + _cpu.GetPendingCycles();
|
_cpu.PendingCycles = 14934 - 3791 + _cpu.GetPendingCycles();
|
||||||
_stic.Sr1 = true;
|
_stic.Sr1 = true;
|
||||||
_islag = true;
|
_isLag = true;
|
||||||
|
|
||||||
bool activeDisplay = _stic.active_display;
|
bool activeDisplay = _stic.active_display;
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
|
||||||
_stic.in_vb_2 = false;
|
_stic.in_vb_2 = false;
|
||||||
|
|
||||||
if (_islag)
|
if (_isLag)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller.IsPressed("Power"))
|
if (controller.IsPressed("Power"))
|
||||||
|
@ -137,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreComm CoreComm { get; }
|
public CoreComm CoreComm { get; }
|
||||||
|
|
|
@ -6,33 +6,19 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get
|
get => _lagCount;
|
||||||
{
|
set => _lagCount = value;
|
||||||
return _lagcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_lagcount = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get
|
get => _isLag;
|
||||||
{
|
set => _isLag = value;
|
||||||
return _islag;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_islag = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
private bool _islag;
|
private bool _isLag;
|
||||||
private int _lagcount;
|
private int _lagCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
@ -63,7 +61,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
};
|
};
|
||||||
|
|
||||||
MemoryDomains = new MemoryDomainList(domains);
|
MemoryDomains = new MemoryDomainList(domains);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(MemoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte PeekSystemBus(long addr)
|
private byte PeekSystemBus(long addr)
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port1
|
public string Port1
|
||||||
{
|
{
|
||||||
get { return _port1; }
|
get => _port1;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!IntellivisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!IntellivisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
@ -65,7 +65,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Port2
|
public string Port2
|
||||||
{
|
{
|
||||||
get { return _port2; }
|
get => _port2;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!IntellivisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
if (!IntellivisionControllerDeck.ValidControllerTypes.ContainsKey(value))
|
||||||
|
|
|
@ -53,8 +53,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
ser.Sync(nameof(ExecutiveRom), ref ExecutiveRom, false);
|
ser.Sync(nameof(ExecutiveRom), ref ExecutiveRom, false);
|
||||||
ser.Sync(nameof(GraphicsRom), ref GraphicsRom, false);
|
ser.Sync(nameof(GraphicsRom), ref GraphicsRom, false);
|
||||||
ser.Sync(nameof(GraphicsRam), ref GraphicsRam, false);
|
ser.Sync(nameof(GraphicsRam), ref GraphicsRam, false);
|
||||||
ser.Sync("islag", ref _islag);
|
ser.Sync("islag", ref _isLag);
|
||||||
ser.Sync("lagcount", ref _lagcount);
|
ser.Sync("lagcount", ref _lagCount);
|
||||||
|
|
||||||
_cpu.SyncState(ser);
|
_cpu.SyncState(ser);
|
||||||
_stic.SyncState(ser);
|
_stic.SyncState(ser);
|
||||||
|
|
|
@ -42,14 +42,14 @@
|
||||||
if (addr==0x01FE)
|
if (addr==0x01FE)
|
||||||
{
|
{
|
||||||
if (!peek)
|
if (!peek)
|
||||||
_islag = false;
|
_isLag = false;
|
||||||
return _psg.Register[14];
|
return _psg.Register[14];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr == 0x01FF)
|
if (addr == 0x01FF)
|
||||||
{
|
{
|
||||||
if (!peek)
|
if (!peek)
|
||||||
_islag = false;
|
_isLag = false;
|
||||||
return _psg.Register[15];
|
return _psg.Register[15];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -35,13 +35,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
public IMemoryCallbackSystem MemoryCallbacks
|
public IMemoryCallbackSystem MemoryCallbacks
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
get { throw new NotImplementedException(); }
|
get => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
public long TotalExecutedCycles
|
public long TotalExecutedCycles => throw new NotImplementedException();
|
||||||
{
|
|
||||||
get { throw new NotImplementedException(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Components.M6502;
|
using BizHawk.Emulation.Cores.Components.M6502;
|
||||||
|
|
||||||
|
@ -11,19 +8,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public string Cpu
|
public string Cpu
|
||||||
{
|
{
|
||||||
get
|
get => "6502";
|
||||||
{
|
|
||||||
return "6502";
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string PCRegisterName
|
public string PCRegisterName => "PC";
|
||||||
{
|
|
||||||
get { return "PC"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> AvailableCpus
|
public IEnumerable<string> AvailableCpus
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
public IInputCallbackSystem InputCallbacks
|
public IInputCallbackSystem InputCallbacks
|
||||||
{
|
{
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
get { throw new NotImplementedException(); }
|
get => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
}, 1));
|
}, 1));
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(mm);
|
_memoryDomains = new MemoryDomainList(mm);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMemoryDomains _memoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
|
|
|
@ -1,56 +1,41 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Runtime.InteropServices;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
using BizHawk.Emulation.Cores.Nintendo.NES;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public partial class QuickNES : INESPPUViewable
|
public partial class QuickNES : INESPPUViewable
|
||||||
{
|
{
|
||||||
// todo: don't just call the callbacks at the end of frame; use the scanline info
|
// todo: don't just call the callbacks at the end of frame; use the scanline info
|
||||||
private Action CB1;
|
private Action _callBack1;
|
||||||
private Action CB2;
|
private Action _callBack2;
|
||||||
|
|
||||||
public int[] GetPalette()
|
public int[] GetPalette() => _videoPalette;
|
||||||
{
|
|
||||||
return VideoPalette;
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte R2000 { get { return QN.qn_get_reg2000(Context); } }
|
private byte R2000 => QN.qn_get_reg2000(Context);
|
||||||
|
|
||||||
public bool BGBaseHigh
|
public bool BGBaseHigh => (R2000 & 0x10) != 0;
|
||||||
{
|
|
||||||
get { return (R2000 & 0x10) != 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SPBaseHigh
|
public bool SPBaseHigh => (R2000 & 0x08) != 0;
|
||||||
{
|
|
||||||
get { return (R2000 & 0x08) != 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SPTall
|
public bool SPTall => (R2000 & 0x20) != 0;
|
||||||
{
|
|
||||||
get { return (R2000 & 0x20) != 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] ppubusbuf = new byte[0x3000];
|
private readonly byte[] ppubusbuf = new byte[0x3000];
|
||||||
public byte[] GetPPUBus()
|
public byte[] GetPPUBus()
|
||||||
{
|
{
|
||||||
QN.qn_peek_ppubus(Context, ppubusbuf);
|
QN.qn_peek_ppubus(Context, ppubusbuf);
|
||||||
return ppubusbuf;
|
return ppubusbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] palrambuf = new byte[0x20];
|
private readonly byte[] palrambuf = new byte[0x20];
|
||||||
public byte[] GetPalRam()
|
public byte[] GetPalRam()
|
||||||
{
|
{
|
||||||
Marshal.Copy(QN.qn_get_palmem(Context), palrambuf, 0, 0x20);
|
Marshal.Copy(QN.qn_get_palmem(Context), palrambuf, 0, 0x20);
|
||||||
return palrambuf;
|
return palrambuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] oambuf = new byte[0x100];
|
private readonly byte[] oambuf = new byte[0x100];
|
||||||
public byte[] GetOam()
|
public byte[] GetOam()
|
||||||
{
|
{
|
||||||
Marshal.Copy(QN.qn_get_oammem(Context), oambuf, 0, 0x100);
|
Marshal.Copy(QN.qn_get_oammem(Context), oambuf, 0, 0x100);
|
||||||
|
@ -68,10 +53,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ExActive
|
public bool ExActive => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GetExRam()
|
public byte[] GetExRam()
|
||||||
{
|
{
|
||||||
|
@ -85,22 +67,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
|
|
||||||
public void InstallCallback1(Action cb, int sl)
|
public void InstallCallback1(Action cb, int sl)
|
||||||
{
|
{
|
||||||
CB1 = cb;
|
_callBack1 = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InstallCallback2(Action cb, int sl)
|
public void InstallCallback2(Action cb, int sl)
|
||||||
{
|
{
|
||||||
CB2 = cb;
|
_callBack2 = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCallback1()
|
public void RemoveCallback1()
|
||||||
{
|
{
|
||||||
CB1 = null;
|
_callBack1 = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCallback2()
|
public void RemoveCallback2()
|
||||||
{
|
{
|
||||||
CB2 = null;
|
_callBack2 = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public byte[] CloneSaveRam()
|
public byte[] CloneSaveRam()
|
||||||
{
|
{
|
||||||
LibQuickNES.ThrowStringError(QN.qn_battery_ram_save(Context, SaveRamBuff, SaveRamBuff.Length));
|
LibQuickNES.ThrowStringError(QN.qn_battery_ram_save(Context, _saveRamBuff, _saveRamBuff.Length));
|
||||||
return (byte[])SaveRamBuff.Clone();
|
return (byte[])_saveRamBuff.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
|
@ -15,21 +15,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
LibQuickNES.ThrowStringError(QN.qn_battery_ram_load(Context, data, data.Length));
|
LibQuickNES.ThrowStringError(QN.qn_battery_ram_load(Context, data, data.Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveRamModified
|
public bool SaveRamModified => QN.qn_has_battery_ram(Context);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return QN.qn_has_battery_ram(Context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private byte[] SaveRamBuff;
|
private byte[] _saveRamBuff;
|
||||||
|
|
||||||
private void InitSaveRamBuff()
|
private void InitSaveRamBuff()
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
LibQuickNES.ThrowStringError(QN.qn_battery_ram_size(Context, ref size));
|
LibQuickNES.ThrowStringError(QN.qn_battery_ram_size(Context, ref size));
|
||||||
SaveRamBuff = new byte[size];
|
_saveRamBuff = new byte[size];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the syncsettings that this run of emulation is using (was passed to ctor)
|
/// the syncsettings that this run of emulation is using (was passed to ctor)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private QuickNESSyncSettings _syncSettings;
|
private readonly QuickNESSyncSettings _syncSettings;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// the syncsettings that were requested but won't be used yet
|
/// the syncsettings that were requested but won't be used yet
|
||||||
|
@ -60,8 +60,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
[DisplayName("Visible Sprites")]
|
[DisplayName("Visible Sprites")]
|
||||||
public int NumSprites
|
public int NumSprites
|
||||||
{
|
{
|
||||||
get { return _NumSprites; }
|
get => _NumSprites;
|
||||||
set { _NumSprites = Math.Min(64, Math.Max(0, value)); }
|
set => _NumSprites = Math.Min(64, Math.Max(0, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
@ -80,15 +80,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
public byte[] Palette
|
public byte[] Palette
|
||||||
{
|
{
|
||||||
get { return _Palette; }
|
get => _Palette;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
{
|
||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
else if (value.Length == 64 * 8 * 3)
|
}
|
||||||
|
|
||||||
|
if (value.Length == 64 * 8 * 3)
|
||||||
|
{
|
||||||
_Palette = value;
|
_Palette = value;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +127,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
|
|
||||||
if (nColors == 512)
|
if (nColors == 512)
|
||||||
{
|
{
|
||||||
//just copy the palette directly
|
// just copy the palette directly
|
||||||
for (int c = 0; c < nColors; c++)
|
for (int c = 0; c < nColors; c++)
|
||||||
{
|
{
|
||||||
_Palette[c * 3 + 0] = pal[c, 0];
|
_Palette[c * 3 + 0] = pal[c, 0];
|
||||||
|
@ -130,7 +137,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//use quickNES's deemph calculator
|
// use quickNES's deemph calculator
|
||||||
for (int c = 0; c < 64; c++)
|
for (int c = 0; c < 64; c++)
|
||||||
{
|
{
|
||||||
int a = c & 63;
|
int a = c & 63;
|
||||||
|
@ -183,7 +190,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
public static bool NeedsReboot(QuickNESSyncSettings x, QuickNESSyncSettings y)
|
public static bool NeedsReboot(QuickNESSyncSettings x, QuickNESSyncSettings y)
|
||||||
{
|
{
|
||||||
// the core can handle dynamic plugging and unplugging, but that changes
|
// the core can handle dynamic plugging and unplugging, but that changes
|
||||||
// the controllerdefinition, and we're not ready for that
|
// the ControllerDefinition, and we're not ready for that
|
||||||
return !DeepEquality.DeepEquals(x, y);
|
return !DeepEquality.DeepEquals(x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public partial class QuickNES : ISoundProvider
|
public partial class QuickNES : ISoundProvider
|
||||||
{
|
{
|
||||||
private short[] MonoBuff = new short[1024];
|
private readonly short[] _monoBuff = new short[1024];
|
||||||
private short[] StereoBuff = new short[2048];
|
private readonly short[] _stereoBuff = new short[2048];
|
||||||
private int NumSamples = 0;
|
private int _numSamples;
|
||||||
|
|
||||||
public bool CanProvideAsync
|
public bool CanProvideAsync => false;
|
||||||
{
|
|
||||||
get { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetSamplesSync(out short[] samples, out int nsamp)
|
public void GetSamplesSync(out short[] samples, out int nsamp)
|
||||||
{
|
{
|
||||||
samples = StereoBuff;
|
samples = _stereoBuff;
|
||||||
nsamp = NumSamples;
|
nsamp = _numSamples;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DiscardSamples()
|
public void DiscardSamples()
|
||||||
|
@ -33,10 +30,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public SyncSoundMode SyncMode
|
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
|
||||||
{
|
|
||||||
get { return SyncSoundMode.Sync; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetSamplesAsync(short[] samples)
|
public void GetSamplesAsync(short[] samples)
|
||||||
{
|
{
|
||||||
|
@ -50,14 +44,14 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
|
|
||||||
private void DrainAudio()
|
private void DrainAudio()
|
||||||
{
|
{
|
||||||
NumSamples = QN.qn_read_audio(Context, MonoBuff, MonoBuff.Length);
|
_numSamples = QN.qn_read_audio(Context, _monoBuff, _monoBuff.Length);
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
fixed (short* _src = &MonoBuff[0], _dst = &StereoBuff[0])
|
fixed (short* _src = &_monoBuff[0], _dst = &_stereoBuff[0])
|
||||||
{
|
{
|
||||||
short* src = _src;
|
short* src = _src;
|
||||||
short* dst = _dst;
|
short* dst = _dst;
|
||||||
for (int i = 0; i < NumSamples; i++)
|
for (int i = 0; i < _numSamples; i++)
|
||||||
{
|
{
|
||||||
*dst++ = *src;
|
*dst++ = *src;
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using BizHawk.Common.BufferExtensions;
|
using BizHawk.Common.BufferExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
@ -8,44 +7,48 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public partial class QuickNES : IStatable
|
public partial class QuickNES : IStatable
|
||||||
{
|
{
|
||||||
public bool BinarySaveStatesPreferred { get { return true; } }
|
public bool BinarySaveStatesPreferred => true;
|
||||||
|
|
||||||
public void SaveStateText(System.IO.TextWriter writer)
|
public void SaveStateText(TextWriter writer)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
var temp = SaveStateBinary();
|
var temp = SaveStateBinary();
|
||||||
temp.SaveAsHexFast(writer);
|
temp.SaveAsHexFast(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadStateText(System.IO.TextReader reader)
|
public void LoadStateText(TextReader reader)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
string hex = reader.ReadLine();
|
string hex = reader.ReadLine();
|
||||||
byte[] state = new byte[hex.Length / 2];
|
byte[] state = new byte[hex.Length / 2];
|
||||||
state.ReadFromHexFast(hex);
|
state.ReadFromHexFast(hex);
|
||||||
LoadStateBinary(new System.IO.BinaryReader(new System.IO.MemoryStream(state)));
|
LoadStateBinary(new BinaryReader(new MemoryStream(state)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SaveStateBinary(System.IO.BinaryWriter writer)
|
public void SaveStateBinary(BinaryWriter writer)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
LibQuickNES.ThrowStringError(QN.qn_state_save(Context, SaveStateBuff, SaveStateBuff.Length));
|
LibQuickNES.ThrowStringError(QN.qn_state_save(Context, _saveStateBuff, _saveStateBuff.Length));
|
||||||
writer.Write(SaveStateBuff.Length);
|
writer.Write(_saveStateBuff.Length);
|
||||||
writer.Write(SaveStateBuff);
|
writer.Write(_saveStateBuff);
|
||||||
|
|
||||||
// other variables
|
// other variables
|
||||||
writer.Write(IsLagFrame);
|
writer.Write(IsLagFrame);
|
||||||
writer.Write(LagCount);
|
writer.Write(LagCount);
|
||||||
writer.Write(Frame);
|
writer.Write(Frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadStateBinary(System.IO.BinaryReader reader)
|
public void LoadStateBinary(BinaryReader reader)
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
int len = reader.ReadInt32();
|
int len = reader.ReadInt32();
|
||||||
if (len != SaveStateBuff.Length)
|
if (len != _saveStateBuff.Length)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Unexpected savestate buffer length!");
|
throw new InvalidOperationException("Unexpected savestate buffer length!");
|
||||||
reader.Read(SaveStateBuff, 0, SaveStateBuff.Length);
|
}
|
||||||
LibQuickNES.ThrowStringError(QN.qn_state_load(Context, SaveStateBuff, SaveStateBuff.Length));
|
|
||||||
|
reader.Read(_saveStateBuff, 0, _saveStateBuff.Length);
|
||||||
|
LibQuickNES.ThrowStringError(QN.qn_state_load(Context, _saveStateBuff, _saveStateBuff.Length));
|
||||||
// other variables
|
// other variables
|
||||||
IsLagFrame = reader.ReadBoolean();
|
IsLagFrame = reader.ReadBoolean();
|
||||||
LagCount = reader.ReadInt32();
|
LagCount = reader.ReadInt32();
|
||||||
|
@ -55,25 +58,28 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
public byte[] SaveStateBinary()
|
public byte[] SaveStateBinary()
|
||||||
{
|
{
|
||||||
CheckDisposed();
|
CheckDisposed();
|
||||||
var ms = new System.IO.MemoryStream(SaveStateBuff2, true);
|
var ms = new MemoryStream(_saveStateBuff2, true);
|
||||||
var bw = new System.IO.BinaryWriter(ms);
|
var bw = new BinaryWriter(ms);
|
||||||
SaveStateBinary(bw);
|
SaveStateBinary(bw);
|
||||||
bw.Flush();
|
bw.Flush();
|
||||||
if (ms.Position != SaveStateBuff2.Length)
|
if (ms.Position != _saveStateBuff2.Length)
|
||||||
|
{
|
||||||
throw new InvalidOperationException("Unexpected savestate length!");
|
throw new InvalidOperationException("Unexpected savestate length!");
|
||||||
|
}
|
||||||
|
|
||||||
bw.Close();
|
bw.Close();
|
||||||
return SaveStateBuff2;
|
return _saveStateBuff2;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] SaveStateBuff;
|
private byte[] _saveStateBuff;
|
||||||
private byte[] SaveStateBuff2;
|
private byte[] _saveStateBuff2;
|
||||||
|
|
||||||
private void InitSaveStateBuff()
|
private void InitSaveStateBuff()
|
||||||
{
|
{
|
||||||
int size = 0;
|
int size = 0;
|
||||||
LibQuickNES.ThrowStringError(QN.qn_state_size(Context, ref size));
|
LibQuickNES.ThrowStringError(QN.qn_state_size(Context, ref size));
|
||||||
SaveStateBuff = new byte[size];
|
_saveStateBuff = new byte[size];
|
||||||
SaveStateBuff2 = new byte[size + 13];
|
_saveStateBuff2 = new byte[size + 13];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public TraceBuffer Tracer { get; private set; }
|
public TraceBuffer Tracer { get; private set; }
|
||||||
|
|
||||||
private LibQuickNES.TraceCallback _tracecb;
|
private LibQuickNES.TraceCallback _traceCb;
|
||||||
|
|
||||||
private const string TraceHeader = "6502: PC, mnemonic, operands, registers (A, X, Y, P, SP)";
|
private const string TraceHeader = "6502: PC, mnemonic, operands, registers (A, X, Y, P, SP)";
|
||||||
|
|
||||||
|
@ -26,10 +26,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
ushort pc = (ushort)s[4];
|
ushort pc = (ushort)s[4];
|
||||||
byte p = (byte)s[5];
|
byte p = (byte)s[5];
|
||||||
|
|
||||||
byte opcode = (byte)s[6];
|
string opcodeStr = MOS6502X.Disassemble(pc, out _, address => _memoryDomains.SystemBus.PeekByte(address));
|
||||||
|
|
||||||
int notused = 0;
|
|
||||||
string opcodeStr = MOS6502X.Disassemble(pc, out notused, (address) => _memoryDomains.SystemBus.PeekByte(address));
|
|
||||||
|
|
||||||
Tracer.Put(new TraceInfo
|
Tracer.Put(new TraceInfo
|
||||||
{
|
{
|
||||||
|
@ -46,8 +43,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
private void ConnectTracer()
|
private void ConnectTracer()
|
||||||
{
|
{
|
||||||
Tracer = new TraceBuffer { Header = TraceHeader };
|
Tracer = new TraceBuffer { Header = TraceHeader };
|
||||||
(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);
|
((BasicServiceProvider) ServiceProvider).Register<ITraceable>(Tracer);
|
||||||
_tracecb = new LibQuickNES.TraceCallback(MakeTrace);
|
_traceCb = MakeTrace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,47 +6,35 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
{
|
{
|
||||||
public int BufferWidth { get; private set; }
|
public int BufferWidth { get; private set; }
|
||||||
public int BufferHeight { get; private set; }
|
public int BufferHeight { get; private set; }
|
||||||
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
|
public int BackgroundColor => unchecked((int)0xff000000);
|
||||||
|
|
||||||
public int VsyncNumerator => 39375000;
|
public int VsyncNumerator => 39375000;
|
||||||
public int VsyncDenominator => 655171;
|
public int VsyncDenominator => 655171;
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer() =>_videoOutput;
|
||||||
{
|
|
||||||
return VideoOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int VirtualWidth
|
public int VirtualWidth => (int)(BufferWidth * 1.146);
|
||||||
{
|
|
||||||
get { return (int)(BufferWidth * 1.146); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int VirtualHeight
|
public int VirtualHeight => BufferHeight;
|
||||||
{
|
|
||||||
get { return BufferHeight; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private int[] VideoOutput = new int[256 * 240];
|
private readonly int[] _videoOutput = new int[256 * 240];
|
||||||
private int[] VideoPalette = new int[512];
|
private readonly int[] _videoPalette = new int[512];
|
||||||
|
|
||||||
private int cropleft = 0;
|
private int _cropLeft, _cropRight, _cropTop, _cropBottom;
|
||||||
private int cropright = 0;
|
|
||||||
private int croptop = 0;
|
|
||||||
private int cropbottom = 0;
|
|
||||||
|
|
||||||
private void RecalculateCrops()
|
private void RecalculateCrops()
|
||||||
{
|
{
|
||||||
cropright = cropleft = _settings.ClipLeftAndRight ? 8 : 0;
|
_cropRight = _cropLeft = _settings.ClipLeftAndRight ? 8 : 0;
|
||||||
cropbottom = croptop = _settings.ClipTopAndBottom ? 8 : 0;
|
_cropBottom = _cropTop = _settings.ClipTopAndBottom ? 8 : 0;
|
||||||
BufferWidth = 256 - cropleft - cropright;
|
BufferWidth = 256 - _cropLeft - _cropRight;
|
||||||
BufferHeight = 240 - croptop - cropbottom;
|
BufferHeight = 240 - _cropTop - _cropBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculatePalette()
|
private void CalculatePalette()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 512; i++)
|
for (int i = 0; i < 512; i++)
|
||||||
{
|
{
|
||||||
VideoPalette[i] =
|
_videoPalette[i] =
|
||||||
_settings.Palette[i * 3] << 16 |
|
_settings.Palette[i * 3] << 16 |
|
||||||
_settings.Palette[i * 3 + 1] << 8 |
|
_settings.Palette[i * 3 + 1] << 8 |
|
||||||
_settings.Palette[i * 3 + 2] |
|
_settings.Palette[i * 3 + 2] |
|
||||||
|
@ -56,7 +44,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
|
|
||||||
private void Blit()
|
private void Blit()
|
||||||
{
|
{
|
||||||
QN.qn_blit(Context, VideoOutput, VideoPalette, cropleft, croptop, cropright, cropbottom);
|
QN.qn_blit(Context, _videoOutput, _videoPalette, _cropLeft, _cropTop, _cropRight, _cropBottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
SetPads(controller, out j1, out j2);
|
SetPads(controller, out j1, out j2);
|
||||||
|
|
||||||
if (Tracer.Enabled)
|
if (Tracer.Enabled)
|
||||||
QN.qn_set_tracecb(Context, _tracecb);
|
QN.qn_set_tracecb(Context, _traceCb);
|
||||||
else
|
else
|
||||||
QN.qn_set_tracecb(Context, null);
|
QN.qn_set_tracecb(Context, null);
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
||||||
if (rendersound)
|
if (rendersound)
|
||||||
DrainAudio();
|
DrainAudio();
|
||||||
|
|
||||||
if (CB1 != null) CB1();
|
if (_callBack1 != null) _callBack1();
|
||||||
if (CB2 != null) CB2();
|
if (_callBack2 != null) _callBack2();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
{
|
{
|
||||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||||
{
|
{
|
||||||
LibsnesApi.CPURegs regs;
|
Api.QUERY_peek_cpu_regs(out var regs);
|
||||||
Api.QUERY_peek_cpu_regs(out regs);
|
|
||||||
|
|
||||||
bool fn = (regs.p & 0x80) != 0;
|
bool fn = (regs.p & 0x80) != 0;
|
||||||
bool fv = (regs.p & 0x40) != 0;
|
bool fv = (regs.p & 0x40) != 0;
|
||||||
|
@ -71,9 +70,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
}
|
}
|
||||||
|
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
public long TotalExecutedCycles
|
public long TotalExecutedCycles => throw new NotImplementedException();
|
||||||
{
|
|
||||||
get { throw new NotImplementedException(); }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
}
|
}
|
||||||
|
|
||||||
// speedup when sound rendering is not needed
|
// speedup when sound rendering is not needed
|
||||||
Api.QUERY_set_audio_sample(rendersound ? _soundcb : null);
|
Api.QUERY_set_audio_sample(renderSound ? _soundcb : null);
|
||||||
|
|
||||||
bool resetSignal = controller.IsPressed("Reset");
|
bool resetSignal = controller.IsPressed("Reset");
|
||||||
if (resetSignal)
|
if (resetSignal)
|
||||||
|
@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
_timeFrameCounter++;
|
_timeFrameCounter++;
|
||||||
Api.CMD_run();
|
Api.CMD_run();
|
||||||
|
|
||||||
// once upon a time we forwarded messages frmo bsnes here, by checking for queued text messages, but I don't think it's needed any longer
|
// once upon a time we forwarded messages from bsnes here, by checking for queued text messages, but I don't think it's needed any longer
|
||||||
if (IsLagFrame)
|
if (IsLagFrame)
|
||||||
{
|
{
|
||||||
LagCount++;
|
LagCount++;
|
||||||
|
@ -86,8 +86,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
public int Frame
|
public int Frame
|
||||||
{
|
{
|
||||||
get { return _timeFrameCounter; }
|
get => _timeFrameCounter;
|
||||||
private set { _timeFrameCounter = value; }
|
private set => _timeFrameCounter = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SystemId { get; }
|
public string SystemId { get; }
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
{
|
{
|
||||||
private readonly List<MemoryDomain> _memoryDomainList = new List<MemoryDomain>();
|
private readonly List<MemoryDomain> _memoryDomainList = new List<MemoryDomain>();
|
||||||
private IMemoryDomains _memoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
private LibsnesApi.SNES_MAPPER? _mapper = null;
|
private LibsnesApi.SNES_MAPPER? _mapper;
|
||||||
|
|
||||||
// works for WRAM, garbage for anything else
|
// works for WRAM, garbage for anything else
|
||||||
private static int? FakeBusMap(int addr)
|
private static int? FakeBusMap(int addr)
|
||||||
|
@ -76,22 +76,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(_memoryDomainList);
|
_memoryDomains = new MemoryDomainList(_memoryDomainList);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe void MakeMemoryDomain(string name, LibsnesApi.SNES_MEMORY id, MemoryDomain.Endian endian, int byteSize = 1)
|
private unsafe void MakeMemoryDomain(string name, LibsnesApi.SNES_MEMORY id, MemoryDomain.Endian endian, int byteSize = 1)
|
||||||
{
|
{
|
||||||
int size = Api.QUERY_get_memory_size(id);
|
int size = Api.QUERY_get_memory_size(id);
|
||||||
|
|
||||||
// if this type of memory isnt available, dont make the memory domain (most commonly save ram)
|
// if this type of memory isn't available, don't make the memory domain (most commonly save ram)
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* blockptr = Api.QUERY_get_memory_data(id);
|
byte* blockPtr = Api.QUERY_get_memory_data(id);
|
||||||
|
|
||||||
var md = new MemoryDomainIntPtrMonitor(name, MemoryDomain.Endian.Little, (IntPtr)blockptr, size,
|
var md = new MemoryDomainIntPtrMonitor(name, MemoryDomain.Endian.Little, (IntPtr)blockPtr, size,
|
||||||
id != LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, // hack: for just this one memory area, it will be readonly
|
id != LibsnesApi.SNES_MEMORY.CARTRIDGE_ROM, // hack: for just this one memory area, it will be readonly
|
||||||
byteSize, Api);
|
byteSize, Api);
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
byte* blockptr = Api.QUERY_get_memory_data(LibsnesApi.SNES_MEMORY.WRAM);
|
byte* blockPtr = Api.QUERY_get_memory_data(LibsnesApi.SNES_MEMORY.WRAM);
|
||||||
|
|
||||||
var md = new MemoryDomainDelegate("System Bus", 0x1000000, MemoryDomain.Endian.Little,
|
var md = new MemoryDomainDelegate("System Bus", 0x1000000, MemoryDomain.Endian.Little,
|
||||||
addr =>
|
addr =>
|
||||||
|
@ -116,7 +116,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
var a = FakeBusMap((int)addr);
|
var a = FakeBusMap((int)addr);
|
||||||
if (a.HasValue)
|
if (a.HasValue)
|
||||||
{
|
{
|
||||||
return blockptr[a.Value];
|
return blockPtr[a.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
return FakeBusRead((int)addr);
|
return FakeBusRead((int)addr);
|
||||||
|
@ -128,7 +128,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
{
|
{
|
||||||
var a = FakeBusMap((int)addr);
|
var a = FakeBusMap((int)addr);
|
||||||
if (a.HasValue)
|
if (a.HasValue)
|
||||||
blockptr[a.Value] = val;
|
blockPtr[a.Value] = val;
|
||||||
}
|
}
|
||||||
}, wordSize: 2);
|
}, wordSize: 2);
|
||||||
_memoryDomainList.Add(md);
|
_memoryDomainList.Add(md);
|
||||||
|
|
|
@ -4,17 +4,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
{
|
{
|
||||||
public partial class LibsnesCore : IRegionable
|
public partial class LibsnesCore : IRegionable
|
||||||
{
|
{
|
||||||
public DisplayType Region
|
public DisplayType Region => Api.Region == LibsnesApi.SNES_REGION.NTSC
|
||||||
{
|
? DisplayType.NTSC
|
||||||
get
|
: DisplayType.PAL;
|
||||||
{
|
|
||||||
if (Api.Region == LibsnesApi.SNES_REGION.NTSC)
|
|
||||||
{
|
|
||||||
return DisplayType.NTSC;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DisplayType.PAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
public bool PutSettings(SnesSettings o)
|
public bool PutSettings(SnesSettings o)
|
||||||
{
|
{
|
||||||
bool refreshneeded = o.Palette != _settings.Palette;
|
bool refreshNeeded = o.Palette != _settings.Palette;
|
||||||
_settings = o;
|
_settings = o;
|
||||||
if (refreshneeded)
|
if (refreshNeeded)
|
||||||
{
|
{
|
||||||
RefreshPalette();
|
RefreshPalette();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System.IO;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using BizHawk.Common.BufferExtensions;
|
using BizHawk.Common.BufferExtensions;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
||||||
|
|
||||||
public int BackgroundColor => 0;
|
public int BackgroundColor => 0;
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer() => _videoBuffer;
|
||||||
{
|
|
||||||
return _videoBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int VsyncNumerator { get; }
|
public int VsyncNumerator { get; }
|
||||||
public int VsyncDenominator { get; }
|
public int VsyncDenominator { get; }
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Waterbox;
|
using BizHawk.Emulation.Cores.Waterbox;
|
||||||
using BizHawk.Common.BizInvoke;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using BizHawk.Common.BufferExtensions;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
|
@ -64,9 +64,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
[FeatureNotImplemented]
|
[FeatureNotImplemented]
|
||||||
public void Step(StepType type) { throw new NotImplementedException(); }
|
public void Step(StepType type) { throw new NotImplementedException(); }
|
||||||
|
|
||||||
public long TotalExecutedCycles
|
public long TotalExecutedCycles => subnes.cpu.TotalExecutedCycles;
|
||||||
{
|
|
||||||
get { return subnes.cpu.TotalExecutedCycles; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
{
|
{
|
||||||
|
@ -11,7 +9,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => subnes.ControllerDefinition;
|
public ControllerDefinition ControllerDefinition => subnes.ControllerDefinition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("-----------------------FRAME-----------------------");
|
//Console.WriteLine("-----------------------FRAME-----------------------");
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
@ -39,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
reset_cycle = controller.GetFloat("Reset Cycle");
|
reset_cycle = controller.GetFloat("Reset Cycle");
|
||||||
reset_cycle_int = (int)Math.Floor(reset_cycle);
|
reset_cycle_int = (int)Math.Floor(reset_cycle);
|
||||||
|
|
||||||
_islag = true;
|
_isLag = true;
|
||||||
subnes.alt_lag = true;
|
subnes.alt_lag = true;
|
||||||
|
|
||||||
InputCallbacks.Call();
|
InputCallbacks.Call();
|
||||||
|
@ -55,11 +53,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
subnes.cpu.ext_ppu_cycle = current_cycle;
|
subnes.cpu.ext_ppu_cycle = current_cycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
_islag = subnes.alt_lag;
|
_isLag = subnes.alt_lag;
|
||||||
|
|
||||||
if (_islag)
|
if (_isLag)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagCount++;
|
||||||
VBL_CNT++;
|
VBL_CNT++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +100,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
_islag = false;
|
_isLag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreComm CoreComm { get; }
|
public CoreComm CoreComm { get; }
|
||||||
|
|
|
@ -6,19 +6,19 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagcount; }
|
get => _lagCount;
|
||||||
set { _lagcount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _islag; }
|
get => _isLag;
|
||||||
set { _islag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
public bool _islag = true;
|
public bool _isLag = true;
|
||||||
private int _lagcount;
|
private int _lagCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
|
@ -18,24 +18,27 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
||||||
public byte[] CloneSaveRam()
|
public byte[] CloneSaveRam()
|
||||||
{
|
{
|
||||||
if (subnes.Board is NES.FDS)
|
if (subnes.Board is NES.FDS fds)
|
||||||
return (subnes.Board as NES.FDS).ReadSaveRam();
|
{
|
||||||
|
return fds.ReadSaveRam();
|
||||||
|
}
|
||||||
|
|
||||||
if (subnes.Board == null || subnes.Board.SaveRam == null)
|
return (byte[]) subnes.Board?.SaveRam?.Clone();
|
||||||
return null;
|
|
||||||
return (byte[])subnes.Board.SaveRam.Clone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
{
|
{
|
||||||
if (subnes.Board is NES.FDS)
|
if (subnes.Board is NES.FDS fds)
|
||||||
{
|
{
|
||||||
(subnes.Board as NES.FDS).StoreSaveRam(data);
|
fds.StoreSaveRam(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (subnes.Board == null || subnes.Board.SaveRam == null)
|
if (subnes.Board?.SaveRam == null)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Array.Copy(data, subnes.Board.SaveRam, data.Length);
|
Array.Copy(data, subnes.Board.SaveRam, data.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Nintendo.NES;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
{
|
{
|
||||||
|
@ -38,8 +37,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
||||||
public byte[] SaveStateBinary()
|
public byte[] SaveStateBinary()
|
||||||
{
|
{
|
||||||
MemoryStream ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
BinaryWriter bw = new BinaryWriter(ms);
|
using var bw = new BinaryWriter(ms);
|
||||||
SaveStateBinary(bw);
|
SaveStateBinary(bw);
|
||||||
bw.Flush();
|
bw.Flush();
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
|
@ -49,9 +48,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
|
||||||
|
|
||||||
private void SyncState(Serializer ser)
|
private void SyncState(Serializer ser)
|
||||||
{
|
{
|
||||||
ser.Sync("Lag", ref _lagcount);
|
ser.Sync("Lag", ref _lagCount);
|
||||||
ser.Sync("Frame", ref _frame);
|
ser.Sync("Frame", ref _frame);
|
||||||
ser.Sync("IsLag", ref _islag);
|
ser.Sync("IsLag", ref _isLag);
|
||||||
ser.Sync(nameof(pass_a_frame), ref pass_a_frame);
|
ser.Sync(nameof(pass_a_frame), ref pass_a_frame);
|
||||||
ser.Sync(nameof(reset_frame), ref reset_frame);
|
ser.Sync(nameof(reset_frame), ref reset_frame);
|
||||||
ser.Sync(nameof(pass_new_input), ref pass_new_input);
|
ser.Sync(nameof(pass_new_input), ref pass_new_input);
|
||||||
|
|
|
@ -102,8 +102,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
CDLMappingApplyRange(mm, "Battery RAM", 0xf7, BRAM.Length);
|
CDLMappingApplyRange(mm, "Battery RAM", 0xf7, BRAM.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
var rammirrors = new HuC6280.MemMapping { Name = "Main Memory", Offs = 0 };
|
var ramMirrors = new HuC6280.MemMapping { Name = "Main Memory", Offs = 0 };
|
||||||
mm[0xf9] = mm[0xfa] = mm[0xfb] = rammirrors;
|
mm[0xf9] = mm[0xfa] = mm[0xfb] = ramMirrors;
|
||||||
|
|
||||||
CDLMappingApplyRange(mm, "Main Memory", 0xf8, Ram.Length);
|
CDLMappingApplyRange(mm, "Main Memory", 0xf8, Ram.Length);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
_controller = controller;
|
_controller = controller;
|
||||||
_lagged = true;
|
_lagged = true;
|
||||||
|
@ -45,8 +45,8 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
|
|
||||||
public int Frame
|
public int Frame
|
||||||
{
|
{
|
||||||
get { return _frame; }
|
get => _frame;
|
||||||
set { _frame = value; }
|
set => _frame = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SystemId { get; }
|
public string SystemId { get; }
|
||||||
|
|
|
@ -6,20 +6,17 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagCount; }
|
get => _lagCount;
|
||||||
set { _lagCount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _isLag; }
|
get => _isLag;
|
||||||
set { _isLag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks
|
public IInputCallbackSystem InputCallbacks => _inputCallbacks;
|
||||||
{
|
|
||||||
get { return _inputCallbacks; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
|
private readonly InputCallbackSystem _inputCallbacks = new InputCallbackSystem();
|
||||||
private int _lagCount;
|
private int _lagCount;
|
||||||
|
|
|
@ -8,15 +8,15 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
{
|
{
|
||||||
public sealed partial class PCEngine
|
public sealed partial class PCEngine
|
||||||
{
|
{
|
||||||
private Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
private readonly Dictionary<string, MemoryDomainByteArray> _byteArrayDomains = new Dictionary<string, MemoryDomainByteArray>();
|
||||||
private bool _memoryDomainsInit = false;
|
private bool _memoryDomainsInit;
|
||||||
private MemoryDomainList _memoryDomains;
|
private MemoryDomainList _memoryDomains;
|
||||||
|
|
||||||
private void SetupMemoryDomains()
|
private void SetupMemoryDomains()
|
||||||
{
|
{
|
||||||
var domains = new List<MemoryDomain>(2);
|
var domains = new List<MemoryDomain>(2);
|
||||||
|
|
||||||
var SystemBusDomain = new MemoryDomainDelegate("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little,
|
var systemBusDomain = new MemoryDomainDelegate("System Bus (21 bit)", 0x200000, MemoryDomain.Endian.Little,
|
||||||
(addr) =>
|
(addr) =>
|
||||||
{
|
{
|
||||||
if (addr < 0 || addr >= 0x200000)
|
if (addr < 0 || addr >= 0x200000)
|
||||||
|
@ -30,9 +30,9 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
Cpu.WriteMemory21((int)addr, value);
|
Cpu.WriteMemory21((int)addr, value);
|
||||||
},
|
},
|
||||||
wordSize: 2);
|
wordSize: 2);
|
||||||
domains.Add(SystemBusDomain);
|
domains.Add(systemBusDomain);
|
||||||
|
|
||||||
var CpuBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
|
var cpuBusDomain = new MemoryDomainDelegate("System Bus", 0x10000, MemoryDomain.Endian.Little,
|
||||||
(addr) =>
|
(addr) =>
|
||||||
{
|
{
|
||||||
if (addr < 0 || addr >= 0x10000)
|
if (addr < 0 || addr >= 0x10000)
|
||||||
|
@ -46,14 +46,16 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
Cpu.WriteMemory((ushort)addr, value);
|
Cpu.WriteMemory((ushort)addr, value);
|
||||||
},
|
},
|
||||||
wordSize: 2);
|
wordSize: 2);
|
||||||
domains.Add(CpuBusDomain);
|
domains.Add(cpuBusDomain);
|
||||||
|
|
||||||
SyncAllByteArrayDomains();
|
SyncAllByteArrayDomains();
|
||||||
|
|
||||||
_memoryDomains = new MemoryDomainList(domains.Concat(_byteArrayDomains.Values).ToList());
|
_memoryDomains = new MemoryDomainList(domains.Concat(_byteArrayDomains.Values).ToList())
|
||||||
_memoryDomains.SystemBus = CpuBusDomain;
|
{
|
||||||
_memoryDomains.MainMemory = _byteArrayDomains["Main Memory"];
|
SystemBus = cpuBusDomain, MainMemory = _byteArrayDomains["Main Memory"]
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
};
|
||||||
|
|
||||||
|
((BasicServiceProvider) ServiceProvider).Register<IMemoryDomains>(_memoryDomains);
|
||||||
_memoryDomainsInit = true;
|
_memoryDomainsInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,14 +9,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
||||||
|
|
||||||
public byte[] CloneSaveRam()
|
public byte[] CloneSaveRam()
|
||||||
{
|
{
|
||||||
if (BRAM != null)
|
return (byte[]) BRAM?.Clone();
|
||||||
{
|
|
||||||
return (byte[])BRAM.Clone();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Common.BizInvoke;
|
|
||||||
using BizHawk.Common.BufferExtensions;
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
using BizHawk.Emulation.Cores.Waterbox;
|
using BizHawk.Emulation.Cores.Waterbox;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.SNK
|
namespace BizHawk.Emulation.Cores.Consoles.SNK
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,17 +27,17 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
public void NewCDL(ICodeDataLog cdl)
|
public void NewCDL(ICodeDataLog cdl)
|
||||||
{
|
{
|
||||||
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
|
cdl["ROM"] = new byte[_memoryDomains["ROM"].Size];
|
||||||
cdl["Main RAM"] = new byte[MemoryDomains["Main RAM"].Size];
|
cdl["Main RAM"] = new byte[_memoryDomains["Main RAM"].Size];
|
||||||
|
|
||||||
if (MemoryDomains.Has("Save RAM"))
|
if (_memoryDomains.Has("Save RAM"))
|
||||||
{
|
{
|
||||||
cdl["Save RAM"] = new byte[MemoryDomains["Save RAM"].Size];
|
cdl["Save RAM"] = new byte[_memoryDomains["Save RAM"].Size];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MemoryDomains.Has("Cart (Volatile) RAM"))
|
if (_memoryDomains.Has("Cart (Volatile) RAM"))
|
||||||
{
|
{
|
||||||
cdl["Cart (Volatile) RAM"] = new byte[MemoryDomains["Cart (Volatile) RAM"].Size];
|
cdl["Cart (Volatile) RAM"] = new byte[_memoryDomains["Cart (Volatile) RAM"].Size];
|
||||||
}
|
}
|
||||||
|
|
||||||
cdl.SubType = "SMS";
|
cdl.SubType = "SMS";
|
||||||
|
|
|
@ -144,9 +144,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long TotalExecutedCycles
|
public long TotalExecutedCycles => L.Cpu.TotalExecutedCycles;
|
||||||
{
|
|
||||||
get { return (long)L.Cpu.TotalExecutedCycles; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
public int L_NMI_CD, R_NMI_CD;
|
public int L_NMI_CD, R_NMI_CD;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
//Console.WriteLine("-----------------------FRAME-----------------------");
|
//Console.WriteLine("-----------------------FRAME-----------------------");
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
@ -31,32 +31,32 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
HardReset();
|
HardReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cablediscosignalNew = controller.IsPressed("Toggle Cable");
|
bool cableDiscoSignalNew = controller.IsPressed("Toggle Cable");
|
||||||
if (cablediscosignalNew && !_cablediscosignal)
|
if (cableDiscoSignalNew && !_cablediscosignal)
|
||||||
{
|
{
|
||||||
_cableconnected ^= true;
|
_cableconnected ^= true;
|
||||||
Console.WriteLine("Cable connect status to {0}", _cableconnected);
|
Console.WriteLine("Cable connect status to {0}", _cableconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
_cablediscosignal = cablediscosignalNew;
|
_cablediscosignal = cableDiscoSignalNew;
|
||||||
|
|
||||||
_islag = true;
|
_isLag = true;
|
||||||
|
|
||||||
GetControllerState(controller);
|
GetControllerState(controller);
|
||||||
|
|
||||||
do_frame(controller, render, rendersound);
|
DoFrame(controller, render, renderSound);
|
||||||
|
|
||||||
_islag = L._isLag;
|
_isLag = L._isLag;
|
||||||
|
|
||||||
if (_islag)
|
if (_isLag)
|
||||||
{
|
{
|
||||||
_lagcount++;
|
_lagCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void do_frame(IController controller, bool render, bool rendersound)
|
private void DoFrame(IController controller, bool render, bool renderSound)
|
||||||
{
|
{
|
||||||
L.start_pressed = controller.IsPressed("P1 Start");
|
L.start_pressed = controller.IsPressed("P1 Start");
|
||||||
R.start_pressed = controller.IsPressed("P2 Start");
|
R.start_pressed = controller.IsPressed("P2 Start");
|
||||||
|
@ -280,8 +280,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
_frame = 0;
|
_frame = 0;
|
||||||
_lagcount = 0;
|
_lagCount = 0;
|
||||||
_islag = false;
|
_isLag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreComm CoreComm { get; }
|
public CoreComm CoreComm { get; }
|
||||||
|
|
|
@ -6,19 +6,19 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
{
|
{
|
||||||
public int LagCount
|
public int LagCount
|
||||||
{
|
{
|
||||||
get { return _lagcount; }
|
get => _lagCount;
|
||||||
set { _lagcount = value; }
|
set => _lagCount = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLagFrame
|
public bool IsLagFrame
|
||||||
{
|
{
|
||||||
get { return _islag; }
|
get => _isLag;
|
||||||
set { _islag = value; }
|
set => _isLag = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
public IInputCallbackSystem InputCallbacks { get; } = new InputCallbackSystem();
|
||||||
|
|
||||||
public bool _islag = true;
|
public bool _isLag = true;
|
||||||
private int _lagcount;
|
private int _lagCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
{
|
{
|
||||||
public partial class GGHawkLink
|
public partial class GGHawkLink
|
||||||
{
|
{
|
||||||
private IMemoryDomains MemoryDomains;
|
private IMemoryDomains _memoryDomains;
|
||||||
|
|
||||||
public void SetupMemoryDomains()
|
public void SetupMemoryDomains()
|
||||||
{
|
{
|
||||||
|
@ -73,18 +73,18 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
if (L.SaveRAM != null)
|
if (L.SaveRAM != null)
|
||||||
{
|
{
|
||||||
var CartRamL = new MemoryDomainByteArray("Cart RAM L", MemoryDomain.Endian.Little, L.SaveRAM, true, 1);
|
var cartRamL = new MemoryDomainByteArray("Cart RAM L", MemoryDomain.Endian.Little, L.SaveRAM, true, 1);
|
||||||
domains.Add(CartRamL);
|
domains.Add(cartRamL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R.SaveRAM != null)
|
if (R.SaveRAM != null)
|
||||||
{
|
{
|
||||||
var CartRamR = new MemoryDomainByteArray("Cart RAM R", MemoryDomain.Endian.Little, R.SaveRAM, true, 1);
|
var cartRamR = new MemoryDomainByteArray("Cart RAM R", MemoryDomain.Endian.Little, R.SaveRAM, true, 1);
|
||||||
domains.Add(CartRamR);
|
domains.Add(cartRamR);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryDomains = new MemoryDomainList(domains);
|
_memoryDomains = new MemoryDomainList(domains);
|
||||||
(ServiceProvider as BasicServiceProvider).Register<IMemoryDomains>(MemoryDomains);
|
((BasicServiceProvider) ServiceProvider).Register(_memoryDomains);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte PeekSystemBusL(long addr)
|
private byte PeekSystemBusL(long addr)
|
||||||
|
|
|
@ -9,21 +9,21 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
{
|
{
|
||||||
if ((L.SaveRAM != null) || (R.SaveRAM != null))
|
if ((L.SaveRAM != null) || (R.SaveRAM != null))
|
||||||
{
|
{
|
||||||
int Len1 = 0;
|
int len1 = 0;
|
||||||
int Len2 = 0;
|
int len2 = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
if (L.SaveRAM != null)
|
if (L.SaveRAM != null)
|
||||||
{
|
{
|
||||||
Len1 = L.SaveRAM.Length;
|
len1 = L.SaveRAM.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R.SaveRAM != null)
|
if (R.SaveRAM != null)
|
||||||
{
|
{
|
||||||
Len2 = R.SaveRAM.Length;
|
len2 = R.SaveRAM.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] temp = new byte[Len1 + Len2];
|
byte[] temp = new byte[len1 + len2];
|
||||||
|
|
||||||
if (L.SaveRAM != null)
|
if (L.SaveRAM != null)
|
||||||
{
|
{
|
||||||
|
@ -45,23 +45,21 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StoreSaveRam(byte[] data)
|
public void StoreSaveRam(byte[] data)
|
||||||
{
|
{
|
||||||
if ((L.SaveRAM != null) && (R.SaveRAM == null))
|
if (L.SaveRAM != null && R.SaveRAM == null)
|
||||||
{
|
{
|
||||||
Buffer.BlockCopy(data, 0, L.SaveRAM, 0, L.SaveRAM.Length);
|
Buffer.BlockCopy(data, 0, L.SaveRAM, 0, L.SaveRAM.Length);
|
||||||
}
|
}
|
||||||
else if ((R.SaveRAM != null) && (L.SaveRAM == null))
|
else if (R.SaveRAM != null && L.SaveRAM == null)
|
||||||
{
|
{
|
||||||
Buffer.BlockCopy(data, 0, R.SaveRAM, 0, R.SaveRAM.Length);
|
Buffer.BlockCopy(data, 0, R.SaveRAM, 0, R.SaveRAM.Length);
|
||||||
}
|
}
|
||||||
else if ((R.SaveRAM != null) && (L.SaveRAM != null))
|
else if (R.SaveRAM != null && L.SaveRAM != null)
|
||||||
{
|
{
|
||||||
Buffer.BlockCopy(data, 0, L.SaveRAM, 0, L.SaveRAM.Length);
|
Buffer.BlockCopy(data, 0, L.SaveRAM, 0, L.SaveRAM.Length);
|
||||||
Buffer.BlockCopy(data, L.SaveRAM.Length, R.SaveRAM, 0, R.SaveRAM.Length);
|
Buffer.BlockCopy(data, L.SaveRAM.Length, R.SaveRAM, 0, R.SaveRAM.Length);
|
||||||
|
@ -70,12 +68,6 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
Console.WriteLine("loading SRAM here");
|
Console.WriteLine("loading SRAM here");
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SaveRamModified
|
public bool SaveRamModified => linkSyncSettings.Use_SRAM;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return linkSyncSettings.Use_SRAM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
private void SyncState(Serializer ser)
|
private void SyncState(Serializer ser)
|
||||||
{
|
{
|
||||||
ser.Sync("Lag", ref _lagcount);
|
ser.Sync("Lag", ref _lagCount);
|
||||||
ser.Sync("Frame", ref _frame);
|
ser.Sync("Frame", ref _frame);
|
||||||
ser.Sync("IsLag", ref _islag);
|
ser.Sync("IsLag", ref _isLag);
|
||||||
ser.Sync(nameof(_cableconnected), ref _cableconnected);
|
ser.Sync(nameof(_cableconnected), ref _cableconnected);
|
||||||
ser.Sync(nameof(_cablediscosignal), ref _cablediscosignal);
|
ser.Sync(nameof(_cablediscosignal), ref _cablediscosignal);
|
||||||
ser.Sync(nameof(do_r_next), ref do_r_next);
|
ser.Sync(nameof(do_r_next), ref do_r_next);
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
|
|
||||||
using BizHawk.Emulation.Cores.Sega.MasterSystem;
|
using BizHawk.Emulation.Cores.Sega.MasterSystem;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
@ -81,8 +78,8 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink
|
||||||
|
|
||||||
public bool LinkConnected
|
public bool LinkConnected
|
||||||
{
|
{
|
||||||
get { return _cableconnected; }
|
get => _cableconnected;
|
||||||
set { _cableconnected = value; }
|
set => _cableconnected = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecFetch(ushort addr)
|
private void ExecFetch(ushort addr)
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
using BizHawk.Common.BizInvoke;
|
using BizHawk.Common.BizInvoke;
|
||||||
using BizHawk.Emulation.Cores.Waterbox;
|
using BizHawk.Emulation.Cores.Waterbox;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive
|
namespace BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,6 @@ using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
||||||
{
|
{
|
||||||
|
@ -51,12 +50,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
||||||
if (Encoding.ASCII.GetString(buff, 0, 16) != "SEGA SEGASATURN ")
|
if (Encoding.ASCII.GetString(buff, 0, 16) != "SEGA SEGASATURN ")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
using (var sha256 = SHA256.Create())
|
using var sha256 = SHA256.Create();
|
||||||
{
|
sha256.ComputeHash(buff, 0x100, 0xd00);
|
||||||
sha256.ComputeHash(buff, 0x100, 0xd00);
|
if (sha256.Hash.BytesToHexString() != "96B8EA48819CFA589F24C40AA149C224C420DCCF38B730F00156EFE25C9BBC8F")
|
||||||
if (sha256.Hash.BytesToHexString() != "96B8EA48819CFA589F24C40AA149C224C420DCCF38B730F00156EFE25C9BBC8F")
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
|
|
||||||
public void NewCDL(ICodeDataLog cdl)
|
public void NewCDL(ICodeDataLog cdl)
|
||||||
{
|
{
|
||||||
cdl["MD CART"] = new byte[MemoryDomains["MD CART"].Size];
|
cdl["MD CART"] = new byte[_memoryDomains["MD CART"].Size];
|
||||||
cdl["68K RAM"] = new byte[MemoryDomains["68K RAM"].Size];
|
cdl["68K RAM"] = new byte[_memoryDomains["68K RAM"].Size];
|
||||||
cdl["Z80 RAM"] = new byte[MemoryDomains["Z80 RAM"].Size];
|
cdl["Z80 RAM"] = new byte[_memoryDomains["Z80 RAM"].Size];
|
||||||
|
|
||||||
if (MemoryDomains.Has("SRAM"))
|
if (_memoryDomains.Has("SRAM"))
|
||||||
cdl["SRAM"] = new byte[MemoryDomains["SRAM"].Size];
|
cdl["SRAM"] = new byte[_memoryDomains["SRAM"].Size];
|
||||||
|
|
||||||
cdl.SubType = "GEN";
|
cdl.SubType = "GEN";
|
||||||
cdl.SubVer = 0;
|
cdl.SubVer = 0;
|
||||||
|
|
|
@ -8,19 +8,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
{
|
{
|
||||||
public string Cpu
|
public string Cpu
|
||||||
{
|
{
|
||||||
get
|
get => "M68000";
|
||||||
{
|
|
||||||
return "M68000";
|
|
||||||
}
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string PCRegisterName
|
public string PCRegisterName => "M68K PC";
|
||||||
{
|
|
||||||
get { return "M68K PC"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> AvailableCpus
|
public IEnumerable<string> AvailableCpus
|
||||||
{
|
{
|
||||||
|
@ -40,6 +34,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: refactor MC6800's disassembler to be a static call
|
// TODO: refactor MC6800's disassembler to be a static call
|
||||||
private MC68000 _disassemblerInstance = new MC68000();
|
private readonly MC68000 _disassemblerInstance = new MC68000();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue