Spaces -> tabs, fix mixed newlines.
This commit is contained in:
parent
2750a420ef
commit
fec63fb66a
|
@ -99,11 +99,11 @@ namespace BizHawk.Client.ApiHawk
|
|||
case "WSWAN":
|
||||
return CoreSystem.WonderSwan;
|
||||
|
||||
case "ZXSpectrum":
|
||||
return CoreSystem.ZXSpectrum;
|
||||
case "ZXSpectrum":
|
||||
return CoreSystem.ZXSpectrum;
|
||||
|
||||
case "AmstradCPC":
|
||||
return CoreSystem.AmstradCPC;
|
||||
case "AmstradCPC":
|
||||
return CoreSystem.AmstradCPC;
|
||||
|
||||
case "GGL":
|
||||
return CoreSystem.GGL;
|
||||
|
@ -229,11 +229,11 @@ namespace BizHawk.Client.ApiHawk
|
|||
case CoreSystem.WonderSwan:
|
||||
return "WSWAN";
|
||||
|
||||
case CoreSystem.ZXSpectrum:
|
||||
return "ZXSpectrum";
|
||||
case CoreSystem.ZXSpectrum:
|
||||
return "ZXSpectrum";
|
||||
|
||||
case CoreSystem.AmstradCPC:
|
||||
return "AmstradCPC";
|
||||
case CoreSystem.AmstradCPC:
|
||||
return "AmstradCPC";
|
||||
|
||||
default:
|
||||
throw new IndexOutOfRangeException($"{value.ToString()} is missing in convert list");
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
VirtualBoy,
|
||||
Vectrex,
|
||||
NeoGeoPocket,
|
||||
ZXSpectrum,
|
||||
AmstradCPC,
|
||||
ZXSpectrum,
|
||||
AmstradCPC,
|
||||
GGL,
|
||||
GB3x,
|
||||
GB4x,
|
||||
|
|
|
@ -126,35 +126,35 @@ namespace BizHawk.Client.Common
|
|||
public Dictionary<string, RealFirmwareFile> Dict { get; } = new Dictionary<string, RealFirmwareFile>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test to determine whether the supplied firmware file matches something in the firmware database
|
||||
/// </summary>
|
||||
public bool CanFileBeImported(string f)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fi = new FileInfo(f);
|
||||
if (!fi.Exists)
|
||||
return false;
|
||||
/// <summary>
|
||||
/// Test to determine whether the supplied firmware file matches something in the firmware database
|
||||
/// </summary>
|
||||
public bool CanFileBeImported(string f)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fi = new FileInfo(f);
|
||||
if (!fi.Exists)
|
||||
return false;
|
||||
|
||||
// weed out filesizes first to reduce the unnecessary overhead of a hashing operation
|
||||
if (FirmwareDatabase.FirmwareFiles.Where(a => a.Size == fi.Length).FirstOrDefault() == null)
|
||||
return false;
|
||||
// weed out filesizes first to reduce the unnecessary overhead of a hashing operation
|
||||
if (FirmwareDatabase.FirmwareFiles.Where(a => a.Size == fi.Length).FirstOrDefault() == null)
|
||||
return false;
|
||||
|
||||
// check the hash
|
||||
using (var reader = new RealFirmwareReader())
|
||||
{
|
||||
reader.Read(fi);
|
||||
if (FirmwareDatabase.FirmwareFiles.Where(a => a.Hash == reader.Dict.FirstOrDefault().Value.Hash).FirstOrDefault() != null)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
// check the hash
|
||||
using (var reader = new RealFirmwareReader())
|
||||
{
|
||||
reader.Read(fi);
|
||||
if (FirmwareDatabase.FirmwareFiles.Where(a => a.Hash == reader.Dict.FirstOrDefault().Value.Hash).FirstOrDefault() != null)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void DoScanAndResolve()
|
||||
public void DoScanAndResolve()
|
||||
{
|
||||
// build a list of file sizes. Only those will be checked during scanning
|
||||
HashSet<long> sizes = new HashSet<long>();
|
||||
|
|
|
@ -156,10 +156,10 @@ namespace BizHawk.Client.Common
|
|||
return SystemInfo.Vectrex;
|
||||
case "NGP":
|
||||
return SystemInfo.NeoGeoPocket;
|
||||
case "ZXSpectrum":
|
||||
return SystemInfo.ZXSpectrum;
|
||||
case "AmstradCPC":
|
||||
return SystemInfo.AmstradCPC;
|
||||
case "ZXSpectrum":
|
||||
return SystemInfo.ZXSpectrum;
|
||||
case "AmstradCPC":
|
||||
return SystemInfo.AmstradCPC;
|
||||
case "ChannelF":
|
||||
return SystemInfo.ChannelF;
|
||||
}
|
||||
|
|
|
@ -57,30 +57,30 @@ namespace BizHawk.Client.Common
|
|||
string token = text.Substring(idx + 1);
|
||||
IOpenAdvanced ioa;
|
||||
|
||||
if (type == OpenAdvancedTypes.OpenRom)
|
||||
{
|
||||
ioa = new OpenAdvanced_OpenRom();
|
||||
if (type == OpenAdvancedTypes.OpenRom)
|
||||
{
|
||||
ioa = new OpenAdvanced_OpenRom();
|
||||
}
|
||||
else if (type == OpenAdvancedTypes.Libretro)
|
||||
{
|
||||
ioa = new OpenAdvanced_Libretro();
|
||||
else if (type == OpenAdvancedTypes.Libretro)
|
||||
{
|
||||
ioa = new OpenAdvanced_Libretro();
|
||||
}
|
||||
else if (type == OpenAdvancedTypes.LibretroNoGame)
|
||||
{
|
||||
ioa = new OpenAdvanced_LibretroNoGame();
|
||||
else if (type == OpenAdvancedTypes.LibretroNoGame)
|
||||
{
|
||||
ioa = new OpenAdvanced_LibretroNoGame();
|
||||
}
|
||||
else if (type == OpenAdvancedTypes.MAME)
|
||||
{
|
||||
ioa = new OpenAdvanced_MAME();
|
||||
else if (type == OpenAdvancedTypes.MAME)
|
||||
{
|
||||
ioa = new OpenAdvanced_MAME();
|
||||
}
|
||||
else
|
||||
{
|
||||
ioa = null;
|
||||
else
|
||||
{
|
||||
ioa = null;
|
||||
}
|
||||
|
||||
if (ioa == null)
|
||||
if (ioa == null)
|
||||
{
|
||||
throw new InvalidOperationException($"{nameof(IOpenAdvanced)} deserialization error");
|
||||
throw new InvalidOperationException($"{nameof(IOpenAdvanced)} deserialization error");
|
||||
}
|
||||
|
||||
ioa.Deserialize(token);
|
||||
|
|
|
@ -66,14 +66,14 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
RomData = FileData;
|
||||
}
|
||||
else if (file.Extension == ".DSK" || file.Extension == ".TAP" || file.Extension == ".TZX" ||
|
||||
file.Extension == ".PZX" || file.Extension == ".CSW" || file.Extension == ".WAV" || file.Extension == ".CDT")
|
||||
{
|
||||
// these are not roms. unforunately if treated as such there are certain edge-cases
|
||||
// where a header offset is detected. This should mitigate this issue until a cleaner solution is found
|
||||
// (-Asnivor)
|
||||
RomData = FileData;
|
||||
}
|
||||
else if (file.Extension == ".DSK" || file.Extension == ".TAP" || file.Extension == ".TZX" ||
|
||||
file.Extension == ".PZX" || file.Extension == ".CSW" || file.Extension == ".WAV" || file.Extension == ".CDT")
|
||||
{
|
||||
// these are not roms. unforunately if treated as such there are certain edge-cases
|
||||
// where a header offset is detected. This should mitigate this issue until a cleaner solution is found
|
||||
// (-Asnivor)
|
||||
RomData = FileData;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there was a header offset, read the whole file into FileData and then copy it into RomData (this is unfortunate, in case RomData isnt needed)
|
||||
|
|
|
@ -529,9 +529,9 @@ namespace BizHawk.Client.Common
|
|||
// try to use our wizard methods
|
||||
game = new GameInfo { Name = Path.GetFileNameWithoutExtension(file.Name), Hash = discHash };
|
||||
|
||||
var dt = new DiscIdentifier(disc).DetectDiscType();
|
||||
var dt = new DiscIdentifier(disc).DetectDiscType();
|
||||
|
||||
switch (dt)
|
||||
switch (dt)
|
||||
{
|
||||
case DiscType.SegaSaturn:
|
||||
game.System = "SAT";
|
||||
|
@ -549,21 +549,21 @@ namespace BizHawk.Client.Common
|
|||
case DiscType.PCFX:
|
||||
game.System = "PCFX";
|
||||
break;
|
||||
case DiscType.TurboCD:
|
||||
game.System = "PCECD";
|
||||
break;
|
||||
case DiscType.TurboCD:
|
||||
game.System = "PCECD";
|
||||
break;
|
||||
|
||||
case DiscType.Amiga:
|
||||
case DiscType.CDi:
|
||||
case DiscType.Dreamcast:
|
||||
case DiscType.GameCube:
|
||||
case DiscType.NeoGeoCD:
|
||||
case DiscType.Panasonic3DO:
|
||||
case DiscType.Playdia:
|
||||
case DiscType.Wii:
|
||||
// no supported emulator core for these (yet)
|
||||
game.System = dt.ToString();
|
||||
throw new NoAvailableCoreException(dt.ToString());
|
||||
case DiscType.Amiga:
|
||||
case DiscType.CDi:
|
||||
case DiscType.Dreamcast:
|
||||
case DiscType.GameCube:
|
||||
case DiscType.NeoGeoCD:
|
||||
case DiscType.Panasonic3DO:
|
||||
case DiscType.Playdia:
|
||||
case DiscType.Wii:
|
||||
// no supported emulator core for these (yet)
|
||||
game.System = dt.ToString();
|
||||
throw new NoAvailableCoreException(dt.ToString());
|
||||
|
||||
case DiscType.AudioDisc:
|
||||
case DiscType.UnknownCDFS:
|
||||
|
@ -574,7 +574,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
else
|
||||
{
|
||||
game.System = "NULL"; // "PCECD";
|
||||
game.System = "NULL"; // "PCECD";
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -583,9 +583,9 @@ namespace BizHawk.Client.Common
|
|||
|
||||
switch (game.System)
|
||||
{
|
||||
case "NULL":
|
||||
nextEmulator = null;
|
||||
break;
|
||||
case "NULL":
|
||||
nextEmulator = null;
|
||||
break;
|
||||
case "GEN":
|
||||
var genesis = new GPGX(nextComm, null, new[] { disc }, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
|
||||
nextEmulator = genesis;
|
||||
|
@ -731,38 +731,38 @@ namespace BizHawk.Client.Common
|
|||
(C64.C64Settings)GetCoreSettings<C64>(),
|
||||
(C64.C64SyncSettings)GetCoreSyncSettings<C64>());
|
||||
break;
|
||||
case "ZXSpectrum":
|
||||
case "ZXSpectrum":
|
||||
|
||||
List<GameInfo> zxGI = new List<GameInfo>();
|
||||
foreach (var a in xmlGame.Assets)
|
||||
{
|
||||
zxGI.Add(new GameInfo { Name = Path.GetFileNameWithoutExtension(a.Key) });
|
||||
}
|
||||
List<GameInfo> zxGI = new List<GameInfo>();
|
||||
foreach (var a in xmlGame.Assets)
|
||||
{
|
||||
zxGI.Add(new GameInfo { Name = Path.GetFileNameWithoutExtension(a.Key) });
|
||||
}
|
||||
|
||||
nextEmulator = new ZXSpectrum(
|
||||
nextComm,
|
||||
xmlGame.Assets.Select(a => a.Value), //.First(),
|
||||
zxGI, // GameInfo.NullInstance,
|
||||
(ZXSpectrum.ZXSpectrumSettings)GetCoreSettings<ZXSpectrum>(),
|
||||
(ZXSpectrum.ZXSpectrumSyncSettings)GetCoreSyncSettings<ZXSpectrum>(),
|
||||
Deterministic);
|
||||
break;
|
||||
case "AmstradCPC":
|
||||
nextEmulator = new ZXSpectrum(
|
||||
nextComm,
|
||||
xmlGame.Assets.Select(a => a.Value), //.First(),
|
||||
zxGI, // GameInfo.NullInstance,
|
||||
(ZXSpectrum.ZXSpectrumSettings)GetCoreSettings<ZXSpectrum>(),
|
||||
(ZXSpectrum.ZXSpectrumSyncSettings)GetCoreSyncSettings<ZXSpectrum>(),
|
||||
Deterministic);
|
||||
break;
|
||||
case "AmstradCPC":
|
||||
|
||||
List<GameInfo> cpcGI = new List<GameInfo>();
|
||||
foreach (var a in xmlGame.Assets)
|
||||
{
|
||||
cpcGI.Add(new GameInfo { Name = Path.GetFileNameWithoutExtension(a.Key) });
|
||||
}
|
||||
List<GameInfo> cpcGI = new List<GameInfo>();
|
||||
foreach (var a in xmlGame.Assets)
|
||||
{
|
||||
cpcGI.Add(new GameInfo { Name = Path.GetFileNameWithoutExtension(a.Key) });
|
||||
}
|
||||
|
||||
nextEmulator = new AmstradCPC(
|
||||
nextComm,
|
||||
xmlGame.Assets.Select(a => a.Value), //.First(),
|
||||
cpcGI, // GameInfo.NullInstance,
|
||||
(AmstradCPC.AmstradCPCSettings)GetCoreSettings<AmstradCPC>(),
|
||||
(AmstradCPC.AmstradCPCSyncSettings)GetCoreSyncSettings<AmstradCPC>());
|
||||
break;
|
||||
case "PSX":
|
||||
nextEmulator = new AmstradCPC(
|
||||
nextComm,
|
||||
xmlGame.Assets.Select(a => a.Value), //.First(),
|
||||
cpcGI, // GameInfo.NullInstance,
|
||||
(AmstradCPC.AmstradCPCSettings)GetCoreSettings<AmstradCPC>(),
|
||||
(AmstradCPC.AmstradCPCSyncSettings)GetCoreSyncSettings<AmstradCPC>());
|
||||
break;
|
||||
case "PSX":
|
||||
var entries = xmlGame.AssetFullPaths;
|
||||
var discs = new List<Disc>();
|
||||
var discNames = new List<string>();
|
||||
|
@ -1127,23 +1127,23 @@ namespace BizHawk.Client.Common
|
|||
var c64 = new C64(nextComm, Enumerable.Repeat(rom.FileData, 1), rom.GameInfo, GetCoreSettings<C64>(), GetCoreSyncSettings<C64>());
|
||||
nextEmulator = c64;
|
||||
break;
|
||||
case "ZXSpectrum":
|
||||
var zx = new ZXSpectrum(nextComm,
|
||||
Enumerable.Repeat(rom.RomData, 1),
|
||||
Enumerable.Repeat(rom.GameInfo, 1).ToList(),
|
||||
GetCoreSettings<ZXSpectrum>(),
|
||||
GetCoreSyncSettings<ZXSpectrum>(),
|
||||
Deterministic);
|
||||
nextEmulator = zx;
|
||||
break;
|
||||
case "ZXSpectrum":
|
||||
var zx = new ZXSpectrum(nextComm,
|
||||
Enumerable.Repeat(rom.RomData, 1),
|
||||
Enumerable.Repeat(rom.GameInfo, 1).ToList(),
|
||||
GetCoreSettings<ZXSpectrum>(),
|
||||
GetCoreSyncSettings<ZXSpectrum>(),
|
||||
Deterministic);
|
||||
nextEmulator = zx;
|
||||
break;
|
||||
case "ChannelF":
|
||||
nextEmulator = new ChannelF(nextComm, game, rom.FileData, GetCoreSettings<ChannelF>(), GetCoreSyncSettings<ChannelF>());
|
||||
break;
|
||||
case "AmstradCPC":
|
||||
var cpc = new AmstradCPC(nextComm, Enumerable.Repeat(rom.RomData, 1), Enumerable.Repeat(rom.GameInfo, 1).ToList(), GetCoreSettings<AmstradCPC>(), GetCoreSyncSettings<AmstradCPC>());
|
||||
nextEmulator = cpc;
|
||||
break;
|
||||
case "GBA":
|
||||
case "AmstradCPC":
|
||||
var cpc = new AmstradCPC(nextComm, Enumerable.Repeat(rom.RomData, 1), Enumerable.Repeat(rom.GameInfo, 1).ToList(), GetCoreSettings<AmstradCPC>(), GetCoreSyncSettings<AmstradCPC>());
|
||||
nextEmulator = cpc;
|
||||
break;
|
||||
case "GBA":
|
||||
if (Global.Config.GBA_UsemGBA)
|
||||
{
|
||||
core = CoreInventory.Instance["GBA", "mGBA"];
|
||||
|
@ -1235,13 +1235,13 @@ namespace BizHawk.Client.Common
|
|||
return LoadRom(path, nextComm, false, recursiveCount + 1);
|
||||
}
|
||||
|
||||
// handle exceptions thrown by the new detected systems that bizhawk does not have cores for
|
||||
else if (ex is NoAvailableCoreException)
|
||||
{
|
||||
DoLoadErrorCallback($"{ex.Message}\n\n{ex}", system);
|
||||
}
|
||||
// handle exceptions thrown by the new detected systems that bizhawk does not have cores for
|
||||
else if (ex is NoAvailableCoreException)
|
||||
{
|
||||
DoLoadErrorCallback($"{ex.Message}\n\n{ex}", system);
|
||||
}
|
||||
|
||||
else
|
||||
else
|
||||
{
|
||||
DoLoadErrorCallback($"A core accepted the rom, but threw an exception while loading it:\n\n{ex}", system);
|
||||
}
|
||||
|
|
|
@ -203,15 +203,15 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
public static SystemInfo NeoGeoPocket { get; } = new SystemInfo("Neo-Geo Pocket", CoreSystem.NeoGeoPocket, 1);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for ZXSpectrum
|
||||
/// </summary>
|
||||
public static SystemInfo ZXSpectrum { get; } = new SystemInfo("ZX Spectrum", CoreSystem.ZXSpectrum, 2);
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for ZXSpectrum
|
||||
/// </summary>
|
||||
public static SystemInfo ZXSpectrum { get; } = new SystemInfo("ZX Spectrum", CoreSystem.ZXSpectrum, 2);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for AmstradCPC
|
||||
/// </summary>
|
||||
public static SystemInfo AmstradCPC { get; } = new SystemInfo("Amstrad CPC", CoreSystem.AmstradCPC, 2);
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for AmstradCPC
|
||||
/// </summary>
|
||||
public static SystemInfo AmstradCPC { get; } = new SystemInfo("Amstrad CPC", CoreSystem.AmstradCPC, 2);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SystemInfo"/> instance for GGL
|
||||
|
|
|
@ -83,12 +83,12 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (hf.IsArchive)
|
||||
{
|
||||
var archiveItem = hf.ArchiveItems.First(ai => ai.Name == filename.Split('|').Skip(1).First());
|
||||
var archiveItem = hf.ArchiveItems.First(ai => ai.Name == filename.Split('|').Skip(1).First());
|
||||
hf.Unbind();
|
||||
hf.BindArchiveMember(archiveItem);
|
||||
data = hf.GetStream().ReadAllBytes();
|
||||
|
||||
filename = filename.Split('|').Skip(1).First();
|
||||
filename = filename.Split('|').Skip(1).First();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -295,19 +295,19 @@ namespace BizHawk.Client.Common
|
|||
new PathEntry { System = "C64", SystemDisplayName = "Commodore 64", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "C64", SystemDisplayName = "Commodore 64", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Base", Path = Path.Combine(".", "ZXSpectrum"), Ordinal = 0 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Base", Path = Path.Combine(".", "ZXSpectrum"), Ordinal = 0 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "ZXSpectrum", SystemDisplayName = "Sinclair ZX Spectrum", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Base", Path = Path.Combine(".", "AmstradCPC"), Ordinal = 0 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Base", Path = Path.Combine(".", "AmstradCPC"), Ordinal = 0 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
|
||||
new PathEntry { System = "AmstradCPC", SystemDisplayName = "Amstrad CPC", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
|
||||
|
||||
new PathEntry { System = "PSX", SystemDisplayName = "Playstation", Type = "Base", Path = Path.Combine(".", "PSX"), Ordinal = 0 },
|
||||
new PathEntry { System = "PSX", SystemDisplayName = "Playstation", Type = "Base", Path = Path.Combine(".", "PSX"), Ordinal = 0 },
|
||||
new PathEntry { System = "PSX", SystemDisplayName = "Playstation", Type = "ROM", Path = ".", Ordinal = 1 },
|
||||
new PathEntry { System = "PSX", SystemDisplayName = "Playstation", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
|
||||
new PathEntry { System = "PSX", SystemDisplayName = "Playstation", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
|
||||
|
|
|
@ -18,23 +18,23 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "userdata";
|
||||
|
||||
[LuaMethodExample("userdata.set(\"Unique key\", \"Current key data\");")]
|
||||
[LuaMethodExample("userdata.set(\"Unique key\", \"Current key data\");")]
|
||||
[LuaMethod("set", "adds or updates the data with the given key with the given value")]
|
||||
public void Set(string name, object value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
var t = value.GetType();
|
||||
if (!t.IsPrimitive && t != typeof(string))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid type for userdata");
|
||||
}
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
var t = value.GetType();
|
||||
if (!t.IsPrimitive && t != typeof(string))
|
||||
{
|
||||
throw new InvalidOperationException("Invalid type for userdata");
|
||||
}
|
||||
}
|
||||
|
||||
Global.UserBag[name] = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local obuseget = userdata.get( \"Unique key\" );")]
|
||||
[LuaMethodExample("local obuseget = userdata.get( \"Unique key\" );")]
|
||||
[LuaMethod("get", "gets the data with the given key, if the key does not exist it will return nil")]
|
||||
public object Get(string key)
|
||||
{
|
||||
|
@ -46,21 +46,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
return null;
|
||||
}
|
||||
|
||||
[LuaMethodExample("userdata.clear( );")]
|
||||
[LuaMethodExample("userdata.clear( );")]
|
||||
[LuaMethod("clear", "clears all user data")]
|
||||
public void Clear()
|
||||
{
|
||||
Global.UserBag.Clear();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( userdata.remove( \"Unique key\" ) ) then\r\n\tconsole.log( \"remove the data with the given key.Returns true if the element is successfully found and removed; otherwise, false.\" );\r\nend;")]
|
||||
[LuaMethodExample("if ( userdata.remove( \"Unique key\" ) ) then\r\n\tconsole.log( \"remove the data with the given key.Returns true if the element is successfully found and removed; otherwise, false.\" );\r\nend;")]
|
||||
[LuaMethod("remove", "remove the data with the given key. Returns true if the element is successfully found and removed; otherwise, false.")]
|
||||
public bool Remove(string key)
|
||||
{
|
||||
return Global.UserBag.Remove(key);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( userdata.containskey( \"Unique key\" ) ) then\r\n\tconsole.log( \"returns whether or not there is an entry for the given key\" );\r\nend;")]
|
||||
[LuaMethodExample("if ( userdata.containskey( \"Unique key\" ) ) then\r\n\tconsole.log( \"returns whether or not there is an entry for the given key\" );\r\nend;")]
|
||||
[LuaMethod("containskey", "returns whether or not there is an entry for the given key")]
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
|
|
|
@ -61,18 +61,18 @@ namespace BizHawk.Client.Common
|
|||
["C64_DREAN"] = PALNCarrier * 2 / 7 / 312 / 65,
|
||||
["INTV"] = 59.92,
|
||||
|
||||
["ZXSpectrum_PAL"] = 50.080128205,
|
||||
["AmstradCPC_PAL"] = 50.08012820512821,
|
||||
["ZXSpectrum_PAL"] = 50.080128205,
|
||||
["AmstradCPC_PAL"] = 50.08012820512821,
|
||||
|
||||
// according to ryphecha, using
|
||||
// clocks[2] = { 53.693182e06, 53.203425e06 }; //ntsc console, pal console
|
||||
// lpf[2][2] = { { 263, 262.5 }, { 314, 312.5 } }; //ntsc,pal; noninterlaced, interlaced
|
||||
// cpl[2] = { 3412.5, 3405 }; //ntsc mode, pal mode
|
||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 0 --- 59.826106 (53.693182e06/(263*3412.5))
|
||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 1 --- 59.940060 (53.693182e06/(262.5*3412.5))
|
||||
// PAL PS1: 1, PAL Mode: 1, Interlaced: 0 --- 49.761427 (53.203425e06/(314*3405))
|
||||
// PAL PS1: 1, PAL Mode: 1, Interlaced: 1 --- 50.000282(53.203425e06/(312.5*3405))
|
||||
};
|
||||
// according to ryphecha, using
|
||||
// clocks[2] = { 53.693182e06, 53.203425e06 }; //ntsc console, pal console
|
||||
// lpf[2][2] = { { 263, 262.5 }, { 314, 312.5 } }; //ntsc,pal; noninterlaced, interlaced
|
||||
// cpl[2] = { 3412.5, 3405 }; //ntsc mode, pal mode
|
||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 0 --- 59.826106 (53.693182e06/(263*3412.5))
|
||||
// PAL PS1: 0, PAL Mode: 0, Interlaced: 1 --- 59.940060 (53.693182e06/(262.5*3412.5))
|
||||
// PAL PS1: 1, PAL Mode: 1, Interlaced: 0 --- 49.761427 (53.203425e06/(314*3405))
|
||||
// PAL PS1: 1, PAL Mode: 1, Interlaced: 1 --- 50.000282(53.203425e06/(312.5*3405))
|
||||
};
|
||||
|
||||
public double this[string systemId, bool pal]
|
||||
{
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace BizHawk.Client.Common
|
|||
["Cursor Left/Right"] = 'l',
|
||||
["Space"] = '_'
|
||||
},
|
||||
["ZXSpectrum"] = new Dictionary<string, char>
|
||||
["ZXSpectrum"] = new Dictionary<string, char>
|
||||
{
|
||||
["Caps Shift"] = '^',
|
||||
["Caps Lock"] = 'L',
|
||||
|
@ -311,13 +311,13 @@ namespace BizHawk.Client.Common
|
|||
["Insert Previous Disk"] = '{',
|
||||
["Get Disk Status"] = 's',
|
||||
["Return"] = 'e',
|
||||
["Space"] = '-',
|
||||
["Up Cursor"] = 'u',
|
||||
["Down Cursor"] = 'd',
|
||||
["Left Cursor"] = 'l',
|
||||
["Right Cursor"] = 'r'
|
||||
},
|
||||
["N64"] = new Dictionary<string, char>
|
||||
["Space"] = '-',
|
||||
["Up Cursor"] = 'u',
|
||||
["Down Cursor"] = 'd',
|
||||
["Left Cursor"] = 'l',
|
||||
["Right Cursor"] = 'r'
|
||||
},
|
||||
["N64"] = new Dictionary<string, char>
|
||||
{
|
||||
["C Up"] = 'u',
|
||||
["C Down"] = 'd',
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace BizHawk.Client.Common
|
|||
WasLagged = _lagLog.History(index + 1)
|
||||
};
|
||||
|
||||
public TasMovie(string path, bool startsFromSavestate = false, BackgroundWorker progressReportWorker = null)
|
||||
public TasMovie(string path, bool startsFromSavestate = false, BackgroundWorker progressReportWorker = null)
|
||||
: base(path)
|
||||
{
|
||||
// TODO: how to call the default constructor AND the base(path) constructor? And is base(path) calling base() ?
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
UpdateValues();
|
||||
|
||||
{
|
||||
UpdateValues();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine(CurrentFrame.ToString());
|
||||
sb.AppendLine(CurrentBranch.ToString());
|
||||
|
|
|
@ -237,11 +237,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public int Count => _watchList.Count;
|
||||
|
||||
public Settings.SearchMode Mode => _settings.Mode;
|
||||
public Settings.SearchMode Mode => _settings.Mode;
|
||||
|
||||
public MemoryDomain Domain => _settings.Domain;
|
||||
public MemoryDomain Domain => _settings.Domain;
|
||||
|
||||
public Compare CompareTo
|
||||
public Compare CompareTo
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -53,10 +53,10 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
public override int Previous => 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ignore that stuff
|
||||
/// </summary>
|
||||
public override string ValueString => Notes; //"";
|
||||
/// <summary>
|
||||
/// Ignore that stuff
|
||||
/// </summary>
|
||||
public override string ValueString => Notes; //"";
|
||||
|
||||
/// <summary>
|
||||
/// Ignore that stuff
|
||||
|
|
|
@ -26,13 +26,13 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ReferenceEquals(y, null))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ReferenceEquals(x, y))
|
||||
{
|
||||
return true;
|
||||
|
|
|
@ -64,10 +64,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
DrawFinish();
|
||||
_GUISurface = GlobalWin.DisplayManager.LockLuaSurface(name, clear ?? true);
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
Console.WriteLine(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
_GUISurface = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Helpers
|
||||
|
@ -149,13 +149,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.OSD.AddMessage(message);
|
||||
}
|
||||
|
||||
public void ClearGraphics()
|
||||
public void ClearGraphics()
|
||||
{
|
||||
_GUISurface.Clear();
|
||||
DrawFinish();
|
||||
}
|
||||
|
||||
public void ClearText()
|
||||
public void ClearText()
|
||||
{
|
||||
GlobalWin.OSD.ClearGUIText();
|
||||
}
|
||||
|
@ -571,53 +571,53 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
public void DrawText(int x, int y, string message, Color? forecolor = null, Color? backcolor = null, string fontfamily = null)
|
||||
{
|
||||
using (var g = GetGraphics())
|
||||
{
|
||||
try
|
||||
{
|
||||
var index = 0;
|
||||
if (string.IsNullOrEmpty(fontfamily))
|
||||
{
|
||||
index = _defaultPixelFont;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (fontfamily)
|
||||
{
|
||||
case "fceux":
|
||||
case "0":
|
||||
index = 0;
|
||||
break;
|
||||
case "gens":
|
||||
case "1":
|
||||
index = 1;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"Unable to find font family: {fontfamily}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
using (var g = GetGraphics())
|
||||
{
|
||||
try
|
||||
{
|
||||
var index = 0;
|
||||
if (string.IsNullOrEmpty(fontfamily))
|
||||
{
|
||||
index = _defaultPixelFont;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (fontfamily)
|
||||
{
|
||||
case "fceux":
|
||||
case "0":
|
||||
index = 0;
|
||||
break;
|
||||
case "gens":
|
||||
case "1":
|
||||
index = 1;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine($"Unable to find font family: {fontfamily}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var f = new StringFormat(StringFormat.GenericTypographic)
|
||||
{
|
||||
FormatFlags = StringFormatFlags.MeasureTrailingSpaces
|
||||
};
|
||||
var font = new Font(GlobalWin.DisplayManager.CustomFonts.Families[index], 8, FontStyle.Regular, GraphicsUnit.Pixel);
|
||||
Size sizeOfText = g.MeasureString(message, font, 0, f).ToSize();
|
||||
var rect = new Rectangle(new Point(x, y), sizeOfText + new Size(1, 0));
|
||||
if (backcolor.HasValue) g.FillRectangle(GetBrush(backcolor.Value), rect);
|
||||
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
g.DrawString(message, font, GetBrush(forecolor ?? _defaultForeground), x, y);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
var f = new StringFormat(StringFormat.GenericTypographic)
|
||||
{
|
||||
FormatFlags = StringFormatFlags.MeasureTrailingSpaces
|
||||
};
|
||||
var font = new Font(GlobalWin.DisplayManager.CustomFonts.Families[index], 8, FontStyle.Regular, GraphicsUnit.Pixel);
|
||||
Size sizeOfText = g.MeasureString(message, font, 0, f).ToSize();
|
||||
var rect = new Rectangle(new Point(x, y), sizeOfText + new Size(1, 0));
|
||||
if (backcolor.HasValue) g.FillRectangle(GetBrush(backcolor.Value), rect);
|
||||
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
g.DrawString(message, font, GetBrush(forecolor ?? _defaultForeground), x, y);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Text(int x, int y, string message, Color? forecolor = null, string anchor = null)
|
||||
public void Text(int x, int y, string message, Color? forecolor = null, string anchor = null)
|
||||
{
|
||||
var a = 0;
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ using System.Windows.Forms;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
class ArgParser
|
||||
//parses command line arguments and adds the values to a class attribute
|
||||
//default values are null for strings and false for boolean
|
||||
//the last value will overwrite previously set values
|
||||
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
|
||||
class ArgParser
|
||||
//parses command line arguments and adds the values to a class attribute
|
||||
//default values are null for strings and false for boolean
|
||||
//the last value will overwrite previously set values
|
||||
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
|
||||
{
|
||||
public string cmdRom = null;
|
||||
public string cmdLoadSlot = null;
|
||||
|
@ -22,8 +22,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string cmdDumpName = null;
|
||||
public HashSet<int> _currAviWriterFrameList;
|
||||
public int _autoDumpLength;
|
||||
public bool _autoCloseOnDump = false;
|
||||
// chrome is never shown, even in windowed mode
|
||||
public bool _autoCloseOnDump = false;
|
||||
// chrome is never shown, even in windowed mode
|
||||
public bool _chromeless = false;
|
||||
public bool startFullscreen = false;
|
||||
public string luaScript = null;
|
||||
|
@ -38,12 +38,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void ParseArguments(string[] args)
|
||||
{
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
|
||||
{
|
||||
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
|
||||
if (args[i] == ">")
|
||||
{
|
||||
i++;
|
||||
var stdout = args[i];
|
||||
var stdout = args[i];
|
||||
Console.SetOut(new StreamWriter(stdout));
|
||||
continue;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
cmdLoadState = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
if (arg.StartsWith("--config="))
|
||||
{
|
||||
{
|
||||
cmdConfigFile = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--movie="))
|
||||
|
@ -78,9 +78,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
foreach (string item in items)
|
||||
{
|
||||
_currAviWriterFrameList.Add(int.Parse(item));
|
||||
}
|
||||
|
||||
// automatically set dump length to maximum frame
|
||||
}
|
||||
|
||||
// automatically set dump length to maximum frame
|
||||
_autoDumpLength = _currAviWriterFrameList.OrderBy(x => x).Last();
|
||||
}
|
||||
else if (arg.StartsWith("--dump-name="))
|
||||
|
@ -132,20 +132,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
URL_post = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--audiosync="))
|
||||
{
|
||||
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
|
||||
else if (arg.StartsWith("--audiosync="))
|
||||
{
|
||||
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdRom = args[i];
|
||||
}
|
||||
}
|
||||
|
||||
//initialize HTTP communication
|
||||
}
|
||||
|
||||
//initialize HTTP communication
|
||||
if (URL_get != null || URL_post != null)
|
||||
{
|
||||
GlobalWin.httpCommunication = new Communication.HttpCommunication();
|
||||
GlobalWin.httpCommunication = new Communication.HttpCommunication();
|
||||
if (URL_get != null)
|
||||
{
|
||||
GlobalWin.httpCommunication.GetUrl = URL_get;
|
||||
|
@ -154,20 +154,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GlobalWin.httpCommunication.PostUrl = URL_post;
|
||||
}
|
||||
}
|
||||
|
||||
//inititalize socket server
|
||||
}
|
||||
|
||||
//inititalize socket server
|
||||
if (socket_ip != null && socket_port > 0)
|
||||
{
|
||||
{
|
||||
GlobalWin.socketServer = new Communication.SocketServer();
|
||||
GlobalWin.socketServer.SetIp(socket_ip, socket_port);
|
||||
}
|
||||
else if (socket_ip == null ^ socket_port == 0)
|
||||
{
|
||||
throw new ArgParserException("Socket server needs both --socket_ip and --socket_port. Socket server was not started");
|
||||
}
|
||||
|
||||
//initialize mapped memory files
|
||||
}
|
||||
|
||||
//initialize mapped memory files
|
||||
if (mmf_filename != null)
|
||||
{
|
||||
GlobalWin.memoryMappedFiles = new Communication.MemoryMappedFiles();
|
||||
|
@ -176,19 +176,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
public static string GetCmdConfigFile(string[] args)
|
||||
{
|
||||
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
|
||||
{
|
||||
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
|
||||
}
|
||||
}
|
||||
|
||||
class ArgParserException : Exception
|
||||
{
|
||||
public ArgParserException()
|
||||
{
|
||||
}
|
||||
|
||||
public ArgParserException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class ArgParserException : Exception
|
||||
{
|
||||
public ArgParserException()
|
||||
{
|
||||
}
|
||||
|
||||
public ArgParserException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
|
||||
namespace BizHawk.Client.EmuHawk.CustomControls
|
||||
{
|
||||
public class GdiPlusRenderer : IControlRenderer
|
||||
|
@ -50,18 +50,18 @@ namespace BizHawk.Client.EmuHawk.CustomControls
|
|||
}
|
||||
|
||||
public void DrawString(string str, Point point)
|
||||
{
|
||||
if (_rotateString)
|
||||
{
|
||||
_graphics.TranslateTransform(point.X, point.Y);
|
||||
_graphics.RotateTransform(90);
|
||||
_graphics.DrawString(str, _currentFont, _currentStringBrush, Point.Empty);
|
||||
_graphics.ResetTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
_graphics.DrawString(str, _currentFont, _currentStringBrush, point);
|
||||
}
|
||||
{
|
||||
if (_rotateString)
|
||||
{
|
||||
_graphics.TranslateTransform(point.X, point.Y);
|
||||
_graphics.RotateTransform(90);
|
||||
_graphics.DrawString(str, _currentFont, _currentStringBrush, Point.Empty);
|
||||
_graphics.ResetTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
_graphics.DrawString(str, _currentFont, _currentStringBrush, point);
|
||||
}
|
||||
}
|
||||
|
||||
public void FillRectangle(int x, int y, int w, int h)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
@ -8,7 +8,7 @@ using BizHawk.Client.EmuHawk.WinFormExtensions;
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class InputRoll
|
||||
{
|
||||
{
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
using (_renderer.LockGraphics(e.Graphics, Width, Height))
|
||||
|
@ -73,33 +73,33 @@ namespace BizHawk.Client.EmuHawk
|
|||
_horizontalColumnHeights = null;
|
||||
_horizontalColumnTops = null;
|
||||
return;
|
||||
}
|
||||
|
||||
_horizontalColumnHeights = new int[visibleColumns.Count];
|
||||
_horizontalColumnTops = new int[visibleColumns.Count];
|
||||
|
||||
int top = 0;
|
||||
int startRow = FirstVisibleRow;
|
||||
for (int j = 0; j < visibleColumns.Count; j++)
|
||||
{
|
||||
RollColumn col = visibleColumns[j];
|
||||
int height = CellHeight;
|
||||
if (col.Rotatable && col.RotatedHeight != null)
|
||||
{
|
||||
height = Math.Max(height, col.RotatedHeight.Value);
|
||||
}
|
||||
else if (col.Rotatable)
|
||||
{
|
||||
string text;
|
||||
int strOffsetX = 0;
|
||||
int strOffsetY = 0;
|
||||
QueryItemText(startRow, col, out text, ref strOffsetX, ref strOffsetY);
|
||||
int textWidth = _renderer.MeasureString(text, _font).Width;
|
||||
height = Math.Max(height, textWidth + (CellWidthPadding * 2));
|
||||
}
|
||||
_horizontalColumnHeights[j] = height;
|
||||
_horizontalColumnTops[j] = top;
|
||||
top += height;
|
||||
}
|
||||
|
||||
_horizontalColumnHeights = new int[visibleColumns.Count];
|
||||
_horizontalColumnTops = new int[visibleColumns.Count];
|
||||
|
||||
int top = 0;
|
||||
int startRow = FirstVisibleRow;
|
||||
for (int j = 0; j < visibleColumns.Count; j++)
|
||||
{
|
||||
RollColumn col = visibleColumns[j];
|
||||
int height = CellHeight;
|
||||
if (col.Rotatable && col.RotatedHeight != null)
|
||||
{
|
||||
height = Math.Max(height, col.RotatedHeight.Value);
|
||||
}
|
||||
else if (col.Rotatable)
|
||||
{
|
||||
string text;
|
||||
int strOffsetX = 0;
|
||||
int strOffsetY = 0;
|
||||
QueryItemText(startRow, col, out text, ref strOffsetX, ref strOffsetY);
|
||||
int textWidth = _renderer.MeasureString(text, _font).Width;
|
||||
height = Math.Max(height, textWidth + (CellWidthPadding * 2));
|
||||
}
|
||||
_horizontalColumnHeights[j] = height;
|
||||
_horizontalColumnTops[j] = top;
|
||||
top += height;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,15 +228,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (HorizontalOrientation)
|
||||
{
|
||||
int startRow = FirstVisibleRow;
|
||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||
|
||||
_renderer.PrepDrawString(_font, _foreColor);
|
||||
int lastVisible = LastVisibleColumnIndex;
|
||||
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
||||
{
|
||||
RollColumn col = visibleColumns[j];
|
||||
int colHeight = GetHColHeight(j);
|
||||
|
||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startRow + 1;
|
||||
|
||||
_renderer.PrepDrawString(_font, _foreColor);
|
||||
int lastVisible = LastVisibleColumnIndex;
|
||||
for (int j = FirstVisibleColumn; j <= lastVisible; j++)
|
||||
{
|
||||
RollColumn col = visibleColumns[j];
|
||||
int colHeight = GetHColHeight(j);
|
||||
|
||||
for (int i = 0, f = 0; f < range; i++, f++)
|
||||
{
|
||||
f += _lagFrames[i];
|
||||
|
@ -268,7 +268,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
int textWidth = _renderer.MeasureString(text, _font).Width;
|
||||
if (col.Rotatable)
|
||||
{
|
||||
// Center Text
|
||||
// Center Text
|
||||
int textX = Math.Max(((colHeight - textWidth) / 2), CellWidthPadding) + strOffsetX;
|
||||
int textY = CellWidthPadding + strOffsetY;
|
||||
var point = new Point(baseX - textY, baseY + textX);
|
||||
|
@ -278,10 +278,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
_renderer.PrepDrawString(_font, _foreColor, rotate: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center Text
|
||||
int textX = Math.Max(((CellWidth - textWidth) / 2), CellWidthPadding) + strOffsetX;
|
||||
int textY = CellHeightPadding + strOffsetY;
|
||||
{
|
||||
// Center Text
|
||||
int textX = Math.Max(((CellWidth - textWidth) / 2), CellWidthPadding) + strOffsetX;
|
||||
int textY = CellHeightPadding + strOffsetY;
|
||||
var point = new Point(baseX + textX, baseY + textY);
|
||||
|
||||
DrawString(text, ColumnWidth, point);
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int _maxCharactersInHorizontal = 1;
|
||||
|
||||
private int _rowCount;
|
||||
private Size _charSize;
|
||||
|
||||
// Updated on paint
|
||||
private Size _charSize;
|
||||
|
||||
// Updated on paint
|
||||
private int[] _horizontalColumnHeights;
|
||||
private int[] _horizontalColumnTops;
|
||||
|
||||
|
@ -94,11 +94,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
using (var g = CreateGraphics())
|
||||
using (_renderer.LockGraphics(g, Width, Height))
|
||||
{
|
||||
// Measure width change to ignore extra padding at start/end
|
||||
var size1 = _renderer.MeasureString("A", _font);
|
||||
var size2 = _renderer.MeasureString("AA", _font);
|
||||
_charSize = new Size(size2.Width - size1.Width, size1.Height); // TODO make this a property so changing it updates other values.
|
||||
{
|
||||
// Measure width change to ignore extra padding at start/end
|
||||
var size1 = _renderer.MeasureString("A", _font);
|
||||
var size2 = _renderer.MeasureString("AA", _font);
|
||||
_charSize = new Size(size2.Width - size1.Width, size1.Height); // TODO make this a property so changing it updates other values.
|
||||
}
|
||||
|
||||
UpdateCellSize();
|
||||
|
@ -1631,7 +1631,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
UpdateDrawSize();
|
||||
|
||||
var columns = _columns.VisibleColumns.ToList();
|
||||
var columns = _columns.VisibleColumns.ToList();
|
||||
int iLastColumn = columns.Count - 1;
|
||||
|
||||
if (HorizontalOrientation)
|
||||
|
@ -1896,13 +1896,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (RollColumn column in _columns.VisibleColumns)
|
||||
{
|
||||
if (column.Left.Value - _hBar.Value <= pixel && column.Right.Value - _hBar.Value >= pixel)
|
||||
{
|
||||
return column;
|
||||
}
|
||||
{
|
||||
foreach (RollColumn column in _columns.VisibleColumns)
|
||||
{
|
||||
if (column.Left.Value - _hBar.Value <= pixel && column.Right.Value - _hBar.Value >= pixel)
|
||||
{
|
||||
return column;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -1940,13 +1940,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
private int GetHColHeight(int index) =>
|
||||
_horizontalColumnHeights != null && index < _horizontalColumnHeights.Length ? _horizontalColumnHeights[index] : CellHeight;
|
||||
|
||||
private int GetHColTop(int index) =>
|
||||
_horizontalColumnTops != null && index < _horizontalColumnTops.Length ? _horizontalColumnTops[index] : (index * CellHeight);
|
||||
|
||||
private int GetHColBottom(int index) =>
|
||||
GetHColTop(index) + GetHColHeight(index);
|
||||
|
||||
// The width of the largest column cell in Horizontal Orientation
|
||||
private int GetHColTop(int index) =>
|
||||
_horizontalColumnTops != null && index < _horizontalColumnTops.Length ? _horizontalColumnTops[index] : (index * CellHeight);
|
||||
|
||||
private int GetHColBottom(int index) =>
|
||||
GetHColTop(index) + GetHColHeight(index);
|
||||
|
||||
// The width of the largest column cell in Horizontal Orientation
|
||||
private int ColumnWidth { get; set; }
|
||||
|
||||
// The height of a column cell in Vertical Orientation.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
|
||||
using System;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public class RollColumn
|
||||
|
@ -18,13 +18,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
public bool Emphasis { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Column header text will be drawn rotated, if true
|
||||
/// <summary>
|
||||
/// Column header text will be drawn rotated, if true
|
||||
/// </summary>
|
||||
public bool Rotatable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If drawn rotated, specifies the desired height, or null to auto-size
|
||||
/// <summary>
|
||||
/// If drawn rotated, specifies the desired height, or null to auto-size
|
||||
/// </summary>
|
||||
public int? RotatedHeight { get; set; }
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ using System.Drawing;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Cores;
|
||||
using BizHawk.Emulation.Cores.Libretro;
|
||||
|
@ -129,13 +129,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
Result = AdvancedRomLoaderType.LibretroLaunchGame;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnMAMELaunchGame_Click(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void btnMAMELaunchGame_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result = AdvancedRomLoaderType.MAMELaunchGame;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void btnClassicLaunchGame_Click(object sender, EventArgs e)
|
||||
|
@ -172,6 +172,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
Global.Config.LibretroCore = filePaths[0];
|
||||
RefreshLibretroCore(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,47 +21,47 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings = ((AmstradCPC)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
// AY panning config
|
||||
var panTypes = Enum.GetNames(typeof(AY38912.AYPanConfig));
|
||||
// AY panning config
|
||||
var panTypes = Enum.GetNames(typeof(AY38912.AYPanConfig));
|
||||
foreach (var val in panTypes)
|
||||
{
|
||||
panTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
panTypecomboBox1.SelectedItem = _settings.AYPanConfig.ToString();
|
||||
}
|
||||
panTypecomboBox1.SelectedItem = _settings.AYPanConfig.ToString();
|
||||
|
||||
// tape volume
|
||||
tapeVolumetrackBar.Value = _settings.TapeVolume;
|
||||
// tape volume
|
||||
tapeVolumetrackBar.Value = _settings.TapeVolume;
|
||||
|
||||
// ay volume
|
||||
ayVolumetrackBar.Value = _settings.AYVolume;
|
||||
// ay volume
|
||||
ayVolumetrackBar.Value = _settings.AYVolume;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_settings.AYPanConfig.ToString() != panTypecomboBox1.SelectedItem.ToString()
|
||||
|| _settings.TapeVolume != tapeVolumetrackBar.Value
|
||||
|| _settings.AYVolume != ayVolumetrackBar.Value;
|
||||
bool changed =
|
||||
_settings.AYPanConfig.ToString() != panTypecomboBox1.SelectedItem.ToString()
|
||||
|| _settings.TapeVolume != tapeVolumetrackBar.Value
|
||||
|| _settings.AYVolume != ayVolumetrackBar.Value;
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_settings.AYPanConfig = (AY38912.AYPanConfig)Enum.Parse(typeof(AY38912.AYPanConfig), panTypecomboBox1.SelectedItem.ToString());
|
||||
_settings.AYPanConfig = (AY38912.AYPanConfig)Enum.Parse(typeof(AY38912.AYPanConfig), panTypecomboBox1.SelectedItem.ToString());
|
||||
|
||||
_settings.TapeVolume = tapeVolumetrackBar.Value;
|
||||
_settings.AYVolume = ayVolumetrackBar.Value;
|
||||
_settings.TapeVolume = tapeVolumetrackBar.Value;
|
||||
_settings.AYVolume = ayVolumetrackBar.Value;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -70,5 +70,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,56 +22,56 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_syncSettings = ((AmstradCPC)Global.Emulator).GetSyncSettings().Clone();
|
||||
|
||||
// machine selection
|
||||
var machineTypes = Enum.GetNames(typeof(MachineType));
|
||||
// machine selection
|
||||
var machineTypes = Enum.GetNames(typeof(MachineType));
|
||||
foreach (var val in machineTypes)
|
||||
{
|
||||
MachineSelectionComboBox.Items.Add(val);
|
||||
}
|
||||
MachineSelectionComboBox.SelectedItem = _syncSettings.MachineType.ToString();
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString()));
|
||||
}
|
||||
MachineSelectionComboBox.SelectedItem = _syncSettings.MachineType.ToString();
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString()));
|
||||
|
||||
// border selecton
|
||||
var borderTypes = Enum.GetNames(typeof(AmstradCPC.BorderType));
|
||||
foreach (var val in borderTypes)
|
||||
{
|
||||
borderTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
borderTypecomboBox1.SelectedItem = _syncSettings.BorderType.ToString();
|
||||
UpdateBorderNotes((AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), borderTypecomboBox1.SelectedItem.ToString()));
|
||||
// border selecton
|
||||
var borderTypes = Enum.GetNames(typeof(AmstradCPC.BorderType));
|
||||
foreach (var val in borderTypes)
|
||||
{
|
||||
borderTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
borderTypecomboBox1.SelectedItem = _syncSettings.BorderType.ToString();
|
||||
UpdateBorderNotes((AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), borderTypecomboBox1.SelectedItem.ToString()));
|
||||
|
||||
// deterministic emulation
|
||||
determEmucheckBox1.Checked = _syncSettings.DeterministicEmulation;
|
||||
// deterministic emulation
|
||||
determEmucheckBox1.Checked = _syncSettings.DeterministicEmulation;
|
||||
|
||||
// autoload tape
|
||||
autoLoadcheckBox1.Checked = _syncSettings.AutoStartStopTape;
|
||||
}
|
||||
// autoload tape
|
||||
autoLoadcheckBox1.Checked = _syncSettings.AutoStartStopTape;
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_syncSettings.MachineType.ToString() != MachineSelectionComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.BorderType.ToString() != borderTypecomboBox1.SelectedItem.ToString()
|
||||
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked
|
||||
|| _syncSettings.AutoStartStopTape != autoLoadcheckBox1.Checked;
|
||||
bool changed =
|
||||
_syncSettings.MachineType.ToString() != MachineSelectionComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.BorderType.ToString() != borderTypecomboBox1.SelectedItem.ToString()
|
||||
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked
|
||||
|| _syncSettings.AutoStartStopTape != autoLoadcheckBox1.Checked;
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_syncSettings.MachineType = (MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString());
|
||||
_syncSettings.BorderType = (AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), borderTypecomboBox1.SelectedItem.ToString());
|
||||
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
|
||||
_syncSettings.AutoStartStopTape = autoLoadcheckBox1.Checked;
|
||||
_syncSettings.MachineType = (MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString());
|
||||
_syncSettings.BorderType = (AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), borderTypecomboBox1.SelectedItem.ToString());
|
||||
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
|
||||
_syncSettings.AutoStartStopTape = autoLoadcheckBox1.Checked;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -81,38 +81,38 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void MachineSelectionComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
private void MachineSelectionComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void UpdateMachineNotes(MachineType type)
|
||||
{
|
||||
textBoxMachineNotes.Text = CPCMachineMetaData.GetMetaString(type);
|
||||
}
|
||||
private void UpdateMachineNotes(MachineType type)
|
||||
{
|
||||
textBoxMachineNotes.Text = CPCMachineMetaData.GetMetaString(type);
|
||||
}
|
||||
|
||||
private void borderTypecomboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateBorderNotes((AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
private void borderTypecomboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateBorderNotes((AmstradCPC.BorderType)Enum.Parse(typeof(AmstradCPC.BorderType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void UpdateBorderNotes(AmstradCPC.BorderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AmstradCPC.BorderType.Uniform:
|
||||
lblBorderInfo.Text = "Attempts to equalise the border areas";
|
||||
break;
|
||||
case AmstradCPC.BorderType.Uncropped:
|
||||
lblBorderInfo.Text = "Pretty much the signal the gate array is generating (looks pants)";
|
||||
break;
|
||||
private void UpdateBorderNotes(AmstradCPC.BorderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AmstradCPC.BorderType.Uniform:
|
||||
lblBorderInfo.Text = "Attempts to equalise the border areas";
|
||||
break;
|
||||
case AmstradCPC.BorderType.Uncropped:
|
||||
lblBorderInfo.Text = "Pretty much the signal the gate array is generating (looks pants)";
|
||||
break;
|
||||
|
||||
case AmstradCPC.BorderType.Widescreen:
|
||||
lblBorderInfo.Text = "Top and bottom border removed so that the result is *almost* 16:9";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
case AmstradCPC.BorderType.Widescreen:
|
||||
lblBorderInfo.Text = "Top and bottom border removed so that the result is *almost* 16:9";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,37 +21,37 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings = ((AmstradCPC)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
|
||||
|
||||
|
||||
// OSD Message Verbosity
|
||||
var osdTypes = Enum.GetNames(typeof(AmstradCPC.OSDVerbosity));
|
||||
foreach (var val in osdTypes)
|
||||
{
|
||||
osdMessageVerbositycomboBox1.Items.Add(val);
|
||||
}
|
||||
osdMessageVerbositycomboBox1.SelectedItem = _settings.OSDMessageVerbosity.ToString();
|
||||
UpdateOSDNotes((AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString()));
|
||||
}
|
||||
// OSD Message Verbosity
|
||||
var osdTypes = Enum.GetNames(typeof(AmstradCPC.OSDVerbosity));
|
||||
foreach (var val in osdTypes)
|
||||
{
|
||||
osdMessageVerbositycomboBox1.Items.Add(val);
|
||||
}
|
||||
osdMessageVerbositycomboBox1.SelectedItem = _settings.OSDMessageVerbosity.ToString();
|
||||
UpdateOSDNotes((AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString();
|
||||
bool changed =
|
||||
_settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString();
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_settings.OSDMessageVerbosity = (AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
|
||||
_settings.OSDMessageVerbosity = (AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -61,26 +61,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void UpdateOSDNotes(AmstradCPC.OSDVerbosity type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AmstradCPC.OSDVerbosity.Full:
|
||||
lblOSDVerbinfo.Text = "Show all OSD messages";
|
||||
break;
|
||||
case AmstradCPC.OSDVerbosity.Medium:
|
||||
lblOSDVerbinfo.Text = "Only show machine/device generated messages";
|
||||
break;
|
||||
case AmstradCPC.OSDVerbosity.None:
|
||||
lblOSDVerbinfo.Text = "No core-driven OSD messages";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void UpdateOSDNotes(AmstradCPC.OSDVerbosity type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case AmstradCPC.OSDVerbosity.Full:
|
||||
lblOSDVerbinfo.Text = "Show all OSD messages";
|
||||
break;
|
||||
case AmstradCPC.OSDVerbosity.Medium:
|
||||
lblOSDVerbinfo.Text = "Only show machine/device generated messages";
|
||||
break;
|
||||
case AmstradCPC.OSDVerbosity.None:
|
||||
lblOSDVerbinfo.Text = "No core-driven OSD messages";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OSDComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateOSDNotes((AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), cb.SelectedItem.ToString()));
|
||||
}
|
||||
}
|
||||
private void OSDComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateOSDNotes((AmstradCPC.OSDVerbosity)Enum.Parse(typeof(AmstradCPC.OSDVerbosity), cb.SelectedItem.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ams = (AmstradCPC)Global.Emulator;
|
||||
var addr = (ushort)numericUpDownAddress.Value;
|
||||
var val = (byte)numericUpDownByte.Value;
|
||||
var ams = (AmstradCPC)Global.Emulator;
|
||||
var addr = (ushort)numericUpDownAddress.Value;
|
||||
var val = (byte)numericUpDownByte.Value;
|
||||
|
||||
ams.PokeMemory(addr, val);
|
||||
ams.PokeMemory(addr, val);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -33,5 +33,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,26 +181,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
tt.TabPages.Add(tabname);
|
||||
tt.TabPages[pageidx].Controls.Add(createpanel(settings, cat.Value, tt.Size));
|
||||
|
||||
// zxhawk hack - it uses multiple categoryLabels
|
||||
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
|
||||
pageidx++;
|
||||
// zxhawk hack - it uses multiple categoryLabels
|
||||
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
|
||||
pageidx++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (buckets[0].Count > 0)
|
||||
{
|
||||
// ZXHawk needs to skip this bit
|
||||
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
|
||||
return;
|
||||
// ZXHawk needs to skip this bit
|
||||
if (Global.Emulator.SystemId == "ZXSpectrum" || Global.Emulator.SystemId == "AmstradCPC" || Global.Emulator.SystemId == "ChannelF")
|
||||
return;
|
||||
|
||||
string tabname =
|
||||
string tabname =
|
||||
(Global.Emulator.SystemId == "C64") ? "Keyboard" :
|
||||
(Global.Emulator.SystemId == "MAME") ? "Misc" :
|
||||
"Console"; // hack
|
||||
tt.TabPages.Add(tabname);
|
||||
tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[0], tt.Size));
|
||||
}
|
||||
}
|
||||
tt.TabPages.Add(tabname);
|
||||
tt.TabPages[pageidx].Controls.Add(createpanel(settings, buckets[0], tt.Size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ControllerConfig(ControllerDefinition def)
|
||||
|
@ -277,27 +277,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
pictureBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;
|
||||
}
|
||||
|
||||
if (controlName == "ZXSpectrum Controller")
|
||||
{
|
||||
pictureBox1.Image = Properties.Resources.ZXSpectrumKeyboards;
|
||||
pictureBox1.Size = Properties.Resources.ZXSpectrumKeyboards.Size;
|
||||
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
|
||||
}
|
||||
if (controlName == "ZXSpectrum Controller")
|
||||
{
|
||||
pictureBox1.Image = Properties.Resources.ZXSpectrumKeyboards;
|
||||
pictureBox1.Size = Properties.Resources.ZXSpectrumKeyboards.Size;
|
||||
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
|
||||
}
|
||||
|
||||
if (controlName == "ChannelF Controller")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (controlName == "AmstradCPC Controller")
|
||||
{
|
||||
/*
|
||||
pictureBox1.Image = Properties.Resources.ZXSpectrumKeyboards;
|
||||
pictureBox1.Size = Properties.Resources.ZXSpectrumKeyboards.Size;
|
||||
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
|
||||
*/
|
||||
}
|
||||
}
|
||||
if (controlName == "AmstradCPC Controller")
|
||||
{
|
||||
/*
|
||||
pictureBox1.Image = Properties.Resources.ZXSpectrumKeyboards;
|
||||
pictureBox1.Size = Properties.Resources.ZXSpectrumKeyboards.Size;
|
||||
tableLayoutPanel1.ColumnStyles[1].Width = Properties.Resources.ZXSpectrumKeyboards.Width;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
// lazy methods, but they're not called often and actually
|
||||
// tracking all of the ControllerConfigPanels wouldn't be simpler
|
||||
|
|
|
@ -52,8 +52,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{ "GBC", "Game Boy Color" },
|
||||
{ "PCFX", "PC-FX" },
|
||||
{ "32X", "32X" },
|
||||
{ "ZXSpectrum", "ZX Spectrum" },
|
||||
{ "AmstradCPC", "Amstrad CPC" },
|
||||
{ "ZXSpectrum", "ZX Spectrum" },
|
||||
{ "AmstradCPC", "Amstrad CPC" },
|
||||
{ "ChannelF", "Channel F" },
|
||||
{ "Vectrex", "Vectrex" }
|
||||
};
|
||||
|
@ -393,81 +393,81 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
ofd.InitialDirectory = currSelectorDir;
|
||||
ofd.RestoreDirectory = true;
|
||||
string frmwarePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
|
||||
string frmwarePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// remember the location we selected this firmware from, maybe there are others
|
||||
currSelectorDir = Path.GetDirectoryName(ofd.FileName);
|
||||
|
||||
try
|
||||
{
|
||||
using (var hf = new HawkFile(ofd.FileName))
|
||||
{
|
||||
// for each selected item, set the user choice (even though multiple selection for this operation is no longer allowed)
|
||||
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
|
||||
{
|
||||
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
|
||||
string filePath = ofd.FileName;
|
||||
try
|
||||
{
|
||||
using (var hf = new HawkFile(ofd.FileName))
|
||||
{
|
||||
// for each selected item, set the user choice (even though multiple selection for this operation is no longer allowed)
|
||||
foreach (ListViewItem lvi in lvFirmwares.SelectedItems)
|
||||
{
|
||||
var fr = lvi.Tag as FirmwareDatabase.FirmwareRecord;
|
||||
string filePath = ofd.FileName;
|
||||
|
||||
// if the selected file is an archive, allow the user to pick the inside file
|
||||
// to always be copied to the global firmwares directory
|
||||
if (hf.IsArchive)
|
||||
{
|
||||
var ac = new ArchiveChooser(new HawkFile(filePath));
|
||||
int memIdx = -1;
|
||||
// if the selected file is an archive, allow the user to pick the inside file
|
||||
// to always be copied to the global firmwares directory
|
||||
if (hf.IsArchive)
|
||||
{
|
||||
var ac = new ArchiveChooser(new HawkFile(filePath));
|
||||
int memIdx = -1;
|
||||
|
||||
if (ac.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
memIdx = ac.SelectedMemberIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ac.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
memIdx = ac.SelectedMemberIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var insideFile = hf.BindArchiveMember(memIdx);
|
||||
var fileData = insideFile.ReadAllBytes();
|
||||
var insideFile = hf.BindArchiveMember(memIdx);
|
||||
var fileData = insideFile.ReadAllBytes();
|
||||
|
||||
// write to file in the firmwares folder
|
||||
File.WriteAllBytes(Path.Combine(frmwarePath, insideFile.Name), fileData);
|
||||
filePath = Path.Combine(frmwarePath, insideFile.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// selected file is not an archive
|
||||
// check whether this file is currently outside of the global firmware directory
|
||||
if (currSelectorDir != frmwarePath)
|
||||
{
|
||||
var askMoveResult = MessageBox.Show(this, "The selected custom firmware does not reside in the root of the global firmware directory.\nDo you want to copy it there?", "Import Custom Firmware", MessageBoxButtons.YesNo);
|
||||
if (askMoveResult == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
filePath = Path.Combine(frmwarePath, fi.Name);
|
||||
File.Copy(ofd.FileName, filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, $"There was an issue copying the file. The customization has NOT been set.\n\n{ex.StackTrace}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// write to file in the firmwares folder
|
||||
File.WriteAllBytes(Path.Combine(frmwarePath, insideFile.Name), fileData);
|
||||
filePath = Path.Combine(frmwarePath, insideFile.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// selected file is not an archive
|
||||
// check whether this file is currently outside of the global firmware directory
|
||||
if (currSelectorDir != frmwarePath)
|
||||
{
|
||||
var askMoveResult = MessageBox.Show(this, "The selected custom firmware does not reside in the root of the global firmware directory.\nDo you want to copy it there?", "Import Custom Firmware", MessageBoxButtons.YesNo);
|
||||
if (askMoveResult == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
filePath = Path.Combine(frmwarePath, fi.Name);
|
||||
File.Copy(ofd.FileName, filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, $"There was an issue copying the file. The customization has NOT been set.\n\n{ex.StackTrace}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Global.Config.FirmwareUserSpecifications[fr.ConfigKey] = filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, $"There was an issue during the process. The customization has NOT been set.\n\n{ex.StackTrace}");
|
||||
return;
|
||||
}
|
||||
Global.Config.FirmwareUserSpecifications[fr.ConfigKey] = filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(this, $"There was an issue during the process. The customization has NOT been set.\n\n{ex.StackTrace}");
|
||||
return;
|
||||
}
|
||||
|
||||
DoScan();
|
||||
DoScan();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -673,10 +673,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
File.WriteAllBytes(outfile, ms.ToArray());
|
||||
hf.Unbind();
|
||||
|
||||
if (cbAllowImport.Checked || Manager.CanFileBeImported(outfile))
|
||||
{
|
||||
didSomething |= RunImportJobSingle(basepath, outfile, ref errors);
|
||||
}
|
||||
if (cbAllowImport.Checked || Manager.CanFileBeImported(outfile))
|
||||
{
|
||||
didSomething |= RunImportJobSingle(basepath, outfile, ref errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
@ -686,10 +686,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
if (cbAllowImport.Checked || Manager.CanFileBeImported(hf.CanonicalFullPath))
|
||||
{
|
||||
didSomething |= RunImportJobSingle(basepath, f, ref errors);
|
||||
}
|
||||
if (cbAllowImport.Checked || Manager.CanFileBeImported(hf.CanonicalFullPath))
|
||||
{
|
||||
didSomething |= RunImportJobSingle(basepath, f, ref errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return base.ProcessCmdKey(ref msg, keyData);
|
||||
}
|
||||
|
||||
private void lvFirmwares_DragEnter(object sender, DragEventArgs e)
|
||||
private void lvFirmwares_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
|
|
@ -21,52 +21,52 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings = ((ZXSpectrum)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
// AY panning config
|
||||
var panTypes = Enum.GetNames(typeof(AY38912.AYPanConfig));
|
||||
// AY panning config
|
||||
var panTypes = Enum.GetNames(typeof(AY38912.AYPanConfig));
|
||||
foreach (var val in panTypes)
|
||||
{
|
||||
panTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
panTypecomboBox1.SelectedItem = _settings.AYPanConfig.ToString();
|
||||
}
|
||||
panTypecomboBox1.SelectedItem = _settings.AYPanConfig.ToString();
|
||||
|
||||
// tape volume
|
||||
tapeVolumetrackBar.Value = _settings.TapeVolume;
|
||||
// tape volume
|
||||
tapeVolumetrackBar.Value = _settings.TapeVolume;
|
||||
|
||||
// ear volume
|
||||
earVolumetrackBar.Value = _settings.EarVolume;
|
||||
// ear volume
|
||||
earVolumetrackBar.Value = _settings.EarVolume;
|
||||
|
||||
// ay volume
|
||||
ayVolumetrackBar.Value = _settings.AYVolume;
|
||||
// ay volume
|
||||
ayVolumetrackBar.Value = _settings.AYVolume;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_settings.AYPanConfig.ToString() != panTypecomboBox1.SelectedItem.ToString()
|
||||
|| _settings.TapeVolume != tapeVolumetrackBar.Value
|
||||
|| _settings.EarVolume != earVolumetrackBar.Value
|
||||
|| _settings.AYVolume != ayVolumetrackBar.Value;
|
||||
bool changed =
|
||||
_settings.AYPanConfig.ToString() != panTypecomboBox1.SelectedItem.ToString()
|
||||
|| _settings.TapeVolume != tapeVolumetrackBar.Value
|
||||
|| _settings.EarVolume != earVolumetrackBar.Value
|
||||
|| _settings.AYVolume != ayVolumetrackBar.Value;
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_settings.AYPanConfig = (AY38912.AYPanConfig)Enum.Parse(typeof(AY38912.AYPanConfig), panTypecomboBox1.SelectedItem.ToString());
|
||||
_settings.AYPanConfig = (AY38912.AYPanConfig)Enum.Parse(typeof(AY38912.AYPanConfig), panTypecomboBox1.SelectedItem.ToString());
|
||||
|
||||
_settings.TapeVolume = tapeVolumetrackBar.Value;
|
||||
_settings.EarVolume = earVolumetrackBar.Value;
|
||||
_settings.AYVolume = ayVolumetrackBar.Value;
|
||||
_settings.TapeVolume = tapeVolumetrackBar.Value;
|
||||
_settings.EarVolume = earVolumetrackBar.Value;
|
||||
_settings.AYVolume = ayVolumetrackBar.Value;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -75,5 +75,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,56 +21,56 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_syncSettings = ((ZXSpectrum)Global.Emulator).GetSyncSettings().Clone();
|
||||
|
||||
// machine selection
|
||||
var machineTypes = Enum.GetNames(typeof(MachineType));
|
||||
// machine selection
|
||||
var machineTypes = Enum.GetNames(typeof(MachineType));
|
||||
foreach (var val in machineTypes)
|
||||
{
|
||||
MachineSelectionComboBox.Items.Add(val);
|
||||
}
|
||||
MachineSelectionComboBox.SelectedItem = _syncSettings.MachineType.ToString();
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString()));
|
||||
}
|
||||
MachineSelectionComboBox.SelectedItem = _syncSettings.MachineType.ToString();
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString()));
|
||||
|
||||
// border selecton
|
||||
var borderTypes = Enum.GetNames(typeof(ZXSpectrum.BorderType));
|
||||
foreach (var val in borderTypes)
|
||||
{
|
||||
borderTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
borderTypecomboBox1.SelectedItem = _syncSettings.BorderType.ToString();
|
||||
UpdateBorderNotes((ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), borderTypecomboBox1.SelectedItem.ToString()));
|
||||
// border selecton
|
||||
var borderTypes = Enum.GetNames(typeof(ZXSpectrum.BorderType));
|
||||
foreach (var val in borderTypes)
|
||||
{
|
||||
borderTypecomboBox1.Items.Add(val);
|
||||
}
|
||||
borderTypecomboBox1.SelectedItem = _syncSettings.BorderType.ToString();
|
||||
UpdateBorderNotes((ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), borderTypecomboBox1.SelectedItem.ToString()));
|
||||
|
||||
// deterministic emulation
|
||||
determEmucheckBox1.Checked = _syncSettings.DeterministicEmulation;
|
||||
// deterministic emulation
|
||||
determEmucheckBox1.Checked = _syncSettings.DeterministicEmulation;
|
||||
|
||||
// autoload tape
|
||||
autoLoadcheckBox1.Checked = _syncSettings.AutoLoadTape;
|
||||
}
|
||||
// autoload tape
|
||||
autoLoadcheckBox1.Checked = _syncSettings.AutoLoadTape;
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_syncSettings.MachineType.ToString() != MachineSelectionComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.BorderType.ToString() != borderTypecomboBox1.SelectedItem.ToString()
|
||||
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked
|
||||
|| _syncSettings.AutoLoadTape != autoLoadcheckBox1.Checked;
|
||||
bool changed =
|
||||
_syncSettings.MachineType.ToString() != MachineSelectionComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.BorderType.ToString() != borderTypecomboBox1.SelectedItem.ToString()
|
||||
|| _syncSettings.DeterministicEmulation != determEmucheckBox1.Checked
|
||||
|| _syncSettings.AutoLoadTape != autoLoadcheckBox1.Checked;
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_syncSettings.MachineType = (MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString());
|
||||
_syncSettings.BorderType = (ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), borderTypecomboBox1.SelectedItem.ToString());
|
||||
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
|
||||
_syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked;
|
||||
_syncSettings.MachineType = (MachineType)Enum.Parse(typeof(MachineType), MachineSelectionComboBox.SelectedItem.ToString());
|
||||
_syncSettings.BorderType = (ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), borderTypecomboBox1.SelectedItem.ToString());
|
||||
_syncSettings.DeterministicEmulation = determEmucheckBox1.Checked;
|
||||
_syncSettings.AutoLoadTape = autoLoadcheckBox1.Checked;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -80,43 +80,43 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void MachineSelectionComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
private void MachineSelectionComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateMachineNotes((MachineType)Enum.Parse(typeof(MachineType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void UpdateMachineNotes(MachineType type)
|
||||
{
|
||||
textBoxCoreDetails.Text = ZXMachineMetaData.GetMetaString(type);
|
||||
}
|
||||
private void UpdateMachineNotes(MachineType type)
|
||||
{
|
||||
textBoxCoreDetails.Text = ZXMachineMetaData.GetMetaString(type);
|
||||
}
|
||||
|
||||
private void borderTypecomboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateBorderNotes((ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
private void borderTypecomboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateBorderNotes((ZXSpectrum.BorderType)Enum.Parse(typeof(ZXSpectrum.BorderType), cb.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void UpdateBorderNotes(ZXSpectrum.BorderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ZXSpectrum.BorderType.Full:
|
||||
lblBorderInfo.Text = "Original border sizes";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Medium:
|
||||
lblBorderInfo.Text = "All borders 24px";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.None:
|
||||
lblBorderInfo.Text = "No border at all";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Small:
|
||||
lblBorderInfo.Text = "All borders 10px";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Widescreen:
|
||||
lblBorderInfo.Text = "No top and bottom border (almost 16:9)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void UpdateBorderNotes(ZXSpectrum.BorderType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ZXSpectrum.BorderType.Full:
|
||||
lblBorderInfo.Text = "Original border sizes";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Medium:
|
||||
lblBorderInfo.Text = "All borders 24px";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.None:
|
||||
lblBorderInfo.Text = "No border at all";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Small:
|
||||
lblBorderInfo.Text = "All borders 10px";
|
||||
break;
|
||||
case ZXSpectrum.BorderType.Widescreen:
|
||||
lblBorderInfo.Text = "No top and bottom border (almost 16:9)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,105 +16,105 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
private string[] possibleControllers;
|
||||
private string[] possibleControllers;
|
||||
|
||||
private void IntvControllerSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
_syncSettings = ((ZXSpectrum)Global.Emulator).GetSyncSettings().Clone();
|
||||
|
||||
possibleControllers = Enum.GetNames(typeof(JoystickType));
|
||||
possibleControllers = Enum.GetNames(typeof(JoystickType));
|
||||
|
||||
foreach (var val in possibleControllers)
|
||||
{
|
||||
Port1ComboBox.Items.Add(val);
|
||||
Port2ComboBox.Items.Add(val);
|
||||
Port3ComboBox.Items.Add(val);
|
||||
}
|
||||
Port3ComboBox.Items.Add(val);
|
||||
}
|
||||
|
||||
Port1ComboBox.SelectedItem = _syncSettings.JoystickType1.ToString();
|
||||
Port2ComboBox.SelectedItem = _syncSettings.JoystickType2.ToString();
|
||||
Port3ComboBox.SelectedItem = _syncSettings.JoystickType3.ToString();
|
||||
}
|
||||
Port3ComboBox.SelectedItem = _syncSettings.JoystickType3.ToString();
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_syncSettings.JoystickType1.ToString() != Port1ComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.JoystickType2.ToString() != Port2ComboBox.SelectedItem.ToString()
|
||||
|| _syncSettings.JoystickType3.ToString() != Port3ComboBox.SelectedItem.ToString();
|
||||
|| _syncSettings.JoystickType3.ToString() != Port3ComboBox.SelectedItem.ToString();
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
// enforce unique joystick selection
|
||||
// enforce unique joystick selection
|
||||
|
||||
bool selectionValid = true;
|
||||
bool selectionValid = true;
|
||||
|
||||
var j1 = Port1ComboBox.SelectedItem.ToString();
|
||||
if (j1 != possibleControllers.First())
|
||||
{
|
||||
if (j1 == Port2ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port2ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j1 == Port3ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port3ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
var j1 = Port1ComboBox.SelectedItem.ToString();
|
||||
if (j1 != possibleControllers.First())
|
||||
{
|
||||
if (j1 == Port2ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port2ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j1 == Port3ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port3ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
var j2 = Port2ComboBox.SelectedItem.ToString();
|
||||
if (j2 != possibleControllers.First())
|
||||
{
|
||||
if (j2 == Port1ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port1ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j2 == Port3ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port3ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
var j2 = Port2ComboBox.SelectedItem.ToString();
|
||||
if (j2 != possibleControllers.First())
|
||||
{
|
||||
if (j2 == Port1ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port1ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j2 == Port3ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port3ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
var j3 = Port3ComboBox.SelectedItem.ToString();
|
||||
if (j3 != possibleControllers.First())
|
||||
{
|
||||
if (j3 == Port1ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port1ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j3 == Port2ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port2ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
var j3 = Port3ComboBox.SelectedItem.ToString();
|
||||
if (j3 != possibleControllers.First())
|
||||
{
|
||||
if (j3 == Port1ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port1ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
if (j3 == Port2ComboBox.SelectedItem.ToString())
|
||||
{
|
||||
Port2ComboBox.SelectedItem = possibleControllers.First();
|
||||
selectionValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (selectionValid)
|
||||
{
|
||||
_syncSettings.JoystickType1 = (JoystickType)Enum.Parse(typeof(JoystickType), Port1ComboBox.SelectedItem.ToString());
|
||||
_syncSettings.JoystickType2 = (JoystickType)Enum.Parse(typeof(JoystickType), Port2ComboBox.SelectedItem.ToString());
|
||||
_syncSettings.JoystickType3 = (JoystickType)Enum.Parse(typeof(JoystickType), Port3ComboBox.SelectedItem.ToString());
|
||||
if (selectionValid)
|
||||
{
|
||||
_syncSettings.JoystickType1 = (JoystickType)Enum.Parse(typeof(JoystickType), Port1ComboBox.SelectedItem.ToString());
|
||||
_syncSettings.JoystickType2 = (JoystickType)Enum.Parse(typeof(JoystickType), Port2ComboBox.SelectedItem.ToString());
|
||||
_syncSettings.JoystickType3 = (JoystickType)Enum.Parse(typeof(JoystickType), Port3ComboBox.SelectedItem.ToString());
|
||||
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
GlobalWin.MainForm.PutCoreSyncSettings(_syncSettings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid joystick configuration. \nDuplicates have automatically been changed to NULL.\n\nPlease review the configuration");
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid joystick configuration. \nDuplicates have automatically been changed to NULL.\n\nPlease review the configuration");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public partial class ZXSpectrumNonSyncSettings : Form
|
||||
{
|
||||
private ZXSpectrum.ZXSpectrumSettings _settings;
|
||||
private int bgColor;
|
||||
private int bgColor;
|
||||
|
||||
public ZXSpectrumNonSyncSettings()
|
||||
{
|
||||
|
@ -22,52 +22,52 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings = ((ZXSpectrum)Global.Emulator).GetSettings().Clone();
|
||||
|
||||
bgColor = _settings.BackgroundColor;
|
||||
bgColor = _settings.BackgroundColor;
|
||||
|
||||
SetBtnColor();
|
||||
SetBtnColor();
|
||||
|
||||
checkBoxShowCoreBrdColor.Checked = _settings.UseCoreBorderForBackground;
|
||||
checkBoxShowCoreBrdColor.Checked = _settings.UseCoreBorderForBackground;
|
||||
|
||||
// OSD Message Verbosity
|
||||
var osdTypes = Enum.GetNames(typeof(ZXSpectrum.OSDVerbosity));
|
||||
foreach (var val in osdTypes)
|
||||
{
|
||||
osdMessageVerbositycomboBox1.Items.Add(val);
|
||||
}
|
||||
osdMessageVerbositycomboBox1.SelectedItem = _settings.OSDMessageVerbosity.ToString();
|
||||
UpdateOSDNotes((ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString()));
|
||||
}
|
||||
// OSD Message Verbosity
|
||||
var osdTypes = Enum.GetNames(typeof(ZXSpectrum.OSDVerbosity));
|
||||
foreach (var val in osdTypes)
|
||||
{
|
||||
osdMessageVerbositycomboBox1.Items.Add(val);
|
||||
}
|
||||
osdMessageVerbositycomboBox1.SelectedItem = _settings.OSDMessageVerbosity.ToString();
|
||||
UpdateOSDNotes((ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void SetBtnColor()
|
||||
{
|
||||
var c = System.Drawing.Color.FromArgb(bgColor);
|
||||
buttonChooseBGColor.ForeColor = c;
|
||||
buttonChooseBGColor.BackColor = c;
|
||||
}
|
||||
private void SetBtnColor()
|
||||
{
|
||||
var c = System.Drawing.Color.FromArgb(bgColor);
|
||||
buttonChooseBGColor.ForeColor = c;
|
||||
buttonChooseBGColor.BackColor = c;
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool changed =
|
||||
_settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString() ||
|
||||
_settings.BackgroundColor != bgColor ||
|
||||
_settings.UseCoreBorderForBackground != checkBoxShowCoreBrdColor.Checked;
|
||||
bool changed =
|
||||
_settings.OSDMessageVerbosity.ToString() != osdMessageVerbositycomboBox1.SelectedItem.ToString() ||
|
||||
_settings.BackgroundColor != bgColor ||
|
||||
_settings.UseCoreBorderForBackground != checkBoxShowCoreBrdColor.Checked;
|
||||
|
||||
if (changed)
|
||||
if (changed)
|
||||
{
|
||||
_settings.OSDMessageVerbosity = (ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
|
||||
_settings.BackgroundColor = bgColor;
|
||||
_settings.UseCoreBorderForBackground = checkBoxShowCoreBrdColor.Checked;
|
||||
_settings.OSDMessageVerbosity = (ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), osdMessageVerbositycomboBox1.SelectedItem.ToString());
|
||||
_settings.BackgroundColor = bgColor;
|
||||
_settings.UseCoreBorderForBackground = checkBoxShowCoreBrdColor.Checked;
|
||||
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
GlobalWin.MainForm.PutCoreSettings(_settings);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -77,84 +77,84 @@ namespace BizHawk.Client.EmuHawk
|
|||
Close();
|
||||
}
|
||||
|
||||
private void UpdateOSDNotes(ZXSpectrum.OSDVerbosity type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ZXSpectrum.OSDVerbosity.Full:
|
||||
lblOSDVerbinfo.Text = "Show all OSD messages";
|
||||
break;
|
||||
case ZXSpectrum.OSDVerbosity.Medium:
|
||||
lblOSDVerbinfo.Text = "Only show machine/device generated messages";
|
||||
break;
|
||||
case ZXSpectrum.OSDVerbosity.None:
|
||||
lblOSDVerbinfo.Text = "No core-driven OSD messages";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void UpdateOSDNotes(ZXSpectrum.OSDVerbosity type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ZXSpectrum.OSDVerbosity.Full:
|
||||
lblOSDVerbinfo.Text = "Show all OSD messages";
|
||||
break;
|
||||
case ZXSpectrum.OSDVerbosity.Medium:
|
||||
lblOSDVerbinfo.Text = "Only show machine/device generated messages";
|
||||
break;
|
||||
case ZXSpectrum.OSDVerbosity.None:
|
||||
lblOSDVerbinfo.Text = "No core-driven OSD messages";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OSDComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateOSDNotes((ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), cb.SelectedItem.ToString()));
|
||||
}
|
||||
private void OSDComboBox_SelectionChangeCommitted(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox cb = sender as ComboBox;
|
||||
UpdateOSDNotes((ZXSpectrum.OSDVerbosity)Enum.Parse(typeof(ZXSpectrum.OSDVerbosity), cb.SelectedItem.ToString()));
|
||||
}
|
||||
|
||||
private void buttonChooseBGColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
var currColor = _settings.BackgroundColor;
|
||||
System.Drawing.Color c = System.Drawing.Color.FromArgb(currColor);
|
||||
using var cd = new ColorDialog();
|
||||
private void buttonChooseBGColor_Click(object sender, EventArgs e)
|
||||
{
|
||||
var currColor = _settings.BackgroundColor;
|
||||
System.Drawing.Color c = System.Drawing.Color.FromArgb(currColor);
|
||||
using var cd = new ColorDialog();
|
||||
|
||||
System.Drawing.Color[] colors = new System.Drawing.Color[]
|
||||
{
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0x00, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xD7, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xD7, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0xD7, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0xD7, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xFF, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xFF, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF),
|
||||
};
|
||||
System.Drawing.Color[] colors = new System.Drawing.Color[]
|
||||
{
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0x00, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xD7, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xD7, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0xD7, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xD7, 0xD7, 0xD7),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0x00, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0x00, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xFF, 0x00),
|
||||
System.Drawing.Color.FromArgb(0x00, 0xFF, 0xFF),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0xFF, 0x00),
|
||||
System.Drawing.Color.FromArgb(0xFF, 0xFF, 0xFF),
|
||||
};
|
||||
|
||||
cd.CustomColors = new int[]
|
||||
{
|
||||
System.Drawing.ColorTranslator.ToOle(colors[0]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[1]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[2]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[3]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[4]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[5]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[6]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[7]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[8]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[9]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[10]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[11]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[12]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[13]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[14]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[15]),
|
||||
};
|
||||
cd.CustomColors = new int[]
|
||||
{
|
||||
System.Drawing.ColorTranslator.ToOle(colors[0]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[1]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[2]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[3]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[4]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[5]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[6]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[7]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[8]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[9]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[10]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[11]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[12]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[13]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[14]),
|
||||
System.Drawing.ColorTranslator.ToOle(colors[15]),
|
||||
};
|
||||
|
||||
cd.Color = c;
|
||||
cd.Color = c;
|
||||
|
||||
if (cd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var color = cd.Color;
|
||||
var col = color.ToArgb();
|
||||
bgColor = col;
|
||||
if (cd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var color = cd.Color;
|
||||
var col = color.ToArgb();
|
||||
bgColor = col;
|
||||
|
||||
SetBtnColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
SetBtnColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
var speccy = (ZXSpectrum)Global.Emulator;
|
||||
var addr = (ushort)numericUpDownAddress.Value;
|
||||
var val = (byte)numericUpDownByte.Value;
|
||||
var speccy = (ZXSpectrum)Global.Emulator;
|
||||
var addr = (ushort)numericUpDownAddress.Value;
|
||||
var val = (byte)numericUpDownByte.Value;
|
||||
|
||||
speccy.PokeMemory(addr, val);
|
||||
speccy.PokeMemory(addr, val);
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void CancelBtn_Click(object sender, EventArgs e)
|
||||
|
@ -33,5 +33,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private IEnumerable<int> SelectedIndices => BreakpointView.SelectedIndices.Cast<int>();
|
||||
|
||||
private IEnumerable<Breakpoint> SelectedItems
|
||||
private IEnumerable<Breakpoint> SelectedItems
|
||||
{
|
||||
get { return SelectedIndices.Select(index => _breakpoints[index]); }
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
|
||||
[Tool(released: true, supportedSystems: new[] { "GB", "GBA", "GEN", "N64", "NES", "PSX", "SAT", "SMS", "SNES" },
|
||||
unsupportedCores: new[] { "Snes9x" })]
|
||||
unsupportedCores: new[] { "Snes9x" })]
|
||||
public partial class GameShark : Form, IToolForm, IToolFormAutoConfig
|
||||
{
|
||||
#region " Game Genie Dictionary "
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void DoLuaClick(object sender, EventArgs e)
|
||||
{
|
||||
LuaWinform parent = Parent as LuaWinform;
|
||||
parent?.DoLuaEvent(Handle);
|
||||
parent?.DoLuaEvent(Handle);
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void DoLuaClick(object sender, EventArgs e)
|
||||
{
|
||||
var parent = Parent as LuaWinform;
|
||||
parent?.DoLuaEvent(Handle);
|
||||
parent?.DoLuaEvent(Handle);
|
||||
}
|
||||
|
||||
protected override void OnClick(EventArgs e)
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class MultiDiskFileSelector : UserControl
|
||||
{
|
||||
public string SystemString = "";
|
||||
public string SystemString = "";
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
|
|
|
@ -155,8 +155,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
SyncCore();
|
||||
if (Visible)
|
||||
{
|
||||
RegenerateData();
|
||||
InternalUpdateValues();
|
||||
RegenerateData();
|
||||
InternalUpdateValues();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool AskSaveChanges() { return true; }
|
||||
public bool UpdateBefore => false;
|
||||
|
||||
public void NewUpdate(ToolFormUpdateType type) { }
|
||||
public void NewUpdate(ToolFormUpdateType type) { }
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
|
|
|
@ -6,255 +6,255 @@ using System.Linq;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[Schema("ZXSpectrum")]
|
||||
class ZXSpectrumSchema : IVirtualPadSchema
|
||||
{
|
||||
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
||||
{
|
||||
yield return Joystick(1);
|
||||
yield return Joystick(2);
|
||||
yield return Joystick(3);
|
||||
yield return Keyboard();
|
||||
//yield return TapeDevice();
|
||||
}
|
||||
[Schema("ZXSpectrum")]
|
||||
class ZXSpectrumSchema : IVirtualPadSchema
|
||||
{
|
||||
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
|
||||
{
|
||||
yield return Joystick(1);
|
||||
yield return Joystick(2);
|
||||
yield return Joystick(3);
|
||||
yield return Keyboard();
|
||||
//yield return TapeDevice();
|
||||
}
|
||||
|
||||
private static PadSchema Joystick(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = $"Joystick {controller}",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(174, 74),
|
||||
MaxSize = new Size(174, 74),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Up",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueUp,
|
||||
Location = new Point(23, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Down",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueDown,
|
||||
Location = new Point(23, 36),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Left",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Back,
|
||||
Location = new Point(2, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Right",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Forward,
|
||||
Location = new Point(44, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button",
|
||||
DisplayName = "B",
|
||||
Location = new Point(124, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
private static PadSchema Joystick(int controller)
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = $"Joystick {controller}",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(174, 74),
|
||||
MaxSize = new Size(174, 74),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Up",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueUp,
|
||||
Location = new Point(23, 15),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Down",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.BlueDown,
|
||||
Location = new Point(23, 36),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Left",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Back,
|
||||
Location = new Point(2, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Right",
|
||||
DisplayName = "",
|
||||
Icon = Properties.Resources.Forward,
|
||||
Location = new Point(44, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = $"P{controller} Button",
|
||||
DisplayName = "B",
|
||||
Location = new Point(124, 24),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class ButtonLayout
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string DisName { get; set; }
|
||||
public double WidthFactor { get; set; }
|
||||
public int Row { get; set; }
|
||||
public bool IsActive = true;
|
||||
}
|
||||
private class ButtonLayout
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string DisName { get; set; }
|
||||
public double WidthFactor { get; set; }
|
||||
public int Row { get; set; }
|
||||
public bool IsActive = true;
|
||||
}
|
||||
|
||||
private static PadSchema Keyboard()
|
||||
{
|
||||
List<ButtonLayout> bls = new List<ButtonLayout>
|
||||
{
|
||||
new ButtonLayout { Name = "Key True Video", DisName = "TV", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Inv Video", DisName = "IV", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 1", DisName = "1", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 2", DisName = "2", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 3", DisName = "3", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 4", DisName = "4", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 5", DisName = "5", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 6", DisName = "6", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 7", DisName = "7", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 8", DisName = "8", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 9", DisName = "9", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 0", DisName = "0", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Break", DisName = "BREAK", Row = 0, WidthFactor = 1.5 },
|
||||
private static PadSchema Keyboard()
|
||||
{
|
||||
List<ButtonLayout> bls = new List<ButtonLayout>
|
||||
{
|
||||
new ButtonLayout { Name = "Key True Video", DisName = "TV", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Inv Video", DisName = "IV", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 1", DisName = "1", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 2", DisName = "2", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 3", DisName = "3", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 4", DisName = "4", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 5", DisName = "5", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 6", DisName = "6", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 7", DisName = "7", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 8", DisName = "8", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 9", DisName = "9", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key 0", DisName = "0", Row = 0, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Break", DisName = "BREAK", Row = 0, WidthFactor = 1.5 },
|
||||
|
||||
new ButtonLayout { Name = "Key Delete", DisName = "DEL", Row = 1, WidthFactor = 1.5 },
|
||||
new ButtonLayout { Name = "Key Graph", DisName = "GR", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Q", DisName = "Q", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key W", DisName = "W", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key E", DisName = "E", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key R", DisName = "R", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key T", DisName = "T", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Y", DisName = "Y", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key U", DisName = "U", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key I", DisName = "I", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key O", DisName = "O", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key P", DisName = "P", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Delete", DisName = "DEL", Row = 1, WidthFactor = 1.5 },
|
||||
new ButtonLayout { Name = "Key Graph", DisName = "GR", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Q", DisName = "Q", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key W", DisName = "W", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key E", DisName = "E", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key R", DisName = "R", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key T", DisName = "T", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Y", DisName = "Y", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key U", DisName = "U", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key I", DisName = "I", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key O", DisName = "O", Row = 1, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key P", DisName = "P", Row = 1, WidthFactor = 1 },
|
||||
|
||||
new ButtonLayout { Name = "Key Extend Mode", DisName = "EM", Row = 2, WidthFactor = 1.5 },
|
||||
new ButtonLayout { Name = "Key Edit", DisName = "ED", Row = 2, WidthFactor = 1.25},
|
||||
new ButtonLayout { Name = "Key A", DisName = "A", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key S", DisName = "S", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key D", DisName = "D", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key F", DisName = "F", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key G", DisName = "G", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key H", DisName = "H", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key J", DisName = "J", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key K", DisName = "K", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key L", DisName = "L", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Return", DisName = "ENTER", Row = 2, WidthFactor = 1.75 },
|
||||
new ButtonLayout { Name = "Key Extend Mode", DisName = "EM", Row = 2, WidthFactor = 1.5 },
|
||||
new ButtonLayout { Name = "Key Edit", DisName = "ED", Row = 2, WidthFactor = 1.25},
|
||||
new ButtonLayout { Name = "Key A", DisName = "A", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key S", DisName = "S", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key D", DisName = "D", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key F", DisName = "F", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key G", DisName = "G", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key H", DisName = "H", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key J", DisName = "J", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key K", DisName = "K", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key L", DisName = "L", Row = 2, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Return", DisName = "ENTER", Row = 2, WidthFactor = 1.75 },
|
||||
|
||||
new ButtonLayout { Name = "Key Caps Shift", DisName = "CAPS-S", Row = 3, WidthFactor = 2.25 },
|
||||
new ButtonLayout { Name = "Key Caps Lock", DisName = "CL", Row = 3, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Z", DisName = "Z", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key X", DisName = "X", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key C", DisName = "C", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key V", DisName = "V", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key B", DisName = "B", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key N", DisName = "N", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key M", DisName = "M", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Period", DisName = ".", Row = 3, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Caps Shift", DisName = "CAPS-S", Row = 3, WidthFactor = 2.25 },
|
||||
new ButtonLayout { Name = "Key Caps Shift", DisName = "CAPS-S", Row = 3, WidthFactor = 2.25 },
|
||||
new ButtonLayout { Name = "Key Caps Lock", DisName = "CL", Row = 3, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Z", DisName = "Z", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key X", DisName = "X", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key C", DisName = "C", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key V", DisName = "V", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key B", DisName = "B", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key N", DisName = "N", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key M", DisName = "M", Row = 3, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Period", DisName = ".", Row = 3, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Caps Shift", DisName = "CAPS-S", Row = 3, WidthFactor = 2.25 },
|
||||
|
||||
new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Semi-Colon", DisName = ";", Row = 4, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Quote", DisName = "\"", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Left Cursor", DisName = "←", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Right Cursor", DisName = "→", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Space", DisName = "SPACE", Row = 4, WidthFactor = 4.5 },
|
||||
new ButtonLayout { Name = "Key Up Cursor", DisName = "↑", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Down Cursor", DisName = "↓", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Comma", DisName = ",", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 },
|
||||
};
|
||||
new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Semi-Colon", DisName = ";", Row = 4, WidthFactor = 1},
|
||||
new ButtonLayout { Name = "Key Quote", DisName = "\"", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Left Cursor", DisName = "←", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Right Cursor", DisName = "→", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Space", DisName = "SPACE", Row = 4, WidthFactor = 4.5 },
|
||||
new ButtonLayout { Name = "Key Up Cursor", DisName = "↑", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Down Cursor", DisName = "↓", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Comma", DisName = ",", Row = 4, WidthFactor = 1 },
|
||||
new ButtonLayout { Name = "Key Symbol Shift", DisName = "SS", Row = 4, WidthFactor = 1 },
|
||||
};
|
||||
|
||||
PadSchema ps = new PadSchema
|
||||
{
|
||||
DisplayName = "Keyboard",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(500, 170)
|
||||
};
|
||||
PadSchema ps = new PadSchema
|
||||
{
|
||||
DisplayName = "Keyboard",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(500, 170)
|
||||
};
|
||||
|
||||
List<PadSchema.ButtonSchema> btns = new List<PadSchema.ButtonSchema>();
|
||||
List<PadSchema.ButtonSchema> btns = new List<PadSchema.ButtonSchema>();
|
||||
|
||||
int rowHeight = 29; //24
|
||||
int stdButtonWidth = 29; //24
|
||||
int yPos = 18;
|
||||
int xPos = 22;
|
||||
int currRow = 0;
|
||||
int rowHeight = 29; //24
|
||||
int stdButtonWidth = 29; //24
|
||||
int yPos = 18;
|
||||
int xPos = 22;
|
||||
int currRow = 0;
|
||||
|
||||
foreach (var b in bls)
|
||||
{
|
||||
if (b.Row > currRow)
|
||||
{
|
||||
currRow++;
|
||||
yPos += rowHeight;
|
||||
xPos = 22;
|
||||
}
|
||||
foreach (var b in bls)
|
||||
{
|
||||
if (b.Row > currRow)
|
||||
{
|
||||
currRow++;
|
||||
yPos += rowHeight;
|
||||
xPos = 22;
|
||||
}
|
||||
|
||||
int txtLength = b.DisName.Length;
|
||||
int btnSize = System.Convert.ToInt32((double)stdButtonWidth * b.WidthFactor);
|
||||
|
||||
int txtLength = b.DisName.Length;
|
||||
int btnSize = System.Convert.ToInt32((double)stdButtonWidth * b.WidthFactor);
|
||||
|
||||
|
||||
string disp = b.DisName;
|
||||
if (txtLength == 1)
|
||||
disp = $" {disp}";
|
||||
|
||||
switch(b.DisName)
|
||||
{
|
||||
case "SPACE": disp = $" {disp} "; break;
|
||||
case "I": disp = $" {disp} "; break;
|
||||
case "W": disp = b.DisName; break;
|
||||
}
|
||||
|
||||
|
||||
if (b.IsActive)
|
||||
{
|
||||
PadSchema.ButtonSchema btn = new PadSchema.ButtonSchema();
|
||||
btn.Name = b.Name;
|
||||
btn.DisplayName = disp;
|
||||
btn.Location = new Point(xPos, yPos);
|
||||
btn.Type = PadSchema.PadInputType.Boolean;
|
||||
btns.Add(btn);
|
||||
}
|
||||
|
||||
xPos += btnSize;
|
||||
}
|
||||
string disp = b.DisName;
|
||||
if (txtLength == 1)
|
||||
disp = $" {disp}";
|
||||
|
||||
switch(b.DisName)
|
||||
{
|
||||
case "SPACE": disp = $" {disp} "; break;
|
||||
case "I": disp = $" {disp} "; break;
|
||||
case "W": disp = b.DisName; break;
|
||||
}
|
||||
|
||||
|
||||
if (b.IsActive)
|
||||
{
|
||||
PadSchema.ButtonSchema btn = new PadSchema.ButtonSchema();
|
||||
btn.Name = b.Name;
|
||||
btn.DisplayName = disp;
|
||||
btn.Location = new Point(xPos, yPos);
|
||||
btn.Type = PadSchema.PadInputType.Boolean;
|
||||
btns.Add(btn);
|
||||
}
|
||||
|
||||
xPos += btnSize;
|
||||
}
|
||||
|
||||
ps.Buttons = btns.ToArray();
|
||||
return ps;
|
||||
}
|
||||
ps.Buttons = btns.ToArray();
|
||||
return ps;
|
||||
}
|
||||
|
||||
private static PadSchema TapeDevice()
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = "DATACORDER",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(174, 74),
|
||||
MaxSize = new Size(174, 74),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Play Tape",
|
||||
Icon = Properties.Resources.Play,
|
||||
Location = new Point(23, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Stop Tape",
|
||||
Icon = Properties.Resources.Stop,
|
||||
Location = new Point(53, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "RTZ Tape",
|
||||
Icon = Properties.Resources.BackMore,
|
||||
Location = new Point(83, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Insert Next Tape",
|
||||
DisplayName = "NEXT TAPE",
|
||||
//Icon = Properties.Resources.MoveRight,
|
||||
Location = new Point(23, 52),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Insert Previous Tape",
|
||||
DisplayName = "PREV TAPE",
|
||||
//Icon = Properties.Resources.MoveLeft,
|
||||
Location = new Point(100, 52),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
private static PadSchema TapeDevice()
|
||||
{
|
||||
return new PadSchema
|
||||
{
|
||||
DisplayName = "DATACORDER",
|
||||
IsConsole = false,
|
||||
DefaultSize = new Size(174, 74),
|
||||
MaxSize = new Size(174, 74),
|
||||
Buttons = new[]
|
||||
{
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Play Tape",
|
||||
Icon = Properties.Resources.Play,
|
||||
Location = new Point(23, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Stop Tape",
|
||||
Icon = Properties.Resources.Stop,
|
||||
Location = new Point(53, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "RTZ Tape",
|
||||
Icon = Properties.Resources.BackMore,
|
||||
Location = new Point(83, 22),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Insert Next Tape",
|
||||
DisplayName = "NEXT TAPE",
|
||||
//Icon = Properties.Resources.MoveRight,
|
||||
Location = new Point(23, 52),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
new PadSchema.ButtonSchema
|
||||
{
|
||||
Name = "Insert Previous Tape",
|
||||
DisplayName = "PREV TAPE",
|
||||
//Icon = Properties.Resources.MoveLeft,
|
||||
Location = new Point(100, 52),
|
||||
Type = PadSchema.PadInputType.Boolean
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,31 +28,31 @@ namespace BizHawk.Common
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// compose multiple ImportResolvers, where subsequent ones takes precedence over earlier ones
|
||||
/// </summary>
|
||||
public class PatchImportResolver : IImportResolver
|
||||
{
|
||||
private readonly List<IImportResolver> _resolvers = new List<IImportResolver>();
|
||||
/// <summary>
|
||||
/// compose multiple ImportResolvers, where subsequent ones takes precedence over earlier ones
|
||||
/// </summary>
|
||||
public class PatchImportResolver : IImportResolver
|
||||
{
|
||||
private readonly List<IImportResolver> _resolvers = new List<IImportResolver>();
|
||||
|
||||
public PatchImportResolver(params IImportResolver[] rr)
|
||||
{
|
||||
Add(rr);
|
||||
}
|
||||
public void Add(params IImportResolver[] rr)
|
||||
{
|
||||
_resolvers.AddRange(rr);
|
||||
}
|
||||
public PatchImportResolver(params IImportResolver[] rr)
|
||||
{
|
||||
Add(rr);
|
||||
}
|
||||
public void Add(params IImportResolver[] rr)
|
||||
{
|
||||
_resolvers.AddRange(rr);
|
||||
}
|
||||
|
||||
public IntPtr Resolve(string entryPoint)
|
||||
{
|
||||
for (int i = _resolvers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var ret = _resolvers[i].Resolve(entryPoint);
|
||||
if (ret != IntPtr.Zero)
|
||||
return ret;
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
public IntPtr Resolve(string entryPoint)
|
||||
{
|
||||
for (int i = _resolvers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var ret = _resolvers[i].Resolve(entryPoint);
|
||||
if (ret != IntPtr.Zero)
|
||||
return ret;
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace BizHawk.Emulation.Common
|
|||
[JsonIgnore]
|
||||
private Node Current => Nodes.Peek();
|
||||
|
||||
public void Prepare()
|
||||
public void Prepare()
|
||||
{
|
||||
Nodes = new Stack<Node>();
|
||||
Nodes.Push(Root);
|
||||
|
|
|
@ -3,9 +3,9 @@ using System.Runtime.InteropServices;
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Arcades.MAME
|
||||
{
|
||||
public static class LibMAME
|
||||
{
|
||||
const string dll = "libmamearcade64.dll"; // libmamearcade64.dll libpacmansh64d.dll
|
||||
public static class LibMAME
|
||||
{
|
||||
const string dll = "libmamearcade64.dll"; // libmamearcade64.dll libpacmansh64d.dll
|
||||
const CallingConvention cc = CallingConvention.Cdecl;
|
||||
|
||||
public enum OutputChannel
|
||||
|
|
|
@ -60,13 +60,13 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
private ManualResetEvent MAMEFrameComplete = new ManualResetEvent(false);
|
||||
private SortedDictionary<string, string> fieldsPorts = new SortedDictionary<string, string>();
|
||||
private IController Controller = NullController.Instance;
|
||||
private int[] frameBuffer = new int[0];
|
||||
private int[] frameBuffer = new int[0];
|
||||
private short[] audioBuffer = new short[0];
|
||||
private Queue<short> audioSamples = new Queue<short>();
|
||||
private int sampleRate = 44100;
|
||||
private bool paused = true;
|
||||
private bool exiting = false;
|
||||
private bool frameDone = true;
|
||||
private bool frameDone = true;
|
||||
private int numSamples = 0;
|
||||
private string gameDirectory;
|
||||
private string gameFilename;
|
||||
|
@ -116,15 +116,15 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
#region ISoundProvider
|
||||
|
||||
public void SetSyncMode(SyncSoundMode mode)
|
||||
{
|
||||
if (mode == SyncSoundMode.Async)
|
||||
{
|
||||
throw new NotSupportedException("Async mode is not supported.");
|
||||
{
|
||||
if (mode == SyncSoundMode.Async)
|
||||
{
|
||||
throw new NotSupportedException("Async mode is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
public void GetSamplesSync(out short[] samples, out int nsamp)
|
||||
{
|
||||
{
|
||||
nsamp = samplesPerFrame;
|
||||
samples = new short[samplesPerFrame * 2];
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace BizHawk.Emulation.Cores.Arcades.MAME
|
|||
}
|
||||
|
||||
public void GetSamplesAsync(short[] samples)
|
||||
{
|
||||
{
|
||||
throw new InvalidOperationException("Async mode is not supported.");
|
||||
}
|
||||
|
||||
|
|
|
@ -171,182 +171,182 @@ namespace BizHawk.Emulation.Cores.Components.M68000
|
|||
static readonly string[] Xn3 = { "000", "001", "010", "011", "100", "101", "110", "111" };
|
||||
|
||||
static readonly string[] Xn3Am3 = {
|
||||
"000000", // Dn Data register
|
||||
"001000",
|
||||
"010000",
|
||||
"011000",
|
||||
"100000",
|
||||
"101000",
|
||||
"110000",
|
||||
"111000",
|
||||
"000000", // Dn Data register
|
||||
"001000",
|
||||
"010000",
|
||||
"011000",
|
||||
"100000",
|
||||
"101000",
|
||||
"110000",
|
||||
"111000",
|
||||
|
||||
"000001", // An Address register
|
||||
"001001",
|
||||
"010001",
|
||||
"011001",
|
||||
"100001",
|
||||
"101001",
|
||||
"110001",
|
||||
"111001",
|
||||
"000001", // An Address register
|
||||
"001001",
|
||||
"010001",
|
||||
"011001",
|
||||
"100001",
|
||||
"101001",
|
||||
"110001",
|
||||
"111001",
|
||||
|
||||
"000010", // (An) Address
|
||||
"001010",
|
||||
"010010",
|
||||
"011010",
|
||||
"100010",
|
||||
"101010",
|
||||
"110010",
|
||||
"111010",
|
||||
"000010", // (An) Address
|
||||
"001010",
|
||||
"010010",
|
||||
"011010",
|
||||
"100010",
|
||||
"101010",
|
||||
"110010",
|
||||
"111010",
|
||||
|
||||
"000011", // (An)+ Address with Postincrement
|
||||
"001011",
|
||||
"010011",
|
||||
"011011",
|
||||
"100011",
|
||||
"101011",
|
||||
"110011",
|
||||
"111011",
|
||||
"000011", // (An)+ Address with Postincrement
|
||||
"001011",
|
||||
"010011",
|
||||
"011011",
|
||||
"100011",
|
||||
"101011",
|
||||
"110011",
|
||||
"111011",
|
||||
|
||||
"000100", // -(An) Address with Predecrement
|
||||
"001100",
|
||||
"010100",
|
||||
"011100",
|
||||
"100100",
|
||||
"101100",
|
||||
"110100",
|
||||
"111100",
|
||||
"000100", // -(An) Address with Predecrement
|
||||
"001100",
|
||||
"010100",
|
||||
"011100",
|
||||
"100100",
|
||||
"101100",
|
||||
"110100",
|
||||
"111100",
|
||||
|
||||
"000101", // (d16, An) Address with Displacement
|
||||
"001101",
|
||||
"010101",
|
||||
"011101",
|
||||
"100101",
|
||||
"101101",
|
||||
"110101",
|
||||
"111101",
|
||||
"000101", // (d16, An) Address with Displacement
|
||||
"001101",
|
||||
"010101",
|
||||
"011101",
|
||||
"100101",
|
||||
"101101",
|
||||
"110101",
|
||||
"111101",
|
||||
|
||||
"000110", // (d8, An, Xn) Address with Index
|
||||
"001110",
|
||||
"010110",
|
||||
"011110",
|
||||
"100110",
|
||||
"101110",
|
||||
"110110",
|
||||
"111110",
|
||||
"000110", // (d8, An, Xn) Address with Index
|
||||
"001110",
|
||||
"010110",
|
||||
"011110",
|
||||
"100110",
|
||||
"101110",
|
||||
"110110",
|
||||
"111110",
|
||||
|
||||
"010111", // (d16, PC) PC with Displacement
|
||||
"011111", // (d8, PC, Xn) PC with Index
|
||||
"000111", // (xxx).W Absolute Short
|
||||
"001111", // (xxx).L Absolute Long
|
||||
"100111", // #imm Immediate
|
||||
};
|
||||
"010111", // (d16, PC) PC with Displacement
|
||||
"011111", // (d8, PC, Xn) PC with Index
|
||||
"000111", // (xxx).W Absolute Short
|
||||
"001111", // (xxx).L Absolute Long
|
||||
"100111", // #imm Immediate
|
||||
};
|
||||
|
||||
static readonly string[] Am3Xn3 = {
|
||||
"000000", // Dn Data register
|
||||
"000001",
|
||||
"000010",
|
||||
"000011",
|
||||
"000100",
|
||||
"000101",
|
||||
"000110",
|
||||
"000111",
|
||||
"000000", // Dn Data register
|
||||
"000001",
|
||||
"000010",
|
||||
"000011",
|
||||
"000100",
|
||||
"000101",
|
||||
"000110",
|
||||
"000111",
|
||||
|
||||
"001000", // An Address register
|
||||
"001001",
|
||||
"001010",
|
||||
"001011",
|
||||
"001100",
|
||||
"001101",
|
||||
"001110",
|
||||
"001111",
|
||||
"001000", // An Address register
|
||||
"001001",
|
||||
"001010",
|
||||
"001011",
|
||||
"001100",
|
||||
"001101",
|
||||
"001110",
|
||||
"001111",
|
||||
|
||||
"010000", // (An) Address
|
||||
"010001",
|
||||
"010010",
|
||||
"010011",
|
||||
"010100",
|
||||
"010101",
|
||||
"010110",
|
||||
"010111",
|
||||
"010000", // (An) Address
|
||||
"010001",
|
||||
"010010",
|
||||
"010011",
|
||||
"010100",
|
||||
"010101",
|
||||
"010110",
|
||||
"010111",
|
||||
|
||||
"011000", // (An)+ Address with Postincrement
|
||||
"011001",
|
||||
"011010",
|
||||
"011011",
|
||||
"011100",
|
||||
"011101",
|
||||
"011110",
|
||||
"011111",
|
||||
"011000", // (An)+ Address with Postincrement
|
||||
"011001",
|
||||
"011010",
|
||||
"011011",
|
||||
"011100",
|
||||
"011101",
|
||||
"011110",
|
||||
"011111",
|
||||
|
||||
"100000", // -(An) Address with Predecrement
|
||||
"100001",
|
||||
"100010",
|
||||
"100011",
|
||||
"100100",
|
||||
"100101",
|
||||
"100110",
|
||||
"100111",
|
||||
"100000", // -(An) Address with Predecrement
|
||||
"100001",
|
||||
"100010",
|
||||
"100011",
|
||||
"100100",
|
||||
"100101",
|
||||
"100110",
|
||||
"100111",
|
||||
|
||||
"101000", // (d16, An) Address with Displacement
|
||||
"101001",
|
||||
"101010",
|
||||
"101011",
|
||||
"101100",
|
||||
"101101",
|
||||
"101110",
|
||||
"101111",
|
||||
"101000", // (d16, An) Address with Displacement
|
||||
"101001",
|
||||
"101010",
|
||||
"101011",
|
||||
"101100",
|
||||
"101101",
|
||||
"101110",
|
||||
"101111",
|
||||
|
||||
"110000", // (d8, An, Xn) Address with Index
|
||||
"110001",
|
||||
"110010",
|
||||
"110011",
|
||||
"110100",
|
||||
"110101",
|
||||
"110110",
|
||||
"110111",
|
||||
"110000", // (d8, An, Xn) Address with Index
|
||||
"110001",
|
||||
"110010",
|
||||
"110011",
|
||||
"110100",
|
||||
"110101",
|
||||
"110110",
|
||||
"110111",
|
||||
|
||||
"111010", // (d16, PC) PC with Displacement
|
||||
"111011", // (d8, PC, Xn) PC with Index
|
||||
"111000", // (xxx).W Absolute Short
|
||||
"111001", // (xxx).L Absolute Long
|
||||
"111100", // #imm Immediate
|
||||
};
|
||||
"111010", // (d16, PC) PC with Displacement
|
||||
"111011", // (d8, PC, Xn) PC with Index
|
||||
"111000", // (xxx).W Absolute Short
|
||||
"111001", // (xxx).L Absolute Long
|
||||
"111100", // #imm Immediate
|
||||
};
|
||||
|
||||
static readonly string[] ConditionMain = {
|
||||
"0010", // HI Higher (unsigned)
|
||||
"0011", // LS Lower or Same (unsigned)
|
||||
"0100", // CC Carry Clear (aka Higher or Same, unsigned)
|
||||
"0101", // CS Carry Set (aka Lower, unsigned)
|
||||
"0110", // NE Not Equal
|
||||
"0111", // EQ Equal
|
||||
"1000", // VC Overflow Clear
|
||||
"1001", // VS Overflow Set
|
||||
"1010", // PL Plus
|
||||
"1011", // MI Minus
|
||||
"1100", // GE Greater or Equal (signed)
|
||||
"1101", // LT Less Than (signed)
|
||||
"1110", // GT Greater Than (signed)
|
||||
"1111" // LE Less or Equal (signed)
|
||||
};
|
||||
"0010", // HI Higher (unsigned)
|
||||
"0011", // LS Lower or Same (unsigned)
|
||||
"0100", // CC Carry Clear (aka Higher or Same, unsigned)
|
||||
"0101", // CS Carry Set (aka Lower, unsigned)
|
||||
"0110", // NE Not Equal
|
||||
"0111", // EQ Equal
|
||||
"1000", // VC Overflow Clear
|
||||
"1001", // VS Overflow Set
|
||||
"1010", // PL Plus
|
||||
"1011", // MI Minus
|
||||
"1100", // GE Greater or Equal (signed)
|
||||
"1101", // LT Less Than (signed)
|
||||
"1110", // GT Greater Than (signed)
|
||||
"1111" // LE Less or Equal (signed)
|
||||
};
|
||||
|
||||
static readonly string[] ConditionAll = {
|
||||
"0000", // T True
|
||||
"0001", // F False
|
||||
"0010", // HI Higher (unsigned)
|
||||
"0011", // LS Lower or Same (unsigned)
|
||||
"0100", // CC Carry Clear (aka Higher or Same, unsigned)
|
||||
"0101", // CS Carry Set (aka Lower, unsigned)
|
||||
"0110", // NE Not Equal
|
||||
"0111", // EQ Equal
|
||||
"1000", // VC Overflow Clear
|
||||
"1001", // VS Overflow Set
|
||||
"1010", // PL Plus
|
||||
"1011", // MI Minus
|
||||
"1100", // GE Greater or Equal (signed)
|
||||
"1101", // LT Less Than (signed)
|
||||
"1110", // GT Greater Than (signed)
|
||||
"1111" // LE Less or Equal (signed)
|
||||
};
|
||||
"0000", // T True
|
||||
"0001", // F False
|
||||
"0010", // HI Higher (unsigned)
|
||||
"0011", // LS Lower or Same (unsigned)
|
||||
"0100", // CC Carry Clear (aka Higher or Same, unsigned)
|
||||
"0101", // CS Carry Set (aka Lower, unsigned)
|
||||
"0110", // NE Not Equal
|
||||
"0111", // EQ Equal
|
||||
"1000", // VC Overflow Clear
|
||||
"1001", // VS Overflow Set
|
||||
"1010", // PL Plus
|
||||
"1011", // MI Minus
|
||||
"1100", // GE Greater or Equal (signed)
|
||||
"1101", // LT Less Than (signed)
|
||||
"1110", // GT Greater Than (signed)
|
||||
"1111" // LE Less or Equal (signed)
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -296,23 +296,23 @@ namespace BizHawk.Emulation.Cores.Components.H6280
|
|||
}
|
||||
|
||||
private static readonly byte[] TableNZ =
|
||||
{
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
|
||||
};
|
||||
{
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
|
||||
};
|
||||
}
|
||||
}
|
|
@ -7,8 +7,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
public long TotalExecutedCycles;
|
||||
|
||||
private int EI_pending;
|
||||
// ZXHawk needs to be able to read this for zx-state snapshot export
|
||||
public int EIPending { get { return EI_pending; } }
|
||||
// ZXHawk needs to be able to read this for zx-state snapshot export
|
||||
public int EIPending { get { return EI_pending; } }
|
||||
|
||||
public const ushort CBpre = 0;
|
||||
public const ushort EXTDpre = 1;
|
||||
|
|
|
@ -30,9 +30,9 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
public Action IRQCallback = delegate () { };
|
||||
public Action NMICallback = delegate () { };
|
||||
|
||||
// this will be a few cycles off for now
|
||||
// it should suffice for now until Alyosha returns from hiatus
|
||||
public Action IRQACKCallback = delegate () { };
|
||||
// this will be a few cycles off for now
|
||||
// it should suffice for now until Alyosha returns from hiatus
|
||||
public Action IRQACKCallback = delegate () { };
|
||||
|
||||
private void NMI_()
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
PopulateBUSRQ(0, 0, 0, 0, PCh, 0, 0);
|
||||
PopulateMEMRQ(0, 0, 0, 0, PCh, 0, 0);
|
||||
IRQS = 7;
|
||||
}
|
||||
}
|
||||
|
||||
// Just jump to $0038
|
||||
private void INTERRUPT_1()
|
||||
|
@ -96,7 +96,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
PopulateBUSRQ(0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0);
|
||||
PopulateMEMRQ(0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0);
|
||||
IRQS = 13;
|
||||
}
|
||||
}
|
||||
|
||||
// Interrupt mode 2 uses the I vector combined with a byte on the data bus
|
||||
private void INTERRUPT_2()
|
||||
|
@ -125,7 +125,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
PopulateBUSRQ(0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0, 0);
|
||||
PopulateMEMRQ(0, 0, 0, 0, I, 0, 0, SPh, 0, 0, SPh, 0, 0, W, 0, 0, W, 0, 0);
|
||||
IRQS = 19;
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetInterrupts()
|
||||
{
|
||||
|
|
|
@ -97,13 +97,13 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
}
|
||||
|
||||
public void IN_A_N_INC_Func(ushort dest, ushort src_l, ushort src_h)
|
||||
{
|
||||
Regs[dest] = ReadHardware((ushort)(Regs[src_l] | (Regs[src_h]) << 8));
|
||||
Regs[DB] = Regs[dest];
|
||||
{
|
||||
Regs[dest] = ReadHardware((ushort)(Regs[src_l] | (Regs[src_h]) << 8));
|
||||
Regs[DB] = Regs[dest];
|
||||
INC16_Func(src_l, src_h);
|
||||
}
|
||||
}
|
||||
|
||||
public void TR_Func(ushort dest, ushort src)
|
||||
public void TR_Func(ushort dest, ushort src)
|
||||
{
|
||||
Regs[dest] = Regs[src];
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
public const ushort RST = 65;
|
||||
public const ushort REP_OP_I = 66;
|
||||
public const ushort REP_OP_O = 67;
|
||||
public const ushort IN_A_N_INC = 68;
|
||||
public const ushort IN_A_N_INC = 68;
|
||||
public const ushort RD_INC_TR_PC = 69; // transfer WZ to PC after read
|
||||
public const ushort WR_TR_PC = 70; // transfer WZ to PC after write
|
||||
public const ushort OUT_INC = 71;
|
||||
|
@ -436,8 +436,8 @@ namespace BizHawk.Emulation.Cores.Components.Z80A
|
|||
IN_INC_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
|
||||
break;
|
||||
case IN_A_N_INC:
|
||||
IN_A_N_INC_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
|
||||
break;
|
||||
IN_A_N_INC_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
|
||||
break;
|
||||
case NEG:
|
||||
NEG_8_Func(cur_instr[instr_pntr++]);
|
||||
break;
|
||||
|
|
|
@ -71,9 +71,9 @@ namespace BizHawk.Emulation.Cores.Calculators
|
|||
|
||||
public string SystemId => "TI83";
|
||||
|
||||
public bool DeterministicEmulation => true;
|
||||
public bool DeterministicEmulation => true;
|
||||
|
||||
public void ResetCounters()
|
||||
public void ResetCounters()
|
||||
{
|
||||
Frame = 0;
|
||||
_lagCount = 0;
|
||||
|
|
|
@ -35,11 +35,11 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
{
|
||||
[DisplayName("Border type")]
|
||||
[Description("Select how to show the border area\n" +
|
||||
"NORMAL:\t Horizontal and Vertical border both set to 32 pixels (although horizontal will appear narrower due to pixel density)\n" +
|
||||
"SMALL PROPORTIONAL:\t Horizontal and Vertical border both set to 16 pixels (although horizontal will appear narrower due to pixel density)\n" +
|
||||
"SMALL FIXED:\t Horizontal border is set to 16 pixels and vertical is made slightly smaller so as to appear horizontal and vertical are the same after pixel density has been applied\n" +
|
||||
"NONE:\t Only the pixel buffer is rendered"
|
||||
)]
|
||||
"NORMAL:\t Horizontal and Vertical border both set to 32 pixels (although horizontal will appear narrower due to pixel density)\n" +
|
||||
"SMALL PROPORTIONAL:\t Horizontal and Vertical border both set to 16 pixels (although horizontal will appear narrower due to pixel density)\n" +
|
||||
"SMALL FIXED:\t Horizontal border is set to 16 pixels and vertical is made slightly smaller so as to appear horizontal and vertical are the same after pixel density has been applied\n" +
|
||||
"NONE:\t Only the pixel buffer is rendered"
|
||||
)]
|
||||
[DefaultValue(BorderType.SmallProportional)]
|
||||
public BorderType BorderType { get; set; }
|
||||
|
||||
|
|
|
@ -108,46 +108,46 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
_port = new IecPort(readIec, readUserPort);
|
||||
}
|
||||
|
||||
public void HardReset()
|
||||
{
|
||||
_pra = 0;
|
||||
_prb = 0;
|
||||
_ddra = 0;
|
||||
_ddrb = 0;
|
||||
_ta = 0xFFFF;
|
||||
_tb = 0xFFFF;
|
||||
_latcha = 1;
|
||||
_latchb = 1;
|
||||
_tod10Ths = 0;
|
||||
_todSec = 0;
|
||||
_todMin = 0;
|
||||
_todHr = 0;
|
||||
_alm10Ths = 0;
|
||||
_almSec = 0;
|
||||
_almMin = 0;
|
||||
_almHr = 0;
|
||||
_sdr = 0;
|
||||
_icr = 0;
|
||||
_cra = 0;
|
||||
_crb = 0;
|
||||
_intMask = 0;
|
||||
_todLatch = false;
|
||||
_taCntPhi2 = false;
|
||||
_taCntCnt = false;
|
||||
_tbCntPhi2 = false;
|
||||
_tbCntTa = false;
|
||||
_tbCntCnt = false;
|
||||
_taIrqNextCycle = false;
|
||||
_tbIrqNextCycle = false;
|
||||
_taState = TimerState.Stop;
|
||||
_tbState = TimerState.Stop;
|
||||
_lastCnt = true;
|
||||
}
|
||||
public void HardReset()
|
||||
{
|
||||
_pra = 0;
|
||||
_prb = 0;
|
||||
_ddra = 0;
|
||||
_ddrb = 0;
|
||||
_ta = 0xFFFF;
|
||||
_tb = 0xFFFF;
|
||||
_latcha = 1;
|
||||
_latchb = 1;
|
||||
_tod10Ths = 0;
|
||||
_todSec = 0;
|
||||
_todMin = 0;
|
||||
_todHr = 0;
|
||||
_alm10Ths = 0;
|
||||
_almSec = 0;
|
||||
_almMin = 0;
|
||||
_almHr = 0;
|
||||
_sdr = 0;
|
||||
_icr = 0;
|
||||
_cra = 0;
|
||||
_crb = 0;
|
||||
_intMask = 0;
|
||||
_todLatch = false;
|
||||
_taCntPhi2 = false;
|
||||
_taCntCnt = false;
|
||||
_tbCntPhi2 = false;
|
||||
_tbCntTa = false;
|
||||
_tbCntCnt = false;
|
||||
_taIrqNextCycle = false;
|
||||
_tbIrqNextCycle = false;
|
||||
_taState = TimerState.Stop;
|
||||
_tbState = TimerState.Stop;
|
||||
_lastCnt = true;
|
||||
}
|
||||
|
||||
public void ExecutePhase()
|
||||
{
|
||||
_thisCnt = ReadCnt();
|
||||
_taUnderflow = false;
|
||||
public void ExecutePhase()
|
||||
{
|
||||
_thisCnt = ReadCnt();
|
||||
_taUnderflow = false;
|
||||
|
||||
if (_taIrqNextCycle)
|
||||
{
|
||||
|
@ -161,358 +161,358 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
TriggerInterrupt(2);
|
||||
}
|
||||
|
||||
if (_taPrb6NegativeNextCycle)
|
||||
{
|
||||
_prb &= 0xBF;
|
||||
_taPrb6NegativeNextCycle = false;
|
||||
}
|
||||
if (_taPrb6NegativeNextCycle)
|
||||
{
|
||||
_prb &= 0xBF;
|
||||
_taPrb6NegativeNextCycle = false;
|
||||
}
|
||||
|
||||
if (_tbPrb7NegativeNextCycle)
|
||||
{
|
||||
_prb &= 0x7F;
|
||||
_tbPrb7NegativeNextCycle = false;
|
||||
}
|
||||
if (_tbPrb7NegativeNextCycle)
|
||||
{
|
||||
_prb &= 0x7F;
|
||||
_tbPrb7NegativeNextCycle = false;
|
||||
}
|
||||
|
||||
|
||||
switch (_taState)
|
||||
{
|
||||
case TimerState.WaitThenCount:
|
||||
_taState = TimerState.Count;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.Stop:
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenStop:
|
||||
_taState = TimerState.Stop;
|
||||
_ta = _latcha;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
_taState = TimerState.Count;
|
||||
_ta = _latcha;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenWaitThenCount:
|
||||
_taState = TimerState.WaitThenCount;
|
||||
if (_ta == 1)
|
||||
{
|
||||
Ta_Interrupt();
|
||||
_taUnderflow = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ta = _latcha;
|
||||
}
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.Count:
|
||||
Ta_Count();
|
||||
break;
|
||||
case TimerState.CountThenStop:
|
||||
_taState = TimerState.Stop;
|
||||
Ta_Count();
|
||||
break;
|
||||
}
|
||||
switch (_taState)
|
||||
{
|
||||
case TimerState.WaitThenCount:
|
||||
_taState = TimerState.Count;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.Stop:
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenStop:
|
||||
_taState = TimerState.Stop;
|
||||
_ta = _latcha;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
_taState = TimerState.Count;
|
||||
_ta = _latcha;
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenWaitThenCount:
|
||||
_taState = TimerState.WaitThenCount;
|
||||
if (_ta == 1)
|
||||
{
|
||||
Ta_Interrupt();
|
||||
_taUnderflow = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ta = _latcha;
|
||||
}
|
||||
Ta_Idle();
|
||||
break;
|
||||
case TimerState.Count:
|
||||
Ta_Count();
|
||||
break;
|
||||
case TimerState.CountThenStop:
|
||||
_taState = TimerState.Stop;
|
||||
Ta_Count();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (_tbState)
|
||||
{
|
||||
case TimerState.WaitThenCount:
|
||||
_tbState = TimerState.Count;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.Stop:
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenStop:
|
||||
_tbState = TimerState.Stop;
|
||||
_tb = _latchb;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
_tbState = TimerState.Count;
|
||||
_tb = _latchb;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenWaitThenCount:
|
||||
_tbState = TimerState.WaitThenCount;
|
||||
if (_tb == 1)
|
||||
{
|
||||
Tb_Interrupt();
|
||||
}
|
||||
else
|
||||
{
|
||||
_tb = _latchb;
|
||||
}
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.Count:
|
||||
Tb_Count();
|
||||
break;
|
||||
case TimerState.CountThenStop:
|
||||
_tbState = TimerState.Stop;
|
||||
Tb_Count();
|
||||
break;
|
||||
}
|
||||
switch (_tbState)
|
||||
{
|
||||
case TimerState.WaitThenCount:
|
||||
_tbState = TimerState.Count;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.Stop:
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenStop:
|
||||
_tbState = TimerState.Stop;
|
||||
_tb = _latchb;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
_tbState = TimerState.Count;
|
||||
_tb = _latchb;
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.LoadThenWaitThenCount:
|
||||
_tbState = TimerState.WaitThenCount;
|
||||
if (_tb == 1)
|
||||
{
|
||||
Tb_Interrupt();
|
||||
}
|
||||
else
|
||||
{
|
||||
_tb = _latchb;
|
||||
}
|
||||
Tb_Idle();
|
||||
break;
|
||||
case TimerState.Count:
|
||||
Tb_Count();
|
||||
break;
|
||||
case TimerState.CountThenStop:
|
||||
_tbState = TimerState.Stop;
|
||||
Tb_Count();
|
||||
break;
|
||||
}
|
||||
|
||||
CountTod();
|
||||
CountTod();
|
||||
|
||||
if (!_todLatch)
|
||||
{
|
||||
_latch10Ths = _tod10Ths;
|
||||
_latchSec = _todSec;
|
||||
_latchMin = _todMin;
|
||||
_latchHr = _todHr;
|
||||
}
|
||||
if (!_todLatch)
|
||||
{
|
||||
_latch10Ths = _tod10Ths;
|
||||
_latchSec = _todSec;
|
||||
_latchMin = _todMin;
|
||||
_latchHr = _todHr;
|
||||
}
|
||||
|
||||
_flagInput = ReadFlag();
|
||||
if (!_flagInput && _flagLatch)
|
||||
{
|
||||
TriggerInterrupt(16);
|
||||
}
|
||||
_flagLatch = _flagInput;
|
||||
_flagInput = ReadFlag();
|
||||
if (!_flagInput && _flagLatch)
|
||||
{
|
||||
TriggerInterrupt(16);
|
||||
}
|
||||
_flagLatch = _flagInput;
|
||||
|
||||
if ((_cra & 0x02) != 0)
|
||||
_ddra |= 0x40;
|
||||
if ((_crb & 0x02) != 0)
|
||||
_ddrb |= 0x80;
|
||||
if ((_cra & 0x02) != 0)
|
||||
_ddra |= 0x40;
|
||||
if ((_crb & 0x02) != 0)
|
||||
_ddrb |= 0x80;
|
||||
|
||||
_lastCnt = _thisCnt;
|
||||
}
|
||||
_lastCnt = _thisCnt;
|
||||
}
|
||||
|
||||
private void Ta_Count()
|
||||
{
|
||||
if (_taCntPhi2 || (_taCntCnt && !_lastCnt && _thisCnt))
|
||||
{
|
||||
if (_ta <= 0 || --_ta == 0)
|
||||
{
|
||||
if (_taState != TimerState.Stop)
|
||||
{
|
||||
Ta_Interrupt();
|
||||
}
|
||||
_taUnderflow = true;
|
||||
}
|
||||
}
|
||||
Ta_Idle();
|
||||
}
|
||||
private void Ta_Count()
|
||||
{
|
||||
if (_taCntPhi2 || (_taCntCnt && !_lastCnt && _thisCnt))
|
||||
{
|
||||
if (_ta <= 0 || --_ta == 0)
|
||||
{
|
||||
if (_taState != TimerState.Stop)
|
||||
{
|
||||
Ta_Interrupt();
|
||||
}
|
||||
_taUnderflow = true;
|
||||
}
|
||||
}
|
||||
Ta_Idle();
|
||||
}
|
||||
|
||||
private void Ta_Interrupt()
|
||||
{
|
||||
_ta = _latcha;
|
||||
private void Ta_Interrupt()
|
||||
{
|
||||
_ta = _latcha;
|
||||
|
||||
if (DelayedInterrupts)
|
||||
_taIrqNextCycle = true;
|
||||
else
|
||||
TriggerInterrupt(1);
|
||||
|
||||
_icr |= 1;
|
||||
_icr |= 1;
|
||||
|
||||
if ((_cra & 0x08) != 0)
|
||||
{
|
||||
_cra &= 0xFE;
|
||||
_newCra &= 0xFE;
|
||||
_taState = TimerState.LoadThenStop;
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = TimerState.LoadThenCount;
|
||||
}
|
||||
if ((_cra & 0x08) != 0)
|
||||
{
|
||||
_cra &= 0xFE;
|
||||
_newCra &= 0xFE;
|
||||
_taState = TimerState.LoadThenStop;
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = TimerState.LoadThenCount;
|
||||
}
|
||||
|
||||
if ((_cra & 0x02) != 0)
|
||||
{
|
||||
if ((_cra & 0x04) != 0)
|
||||
{
|
||||
_taPrb6NegativeNextCycle = true;
|
||||
_prb |= 0x40;
|
||||
}
|
||||
else
|
||||
{
|
||||
_prb ^= 0x40;
|
||||
}
|
||||
_ddrb |= 0x40;
|
||||
}
|
||||
}
|
||||
if ((_cra & 0x02) != 0)
|
||||
{
|
||||
if ((_cra & 0x04) != 0)
|
||||
{
|
||||
_taPrb6NegativeNextCycle = true;
|
||||
_prb |= 0x40;
|
||||
}
|
||||
else
|
||||
{
|
||||
_prb ^= 0x40;
|
||||
}
|
||||
_ddrb |= 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
private void Ta_Idle()
|
||||
{
|
||||
if (_hasNewCra)
|
||||
{
|
||||
switch (_taState)
|
||||
{
|
||||
case TimerState.Stop:
|
||||
case TimerState.LoadThenStop:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
_taState = (_newCra & 0x10) != 0
|
||||
? TimerState.LoadThenWaitThenCount
|
||||
: TimerState.WaitThenCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenStop;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TimerState.Count:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = (_newCra & 0x10) != 0
|
||||
? TimerState.LoadThenStop
|
||||
: TimerState.CountThenStop;
|
||||
}
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
case TimerState.WaitThenCount:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
if ((_newCra & 0x08) != 0)
|
||||
{
|
||||
_newCra &= 0xFE;
|
||||
_taState = TimerState.Stop;
|
||||
}
|
||||
else if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = TimerState.Stop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_cra = _newCra & 0xEF;
|
||||
_hasNewCra = false;
|
||||
}
|
||||
}
|
||||
private void Ta_Idle()
|
||||
{
|
||||
if (_hasNewCra)
|
||||
{
|
||||
switch (_taState)
|
||||
{
|
||||
case TimerState.Stop:
|
||||
case TimerState.LoadThenStop:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
_taState = (_newCra & 0x10) != 0
|
||||
? TimerState.LoadThenWaitThenCount
|
||||
: TimerState.WaitThenCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenStop;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TimerState.Count:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = (_newCra & 0x10) != 0
|
||||
? TimerState.LoadThenStop
|
||||
: TimerState.CountThenStop;
|
||||
}
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
case TimerState.WaitThenCount:
|
||||
if ((_newCra & 0x01) != 0)
|
||||
{
|
||||
if ((_newCra & 0x08) != 0)
|
||||
{
|
||||
_newCra &= 0xFE;
|
||||
_taState = TimerState.Stop;
|
||||
}
|
||||
else if ((_newCra & 0x10) != 0)
|
||||
{
|
||||
_taState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_taState = TimerState.Stop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_cra = _newCra & 0xEF;
|
||||
_hasNewCra = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void Tb_Count()
|
||||
{
|
||||
if (_tbCntPhi2 || (_tbCntTa && _taUnderflow) || (_tbCntTaCnt && _taUnderflow && _thisCnt) || (_tbCntCnt && !_lastCnt && _thisCnt))
|
||||
{
|
||||
if (_tb <= 0 || --_tb == 0)
|
||||
{
|
||||
if (_tbState != TimerState.Stop)
|
||||
{
|
||||
Tb_Interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Tb_Idle();
|
||||
}
|
||||
private void Tb_Count()
|
||||
{
|
||||
if (_tbCntPhi2 || (_tbCntTa && _taUnderflow) || (_tbCntTaCnt && _taUnderflow && _thisCnt) || (_tbCntCnt && !_lastCnt && _thisCnt))
|
||||
{
|
||||
if (_tb <= 0 || --_tb == 0)
|
||||
{
|
||||
if (_tbState != TimerState.Stop)
|
||||
{
|
||||
Tb_Interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Tb_Idle();
|
||||
}
|
||||
|
||||
private void Tb_Interrupt()
|
||||
{
|
||||
_tb = _latchb;
|
||||
private void Tb_Interrupt()
|
||||
{
|
||||
_tb = _latchb;
|
||||
if (DelayedInterrupts)
|
||||
_tbIrqNextCycle = true;
|
||||
else
|
||||
TriggerInterrupt(2);
|
||||
|
||||
_icr |= 2;
|
||||
_icr |= 2;
|
||||
|
||||
if ((_crb & 0x08) != 0)
|
||||
{
|
||||
_crb &= 0xFE;
|
||||
_newCrb &= 0xFE;
|
||||
_tbState = TimerState.LoadThenStop;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = TimerState.LoadThenCount;
|
||||
}
|
||||
if ((_crb & 0x08) != 0)
|
||||
{
|
||||
_crb &= 0xFE;
|
||||
_newCrb &= 0xFE;
|
||||
_tbState = TimerState.LoadThenStop;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = TimerState.LoadThenCount;
|
||||
}
|
||||
|
||||
if ((_crb & 0x02) != 0)
|
||||
{
|
||||
if ((_crb & 0x04) != 0)
|
||||
{
|
||||
_tbPrb7NegativeNextCycle = true;
|
||||
_prb |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
_prb ^= 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((_crb & 0x02) != 0)
|
||||
{
|
||||
if ((_crb & 0x04) != 0)
|
||||
{
|
||||
_tbPrb7NegativeNextCycle = true;
|
||||
_prb |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
_prb ^= 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Tb_Idle()
|
||||
{
|
||||
if (_hasNewCrb)
|
||||
{
|
||||
switch (_tbState)
|
||||
{
|
||||
case TimerState.Stop:
|
||||
case TimerState.LoadThenStop:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
_tbState = (_newCrb & 0x10) != 0
|
||||
? TimerState.LoadThenWaitThenCount
|
||||
: TimerState.WaitThenCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenStop;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TimerState.Count:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = (_newCrb & 0x10) != 0
|
||||
? TimerState.LoadThenStop
|
||||
: TimerState.CountThenStop;
|
||||
}
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
case TimerState.WaitThenCount:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
if ((_newCrb & 0x08) != 0)
|
||||
{
|
||||
_newCrb &= 0xFE;
|
||||
_tbState = TimerState.Stop;
|
||||
}
|
||||
else if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = TimerState.Stop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_crb = _newCrb & 0xEF;
|
||||
_hasNewCrb = false;
|
||||
}
|
||||
}
|
||||
private void Tb_Idle()
|
||||
{
|
||||
if (_hasNewCrb)
|
||||
{
|
||||
switch (_tbState)
|
||||
{
|
||||
case TimerState.Stop:
|
||||
case TimerState.LoadThenStop:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
_tbState = (_newCrb & 0x10) != 0
|
||||
? TimerState.LoadThenWaitThenCount
|
||||
: TimerState.WaitThenCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenStop;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TimerState.Count:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = (_newCrb & 0x10) != 0
|
||||
? TimerState.LoadThenStop
|
||||
: TimerState.CountThenStop;
|
||||
}
|
||||
break;
|
||||
case TimerState.LoadThenCount:
|
||||
case TimerState.WaitThenCount:
|
||||
if ((_newCrb & 0x01) != 0)
|
||||
{
|
||||
if ((_newCrb & 0x08) != 0)
|
||||
{
|
||||
_newCrb &= 0xFE;
|
||||
_tbState = TimerState.Stop;
|
||||
}
|
||||
else if ((_newCrb & 0x10) != 0)
|
||||
{
|
||||
_tbState = TimerState.LoadThenWaitThenCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tbState = TimerState.Stop;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_crb = _newCrb & 0xEF;
|
||||
_hasNewCrb = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerInterrupt(int bit)
|
||||
{
|
||||
_icr |= bit;
|
||||
if ((_intMask & bit) == 0) return;
|
||||
_icr |= 0x80;
|
||||
}
|
||||
private void TriggerInterrupt(int bit)
|
||||
{
|
||||
_icr |= bit;
|
||||
if ((_intMask & bit) == 0) return;
|
||||
_icr |= 0x80;
|
||||
}
|
||||
|
||||
public void SyncState(Serializer ser)
|
||||
{
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
else
|
||||
{
|
||||
_t1C--;
|
||||
if (_t1C == 0)
|
||||
if (_t1C == 0)
|
||||
{
|
||||
switch (_acrT1Control)
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (_t1C < 0)
|
||||
else if (_t1C < 0)
|
||||
{
|
||||
if (_t1CLoaded)
|
||||
{
|
||||
|
@ -331,7 +331,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
break;
|
||||
}
|
||||
|
||||
// interrupt generation
|
||||
// interrupt generation
|
||||
|
||||
if (_acrSrControl == ACR_SR_CONTROL_DISABLED)
|
||||
{
|
||||
|
@ -350,30 +350,30 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
with output pins on the peripheral ports.
|
||||
*/
|
||||
|
||||
if ((_pcrCa1IntControl == PCR_INT_CONTROL_POSITIVE_EDGE && Ca1 && !_ca1L) ||
|
||||
(_pcrCa1IntControl == PCR_INT_CONTROL_NEGATIVE_EDGE && !Ca1 && _ca1L))
|
||||
{
|
||||
if (_acrPaLatchEnable && (_ifr & 0x02) == 0)
|
||||
if ((_pcrCa1IntControl == PCR_INT_CONTROL_POSITIVE_EDGE && Ca1 && !_ca1L) ||
|
||||
(_pcrCa1IntControl == PCR_INT_CONTROL_NEGATIVE_EDGE && !Ca1 && _ca1L))
|
||||
{
|
||||
if (_acrPaLatchEnable && (_ifr & 0x02) == 0)
|
||||
_paLatch = _port.ReadExternalPra();
|
||||
_ifr |= 0x02;
|
||||
}
|
||||
_ifr |= 0x02;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
Input latching on the PB port is controlled in the same manner as that described for the PA port.
|
||||
However, with the peripheral B port the input latch will store either the voltage on the pin or the contents
|
||||
of the Output Register (ORB) depending on whether the pin is programmed to act as an input or an
|
||||
output. As with the PA port, the processor always reads the input latches.
|
||||
*/
|
||||
|
||||
if ((_pcrCb1IntControl == PCR_INT_CONTROL_POSITIVE_EDGE && Cb1 && !_cb1L) ||
|
||||
(_pcrCb1IntControl == PCR_INT_CONTROL_NEGATIVE_EDGE && !Cb1 && _cb1L))
|
||||
{
|
||||
if (_acrPbLatchEnable && (_ifr & 0x10) == 0)
|
||||
if ((_pcrCb1IntControl == PCR_INT_CONTROL_POSITIVE_EDGE && Cb1 && !_cb1L) ||
|
||||
(_pcrCb1IntControl == PCR_INT_CONTROL_NEGATIVE_EDGE && !Cb1 && _cb1L))
|
||||
{
|
||||
if (_acrPbLatchEnable && (_ifr & 0x10) == 0)
|
||||
_pbLatch = _port.ReadPrb(_prb, _ddrb);
|
||||
if (_acrSrControl == ACR_SR_CONTROL_DISABLED)
|
||||
_shiftIn = true;
|
||||
_ifr |= 0x10;
|
||||
}
|
||||
_ifr |= 0x10;
|
||||
}
|
||||
|
||||
if (_shiftIn)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
|
||||
switch (borderType)
|
||||
{
|
||||
|
||||
|
||||
case C64.BorderType.Full:
|
||||
newHblankStart = -1;
|
||||
newHblankEnd = -1;
|
||||
|
@ -128,27 +128,27 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.MOS
|
|||
newVblankStart = 0xFA + hBorderSize;
|
||||
newVblankEnd = 0x32 - hBorderSize;
|
||||
break;
|
||||
case C64.BorderType.None:
|
||||
newHblankStart = 0x158 + PixBufferSize;
|
||||
newHblankEnd = 0x018 + PixBufferSize;
|
||||
newVblankStart = 0xFA;
|
||||
newVblankEnd = 0x32;
|
||||
_vblank = true;
|
||||
_hblank = true;
|
||||
break;
|
||||
case C64.BorderType.None:
|
||||
newHblankStart = 0x158 + PixBufferSize;
|
||||
newHblankEnd = 0x018 + PixBufferSize;
|
||||
newVblankStart = 0xFA;
|
||||
newVblankEnd = 0x32;
|
||||
_vblank = true;
|
||||
_hblank = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// wrap values
|
||||
if (_hblank)
|
||||
{
|
||||
newHblankStart = WrapValue(0, maxWidth, newHblankStart);
|
||||
newHblankEnd = WrapValue(0, maxWidth, newHblankEnd);
|
||||
}
|
||||
if (_hblank)
|
||||
{
|
||||
newHblankStart = WrapValue(0, maxWidth, newHblankStart);
|
||||
newHblankEnd = WrapValue(0, maxWidth, newHblankEnd);
|
||||
}
|
||||
if (_vblank)
|
||||
{
|
||||
newVblankStart = WrapValue(0, lines, newVblankStart);
|
||||
newVblankEnd = WrapValue(0, lines, newVblankEnd);
|
||||
}
|
||||
{
|
||||
newVblankStart = WrapValue(0, lines, newVblankStart);
|
||||
newVblankEnd = WrapValue(0, lines, newVblankEnd);
|
||||
}
|
||||
|
||||
// calculate output dimensions
|
||||
_hblankStartCheckXRaster = newHblankStart & 0xFFC;
|
||||
|
|
|
@ -181,76 +181,76 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
|
|||
|
||||
public static Disk Read(byte[] source)
|
||||
{
|
||||
var formatB = source[D64_DISK_ID_OFFSET + 0x00];
|
||||
var formatA = source[D64_DISK_ID_OFFSET + 0x01];
|
||||
var formatB = source[D64_DISK_ID_OFFSET + 0x00];
|
||||
var formatA = source[D64_DISK_ID_OFFSET + 0x01];
|
||||
|
||||
using (var mem = new MemoryStream(source))
|
||||
{
|
||||
var reader = new BinaryReader(mem);
|
||||
var trackDatas = new List<byte[]>();
|
||||
var trackLengths = new List<int>();
|
||||
var trackNumbers = new List<int>();
|
||||
var trackDensities = new List<int>();
|
||||
var errorType = ErrorType.NoError;
|
||||
int trackCount;
|
||||
int errorOffset = -1;
|
||||
using (var mem = new MemoryStream(source))
|
||||
{
|
||||
var reader = new BinaryReader(mem);
|
||||
var trackDatas = new List<byte[]>();
|
||||
var trackLengths = new List<int>();
|
||||
var trackNumbers = new List<int>();
|
||||
var trackDensities = new List<int>();
|
||||
var errorType = ErrorType.NoError;
|
||||
int trackCount;
|
||||
int errorOffset = -1;
|
||||
|
||||
switch (source.Length)
|
||||
{
|
||||
case 174848: // 35 tracks no errors
|
||||
trackCount = 35;
|
||||
break;
|
||||
case 175531: // 35 tracks with errors
|
||||
trackCount = 35;
|
||||
errorOffset = 174848;
|
||||
break;
|
||||
case 196608: // 40 tracks no errors
|
||||
trackCount = 40;
|
||||
break;
|
||||
case 197376: // 40 tracks with errors
|
||||
trackCount = 40;
|
||||
errorOffset = 196608;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Not able to identify capacity of the D64 file.");
|
||||
}
|
||||
switch (source.Length)
|
||||
{
|
||||
case 174848: // 35 tracks no errors
|
||||
trackCount = 35;
|
||||
break;
|
||||
case 175531: // 35 tracks with errors
|
||||
trackCount = 35;
|
||||
errorOffset = 174848;
|
||||
break;
|
||||
case 196608: // 40 tracks no errors
|
||||
trackCount = 40;
|
||||
break;
|
||||
case 197376: // 40 tracks with errors
|
||||
trackCount = 40;
|
||||
errorOffset = 196608;
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Not able to identify capacity of the D64 file.");
|
||||
}
|
||||
|
||||
for (var i = 0; i < trackCount; i++)
|
||||
{
|
||||
if (errorOffset >= 0)
|
||||
{
|
||||
errorType = (ErrorType) source[errorOffset];
|
||||
errorOffset++;
|
||||
}
|
||||
var sectors = SectorsPerTrack[i];
|
||||
var trackLengthBits = 0;
|
||||
using (var trackMem = new MemoryStream())
|
||||
{
|
||||
for (var j = 0; j < sectors; j++)
|
||||
{
|
||||
int bitsWritten;
|
||||
var sectorData = reader.ReadBytes(256);
|
||||
var diskData = ConvertSectorToGcr(sectorData, (byte)j, (byte)(i + 1), formatA, formatB, StandardSectorGapLength[DensityTable[i]], errorType, out bitsWritten);
|
||||
trackMem.Write(diskData, 0, diskData.Length);
|
||||
trackLengthBits += bitsWritten;
|
||||
}
|
||||
var density = DensityTable[i];
|
||||
for (var i = 0; i < trackCount; i++)
|
||||
{
|
||||
if (errorOffset >= 0)
|
||||
{
|
||||
errorType = (ErrorType) source[errorOffset];
|
||||
errorOffset++;
|
||||
}
|
||||
var sectors = SectorsPerTrack[i];
|
||||
var trackLengthBits = 0;
|
||||
using (var trackMem = new MemoryStream())
|
||||
{
|
||||
for (var j = 0; j < sectors; j++)
|
||||
{
|
||||
int bitsWritten;
|
||||
var sectorData = reader.ReadBytes(256);
|
||||
var diskData = ConvertSectorToGcr(sectorData, (byte)j, (byte)(i + 1), formatA, formatB, StandardSectorGapLength[DensityTable[i]], errorType, out bitsWritten);
|
||||
trackMem.Write(diskData, 0, diskData.Length);
|
||||
trackLengthBits += bitsWritten;
|
||||
}
|
||||
var density = DensityTable[i];
|
||||
|
||||
// we pad the tracks with extra gap bytes to meet MNIB standards
|
||||
while (trackMem.Length < StandardTrackLengthBytes[density])
|
||||
{
|
||||
trackMem.WriteByte(0x55);
|
||||
}
|
||||
// we pad the tracks with extra gap bytes to meet MNIB standards
|
||||
while (trackMem.Length < StandardTrackLengthBytes[density])
|
||||
{
|
||||
trackMem.WriteByte(0x55);
|
||||
}
|
||||
|
||||
trackDatas.Add(trackMem.ToArray());
|
||||
trackLengths.Add(trackLengthBits);
|
||||
trackNumbers.Add(i * 2);
|
||||
trackDensities.Add(DensityTable[i]);
|
||||
}
|
||||
}
|
||||
trackDatas.Add(trackMem.ToArray());
|
||||
trackLengths.Add(trackLengthBits);
|
||||
trackNumbers.Add(i * 2);
|
||||
trackDensities.Add(DensityTable[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return new Disk(trackDatas, trackNumbers, trackDensities, 84) {WriteProtected = false};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,79 +64,79 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media
|
|||
}
|
||||
}
|
||||
|
||||
public static byte[] Write(IList<byte[]> trackData, IList<int> trackNumbers, IList<int> trackDensities)
|
||||
{
|
||||
const byte version = 0;
|
||||
const byte trackCount = 84;
|
||||
const int headerLength = 0xC;
|
||||
const byte dataFillerValue = 0xFF;
|
||||
public static byte[] Write(IList<byte[]> trackData, IList<int> trackNumbers, IList<int> trackDensities)
|
||||
{
|
||||
const byte version = 0;
|
||||
const byte trackCount = 84;
|
||||
const int headerLength = 0xC;
|
||||
const byte dataFillerValue = 0xFF;
|
||||
|
||||
var trackMaxLength = (ushort)Math.Max(7928, trackData.Max(d => d.Length));
|
||||
var trackMaxLength = (ushort)Math.Max(7928, trackData.Max(d => d.Length));
|
||||
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
var writer = new BinaryWriter(mem);
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
var writer = new BinaryWriter(mem);
|
||||
|
||||
// header ID
|
||||
writer.Write("GCR-1541".ToCharArray());
|
||||
// header ID
|
||||
writer.Write("GCR-1541".ToCharArray());
|
||||
|
||||
// version #
|
||||
writer.Write(version);
|
||||
// version #
|
||||
writer.Write(version);
|
||||
|
||||
// tracks in the image
|
||||
writer.Write(trackCount);
|
||||
// tracks in the image
|
||||
writer.Write(trackCount);
|
||||
|
||||
// maximum track size in bytes
|
||||
writer.Write(trackMaxLength);
|
||||
// maximum track size in bytes
|
||||
writer.Write(trackMaxLength);
|
||||
|
||||
// combine track data
|
||||
var offsets = new List<int>();
|
||||
var densities = new List<int>();
|
||||
using (var trackMem = new MemoryStream())
|
||||
{
|
||||
var trackMemWriter = new BinaryWriter(trackMem);
|
||||
for (var i = 0; i < trackCount; i++)
|
||||
{
|
||||
if (trackNumbers.Contains(i))
|
||||
{
|
||||
var trackIndex = trackNumbers.IndexOf(i);
|
||||
offsets.Add((int)trackMem.Length);
|
||||
densities.Add(trackDensities[trackIndex]);
|
||||
// combine track data
|
||||
var offsets = new List<int>();
|
||||
var densities = new List<int>();
|
||||
using (var trackMem = new MemoryStream())
|
||||
{
|
||||
var trackMemWriter = new BinaryWriter(trackMem);
|
||||
for (var i = 0; i < trackCount; i++)
|
||||
{
|
||||
if (trackNumbers.Contains(i))
|
||||
{
|
||||
var trackIndex = trackNumbers.IndexOf(i);
|
||||
offsets.Add((int)trackMem.Length);
|
||||
densities.Add(trackDensities[trackIndex]);
|
||||
|
||||
var data = trackData[trackIndex];
|
||||
var buffer = Enumerable.Repeat(dataFillerValue, trackMaxLength).ToArray();
|
||||
var dataBytes = data.Select(d => unchecked((byte)d)).ToArray();
|
||||
Array.Copy(dataBytes, buffer, dataBytes.Length);
|
||||
trackMemWriter.Write((ushort)dataBytes.Length);
|
||||
trackMemWriter.Write(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets.Add(-1);
|
||||
densities.Add(0);
|
||||
}
|
||||
}
|
||||
trackMemWriter.Flush();
|
||||
var data = trackData[trackIndex];
|
||||
var buffer = Enumerable.Repeat(dataFillerValue, trackMaxLength).ToArray();
|
||||
var dataBytes = data.Select(d => unchecked((byte)d)).ToArray();
|
||||
Array.Copy(dataBytes, buffer, dataBytes.Length);
|
||||
trackMemWriter.Write((ushort)dataBytes.Length);
|
||||
trackMemWriter.Write(buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets.Add(-1);
|
||||
densities.Add(0);
|
||||
}
|
||||
}
|
||||
trackMemWriter.Flush();
|
||||
|
||||
// offset table
|
||||
foreach (var offset in offsets.Select(o => o >= 0 ? o + headerLength + trackCount * 8 : 0))
|
||||
{
|
||||
writer.Write(offset);
|
||||
}
|
||||
// offset table
|
||||
foreach (var offset in offsets.Select(o => o >= 0 ? o + headerLength + trackCount * 8 : 0))
|
||||
{
|
||||
writer.Write(offset);
|
||||
}
|
||||
|
||||
// speed zone data
|
||||
foreach (var density in densities)
|
||||
{
|
||||
writer.Write(density);
|
||||
}
|
||||
// speed zone data
|
||||
foreach (var density in densities)
|
||||
{
|
||||
writer.Write(density);
|
||||
}
|
||||
|
||||
// track data
|
||||
writer.Write(trackMem.ToArray());
|
||||
}
|
||||
// track data
|
||||
writer.Write(trackMem.ToArray());
|
||||
}
|
||||
|
||||
writer.Flush();
|
||||
return mem.ToArray();
|
||||
}
|
||||
}
|
||||
writer.Flush();
|
||||
return mem.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,167 +36,167 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Serial
|
|||
_rngCurrent = unchecked((int) ((_rngCurrent * LEHMER_RNG_PRIME) & int.MaxValue));
|
||||
}
|
||||
|
||||
private void ExecuteFlux()
|
||||
{
|
||||
// This actually executes the main 16mhz clock
|
||||
while (_clocks > 0)
|
||||
{
|
||||
_clocks--;
|
||||
private void ExecuteFlux()
|
||||
{
|
||||
// This actually executes the main 16mhz clock
|
||||
while (_clocks > 0)
|
||||
{
|
||||
_clocks--;
|
||||
|
||||
// rotate disk
|
||||
if (_motorEnabled)
|
||||
{
|
||||
if (_disk == null)
|
||||
{
|
||||
_diskBitsLeft = 1;
|
||||
_diskBits = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_diskBitsLeft <= 0)
|
||||
{
|
||||
if (_diskWriteEnabled)
|
||||
_trackImageData[_diskByteOffset] = _diskOutputBits;
|
||||
// rotate disk
|
||||
if (_motorEnabled)
|
||||
{
|
||||
if (_disk == null)
|
||||
{
|
||||
_diskBitsLeft = 1;
|
||||
_diskBits = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_diskBitsLeft <= 0)
|
||||
{
|
||||
if (_diskWriteEnabled)
|
||||
_trackImageData[_diskByteOffset] = _diskOutputBits;
|
||||
|
||||
_diskByteOffset++;
|
||||
_diskByteOffset++;
|
||||
|
||||
if (_diskByteOffset == Disk.FluxEntriesPerTrack)
|
||||
_diskByteOffset = 0;
|
||||
if (_diskByteOffset == Disk.FluxEntriesPerTrack)
|
||||
_diskByteOffset = 0;
|
||||
|
||||
if (!_diskWriteEnabled)
|
||||
_diskBits = _trackImageData[_diskByteOffset];
|
||||
if (!_diskWriteEnabled)
|
||||
_diskBits = _trackImageData[_diskByteOffset];
|
||||
|
||||
_diskOutputBits = 0;
|
||||
_diskBitsLeft = Disk.FluxBitsPerEntry;
|
||||
}
|
||||
}
|
||||
_diskOutputBits >>= 1;
|
||||
_diskOutputBits = 0;
|
||||
_diskBitsLeft = Disk.FluxBitsPerEntry;
|
||||
}
|
||||
}
|
||||
_diskOutputBits >>= 1;
|
||||
|
||||
if (_diskWriteEnabled && !_diskWriteProtected)
|
||||
_countsBeforeRandomTransition = 0;
|
||||
if (_diskWriteEnabled && !_diskWriteProtected)
|
||||
_countsBeforeRandomTransition = 0;
|
||||
|
||||
if ((_diskBits & 1) != 0)
|
||||
{
|
||||
_countsBeforeRandomTransition = 0;
|
||||
_diskFluxReversalDetected = true;
|
||||
_diskOutputBits |= int.MinValue; // set bit 31
|
||||
}
|
||||
else
|
||||
{
|
||||
_diskOutputBits &= int.MaxValue; // clear bit 31
|
||||
}
|
||||
if ((_diskBits & 1) != 0)
|
||||
{
|
||||
_countsBeforeRandomTransition = 0;
|
||||
_diskFluxReversalDetected = true;
|
||||
_diskOutputBits |= int.MinValue; // set bit 31
|
||||
}
|
||||
else
|
||||
{
|
||||
_diskOutputBits &= int.MaxValue; // clear bit 31
|
||||
}
|
||||
|
||||
_diskBits >>= 1;
|
||||
_diskBitsLeft--;
|
||||
}
|
||||
_diskBits >>= 1;
|
||||
_diskBitsLeft--;
|
||||
}
|
||||
|
||||
// random flux transition readings for unformatted data
|
||||
if (_countsBeforeRandomTransition > 0)
|
||||
{
|
||||
_countsBeforeRandomTransition--;
|
||||
if (_countsBeforeRandomTransition == 0)
|
||||
{
|
||||
_diskFluxReversalDetected = true;
|
||||
AdvanceRng();
|
||||
// This constant is what VICE uses. TODO: Determine accuracy.
|
||||
_countsBeforeRandomTransition = (_rngCurrent % 367) + 33;
|
||||
}
|
||||
}
|
||||
// random flux transition readings for unformatted data
|
||||
if (_countsBeforeRandomTransition > 0)
|
||||
{
|
||||
_countsBeforeRandomTransition--;
|
||||
if (_countsBeforeRandomTransition == 0)
|
||||
{
|
||||
_diskFluxReversalDetected = true;
|
||||
AdvanceRng();
|
||||
// This constant is what VICE uses. TODO: Determine accuracy.
|
||||
_countsBeforeRandomTransition = (_rngCurrent % 367) + 33;
|
||||
}
|
||||
}
|
||||
|
||||
// flux transition circuitry
|
||||
if (_diskFluxReversalDetected)
|
||||
{
|
||||
if (!_diskWriteEnabled)
|
||||
{
|
||||
_diskDensityCounter = _diskDensity;
|
||||
_diskSupplementaryCounter = 0;
|
||||
}
|
||||
_diskFluxReversalDetected = false;
|
||||
if (_countsBeforeRandomTransition == 0)
|
||||
{
|
||||
AdvanceRng();
|
||||
// This constant is what VICE uses. TODO: Determine accuracy.
|
||||
_countsBeforeRandomTransition = (_rngCurrent & 0x1F) + 289;
|
||||
}
|
||||
}
|
||||
// flux transition circuitry
|
||||
if (_diskFluxReversalDetected)
|
||||
{
|
||||
if (!_diskWriteEnabled)
|
||||
{
|
||||
_diskDensityCounter = _diskDensity;
|
||||
_diskSupplementaryCounter = 0;
|
||||
}
|
||||
_diskFluxReversalDetected = false;
|
||||
if (_countsBeforeRandomTransition == 0)
|
||||
{
|
||||
AdvanceRng();
|
||||
// This constant is what VICE uses. TODO: Determine accuracy.
|
||||
_countsBeforeRandomTransition = (_rngCurrent & 0x1F) + 289;
|
||||
}
|
||||
}
|
||||
|
||||
// counter circuitry
|
||||
if (_diskDensityCounter >= 16)
|
||||
{
|
||||
_diskDensityCounter = _diskDensity;
|
||||
_diskSupplementaryCounter++;
|
||||
// counter circuitry
|
||||
if (_diskDensityCounter >= 16)
|
||||
{
|
||||
_diskDensityCounter = _diskDensity;
|
||||
_diskSupplementaryCounter++;
|
||||
|
||||
if ((_diskSupplementaryCounter & 0x3) == 0x2)
|
||||
{
|
||||
if (!_diskWriteEnabled)
|
||||
_diskWriteBitsRemaining = 0;
|
||||
_diskWriteEnabled = !Via1.Cb2;
|
||||
if ((_diskSupplementaryCounter & 0x3) == 0x2)
|
||||
{
|
||||
if (!_diskWriteEnabled)
|
||||
_diskWriteBitsRemaining = 0;
|
||||
_diskWriteEnabled = !Via1.Cb2;
|
||||
|
||||
_diskWriteBitsRemaining--;
|
||||
if (_diskWriteEnabled)
|
||||
{
|
||||
_countsBeforeRandomTransition = 0;
|
||||
_byteReady = false;
|
||||
if (_diskWriteBitsRemaining <= 0)
|
||||
{
|
||||
_diskWriteLatch = Via1.EffectivePrA;
|
||||
_diskWriteBitsRemaining = 8;
|
||||
_byteReady = Via1.Ca2;
|
||||
}
|
||||
if ((_diskWriteLatch & 0x80) != 0)
|
||||
{
|
||||
_diskOutputBits |= int.MinValue; // set bit 31
|
||||
}
|
||||
_diskWriteLatch <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_bitsRemainingInLatchedByte--;
|
||||
_byteReady = false;
|
||||
_bitHistory = (_bitHistory << 1) | ((_diskSupplementaryCounter & 0xC) == 0x0 ? 1 : 0);
|
||||
_sync = false;
|
||||
if (!_diskWriteEnabled && (_bitHistory & 0x3FF) == 0x3FF)
|
||||
{
|
||||
_sync = true;
|
||||
_bitsRemainingInLatchedByte = 8;
|
||||
_byteReady = false;
|
||||
}
|
||||
_diskWriteBitsRemaining--;
|
||||
if (_diskWriteEnabled)
|
||||
{
|
||||
_countsBeforeRandomTransition = 0;
|
||||
_byteReady = false;
|
||||
if (_diskWriteBitsRemaining <= 0)
|
||||
{
|
||||
_diskWriteLatch = Via1.EffectivePrA;
|
||||
_diskWriteBitsRemaining = 8;
|
||||
_byteReady = Via1.Ca2;
|
||||
}
|
||||
if ((_diskWriteLatch & 0x80) != 0)
|
||||
{
|
||||
_diskOutputBits |= int.MinValue; // set bit 31
|
||||
}
|
||||
_diskWriteLatch <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_bitsRemainingInLatchedByte--;
|
||||
_byteReady = false;
|
||||
_bitHistory = (_bitHistory << 1) | ((_diskSupplementaryCounter & 0xC) == 0x0 ? 1 : 0);
|
||||
_sync = false;
|
||||
if (!_diskWriteEnabled && (_bitHistory & 0x3FF) == 0x3FF)
|
||||
{
|
||||
_sync = true;
|
||||
_bitsRemainingInLatchedByte = 8;
|
||||
_byteReady = false;
|
||||
}
|
||||
|
||||
if (_bitsRemainingInLatchedByte <= 0)
|
||||
{
|
||||
_bitsRemainingInLatchedByte = 8;
|
||||
if (_bitsRemainingInLatchedByte <= 0)
|
||||
{
|
||||
_bitsRemainingInLatchedByte = 8;
|
||||
|
||||
// SOE (SO/Byte Ready enabled)
|
||||
_byteReady = Via1.Ca2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// SOE (SO/Byte Ready enabled)
|
||||
_byteReady = Via1.Ca2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// negative transition activates SO pin on CPU
|
||||
_previousCa1 = Via1.Ca1;
|
||||
Via1.Ca1 = !_byteReady;
|
||||
if (_previousCa1 && !Via1.Ca1)
|
||||
{
|
||||
// cycle 6 is roughly 400ns
|
||||
_overflowFlagDelaySr |= _diskCycle > 6 ? 4 : 2;
|
||||
}
|
||||
}
|
||||
// negative transition activates SO pin on CPU
|
||||
_previousCa1 = Via1.Ca1;
|
||||
Via1.Ca1 = !_byteReady;
|
||||
if (_previousCa1 && !Via1.Ca1)
|
||||
{
|
||||
// cycle 6 is roughly 400ns
|
||||
_overflowFlagDelaySr |= _diskCycle > 6 ? 4 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (_diskSupplementaryCounter >= 16)
|
||||
{
|
||||
_diskSupplementaryCounter = 0;
|
||||
}
|
||||
if (_diskSupplementaryCounter >= 16)
|
||||
{
|
||||
_diskSupplementaryCounter = 0;
|
||||
}
|
||||
|
||||
_cpuClocks--;
|
||||
if (_cpuClocks <= 0)
|
||||
{
|
||||
ExecuteSystem();
|
||||
_cpuClocks = 16;
|
||||
}
|
||||
_cpuClocks--;
|
||||
if (_cpuClocks <= 0)
|
||||
{
|
||||
ExecuteSystem();
|
||||
_cpuClocks = 16;
|
||||
}
|
||||
|
||||
_diskDensityCounter++;
|
||||
_diskCycle = (_diskCycle + 1) & 0xF;
|
||||
}
|
||||
}
|
||||
_diskDensityCounter++;
|
||||
_diskCycle = (_diskCycle + 1) & 0xF;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,82 +429,82 @@ namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|||
public static readonly int[] PALPalette =
|
||||
{
|
||||
0x000000, 0x1c1c1c, 0x393939, 0x595959, // Grey
|
||||
0x797979, 0x929292, 0xababab, 0xbcbcbc,
|
||||
0x797979, 0x929292, 0xababab, 0xbcbcbc,
|
||||
0xcdcdcd, 0xd9d9d9, 0xe6e6e6, 0xececec,
|
||||
0xf2f2f2, 0xf8f8f8, 0xffffff, 0xffffff,
|
||||
|
||||
0x263001, 0x243803, 0x234005, 0x51541b, // Orange Green
|
||||
0x806931, 0x978135, 0xaf993a, 0xc2a73e,
|
||||
0x806931, 0x978135, 0xaf993a, 0xc2a73e,
|
||||
0xd5b543, 0xdbc03d, 0xe1cb38, 0xe2d836,
|
||||
0xe3e534, 0xeff258, 0xfbff7d, 0xfbff7d,
|
||||
|
||||
0x263001, 0x243803, 0x234005, 0x51541b, // Orange Green
|
||||
0x806931, 0x978135, 0xaf993a, 0xc2a73e,
|
||||
0x806931, 0x978135, 0xaf993a, 0xc2a73e,
|
||||
0xd5b543, 0xdbc03d, 0xe1cb38, 0xe2d836,
|
||||
0xe3e534, 0xeff258, 0xfbff7d, 0xfbff7d,
|
||||
|
||||
0x401a02, 0x581f05, 0x702408, 0x8d3a13, // Light Orange
|
||||
0xab511f, 0xb56427, 0xbf7730, 0xd0853a,
|
||||
0xab511f, 0xb56427, 0xbf7730, 0xd0853a,
|
||||
0xe19344, 0xeda04e, 0xf9ad58, 0xfcb75c,
|
||||
0xffc160, 0xffc671, 0xffcb83, 0xffcb83,
|
||||
|
||||
0x391701, 0x5e2304, 0x833008, 0xa54716, // Gold
|
||||
0xc85f24, 0xe37820, 0xff911d, 0xffab1d,
|
||||
0xc85f24, 0xe37820, 0xff911d, 0xffab1d,
|
||||
0xffc51d, 0xffce34, 0xffd84c, 0xffe651,
|
||||
0xfff456, 0xfff977, 0xffff98, 0xffff98,
|
||||
|
||||
0x451904, 0x721e11, 0x9f241e, 0xb33a20, // Orange
|
||||
0xc85122, 0xe36920, 0xff811e, 0xff8c25,
|
||||
0xc85122, 0xe36920, 0xff811e, 0xff8c25,
|
||||
0xff982c, 0xffae38, 0xffc545, 0xffc559,
|
||||
0xffc66d, 0xffd587, 0xffe4a1, 0xffe4a1,
|
||||
|
||||
0x4a1704, 0x7e1a0d, 0xb21d17, 0xc82119, // Red Orange
|
||||
0xdf251c, 0xec3b38, 0xfa5255, 0xfc6161,
|
||||
0xdf251c, 0xec3b38, 0xfa5255, 0xfc6161,
|
||||
0xff706e, 0xff7f7e, 0xff8f8f, 0xff9d9e,
|
||||
0xffabad, 0xffb9bd, 0xffc7ce, 0xffc7ce,
|
||||
|
||||
0x050568, 0x3b136d, 0x712272, 0x8b2a8c, // Pink
|
||||
0xa532a6, 0xb938ba, 0xcd3ecf, 0xdb47dd,
|
||||
0xa532a6, 0xb938ba, 0xcd3ecf, 0xdb47dd,
|
||||
0xea51eb, 0xf45ff5, 0xfe6dff, 0xfe7afd,
|
||||
0xff87fb, 0xff95fd, 0xffa4ff, 0xffa4ff,
|
||||
|
||||
0x280479, 0x400984, 0x590f90, 0x70249d, // Purple
|
||||
0x8839aa, 0xa441c3, 0xc04adc, 0xd054ed,
|
||||
0x8839aa, 0xa441c3, 0xc04adc, 0xd054ed,
|
||||
0xe05eff, 0xe96dff, 0xf27cff, 0xf88aff,
|
||||
0xff98ff, 0xfea1ff, 0xfeabff, 0xfeabff,
|
||||
|
||||
0x051e81, 0x0626a5, 0x082fca, 0x263dd4, // Blue1
|
||||
0x444cde, 0x4f5aee, 0x5a68ff, 0x6575ff,
|
||||
0x444cde, 0x4f5aee, 0x5a68ff, 0x6575ff,
|
||||
0x7183ff, 0x8091ff, 0x90a0ff, 0x97a9ff,
|
||||
0x9fb2ff, 0xafbeff, 0xc0cbff, 0xc0cbff,
|
||||
|
||||
0x0c048b, 0x2218a0, 0x382db5, 0x483ec7, // Blue2
|
||||
0x584fda, 0x6159ec, 0x6b64ff, 0x7a74ff,
|
||||
0x584fda, 0x6159ec, 0x6b64ff, 0x7a74ff,
|
||||
0x8a84ff, 0x918eff, 0x9998ff, 0xa5a3ff,
|
||||
0xb1aeff, 0xb8b8ff, 0xc0c2ff, 0xc0c2ff,
|
||||
|
||||
0x1d295a, 0x1d3876, 0x1d4892, 0x1c5cac, // Light Blue
|
||||
0x1c71c6, 0x3286cf, 0x489bd9, 0x4ea8ec,
|
||||
0x1c71c6, 0x3286cf, 0x489bd9, 0x4ea8ec,
|
||||
0x55b6ff, 0x70c7ff, 0x8cd8ff, 0x93dbff,
|
||||
0x9bdfff, 0xafe4ff, 0xc3e9ff, 0xc3e9ff,
|
||||
|
||||
0x2f4302, 0x395202, 0x446103, 0x417a12, // Turquoise
|
||||
0x3e9421, 0x4a9f2e, 0x57ab3b, 0x5cbd55,
|
||||
0x3e9421, 0x4a9f2e, 0x57ab3b, 0x5cbd55,
|
||||
0x61d070, 0x69e27a, 0x72f584, 0x7cfa8d,
|
||||
0x87ff97, 0x9affa6, 0xadffb6, 0xadffb6,
|
||||
|
||||
0x0a4108, 0x0d540a, 0x10680d, 0x137d0f, // Green Blue
|
||||
0x169212, 0x19a514, 0x1cb917, 0x1ec919,
|
||||
0x169212, 0x19a514, 0x1cb917, 0x1ec919,
|
||||
0x21d91b, 0x47e42d, 0x6ef040, 0x78f74d,
|
||||
0x83ff5b, 0x9aff7a, 0xb2ff9a, 0xb2ff9a,
|
||||
|
||||
0x04410b, 0x05530e, 0x066611, 0x077714, // Green
|
||||
0x088817, 0x099b1a, 0x0baf1d, 0x48c41f,
|
||||
0x088817, 0x099b1a, 0x0baf1d, 0x48c41f,
|
||||
0x86d922, 0x8fe924, 0x99f927, 0xa8fc41,
|
||||
0xb7ff5b, 0xc9ff6e, 0xdcff81, 0xdcff81,
|
||||
|
||||
0x02350f, 0x073f15, 0x0c4a1c, 0x2d5f1e, // Yellow Green
|
||||
0x4f7420, 0x598324, 0x649228, 0x82a12e,
|
||||
0x4f7420, 0x598324, 0x649228, 0x82a12e,
|
||||
0xa1b034, 0xa9c13a, 0xb2d241, 0xc4d945,
|
||||
0xd6e149, 0xe4f04e, 0xf2ff53, 0xf2ff53
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
{
|
||||
get
|
||||
{
|
||||
return _lagcount;
|
||||
return _lagcount;
|
||||
}
|
||||
|
||||
set
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX
|
|||
public int Port1;
|
||||
public int Port2;
|
||||
public int PixelPro;
|
||||
}
|
||||
}
|
||||
|
||||
[BizImport(CC)]
|
||||
public abstract void SetCDCallbacks(LibSaturnus.CDTOCCallback toccallback,
|
||||
|
|
|
@ -63,13 +63,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
ForceGammaCorrection = false;
|
||||
GammaCorrectionLevel = 2.0f;
|
||||
EnableOverscan = false;
|
||||
OverscanNtscTop = 0;
|
||||
OverscanNtscBottom = 0;
|
||||
OverscanNtscLeft = 0;
|
||||
OverscanNtscRight = 0;
|
||||
OverscanPalTop = 0;
|
||||
OverscanPalBottom = 0;
|
||||
OverscanPalLeft = 0;
|
||||
OverscanNtscTop = 0;
|
||||
OverscanNtscBottom = 0;
|
||||
OverscanNtscLeft = 0;
|
||||
OverscanNtscRight = 0;
|
||||
OverscanPalTop = 0;
|
||||
OverscanPalBottom = 0;
|
||||
OverscanPalLeft = 0;
|
||||
OverscanPalRight = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
public int BufferWidth { get; private set; }
|
||||
public int BufferHeight { get; private set; }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
public int VsyncNumerator { get; internal set; }
|
||||
public int VsyncNumerator { get; internal set; }
|
||||
public int VsyncDenominator { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
static byte[] TRIANGLE_TABLE =
|
||||
{
|
||||
15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
|
||||
};
|
||||
static int[] NOISE_TABLE_NTSC =
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||
{
|
||||
public partial class NES
|
||||
{
|
||||
public partial class NES
|
||||
{
|
||||
public struct CpuLink : IMOS6502XLink
|
||||
{
|
||||
private readonly NES _nes;
|
||||
|
|
|
@ -66,8 +66,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
eMessage_BRK_hook_write,
|
||||
eMessage_BRK_hook_nmi,
|
||||
eMessage_BRK_hook_irq,
|
||||
eMessage_BRK_hook_exec_smp,
|
||||
eMessage_BRK_hook_read_smp,
|
||||
eMessage_BRK_hook_exec_smp,
|
||||
eMessage_BRK_hook_read_smp,
|
||||
eMessage_BRK_hook_write_smp,
|
||||
eMessage_BRK_scanlineStart,
|
||||
};
|
||||
|
|
|
@ -1,143 +1,143 @@
|
|||
namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
||||
{
|
||||
public partial class VDP
|
||||
{
|
||||
// TODO: HCounter
|
||||
readonly byte[] VLineCounterTableNTSC192 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
public partial class VDP
|
||||
{
|
||||
// TODO: HCounter
|
||||
readonly byte[] VLineCounterTableNTSC192 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA,
|
||||
0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
|
||||
readonly byte[] VLineCounterTableNTSC224 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
|
||||
0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
readonly byte[] VLineCounterTableNTSC224 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA,
|
||||
0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
};
|
||||
|
||||
readonly byte[] VLineCounterTableNTSC240 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05
|
||||
};
|
||||
readonly byte[] VLineCounterTableNTSC240 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05
|
||||
};
|
||||
|
||||
readonly byte[] VLineCounterTablePAL192 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2,
|
||||
0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
readonly byte[] VLineCounterTablePAL192 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2,
|
||||
0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
|
||||
readonly byte[] VLineCounterTablePAL224 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02,
|
||||
0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
readonly byte[] VLineCounterTablePAL224 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02,
|
||||
0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
|
||||
readonly byte[] VLineCounterTablePAL240 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
}
|
||||
readonly byte[] VLineCounterTablePAL240 =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,
|
||||
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
|
||||
0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
|
||||
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
|
||||
0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
||||
0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
|
||||
0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
|
||||
0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -234,10 +234,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
|||
|
||||
protected override string[] AnalogNames => _analogNames;
|
||||
|
||||
public ThreeDeeGamepad()
|
||||
{
|
||||
Definition.FloatRanges[2] = new FloatRange(0, 0, 255);
|
||||
Definition.FloatRanges[3] = new FloatRange(0, 0, 255);
|
||||
public ThreeDeeGamepad()
|
||||
{
|
||||
Definition.FloatRanges[2] = new FloatRange(0, 0, 255);
|
||||
Definition.FloatRanges[3] = new FloatRange(0, 0, 255);
|
||||
}
|
||||
|
||||
public override void Update(IController controller, byte[] dest, int offset)
|
||||
|
@ -275,9 +275,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
|||
"Mouse Left", "Mouse Right", "Mouse Center", "Start"
|
||||
};
|
||||
|
||||
protected override string[] ButtonNames => _buttonNames;
|
||||
|
||||
private static readonly string[] _analogNames =
|
||||
protected override string[] ButtonNames => _buttonNames;
|
||||
|
||||
private static readonly string[] _analogNames =
|
||||
{
|
||||
"X", "Y"
|
||||
};
|
||||
|
@ -288,7 +288,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
|||
{
|
||||
switch (name)
|
||||
{
|
||||
default:
|
||||
default:
|
||||
case "Mouse Left":
|
||||
return 0;
|
||||
case "Mouse Center":
|
||||
|
@ -366,7 +366,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
|||
switch (name)
|
||||
{
|
||||
default:
|
||||
return 0;
|
||||
return 0;
|
||||
case "Start":
|
||||
return 1;
|
||||
case "A":
|
||||
|
@ -557,116 +557,116 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.Saturn
|
|||
{
|
||||
switch (name)
|
||||
{
|
||||
default: return 0;
|
||||
case "Escape": return 1;
|
||||
case "F1": return 2;
|
||||
case "F2": return 3;
|
||||
case "F3": return 4;
|
||||
default: return 0;
|
||||
case "Escape": return 1;
|
||||
case "F1": return 2;
|
||||
case "F2": return 3;
|
||||
case "F3": return 4;
|
||||
case "F4": return 5;
|
||||
case "F5": return 6;
|
||||
case "F6": return 7;
|
||||
case "F7": return 8;
|
||||
case "F8": return 9;
|
||||
case "F9": return 10;
|
||||
case "F10": return 11;
|
||||
case "F11": return 12;
|
||||
case "F12": return 13;
|
||||
|
||||
case "Grave`": return 100;
|
||||
case "1(One)": return 101;
|
||||
case "2": return 102;
|
||||
case "3": return 103;
|
||||
case "F6": return 7;
|
||||
case "F7": return 8;
|
||||
case "F8": return 9;
|
||||
case "F9": return 10;
|
||||
case "F10": return 11;
|
||||
case "F11": return 12;
|
||||
case "F12": return 13;
|
||||
|
||||
case "Grave`": return 100;
|
||||
case "1(One)": return 101;
|
||||
case "2": return 102;
|
||||
case "3": return 103;
|
||||
case "4": return 104;
|
||||
case "5": return 105;
|
||||
case "6": return 106;
|
||||
case "5": return 105;
|
||||
case "6": return 106;
|
||||
case "7": return 107;
|
||||
case "8": return 108;
|
||||
case "9": return 109;
|
||||
case "0(Zero)": return 110;
|
||||
case "Minus-": return 111;
|
||||
case "Equals=": return 112;
|
||||
case "Backslash\\": return 113;
|
||||
case "Backspace": return 114;
|
||||
|
||||
case "Tab": return 200;
|
||||
case "Q": return 201;
|
||||
case "W": return 202;
|
||||
case "E": return 203;
|
||||
case "R(Key)": return 204;
|
||||
case "T": return 205;
|
||||
case "Y(Key)": return 206;
|
||||
case "U": return 207;
|
||||
case "I": return 208;
|
||||
case "O": return 209;
|
||||
case "P": return 210;
|
||||
case "LeftBracket[": return 211;
|
||||
case "RightBracket]": return 212;
|
||||
case "Enter": return 213;
|
||||
|
||||
case "CapsLock": return 300;
|
||||
case "A(Key)": return 301;
|
||||
case "S": return 302;
|
||||
case "D": return 303;
|
||||
case "F": return 304;
|
||||
case "G": return 305;
|
||||
case "8": return 108;
|
||||
case "9": return 109;
|
||||
case "0(Zero)": return 110;
|
||||
case "Minus-": return 111;
|
||||
case "Equals=": return 112;
|
||||
case "Backslash\\": return 113;
|
||||
case "Backspace": return 114;
|
||||
|
||||
case "Tab": return 200;
|
||||
case "Q": return 201;
|
||||
case "W": return 202;
|
||||
case "E": return 203;
|
||||
case "R(Key)": return 204;
|
||||
case "T": return 205;
|
||||
case "Y(Key)": return 206;
|
||||
case "U": return 207;
|
||||
case "I": return 208;
|
||||
case "O": return 209;
|
||||
case "P": return 210;
|
||||
case "LeftBracket[": return 211;
|
||||
case "RightBracket]": return 212;
|
||||
case "Enter": return 213;
|
||||
|
||||
case "CapsLock": return 300;
|
||||
case "A(Key)": return 301;
|
||||
case "S": return 302;
|
||||
case "D": return 303;
|
||||
case "F": return 304;
|
||||
case "G": return 305;
|
||||
case "H": return 306;
|
||||
case "J": return 307;
|
||||
case "K": return 308;
|
||||
case "L(Key)": return 309;
|
||||
case "Semicolon;": return 310;
|
||||
case "Quote'": return 311;
|
||||
|
||||
case "LeftShift": return 400;
|
||||
case "Z(Key)": return 401;
|
||||
case "X(Key)": return 402;
|
||||
case "J": return 307;
|
||||
case "K": return 308;
|
||||
case "L(Key)": return 309;
|
||||
case "Semicolon;": return 310;
|
||||
case "Quote'": return 311;
|
||||
|
||||
case "LeftShift": return 400;
|
||||
case "Z(Key)": return 401;
|
||||
case "X(Key)": return 402;
|
||||
case "C(Key)": return 403;
|
||||
case "V": return 404;
|
||||
case "B(Key)": return 405;
|
||||
case "N": return 406;
|
||||
case "M": return 407;
|
||||
case "V": return 404;
|
||||
case "B(Key)": return 405;
|
||||
case "N": return 406;
|
||||
case "M": return 407;
|
||||
case "Comma,": return 408;
|
||||
case "Period.": return 409;
|
||||
case "Slash/": return 410;
|
||||
case "RightShift": return 411;
|
||||
|
||||
case "LeftCtrl": return 500;
|
||||
case "LeftAlt": return 501;
|
||||
case "Space": return 502;
|
||||
case "RightAlt": return 503;
|
||||
case "RightCtrl": return 504;
|
||||
|
||||
case "PrintScreen": return 1000;
|
||||
case "ScrollLock": return 1001;
|
||||
case "Pause": return 1002;
|
||||
|
||||
case "Insert": return 1100;
|
||||
case "Delete": return 1101;
|
||||
case "Slash/": return 410;
|
||||
case "RightShift": return 411;
|
||||
|
||||
case "LeftCtrl": return 500;
|
||||
case "LeftAlt": return 501;
|
||||
case "Space": return 502;
|
||||
case "RightAlt": return 503;
|
||||
case "RightCtrl": return 504;
|
||||
|
||||
case "PrintScreen": return 1000;
|
||||
case "ScrollLock": return 1001;
|
||||
case "Pause": return 1002;
|
||||
|
||||
case "Insert": return 1100;
|
||||
case "Delete": return 1101;
|
||||
case "Home": return 1102;
|
||||
case "End": return 1103;
|
||||
case "End": return 1103;
|
||||
case "PageUp": return 1104;
|
||||
case "PageDown": return 1105;
|
||||
|
||||
case "PageDown": return 1105;
|
||||
|
||||
case "Up": return 1200;
|
||||
case "Down": return 1201;
|
||||
case "CursorLeft": return 1202;
|
||||
case "Right": return 1203;
|
||||
|
||||
case "NumLock": return 1300;
|
||||
case "KeypadSlash(Divide)": return 1301;
|
||||
case "KeypadAsterisk(Multiply)": return 1302;
|
||||
case "KeypadMinus": return 1303;
|
||||
case "KeypadHome/7": return 1304;
|
||||
case "KeypadUp/8": return 1305;
|
||||
case "KeypadPageup/9": return 1306;
|
||||
case "KeypadPlus": return 1307;
|
||||
case "KeypadLeft/4": return 1308;
|
||||
case "Down": return 1201;
|
||||
case "CursorLeft": return 1202;
|
||||
case "Right": return 1203;
|
||||
|
||||
case "NumLock": return 1300;
|
||||
case "KeypadSlash(Divide)": return 1301;
|
||||
case "KeypadAsterisk(Multiply)": return 1302;
|
||||
case "KeypadMinus": return 1303;
|
||||
case "KeypadHome/7": return 1304;
|
||||
case "KeypadUp/8": return 1305;
|
||||
case "KeypadPageup/9": return 1306;
|
||||
case "KeypadPlus": return 1307;
|
||||
case "KeypadLeft/4": return 1308;
|
||||
case "KeypadCenter/5": return 1309;
|
||||
case "KeypadRight/6": return 1310;
|
||||
case "KeypadEnd/1": return 1311;
|
||||
case "KeypadDown/2": return 1312;
|
||||
case "KeypadPagedown/3": return 1313;
|
||||
case "KeypadEnter": return 1314;
|
||||
case "KeypadInsert/0": return 1315;
|
||||
case "KeypadRight/6": return 1310;
|
||||
case "KeypadEnd/1": return 1311;
|
||||
case "KeypadDown/2": return 1312;
|
||||
case "KeypadPagedown/3": return 1313;
|
||||
case "KeypadEnter": return 1314;
|
||||
case "KeypadInsert/0": return 1315;
|
||||
case "KeypadDelete": return 1316;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,20 +61,20 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
|
||||
private void InitMemCallbacks()
|
||||
{
|
||||
ExecCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
|
||||
ExecCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessExecute);
|
||||
MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
|
||||
});
|
||||
ReadCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessRead);
|
||||
MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
|
||||
ReadCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessRead);
|
||||
MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
|
||||
});
|
||||
WriteCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
|
||||
MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
|
||||
WriteCallback = new LibGPGX.mem_cb(a =>
|
||||
{
|
||||
uint flags = (uint)(MemoryCallbackFlags.AccessWrite);
|
||||
MemoryCallbacks.CallMemoryCallbacks(a, 0, flags, "M68K BUS");
|
||||
});
|
||||
_memoryCallbacks.ActiveChanged += RefreshMemCallbacks;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace BizHawk.Emulation.Cores
|
|||
WS, WSC, NGC,
|
||||
|
||||
C64,
|
||||
ZXSpectrum,
|
||||
AmstradCPC,
|
||||
ZXSpectrum,
|
||||
AmstradCPC,
|
||||
INT,
|
||||
A26, A52, A78, LNX,
|
||||
|
||||
|
|
|
@ -526,134 +526,134 @@ namespace BizHawk.Emulation.Common.Components
|
|||
|
||||
#region tables
|
||||
static readonly byte[] egRateCounterShiftValues =
|
||||
{
|
||||
11, 11, 11, 11, // Rates 0-3
|
||||
10, 10, 10, 10, // Rates 4-7
|
||||
9, 9, 9, 9, // Rates 8-11
|
||||
8, 8, 8, 8, // Rates 12-15
|
||||
7, 7, 7, 7, // Rates 16-19
|
||||
6, 6, 6, 6, // Rates 20-23
|
||||
5, 5, 5, 5, // Rates 24-27
|
||||
4, 4, 4, 4, // Rates 28-31
|
||||
3, 3, 3, 3, // Rates 32-35
|
||||
2, 2, 2, 2, // Rates 36-39
|
||||
1, 1, 1, 1, // Rates 40-43
|
||||
0, 0, 0, 0, // Rates 44-47
|
||||
0, 0, 0, 0, // Rates 48-51
|
||||
0, 0, 0, 0, // Rates 52-55
|
||||
0, 0, 0, 0, // Rates 56-59
|
||||
0, 0, 0, 0 // Rates 60-63
|
||||
};
|
||||
{
|
||||
11, 11, 11, 11, // Rates 0-3
|
||||
10, 10, 10, 10, // Rates 4-7
|
||||
9, 9, 9, 9, // Rates 8-11
|
||||
8, 8, 8, 8, // Rates 12-15
|
||||
7, 7, 7, 7, // Rates 16-19
|
||||
6, 6, 6, 6, // Rates 20-23
|
||||
5, 5, 5, 5, // Rates 24-27
|
||||
4, 4, 4, 4, // Rates 28-31
|
||||
3, 3, 3, 3, // Rates 32-35
|
||||
2, 2, 2, 2, // Rates 36-39
|
||||
1, 1, 1, 1, // Rates 40-43
|
||||
0, 0, 0, 0, // Rates 44-47
|
||||
0, 0, 0, 0, // Rates 48-51
|
||||
0, 0, 0, 0, // Rates 52-55
|
||||
0, 0, 0, 0, // Rates 56-59
|
||||
0, 0, 0, 0 // Rates 60-63
|
||||
};
|
||||
|
||||
static readonly byte[] egRateIncrementValues =
|
||||
{
|
||||
0,0,0,0,0,0,0,0, // Rate 0
|
||||
0,0,0,0,0,0,0,0, // Rate 1
|
||||
0,1,0,1,0,1,0,1, // Rate 2
|
||||
0,1,0,1,0,1,0,1, // Rate 3
|
||||
0,1,0,1,0,1,0,1, // Rate 4
|
||||
0,1,0,1,0,1,0,1, // Rate 5
|
||||
0,1,1,1,0,1,1,1, // Rate 6
|
||||
0,1,1,1,0,1,1,1, // Rate 7
|
||||
0,1,0,1,0,1,0,1, // Rate 8
|
||||
0,1,0,1,1,1,0,1, // Rate 9
|
||||
0,1,1,1,0,1,1,1, // Rate 10
|
||||
0,1,1,1,1,1,1,1, // Rate 11
|
||||
0,1,0,1,0,1,0,1, // Rate 12
|
||||
0,1,0,1,1,1,0,1, // Rate 13
|
||||
0,1,1,1,0,1,1,1, // Rate 14
|
||||
0,1,1,1,1,1,1,1, // Rate 15
|
||||
0,1,0,1,0,1,0,1, // Rate 16
|
||||
0,1,0,1,1,1,0,1, // Rate 17
|
||||
0,1,1,1,0,1,1,1, // Rate 18
|
||||
0,1,1,1,1,1,1,1, // Rate 19
|
||||
0,1,0,1,0,1,0,1, // Rate 20
|
||||
0,1,0,1,1,1,0,1, // Rate 21
|
||||
0,1,1,1,0,1,1,1, // Rate 22
|
||||
0,1,1,1,1,1,1,1, // Rate 23
|
||||
0,1,0,1,0,1,0,1, // Rate 24
|
||||
0,1,0,1,1,1,0,1, // Rate 25
|
||||
0,1,1,1,0,1,1,1, // Rate 26
|
||||
0,1,1,1,1,1,1,1, // Rate 27
|
||||
0,1,0,1,0,1,0,1, // Rate 28
|
||||
0,1,0,1,1,1,0,1, // Rate 29
|
||||
0,1,1,1,0,1,1,1, // Rate 30
|
||||
0,1,1,1,1,1,1,1, // Rate 31
|
||||
0,1,0,1,0,1,0,1, // Rate 32
|
||||
0,1,0,1,1,1,0,1, // Rate 33
|
||||
0,1,1,1,0,1,1,1, // Rate 34
|
||||
0,1,1,1,1,1,1,1, // Rate 35
|
||||
0,1,0,1,0,1,0,1, // Rate 36
|
||||
0,1,0,1,1,1,0,1, // Rate 37
|
||||
0,1,1,1,0,1,1,1, // Rate 38
|
||||
0,1,1,1,1,1,1,1, // Rate 39
|
||||
0,1,0,1,0,1,0,1, // Rate 40
|
||||
0,1,0,1,1,1,0,1, // Rate 41
|
||||
0,1,1,1,0,1,1,1, // Rate 42
|
||||
0,1,1,1,1,1,1,1, // Rate 43
|
||||
0,1,0,1,0,1,0,1, // Rate 44
|
||||
0,1,0,1,1,1,0,1, // Rate 45
|
||||
0,1,1,1,0,1,1,1, // Rate 46
|
||||
0,1,1,1,1,1,1,1, // Rate 47
|
||||
1,1,1,1,1,1,1,1, // Rate 48
|
||||
1,1,1,2,1,1,1,2, // Rate 49
|
||||
1,2,1,2,1,2,1,2, // Rate 50
|
||||
1,2,2,2,1,2,2,2, // Rate 51
|
||||
2,2,2,2,2,2,2,2, // Rate 52
|
||||
2,2,2,4,2,2,2,4, // Rate 53
|
||||
2,4,2,4,2,4,2,4, // Rate 54
|
||||
2,4,4,4,2,4,4,4, // Rate 55
|
||||
4,4,4,4,4,4,4,4, // Rate 56
|
||||
4,4,4,8,4,4,4,8, // Rate 57
|
||||
4,8,4,8,4,8,4,8, // Rate 58
|
||||
4,8,8,8,4,8,8,8, // Rate 59
|
||||
8,8,8,8,8,8,8,8, // Rate 60
|
||||
8,8,8,8,8,8,8,8, // Rate 61
|
||||
8,8,8,8,8,8,8,8, // Rate 62
|
||||
8,8,8,8,8,8,8,8 // Rate 63
|
||||
};
|
||||
{
|
||||
0,0,0,0,0,0,0,0, // Rate 0
|
||||
0,0,0,0,0,0,0,0, // Rate 1
|
||||
0,1,0,1,0,1,0,1, // Rate 2
|
||||
0,1,0,1,0,1,0,1, // Rate 3
|
||||
0,1,0,1,0,1,0,1, // Rate 4
|
||||
0,1,0,1,0,1,0,1, // Rate 5
|
||||
0,1,1,1,0,1,1,1, // Rate 6
|
||||
0,1,1,1,0,1,1,1, // Rate 7
|
||||
0,1,0,1,0,1,0,1, // Rate 8
|
||||
0,1,0,1,1,1,0,1, // Rate 9
|
||||
0,1,1,1,0,1,1,1, // Rate 10
|
||||
0,1,1,1,1,1,1,1, // Rate 11
|
||||
0,1,0,1,0,1,0,1, // Rate 12
|
||||
0,1,0,1,1,1,0,1, // Rate 13
|
||||
0,1,1,1,0,1,1,1, // Rate 14
|
||||
0,1,1,1,1,1,1,1, // Rate 15
|
||||
0,1,0,1,0,1,0,1, // Rate 16
|
||||
0,1,0,1,1,1,0,1, // Rate 17
|
||||
0,1,1,1,0,1,1,1, // Rate 18
|
||||
0,1,1,1,1,1,1,1, // Rate 19
|
||||
0,1,0,1,0,1,0,1, // Rate 20
|
||||
0,1,0,1,1,1,0,1, // Rate 21
|
||||
0,1,1,1,0,1,1,1, // Rate 22
|
||||
0,1,1,1,1,1,1,1, // Rate 23
|
||||
0,1,0,1,0,1,0,1, // Rate 24
|
||||
0,1,0,1,1,1,0,1, // Rate 25
|
||||
0,1,1,1,0,1,1,1, // Rate 26
|
||||
0,1,1,1,1,1,1,1, // Rate 27
|
||||
0,1,0,1,0,1,0,1, // Rate 28
|
||||
0,1,0,1,1,1,0,1, // Rate 29
|
||||
0,1,1,1,0,1,1,1, // Rate 30
|
||||
0,1,1,1,1,1,1,1, // Rate 31
|
||||
0,1,0,1,0,1,0,1, // Rate 32
|
||||
0,1,0,1,1,1,0,1, // Rate 33
|
||||
0,1,1,1,0,1,1,1, // Rate 34
|
||||
0,1,1,1,1,1,1,1, // Rate 35
|
||||
0,1,0,1,0,1,0,1, // Rate 36
|
||||
0,1,0,1,1,1,0,1, // Rate 37
|
||||
0,1,1,1,0,1,1,1, // Rate 38
|
||||
0,1,1,1,1,1,1,1, // Rate 39
|
||||
0,1,0,1,0,1,0,1, // Rate 40
|
||||
0,1,0,1,1,1,0,1, // Rate 41
|
||||
0,1,1,1,0,1,1,1, // Rate 42
|
||||
0,1,1,1,1,1,1,1, // Rate 43
|
||||
0,1,0,1,0,1,0,1, // Rate 44
|
||||
0,1,0,1,1,1,0,1, // Rate 45
|
||||
0,1,1,1,0,1,1,1, // Rate 46
|
||||
0,1,1,1,1,1,1,1, // Rate 47
|
||||
1,1,1,1,1,1,1,1, // Rate 48
|
||||
1,1,1,2,1,1,1,2, // Rate 49
|
||||
1,2,1,2,1,2,1,2, // Rate 50
|
||||
1,2,2,2,1,2,2,2, // Rate 51
|
||||
2,2,2,2,2,2,2,2, // Rate 52
|
||||
2,2,2,4,2,2,2,4, // Rate 53
|
||||
2,4,2,4,2,4,2,4, // Rate 54
|
||||
2,4,4,4,2,4,4,4, // Rate 55
|
||||
4,4,4,4,4,4,4,4, // Rate 56
|
||||
4,4,4,8,4,4,4,8, // Rate 57
|
||||
4,8,4,8,4,8,4,8, // Rate 58
|
||||
4,8,8,8,4,8,8,8, // Rate 59
|
||||
8,8,8,8,8,8,8,8, // Rate 60
|
||||
8,8,8,8,8,8,8,8, // Rate 61
|
||||
8,8,8,8,8,8,8,8, // Rate 62
|
||||
8,8,8,8,8,8,8,8 // Rate 63
|
||||
};
|
||||
|
||||
static readonly int[] slTable = // translates a 4-bit SL value into a 10-bit attenuation value
|
||||
{
|
||||
0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0,
|
||||
0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x3FF
|
||||
};
|
||||
{
|
||||
0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0,
|
||||
0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x3FF
|
||||
};
|
||||
|
||||
static readonly int[] detuneTable =
|
||||
{
|
||||
0, 0, 1, 2, // Key-Code 0
|
||||
0, 0, 1, 2, // Key-Code 1
|
||||
0, 0, 1, 2, // Key-Code 2
|
||||
0, 0, 1, 2, // Key-Code 3
|
||||
0, 1, 2, 2, // Key-Code 4
|
||||
0, 1, 2, 3, // Key-Code 5
|
||||
0, 1, 2, 3, // Key-Code 6
|
||||
0, 1, 2, 3, // Key-Code 7
|
||||
0, 1, 2, 4, // Key-Code 8
|
||||
0, 1, 3, 4, // Key-Code 9
|
||||
0, 1, 3, 4, // Key-Code 10
|
||||
0, 1, 3, 5, // Key-Code 11
|
||||
0, 2, 4, 5, // Key-Code 12
|
||||
0, 2, 4, 6, // Key-Code 13
|
||||
0, 2, 4, 6, // Key-Code 14
|
||||
0, 2, 5, 7, // Key-Code 15
|
||||
0, 2, 5, 8, // Key-Code 16
|
||||
0, 3, 6, 8, // Key-Code 17
|
||||
0, 3, 6, 9, // Key-Code 18
|
||||
0, 3, 7, 10, // Key-Code 19
|
||||
0, 4, 8, 11, // Key-Code 20
|
||||
0, 4, 8, 12, // Key-Code 21
|
||||
0, 4, 9, 13, // Key-Code 22
|
||||
0, 5, 10, 14, // Key-Code 23
|
||||
0, 5, 11, 16, // Key-Code 24
|
||||
0, 6, 12, 17, // Key-Code 25
|
||||
0, 6, 13, 19, // Key-Code 26
|
||||
0, 7, 14, 20, // Key-Code 27
|
||||
0, 8, 16, 22, // Key-Code 28
|
||||
0, 8, 16, 22, // Key-Code 29
|
||||
0, 8, 16, 22, // Key-Code 30
|
||||
0, 8, 16, 22 // Key-Code 31
|
||||
};
|
||||
{
|
||||
0, 0, 1, 2, // Key-Code 0
|
||||
0, 0, 1, 2, // Key-Code 1
|
||||
0, 0, 1, 2, // Key-Code 2
|
||||
0, 0, 1, 2, // Key-Code 3
|
||||
0, 1, 2, 2, // Key-Code 4
|
||||
0, 1, 2, 3, // Key-Code 5
|
||||
0, 1, 2, 3, // Key-Code 6
|
||||
0, 1, 2, 3, // Key-Code 7
|
||||
0, 1, 2, 4, // Key-Code 8
|
||||
0, 1, 3, 4, // Key-Code 9
|
||||
0, 1, 3, 4, // Key-Code 10
|
||||
0, 1, 3, 5, // Key-Code 11
|
||||
0, 2, 4, 5, // Key-Code 12
|
||||
0, 2, 4, 6, // Key-Code 13
|
||||
0, 2, 4, 6, // Key-Code 14
|
||||
0, 2, 5, 7, // Key-Code 15
|
||||
0, 2, 5, 8, // Key-Code 16
|
||||
0, 3, 6, 8, // Key-Code 17
|
||||
0, 3, 6, 9, // Key-Code 18
|
||||
0, 3, 7, 10, // Key-Code 19
|
||||
0, 4, 8, 11, // Key-Code 20
|
||||
0, 4, 8, 12, // Key-Code 21
|
||||
0, 4, 9, 13, // Key-Code 22
|
||||
0, 5, 10, 14, // Key-Code 23
|
||||
0, 5, 11, 16, // Key-Code 24
|
||||
0, 6, 12, 17, // Key-Code 25
|
||||
0, 6, 13, 19, // Key-Code 26
|
||||
0, 7, 14, 20, // Key-Code 27
|
||||
0, 8, 16, 22, // Key-Code 28
|
||||
0, 8, 16, 22, // Key-Code 29
|
||||
0, 8, 16, 22, // Key-Code 30
|
||||
0, 8, 16, 22 // Key-Code 31
|
||||
};
|
||||
#endregion
|
||||
|
||||
// ====================================================================================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using BizHawk.Common;
|
||||
using BizHawk.Common.BizInvoke;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using BizHawk.Common.BizInvoke;
|
||||
using BizHawk.Common.BufferExtensions;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
@ -31,8 +31,8 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
/// </summary>
|
||||
private List<MemoryBlockBase> _memoryBlocks = new List<MemoryBlockBase>();
|
||||
|
||||
/// <summary>
|
||||
/// an informative name for each memory block: used for debugging purposes
|
||||
/// <summary>
|
||||
/// an informative name for each memory block: used for debugging purposes
|
||||
/// </summary>
|
||||
private List<string> _memoryBlockNames = new List<string>();
|
||||
|
||||
|
@ -136,15 +136,15 @@ namespace BizHawk.Emulation.Cores.Waterbox
|
|||
m.Activate();
|
||||
}
|
||||
|
||||
public void PrintDebuggingInfo()
|
||||
{
|
||||
using (this.EnterExit())
|
||||
{
|
||||
foreach (var a in _memoryBlocks.Zip(_memoryBlockNames, (m, s) => new { m, s }))
|
||||
{
|
||||
Console.WriteLine($"{a.m.FullHash().BytesToHexString()}: {a.s}");
|
||||
}
|
||||
}
|
||||
public void PrintDebuggingInfo()
|
||||
{
|
||||
using (this.EnterExit())
|
||||
{
|
||||
foreach (var a in _memoryBlocks.Zip(_memoryBlockNames, (m, s) => new { m, s }))
|
||||
{
|
||||
Console.WriteLine($"{a.m.FullHash().BytesToHexString()}: {a.s}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _disposed = false;
|
||||
|
|
|
@ -5,151 +5,151 @@ using System.Text;
|
|||
|
||||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class to convert big and little endian numbers from a byte
|
||||
/// array to a value.
|
||||
///
|
||||
/// This code was modified from the endian bit converter presented by
|
||||
/// Robert Unoki in his blog post:
|
||||
/// http://blogs.msdn.com/robunoki/archive/2006/04/05/568737.aspx
|
||||
///
|
||||
/// I have added support for more data types and the ability to
|
||||
/// specify an offset into the array to be converted where the value
|
||||
/// begins.
|
||||
/// </summary>
|
||||
public class EndianBitConverter {
|
||||
#region Static Constructors
|
||||
/// <summary>
|
||||
/// Helper class to convert big and little endian numbers from a byte
|
||||
/// array to a value.
|
||||
///
|
||||
/// This code was modified from the endian bit converter presented by
|
||||
/// Robert Unoki in his blog post:
|
||||
/// http://blogs.msdn.com/robunoki/archive/2006/04/05/568737.aspx
|
||||
///
|
||||
/// I have added support for more data types and the ability to
|
||||
/// specify an offset into the array to be converted where the value
|
||||
/// begins.
|
||||
/// </summary>
|
||||
public class EndianBitConverter {
|
||||
#region Static Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Build a converter from little endian to the system endian-ness.
|
||||
/// </summary>
|
||||
/// <returns>The converter</returns>
|
||||
public static EndianBitConverter CreateForLittleEndian() {
|
||||
return new EndianBitConverter(!BitConverter.IsLittleEndian);
|
||||
}
|
||||
/// <summary>
|
||||
/// Build a converter from little endian to the system endian-ness.
|
||||
/// </summary>
|
||||
/// <returns>The converter</returns>
|
||||
public static EndianBitConverter CreateForLittleEndian() {
|
||||
return new EndianBitConverter(!BitConverter.IsLittleEndian);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build a converter from big endian to the system endian-ness.
|
||||
/// </summary>
|
||||
/// <returns>The converter</returns>
|
||||
public static EndianBitConverter CreateForBigEndian() {
|
||||
return new EndianBitConverter(BitConverter.IsLittleEndian);
|
||||
}
|
||||
/// <summary>
|
||||
/// Build a converter from big endian to the system endian-ness.
|
||||
/// </summary>
|
||||
/// <returns>The converter</returns>
|
||||
public static EndianBitConverter CreateForBigEndian() {
|
||||
return new EndianBitConverter(BitConverter.IsLittleEndian);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Keep track of whether we need to swap the bytes or not
|
||||
/// </summary>
|
||||
private bool swap;
|
||||
/// <summary>
|
||||
/// Keep track of whether we need to swap the bytes or not
|
||||
/// </summary>
|
||||
private bool swap;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Constructor
|
||||
#region Private Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Create the converter with the given endian-ness.
|
||||
/// </summary>
|
||||
/// <param name="swapBytes">Whether or not to swap bytes.</param>
|
||||
private EndianBitConverter(bool swapBytes) {
|
||||
swap = swapBytes;
|
||||
}
|
||||
/// <summary>
|
||||
/// Create the converter with the given endian-ness.
|
||||
/// </summary>
|
||||
/// <param name="swapBytes">Whether or not to swap bytes.</param>
|
||||
private EndianBitConverter(bool swapBytes) {
|
||||
swap = swapBytes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 16-bit
|
||||
#region 16-bit
|
||||
|
||||
public Int16 ToInt16(byte[] data) {
|
||||
return ToInt16(data, 0);
|
||||
}
|
||||
public Int16 ToInt16(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 2);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt16(corrected, offset);
|
||||
}
|
||||
public Int16 ToInt16(byte[] data) {
|
||||
return ToInt16(data, 0);
|
||||
}
|
||||
public Int16 ToInt16(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 2);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt16(corrected, offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 32-bit
|
||||
#region 32-bit
|
||||
|
||||
public Int32 ToInt32(byte[] data) {
|
||||
return ToInt32(data, 0);
|
||||
}
|
||||
public Int32 ToInt32(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 4);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt32(corrected, offset);
|
||||
}
|
||||
public Int32 ToInt32(byte[] data) {
|
||||
return ToInt32(data, 0);
|
||||
}
|
||||
public Int32 ToInt32(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 4);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt32(corrected, offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 64-bit
|
||||
#region 64-bit
|
||||
|
||||
public Int64 ToInt64(byte[] data) {
|
||||
return ToInt64(data, 0);
|
||||
}
|
||||
public Int64 ToInt64(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 8);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt64(corrected, offset);
|
||||
}
|
||||
public Int64 ToInt64(byte[] data) {
|
||||
return ToInt64(data, 0);
|
||||
}
|
||||
public Int64 ToInt64(byte[] data, int offset) {
|
||||
byte[] corrected;
|
||||
if (swap) {
|
||||
corrected = (byte[])data.Clone();
|
||||
Array.Reverse(corrected, offset, 8);
|
||||
}
|
||||
else {
|
||||
corrected = data;
|
||||
}
|
||||
return BitConverter.ToInt64(corrected, offset);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
// (asni 20171013) - Some methods I wrote that have been shoehorned in from another project to speed up development time
|
||||
// If these are offensive in any way, tell me I suck and that I need to do more work with existing methods
|
||||
#region Misc
|
||||
// (asni 20171013) - Some methods I wrote that have been shoehorned in from another project to speed up development time
|
||||
// If these are offensive in any way, tell me I suck and that I need to do more work with existing methods
|
||||
#region Misc
|
||||
|
||||
/// <summary>
|
||||
/// Returns a byte array of any length
|
||||
/// Not really anything endian going on, but I struggled to find a better place for it
|
||||
/// </summary>
|
||||
public byte[] ReadBytes(byte[] buffer, int offset, int length)
|
||||
{
|
||||
return buffer.Skip(offset).Take(length).ToArray();
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns a byte array of any length
|
||||
/// Not really anything endian going on, but I struggled to find a better place for it
|
||||
/// </summary>
|
||||
public byte[] ReadBytes(byte[] buffer, int offset, int length)
|
||||
{
|
||||
return buffer.Skip(offset).Take(length).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns an int32 value from any size byte array
|
||||
/// (careful, data may/will be truncated)
|
||||
/// </summary>
|
||||
public int ReadIntValue(byte[] buffer, int offset, int length)
|
||||
{
|
||||
var bytes = buffer.Skip(offset).Take(length).ToArray();
|
||||
/// <summary>
|
||||
/// Returns an int32 value from any size byte array
|
||||
/// (careful, data may/will be truncated)
|
||||
/// </summary>
|
||||
public int ReadIntValue(byte[] buffer, int offset, int length)
|
||||
{
|
||||
var bytes = buffer.Skip(offset).Take(length).ToArray();
|
||||
|
||||
if (swap)
|
||||
Array.Reverse(bytes);
|
||||
if (swap)
|
||||
Array.Reverse(bytes);
|
||||
|
||||
if (length == 1)
|
||||
return bytes.FirstOrDefault();
|
||||
if (length == 1)
|
||||
return bytes.FirstOrDefault();
|
||||
|
||||
if (length == 2)
|
||||
return BitConverter.ToInt16(bytes, 0);
|
||||
if (length == 2)
|
||||
return BitConverter.ToInt16(bytes, 0);
|
||||
|
||||
int result = BitConverter.ToInt32(bytes, 0);
|
||||
return result;
|
||||
}
|
||||
int result = BitConverter.ToInt32(bytes, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,24 +48,24 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
s.Seek(this.Offset * ISOFile.SECTOR_SIZE, SeekOrigin.Begin);
|
||||
|
||||
List<ISONodeRecord> records = new List<ISONodeRecord>();
|
||||
|
||||
// Read the directory entries
|
||||
while (s.Position < ((this.Offset * ISOFile.SECTOR_SIZE) + this.Length))
|
||||
|
||||
// Read the directory entries
|
||||
while (s.Position < ((this.Offset * ISOFile.SECTOR_SIZE) + this.Length))
|
||||
{
|
||||
ISONode node;
|
||||
ISONodeRecord record;
|
||||
|
||||
|
||||
// Read the record
|
||||
record = new ISONodeRecord();
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.CDInteractive)
|
||||
record.ParseCDInteractive(s);
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.ISO9660)
|
||||
record.ParseISO9660(s);
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.CDInteractive)
|
||||
record.ParseCDInteractive(s);
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.ISO9660)
|
||||
record.ParseISO9660(s);
|
||||
|
||||
|
||||
//zero 24-jun-2013 - improved validity checks
|
||||
//theres nothing here!
|
||||
if (record.Length == 0)
|
||||
//zero 24-jun-2013 - improved validity checks
|
||||
//theres nothing here!
|
||||
if (record.Length == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -98,8 +98,8 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
}
|
||||
|
||||
// Add the node as a child
|
||||
if (!this.Children.ContainsKey(record.Name))
|
||||
this.Children.Add(record.Name, node);
|
||||
if (!this.Children.ContainsKey(record.Name))
|
||||
this.Children.Add(record.Name, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,47 +6,47 @@ using System.Linq;
|
|||
|
||||
namespace BizHawk.Emulation.DiscSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is meant to parse disk images as specified by:
|
||||
///
|
||||
/// ISO9660
|
||||
/// -------
|
||||
/// It should work for most disk images that are created
|
||||
/// by the stanard disk imaging software. This class is by no means
|
||||
/// robust to all variations of ISO9660.
|
||||
/// Also, this class does not currently support the UDF file system.
|
||||
///
|
||||
/// The information for building class came from three primary sources:
|
||||
/// 1. The ISO9660 wikipedia article:
|
||||
/// http://en.wikipedia.org/wiki/ISO_9660
|
||||
/// 2. ISO9660 Simplified for DOS/Windows
|
||||
/// http://alumnus.caltech.edu/~pje/iso9660.html
|
||||
/// 3. The ISO 9660 File System
|
||||
/// http://users.telenet.be/it3.consultants.bvba/handouts/ISO9960.html
|
||||
///
|
||||
///
|
||||
/// CD-I
|
||||
/// ----
|
||||
/// (asni - 20171013) - Class modified to be able to detect and consume Green
|
||||
/// Book disc images.
|
||||
///
|
||||
/// The implemtation of CD-I in this class adds some (but not all) additional
|
||||
/// properties to the class structures that CD-I brings. This means that
|
||||
/// the same ISO class structures can be returned for both standards.
|
||||
/// These small additions are readily found in ISOVolumeDescriptor.cs
|
||||
///
|
||||
/// ISOFile.cs also now contains a public 'ISOFormat' enum that is set
|
||||
/// during disc parsing.
|
||||
///
|
||||
/// The main reference source for this implementation:
|
||||
/// 1. The CD-I Full Functional Specification (aka Green Book)
|
||||
/// https://www.lscdweb.com/data/downloadables/2/8/cdi_may94_r2.pdf
|
||||
///
|
||||
///
|
||||
/// TODO: Add functions to enumerate a directory or visit a file...
|
||||
///
|
||||
/// </summary>
|
||||
public class ISOFile
|
||||
/// <summary>
|
||||
/// This class is meant to parse disk images as specified by:
|
||||
///
|
||||
/// ISO9660
|
||||
/// -------
|
||||
/// It should work for most disk images that are created
|
||||
/// by the stanard disk imaging software. This class is by no means
|
||||
/// robust to all variations of ISO9660.
|
||||
/// Also, this class does not currently support the UDF file system.
|
||||
///
|
||||
/// The information for building class came from three primary sources:
|
||||
/// 1. The ISO9660 wikipedia article:
|
||||
/// http://en.wikipedia.org/wiki/ISO_9660
|
||||
/// 2. ISO9660 Simplified for DOS/Windows
|
||||
/// http://alumnus.caltech.edu/~pje/iso9660.html
|
||||
/// 3. The ISO 9660 File System
|
||||
/// http://users.telenet.be/it3.consultants.bvba/handouts/ISO9960.html
|
||||
///
|
||||
///
|
||||
/// CD-I
|
||||
/// ----
|
||||
/// (asni - 20171013) - Class modified to be able to detect and consume Green
|
||||
/// Book disc images.
|
||||
///
|
||||
/// The implemtation of CD-I in this class adds some (but not all) additional
|
||||
/// properties to the class structures that CD-I brings. This means that
|
||||
/// the same ISO class structures can be returned for both standards.
|
||||
/// These small additions are readily found in ISOVolumeDescriptor.cs
|
||||
///
|
||||
/// ISOFile.cs also now contains a public 'ISOFormat' enum that is set
|
||||
/// during disc parsing.
|
||||
///
|
||||
/// The main reference source for this implementation:
|
||||
/// 1. The CD-I Full Functional Specification (aka Green Book)
|
||||
/// https://www.lscdweb.com/data/downloadables/2/8/cdi_may94_r2.pdf
|
||||
///
|
||||
///
|
||||
/// TODO: Add functions to enumerate a directory or visit a file...
|
||||
///
|
||||
/// </summary>
|
||||
public class ISOFile
|
||||
{
|
||||
#region Constants
|
||||
|
||||
|
@ -55,36 +55,36 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public const int SECTOR_SIZE = 2048;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Static Members
|
||||
#region Static Members
|
||||
|
||||
/// <summary>
|
||||
/// Making this a static for now. Every other way I tried was fairly ineligant (asni)
|
||||
/// </summary>
|
||||
public static ISOFormat Format;
|
||||
/// <summary>
|
||||
/// Making this a static for now. Every other way I tried was fairly ineligant (asni)
|
||||
/// </summary>
|
||||
public static ISOFormat Format;
|
||||
|
||||
public static List<CDIPathNode> CDIPathTable;
|
||||
public static List<CDIPathNode> CDIPathTable;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Public Members
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// This is a list of all the volume descriptors in the disk image.
|
||||
/// NOTE: The first entry should be the primary volume.
|
||||
/// </summary>
|
||||
public List<ISOVolumeDescriptor> VolumeDescriptors;
|
||||
/// <summary>
|
||||
/// This is a list of all the volume descriptors in the disk image.
|
||||
/// NOTE: The first entry should be the primary volume.
|
||||
/// </summary>
|
||||
public List<ISOVolumeDescriptor> VolumeDescriptors;
|
||||
|
||||
/// <summary>
|
||||
/// The Directory that is the root of this file system
|
||||
/// </summary>
|
||||
public ISODirectoryNode Root;
|
||||
|
||||
/// <summary>
|
||||
/// The type of CDFS format detected
|
||||
/// </summary>
|
||||
public ISOFormat CDFSType;
|
||||
/// <summary>
|
||||
/// The type of CDFS format detected
|
||||
/// </summary>
|
||||
public ISOFormat CDFSType;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -117,9 +117,9 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
// Seek through the first volume descriptor
|
||||
s.Seek(startPosition + (SECTOR_SIZE * startSector), SeekOrigin.Begin);
|
||||
|
||||
// Read one of more volume descriptors
|
||||
do
|
||||
|
||||
// Read one of more volume descriptors
|
||||
do
|
||||
{
|
||||
//zero 24-jun-2013 - improved validity checks
|
||||
|
||||
|
@ -127,7 +127,7 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
bool isValid = desc.Parse(s);
|
||||
if (!isValid) return false;
|
||||
|
||||
this.CDFSType = Format;
|
||||
this.CDFSType = Format;
|
||||
|
||||
if (desc.IsTerminator())
|
||||
break;
|
||||
|
@ -140,17 +140,17 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
} while (true);
|
||||
|
||||
//zero 24-jun-2013 - well, my very first test iso had 2 volume descriptors.
|
||||
// Check to make sure we only read one volume descriptor
|
||||
// Finding more could be an error with the disk.
|
||||
//if (this.VolumeDescriptors.Count != 1) {
|
||||
// Console.WriteLine("Strange ISO format...");
|
||||
// return;
|
||||
//}
|
||||
//zero 24-jun-2013 - well, my very first test iso had 2 volume descriptors.
|
||||
// Check to make sure we only read one volume descriptor
|
||||
// Finding more could be an error with the disk.
|
||||
//if (this.VolumeDescriptors.Count != 1) {
|
||||
// Console.WriteLine("Strange ISO format...");
|
||||
// return;
|
||||
//}
|
||||
|
||||
|
||||
//zero 24-jun-2013 - if theres no volume descriptors, we're gonna call this not a cdfs
|
||||
if (VolumeDescriptors.Count == 0) return false;
|
||||
//zero 24-jun-2013 - if theres no volume descriptors, we're gonna call this not a cdfs
|
||||
if (VolumeDescriptors.Count == 0) return false;
|
||||
|
||||
// Visit all the directories and get the offset of each directory/file
|
||||
|
||||
|
@ -159,64 +159,64 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
// Create (and visit) the root node
|
||||
this.Root = new ISODirectoryNode(this.VolumeDescriptors[0].RootDirectoryRecord);
|
||||
|
||||
visitedNodes.Add(this.Root.Offset, this.Root);
|
||||
this.Root.Parse(s, visitedNodes);
|
||||
|
||||
visitedNodes.Add(this.Root.Offset, this.Root);
|
||||
this.Root.Parse(s, visitedNodes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private List<KeyValuePair<string, ISOFileNode>> fileNodes;
|
||||
private List<ISODirectoryNode> dirsParsed;
|
||||
private List<KeyValuePair<string, ISOFileNode>> fileNodes;
|
||||
private List<ISODirectoryNode> dirsParsed;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a flat list of all recursed files
|
||||
/// </summary>
|
||||
public List<KeyValuePair<string, ISOFileNode>> EnumerateAllFilesRecursively()
|
||||
{
|
||||
fileNodes = new List<KeyValuePair<string, ISOFileNode>>();
|
||||
dirsParsed = new List<ISODirectoryNode>();
|
||||
/// <summary>
|
||||
/// Returns a flat list of all recursed files
|
||||
/// </summary>
|
||||
public List<KeyValuePair<string, ISOFileNode>> EnumerateAllFilesRecursively()
|
||||
{
|
||||
fileNodes = new List<KeyValuePair<string, ISOFileNode>>();
|
||||
dirsParsed = new List<ISODirectoryNode>();
|
||||
|
||||
if (Root.Children == null)
|
||||
return fileNodes;
|
||||
if (Root.Children == null)
|
||||
return fileNodes;
|
||||
|
||||
// get all folders
|
||||
var dirs = (from a in Root.Children where a.Value.GetType() == typeof(ISODirectoryNode) select a);
|
||||
// iterate through each folder
|
||||
foreach (var d in dirs)
|
||||
{
|
||||
// process all files in this directory (and recursively process files in sub folders
|
||||
ISODirectoryNode idn = d.Value as ISODirectoryNode;
|
||||
if (dirsParsed.Where(a => a == idn).Count() > 0)
|
||||
continue;
|
||||
// get all folders
|
||||
var dirs = (from a in Root.Children where a.Value.GetType() == typeof(ISODirectoryNode) select a);
|
||||
// iterate through each folder
|
||||
foreach (var d in dirs)
|
||||
{
|
||||
// process all files in this directory (and recursively process files in sub folders
|
||||
ISODirectoryNode idn = d.Value as ISODirectoryNode;
|
||||
if (dirsParsed.Where(a => a == idn).Count() > 0)
|
||||
continue;
|
||||
|
||||
dirsParsed.Add(idn);
|
||||
ProcessDirectoryFiles(idn.Children);
|
||||
}
|
||||
dirsParsed.Add(idn);
|
||||
ProcessDirectoryFiles(idn.Children);
|
||||
}
|
||||
|
||||
return fileNodes.Distinct().ToList();
|
||||
}
|
||||
return fileNodes.Distinct().ToList();
|
||||
}
|
||||
|
||||
private void ProcessDirectoryFiles(Dictionary<string, ISONode> idn)
|
||||
{
|
||||
foreach (var n in idn)
|
||||
{
|
||||
if (n.Value.GetType() == typeof(ISODirectoryNode))
|
||||
{
|
||||
if (dirsParsed.Where(a => a == n.Value).Count() > 0)
|
||||
continue;
|
||||
private void ProcessDirectoryFiles(Dictionary<string, ISONode> idn)
|
||||
{
|
||||
foreach (var n in idn)
|
||||
{
|
||||
if (n.Value.GetType() == typeof(ISODirectoryNode))
|
||||
{
|
||||
if (dirsParsed.Where(a => a == n.Value).Count() > 0)
|
||||
continue;
|
||||
|
||||
dirsParsed.Add(n.Value as ISODirectoryNode);
|
||||
ProcessDirectoryFiles((n.Value as ISODirectoryNode).Children);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyValuePair<string, ISOFileNode> f = new KeyValuePair<string, ISOFileNode>(n.Key, n.Value as ISOFileNode);
|
||||
fileNodes.Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
dirsParsed.Add(n.Value as ISODirectoryNode);
|
||||
ProcessDirectoryFiles((n.Value as ISODirectoryNode).Children);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeyValuePair<string, ISOFileNode> f = new KeyValuePair<string, ISOFileNode>(n.Key, n.Value as ISOFileNode);
|
||||
fileNodes.Add(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -231,17 +231,17 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
this.Root.Print(0);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
#region Misc
|
||||
|
||||
public enum ISOFormat
|
||||
{
|
||||
Unknown,
|
||||
ISO9660,
|
||||
CDInteractive
|
||||
}
|
||||
public enum ISOFormat
|
||||
{
|
||||
Unknown,
|
||||
ISO9660,
|
||||
CDInteractive
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,16 +31,16 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public byte Length;
|
||||
|
||||
/// <summary>
|
||||
/// This is the number of blocks at the beginning of the file reserved for extended attribute information
|
||||
/// The format of the extended attribute record is not defined and is reserved for application use
|
||||
/// </summary>
|
||||
public byte ExtendedAttribRecordLength;
|
||||
/// <summary>
|
||||
/// This is the number of blocks at the beginning of the file reserved for extended attribute information
|
||||
/// The format of the extended attribute record is not defined and is reserved for application use
|
||||
/// </summary>
|
||||
public byte ExtendedAttribRecordLength;
|
||||
|
||||
/// <summary>
|
||||
/// The file offset of the data for this file/directory (in sectors).
|
||||
/// </summary>
|
||||
public long OffsetOfData;
|
||||
/// <summary>
|
||||
/// The file offset of the data for this file/directory (in sectors).
|
||||
/// </summary>
|
||||
public long OffsetOfData;
|
||||
/// <summary>
|
||||
/// The length of the data for this file/directory (in bytes).
|
||||
/// </summary>
|
||||
|
@ -155,11 +155,11 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
MemoryStream s = new MemoryStream(data);
|
||||
s.Seek(cursor, SeekOrigin.Begin);
|
||||
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.ISO9660)
|
||||
this.ParseISO9660(s);
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.ISO9660)
|
||||
this.ParseISO9660(s);
|
||||
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.CDInteractive)
|
||||
this.ParseCDInteractive(s);
|
||||
if (ISOFile.Format == ISOFile.ISOFormat.CDInteractive)
|
||||
this.ParseCDInteractive(s);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -223,100 +223,100 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
s.Seek(startPosition + this.Length, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Parse the node record from the given CD-I stream.
|
||||
/// </summary>
|
||||
/// <param name="s">The stream to parse from.</param>
|
||||
public void ParseCDInteractive(Stream s)
|
||||
{
|
||||
/*
|
||||
BP Size in bytes Description
|
||||
1 1 Record length
|
||||
2 1 Extended Attribute record length
|
||||
3 4 Reserved
|
||||
7 4 File beginning LBN
|
||||
11 4 Reserved
|
||||
15 4 File size
|
||||
19 6 Creation date
|
||||
25 1 Reserved
|
||||
26 1 File flags
|
||||
27 2 Interleave
|
||||
29 2 Reserved
|
||||
31 2 Album Set Sequence number
|
||||
33 1 File name size
|
||||
34 (n) File name
|
||||
34+n 4 Owner ID
|
||||
38+n 2 Attributes
|
||||
40+n 2 Reserved
|
||||
42+n 1 File number
|
||||
43+n 1 Reserved
|
||||
43+n Total
|
||||
*/
|
||||
{
|
||||
/*
|
||||
BP Size in bytes Description
|
||||
1 1 Record length
|
||||
2 1 Extended Attribute record length
|
||||
3 4 Reserved
|
||||
7 4 File beginning LBN
|
||||
11 4 Reserved
|
||||
15 4 File size
|
||||
19 6 Creation date
|
||||
25 1 Reserved
|
||||
26 1 File flags
|
||||
27 2 Interleave
|
||||
29 2 Reserved
|
||||
31 2 Album Set Sequence number
|
||||
33 1 File name size
|
||||
34 (n) File name
|
||||
34+n 4 Owner ID
|
||||
38+n 2 Attributes
|
||||
40+n 2 Reserved
|
||||
42+n 1 File number
|
||||
43+n 1 Reserved
|
||||
43+n Total
|
||||
*/
|
||||
|
||||
EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
s.Position -= ISOFile.SECTOR_SIZE;
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
s.Position -= ISOFile.SECTOR_SIZE;
|
||||
|
||||
// Get the record length
|
||||
this.Length = buffer[0];
|
||||
// Get the record length
|
||||
this.Length = buffer[0];
|
||||
|
||||
// extended attribute record length
|
||||
this.ExtendedAttribRecordLength = buffer[1];
|
||||
// extended attribute record length
|
||||
this.ExtendedAttribRecordLength = buffer[1];
|
||||
|
||||
// Read Data Offset
|
||||
this.OffsetOfData = bcBig.ReadIntValue(buffer, 6, 4);
|
||||
// Read Data Offset
|
||||
this.OffsetOfData = bcBig.ReadIntValue(buffer, 6, 4);
|
||||
|
||||
// Read Data Length
|
||||
this.LengthOfData = bcBig.ReadIntValue(buffer, 14, 4);
|
||||
// Read Data Length
|
||||
this.LengthOfData = bcBig.ReadIntValue(buffer, 14, 4);
|
||||
|
||||
// Read the time
|
||||
var ti = bc.ReadBytes(buffer, 18, 6);
|
||||
this.Year = ti[0];
|
||||
this.Month = ti[1];
|
||||
this.Day = ti[2];
|
||||
this.Hour = ti[3];
|
||||
this.Minute = ti[4];
|
||||
this.Second = ti[5];
|
||||
// Read the time
|
||||
var ti = bc.ReadBytes(buffer, 18, 6);
|
||||
this.Year = ti[0];
|
||||
this.Month = ti[1];
|
||||
this.Day = ti[2];
|
||||
this.Hour = ti[3];
|
||||
this.Minute = ti[4];
|
||||
this.Second = ti[5];
|
||||
|
||||
// read interleave - still to do
|
||||
// read interleave - still to do
|
||||
|
||||
// read album (volume) set sequence number (we are ignoring this)
|
||||
// read album (volume) set sequence number (we are ignoring this)
|
||||
|
||||
// Read the name length
|
||||
this.NameLength = buffer[32];
|
||||
// Read the name length
|
||||
this.NameLength = buffer[32];
|
||||
|
||||
// Read the file/directory name
|
||||
var name = bc.ReadBytes(buffer, 33, this.NameLength);
|
||||
if (this.NameLength == 1 && (name[0] == 0 || name[0] == 1))
|
||||
{
|
||||
if (name[0] == 0)
|
||||
this.Name = ISONodeRecord.CURRENT_DIRECTORY;
|
||||
else
|
||||
this.Name = ISONodeRecord.PARENT_DIRECTORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Name = ASCIIEncoding.ASCII.GetString(name, 0, this.NameLength);
|
||||
}
|
||||
// Read the file/directory name
|
||||
var name = bc.ReadBytes(buffer, 33, this.NameLength);
|
||||
if (this.NameLength == 1 && (name[0] == 0 || name[0] == 1))
|
||||
{
|
||||
if (name[0] == 0)
|
||||
this.Name = ISONodeRecord.CURRENT_DIRECTORY;
|
||||
else
|
||||
this.Name = ISONodeRecord.PARENT_DIRECTORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Name = ASCIIEncoding.ASCII.GetString(name, 0, this.NameLength);
|
||||
}
|
||||
|
||||
// skip ownerID for now
|
||||
// skip ownerID for now
|
||||
|
||||
// read the flags - only really interested in the directory attribute (bit 15)
|
||||
// (confusingly these are called 'attributes' in CD-I. the CD-I 'File Flags' entry is something else entirely)
|
||||
this.Flags = buffer[37 + this.NameLength];
|
||||
// read the flags - only really interested in the directory attribute (bit 15)
|
||||
// (confusingly these are called 'attributes' in CD-I. the CD-I 'File Flags' entry is something else entirely)
|
||||
this.Flags = buffer[37 + this.NameLength];
|
||||
|
||||
// skip filenumber
|
||||
//this.FileNumber = buffer[41 + this.NameLength];
|
||||
// skip filenumber
|
||||
//this.FileNumber = buffer[41 + this.NameLength];
|
||||
|
||||
// Seek to end
|
||||
s.Seek(startPosition + this.Length, SeekOrigin.Begin);
|
||||
}
|
||||
// Seek to end
|
||||
s.Seek(startPosition + this.Length, SeekOrigin.Begin);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,21 +25,21 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
private const int LENGTH_TIME = 17;
|
||||
private const int LENGTH_RESERVED = 512;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Private Properties
|
||||
#region Private Properties
|
||||
|
||||
private EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
private EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
private EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
private EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// The type of this volume description, only 1 and 255 are supported
|
||||
/// </summary>
|
||||
public byte Type;
|
||||
/// <summary>
|
||||
/// The type of this volume description, only 1 and 255 are supported
|
||||
/// </summary>
|
||||
public byte Type;
|
||||
|
||||
/// <summary>
|
||||
/// The system identifier
|
||||
|
@ -76,18 +76,18 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// (ISO9660 only) Sector offset of the first path table
|
||||
/// </summary>
|
||||
public int OffsetOfFirstLittleEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the second path table
|
||||
/// </summary>
|
||||
public int OffsetOfSecondLittleEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the first path table
|
||||
/// </summary>
|
||||
public int OffsetOfFirstBigEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the second path table
|
||||
/// </summary>
|
||||
public int OffsetOfSecondBigEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the second path table
|
||||
/// </summary>
|
||||
public int OffsetOfSecondLittleEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the first path table
|
||||
/// </summary>
|
||||
public int OffsetOfFirstBigEndianPathTable;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Sector offset of the second path table
|
||||
/// </summary>
|
||||
public int OffsetOfSecondBigEndianPathTable;
|
||||
|
||||
/// <summary>
|
||||
/// The root directory record
|
||||
|
@ -141,39 +141,39 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
public byte[] EffectiveDateTime;
|
||||
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Extra reserved data
|
||||
/// </summary>
|
||||
public byte[] Reserved;
|
||||
/// <summary>
|
||||
/// (ISO9660 only) Extra reserved data
|
||||
/// </summary>
|
||||
public byte[] Reserved;
|
||||
|
||||
|
||||
// CD-Interactive only
|
||||
|
||||
/// <summary>
|
||||
/// The bits of this field are numbered from 0 to 7 starting with the least significant bit
|
||||
/// BitPosition 0: A value of 0 = the coded character set identifier field specifies only an escape sequence registered according to ISO 2375
|
||||
/// A value of 1 = the coded character set identifier field specifies only an escape sequence NOT registered according to ISO 2375
|
||||
/// BitPostion 1-7: All bits are 0 (reserved for future standardization)
|
||||
/// </summary>
|
||||
public byte VolumeFlags;
|
||||
/// <summary>
|
||||
/// This field specifies one escape sequence according to the International Register of Coded Character Sets to be used with escape
|
||||
/// sequence standards for recording.The ESC character, which is the first character of all sequences, shall be omitted when recording this field
|
||||
/// </summary>
|
||||
public byte[] CodedCharSetIdent;
|
||||
/// <summary>
|
||||
/// The block address of the first block of the system Path Table is kept in this field
|
||||
/// </summary>
|
||||
public int AddressOfPathTable;
|
||||
// CD-Interactive only
|
||||
|
||||
/// <summary>
|
||||
/// The bits of this field are numbered from 0 to 7 starting with the least significant bit
|
||||
/// BitPosition 0: A value of 0 = the coded character set identifier field specifies only an escape sequence registered according to ISO 2375
|
||||
/// A value of 1 = the coded character set identifier field specifies only an escape sequence NOT registered according to ISO 2375
|
||||
/// BitPostion 1-7: All bits are 0 (reserved for future standardization)
|
||||
/// </summary>
|
||||
public byte VolumeFlags;
|
||||
/// <summary>
|
||||
/// This field specifies one escape sequence according to the International Register of Coded Character Sets to be used with escape
|
||||
/// sequence standards for recording.The ESC character, which is the first character of all sequences, shall be omitted when recording this field
|
||||
/// </summary>
|
||||
public byte[] CodedCharSetIdent;
|
||||
/// <summary>
|
||||
/// The block address of the first block of the system Path Table is kept in this field
|
||||
/// </summary>
|
||||
public int AddressOfPathTable;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Construction
|
||||
#region Construction
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public ISOVolumeDescriptor()
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
public ISOVolumeDescriptor()
|
||||
{
|
||||
// Set everything to the default value
|
||||
this.Type = 0;
|
||||
|
@ -211,10 +211,10 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
|
||||
this.Reserved = new byte[LENGTH_RESERVED];
|
||||
|
||||
// CD-I specific
|
||||
this.VolumeFlags = 0;
|
||||
this.CodedCharSetIdent = new byte[LENGTH_SHORT_IDENTIFIER];
|
||||
this.AddressOfPathTable = 0;
|
||||
// CD-I specific
|
||||
this.VolumeFlags = 0;
|
||||
this.CodedCharSetIdent = new byte[LENGTH_SHORT_IDENTIFIER];
|
||||
this.AddressOfPathTable = 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -233,267 +233,267 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
|
||||
// Parse based on format
|
||||
byte[] header = bc.ReadBytes(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
if (GetISO9660(header))
|
||||
{
|
||||
ParseISO9660(s);
|
||||
return true;
|
||||
}
|
||||
if (GetCDI(header))
|
||||
{
|
||||
ParseCDInteractive(s);
|
||||
return true;
|
||||
}
|
||||
// Parse based on format
|
||||
byte[] header = bc.ReadBytes(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
if (GetISO9660(header))
|
||||
{
|
||||
ParseISO9660(s);
|
||||
return true;
|
||||
}
|
||||
if (GetCDI(header))
|
||||
{
|
||||
ParseCDInteractive(s);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ParseISO9660(Stream s)
|
||||
{
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
s.Position = startPosition - ISOFile.SECTOR_SIZE;
|
||||
public void ParseISO9660(Stream s)
|
||||
{
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
s.Position = startPosition - ISOFile.SECTOR_SIZE;
|
||||
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
|
||||
// Get the type
|
||||
this.Type = buffer[0];
|
||||
// Get the type
|
||||
this.Type = buffer[0];
|
||||
|
||||
// Handle the primary volume information
|
||||
if (this.Type == 1)
|
||||
{
|
||||
int cursor = 8;
|
||||
// Get the system identifier
|
||||
Array.Copy(buffer, cursor,
|
||||
this.SystemIdentifier, 0, LENGTH_SHORT_IDENTIFIER);
|
||||
cursor += LENGTH_SHORT_IDENTIFIER;
|
||||
// Handle the primary volume information
|
||||
if (this.Type == 1)
|
||||
{
|
||||
int cursor = 8;
|
||||
// Get the system identifier
|
||||
Array.Copy(buffer, cursor,
|
||||
this.SystemIdentifier, 0, LENGTH_SHORT_IDENTIFIER);
|
||||
cursor += LENGTH_SHORT_IDENTIFIER;
|
||||
|
||||
// Get the volume identifier
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeIdentifier, 0, LENGTH_SHORT_IDENTIFIER);
|
||||
cursor += LENGTH_SHORT_IDENTIFIER;
|
||||
// Get the volume identifier
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeIdentifier, 0, LENGTH_SHORT_IDENTIFIER);
|
||||
cursor += LENGTH_SHORT_IDENTIFIER;
|
||||
|
||||
cursor += 8;
|
||||
cursor += 8;
|
||||
|
||||
// Get the total number of sectors
|
||||
this.NumberOfSectors = bc.ToInt32(buffer, cursor);
|
||||
cursor += 8;
|
||||
// Get the total number of sectors
|
||||
this.NumberOfSectors = bc.ToInt32(buffer, cursor);
|
||||
cursor += 8;
|
||||
|
||||
cursor += 32;
|
||||
cursor += 32;
|
||||
|
||||
this.VolumeSetSize = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.VolumeSequenceNumber = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.SectorSize = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.VolumeSetSize = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.VolumeSequenceNumber = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.SectorSize = bc.ToInt16(buffer, cursor);
|
||||
cursor += 4;
|
||||
|
||||
this.PathTableSize = bc.ToInt32(buffer, cursor);
|
||||
cursor += 8;
|
||||
this.OffsetOfFirstLittleEndianPathTable = bc.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfSecondLittleEndianPathTable = bc.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfFirstLittleEndianPathTable = bcBig.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfSecondLittleEndianPathTable = bcBig.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.PathTableSize = bc.ToInt32(buffer, cursor);
|
||||
cursor += 8;
|
||||
this.OffsetOfFirstLittleEndianPathTable = bc.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfSecondLittleEndianPathTable = bc.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfFirstLittleEndianPathTable = bcBig.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
this.OffsetOfSecondLittleEndianPathTable = bcBig.ToInt32(buffer, cursor);
|
||||
cursor += 4;
|
||||
|
||||
this.RootDirectoryRecord.Parse(buffer, cursor);
|
||||
cursor += LENGTH_ROOT_DIRECTORY_RECORD;
|
||||
this.RootDirectoryRecord.Parse(buffer, cursor);
|
||||
cursor += LENGTH_ROOT_DIRECTORY_RECORD;
|
||||
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeSetIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.PublisherIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.DataPreparerIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.ApplicationIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeSetIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.PublisherIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.DataPreparerIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.ApplicationIdentifier, 0, LENGTH_LONG_IDENTIFIER);
|
||||
cursor += LENGTH_LONG_IDENTIFIER;
|
||||
|
||||
Array.Copy(buffer, cursor,
|
||||
this.CopyrightFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.AbstractFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.BibliographicalFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.CopyrightFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.AbstractFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.BibliographicalFileIdentifier, 0, LENGTH_IDENTIFIER);
|
||||
cursor += LENGTH_IDENTIFIER;
|
||||
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeCreationDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.LastModifiedDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.ExpirationDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.EffectiveDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.VolumeCreationDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.LastModifiedDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.ExpirationDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
Array.Copy(buffer, cursor,
|
||||
this.EffectiveDateTime, 0, LENGTH_TIME);
|
||||
cursor += LENGTH_TIME;
|
||||
|
||||
cursor += 1;
|
||||
cursor += 1;
|
||||
|
||||
cursor += 1;
|
||||
cursor += 1;
|
||||
|
||||
Array.Copy(buffer, cursor,
|
||||
this.Reserved, 0, LENGTH_RESERVED);
|
||||
cursor += LENGTH_RESERVED;
|
||||
}
|
||||
}
|
||||
Array.Copy(buffer, cursor,
|
||||
this.Reserved, 0, LENGTH_RESERVED);
|
||||
cursor += LENGTH_RESERVED;
|
||||
}
|
||||
}
|
||||
|
||||
public void ParseCDInteractive(Stream s)
|
||||
{
|
||||
/* From the Green Book Spec
|
||||
* BP (byte position) obviously is n+1
|
||||
|
||||
BP Size in Bytes Description
|
||||
1 1 Disc Label Record Type
|
||||
2 5 Volume Structure Standard ID
|
||||
7 1 Volume Structure Version number
|
||||
8 1 Volume flags
|
||||
9 32 System identifier
|
||||
41 32 Volume identifier
|
||||
73 12 Reserved
|
||||
85 4 Volume space size
|
||||
89 32 Coded Character Set identifier
|
||||
121 2 Reserved
|
||||
123 2 Number of Volumes in Album
|
||||
125 2 Reserved
|
||||
127 2 Album Set Sequence number
|
||||
129 2 Reserved
|
||||
131 2 Logical Block size
|
||||
133 4 Reserved
|
||||
137 4 Path Table size
|
||||
141 8 Reserved
|
||||
149 4 Address of Path Table
|
||||
153 38 Reserved
|
||||
191 128 Album identifier
|
||||
319 128 Publisher identifier
|
||||
447 128 Data Preparer identifier
|
||||
575 128 Application identifier
|
||||
703 32 Copyright file name
|
||||
735 5 Reserved
|
||||
740 32 Abstract file name
|
||||
772 5 Reserved
|
||||
777 32 Bibliographic file name
|
||||
809 5 Reserved
|
||||
814 16 Creation date and time
|
||||
830 1 Reserved
|
||||
831 16 Modification date and time
|
||||
847 1 Reserved
|
||||
848 16 Expiration date and time
|
||||
864 1 Reserved
|
||||
865 16 Effective date and time
|
||||
881 1 Reserved
|
||||
882 1 File Structure Standard Version number
|
||||
883 1 Reserved
|
||||
884 512 Application use
|
||||
1396 653 Reserved */
|
||||
public void ParseCDInteractive(Stream s)
|
||||
{
|
||||
/* From the Green Book Spec
|
||||
* BP (byte position) obviously is n+1
|
||||
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
s.Position = startPosition - ISOFile.SECTOR_SIZE;
|
||||
BP Size in Bytes Description
|
||||
1 1 Disc Label Record Type
|
||||
2 5 Volume Structure Standard ID
|
||||
7 1 Volume Structure Version number
|
||||
8 1 Volume flags
|
||||
9 32 System identifier
|
||||
41 32 Volume identifier
|
||||
73 12 Reserved
|
||||
85 4 Volume space size
|
||||
89 32 Coded Character Set identifier
|
||||
121 2 Reserved
|
||||
123 2 Number of Volumes in Album
|
||||
125 2 Reserved
|
||||
127 2 Album Set Sequence number
|
||||
129 2 Reserved
|
||||
131 2 Logical Block size
|
||||
133 4 Reserved
|
||||
137 4 Path Table size
|
||||
141 8 Reserved
|
||||
149 4 Address of Path Table
|
||||
153 38 Reserved
|
||||
191 128 Album identifier
|
||||
319 128 Publisher identifier
|
||||
447 128 Data Preparer identifier
|
||||
575 128 Application identifier
|
||||
703 32 Copyright file name
|
||||
735 5 Reserved
|
||||
740 32 Abstract file name
|
||||
772 5 Reserved
|
||||
777 32 Bibliographic file name
|
||||
809 5 Reserved
|
||||
814 16 Creation date and time
|
||||
830 1 Reserved
|
||||
831 16 Modification date and time
|
||||
847 1 Reserved
|
||||
848 16 Expiration date and time
|
||||
864 1 Reserved
|
||||
865 16 Effective date and time
|
||||
881 1 Reserved
|
||||
882 1 File Structure Standard Version number
|
||||
883 1 Reserved
|
||||
884 512 Application use
|
||||
1396 653 Reserved */
|
||||
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
long startPosition = s.Position;
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
s.Position = startPosition - ISOFile.SECTOR_SIZE;
|
||||
|
||||
// Get the type
|
||||
this.Type = buffer[0];
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
|
||||
// Handle the primary volume information
|
||||
if (this.Type == 1)
|
||||
{
|
||||
this.VolumeFlags = buffer[7];
|
||||
this.SystemIdentifier = bc.ReadBytes(buffer, 8, LENGTH_SHORT_IDENTIFIER);
|
||||
this.VolumeIdentifier = bc.ReadBytes(buffer, 40, LENGTH_SHORT_IDENTIFIER);
|
||||
this.NumberOfSectors = bcBig.ReadIntValue(buffer, 84, 4);
|
||||
this.CodedCharSetIdent = bc.ReadBytes(buffer, 88, LENGTH_SHORT_IDENTIFIER);
|
||||
this.VolumeSetSize = bcBig.ReadIntValue(buffer, 122, 2);
|
||||
this.VolumeSequenceNumber = bcBig.ReadIntValue(buffer, 126, 2);
|
||||
this.SectorSize = bcBig.ReadIntValue(buffer, 130, 2);
|
||||
this.PathTableSize = bcBig.ReadIntValue(buffer, 136, 4);
|
||||
this.AddressOfPathTable = bcBig.ReadIntValue(buffer, 148, 4);
|
||||
// Get the type
|
||||
this.Type = buffer[0];
|
||||
|
||||
this.VolumeSetIdentifier = bc.ReadBytes(buffer, 190, LENGTH_LONG_IDENTIFIER);
|
||||
this.PublisherIdentifier = bc.ReadBytes(buffer, 318, LENGTH_LONG_IDENTIFIER);
|
||||
this.DataPreparerIdentifier = bc.ReadBytes(buffer, 446, LENGTH_LONG_IDENTIFIER);
|
||||
this.ApplicationIdentifier = bc.ReadBytes(buffer, 574, LENGTH_LONG_IDENTIFIER);
|
||||
// Handle the primary volume information
|
||||
if (this.Type == 1)
|
||||
{
|
||||
this.VolumeFlags = buffer[7];
|
||||
this.SystemIdentifier = bc.ReadBytes(buffer, 8, LENGTH_SHORT_IDENTIFIER);
|
||||
this.VolumeIdentifier = bc.ReadBytes(buffer, 40, LENGTH_SHORT_IDENTIFIER);
|
||||
this.NumberOfSectors = bcBig.ReadIntValue(buffer, 84, 4);
|
||||
this.CodedCharSetIdent = bc.ReadBytes(buffer, 88, LENGTH_SHORT_IDENTIFIER);
|
||||
this.VolumeSetSize = bcBig.ReadIntValue(buffer, 122, 2);
|
||||
this.VolumeSequenceNumber = bcBig.ReadIntValue(buffer, 126, 2);
|
||||
this.SectorSize = bcBig.ReadIntValue(buffer, 130, 2);
|
||||
this.PathTableSize = bcBig.ReadIntValue(buffer, 136, 4);
|
||||
this.AddressOfPathTable = bcBig.ReadIntValue(buffer, 148, 4);
|
||||
|
||||
this.CopyrightFileIdentifier = bc.ReadBytes(buffer, 702, LENGTH_SHORT_IDENTIFIER);
|
||||
this.AbstractFileIdentifier = bc.ReadBytes(buffer, 739, LENGTH_SHORT_IDENTIFIER);
|
||||
this.BibliographicalFileIdentifier = bc.ReadBytes(buffer, 776, LENGTH_SHORT_IDENTIFIER);
|
||||
this.VolumeSetIdentifier = bc.ReadBytes(buffer, 190, LENGTH_LONG_IDENTIFIER);
|
||||
this.PublisherIdentifier = bc.ReadBytes(buffer, 318, LENGTH_LONG_IDENTIFIER);
|
||||
this.DataPreparerIdentifier = bc.ReadBytes(buffer, 446, LENGTH_LONG_IDENTIFIER);
|
||||
this.ApplicationIdentifier = bc.ReadBytes(buffer, 574, LENGTH_LONG_IDENTIFIER);
|
||||
|
||||
this.VolumeCreationDateTime = bc.ReadBytes(buffer, 813, 16);
|
||||
this.LastModifiedDateTime = bc.ReadBytes(buffer, 830, 16);
|
||||
this.ExpirationDateTime = bc.ReadBytes(buffer, 847, 16);
|
||||
this.EffectiveDateTime = bc.ReadBytes(buffer, 864, 16);
|
||||
this.CopyrightFileIdentifier = bc.ReadBytes(buffer, 702, LENGTH_SHORT_IDENTIFIER);
|
||||
this.AbstractFileIdentifier = bc.ReadBytes(buffer, 739, LENGTH_SHORT_IDENTIFIER);
|
||||
this.BibliographicalFileIdentifier = bc.ReadBytes(buffer, 776, LENGTH_SHORT_IDENTIFIER);
|
||||
|
||||
// save current position
|
||||
long pos = s.Position;
|
||||
|
||||
// get path table records
|
||||
s.Position = ISOFile.SECTOR_SIZE * this.AddressOfPathTable;
|
||||
ISOFile.CDIPathTable = CDIPathNode.ParsePathTable(s, this.PathTableSize);
|
||||
this.VolumeCreationDateTime = bc.ReadBytes(buffer, 813, 16);
|
||||
this.LastModifiedDateTime = bc.ReadBytes(buffer, 830, 16);
|
||||
this.ExpirationDateTime = bc.ReadBytes(buffer, 847, 16);
|
||||
this.EffectiveDateTime = bc.ReadBytes(buffer, 864, 16);
|
||||
|
||||
// read the root dir record
|
||||
s.Position = ISOFile.SECTOR_SIZE * ISOFile.CDIPathTable[0].DirectoryBlockAddress;
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
this.RootDirectoryRecord.Parse(buffer, 0);
|
||||
// save current position
|
||||
long pos = s.Position;
|
||||
|
||||
// get path table records
|
||||
s.Position = ISOFile.SECTOR_SIZE * this.AddressOfPathTable;
|
||||
ISOFile.CDIPathTable = CDIPathNode.ParsePathTable(s, this.PathTableSize);
|
||||
|
||||
// go back to where we were
|
||||
s.Position = pos;
|
||||
}
|
||||
}
|
||||
// read the root dir record
|
||||
s.Position = ISOFile.SECTOR_SIZE * ISOFile.CDIPathTable[0].DirectoryBlockAddress;
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
this.RootDirectoryRecord.Parse(buffer, 0);
|
||||
|
||||
/// <summary>
|
||||
/// Detect ISO9660
|
||||
/// </summary>
|
||||
public bool GetISO9660(byte[] buffer)
|
||||
{
|
||||
//zero 24-jun-2013 - validate ISO9660
|
||||
// "CD001\x01"
|
||||
if (buffer[1] == 'C' && buffer[2] == 'D' && buffer[3] == '0' && buffer[4] == '0' && buffer[5] == '1' && buffer[6] == 0x01)
|
||||
{
|
||||
ISOFile.Format = ISOFile.ISOFormat.ISO9660;
|
||||
return true;
|
||||
}
|
||||
// go back to where we were
|
||||
s.Position = pos;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Detect ISO9660
|
||||
/// </summary>
|
||||
public bool GetISO9660(byte[] buffer)
|
||||
{
|
||||
//zero 24-jun-2013 - validate ISO9660
|
||||
// "CD001\x01"
|
||||
if (buffer[1] == 'C' && buffer[2] == 'D' && buffer[3] == '0' && buffer[4] == '0' && buffer[5] == '1' && buffer[6] == 0x01)
|
||||
{
|
||||
ISOFile.Format = ISOFile.ISOFormat.ISO9660;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Detect CD-I
|
||||
/// </summary>
|
||||
public bool GetCDI(byte[] buffer)
|
||||
{
|
||||
// CD-Interactive
|
||||
if (Encoding.ASCII.GetString(bc.ReadBytes(buffer, 1, 5)).Contains("CD-I"))
|
||||
{
|
||||
ISOFile.Format = ISOFile.ISOFormat.CDInteractive;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Detect CD-I
|
||||
/// </summary>
|
||||
public bool GetCDI(byte[] buffer)
|
||||
{
|
||||
// CD-Interactive
|
||||
if (Encoding.ASCII.GetString(bc.ReadBytes(buffer, 1, 5)).Contains("CD-I"))
|
||||
{
|
||||
ISOFile.Format = ISOFile.ISOFormat.CDInteractive;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Type Information
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this is the terminator volume descriptor.
|
||||
/// </summary>
|
||||
/// <returns>True if the terminator.</returns>
|
||||
public bool IsTerminator()
|
||||
#region Type Information
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this is the terminator volume descriptor.
|
||||
/// </summary>
|
||||
/// <returns>True if the terminator.</returns>
|
||||
public bool IsTerminator()
|
||||
{
|
||||
return (this.Type == 255);
|
||||
}
|
||||
|
@ -501,108 +501,108 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Directory Path Table entry on a CD-I disc
|
||||
/// </summary>
|
||||
public class CDIPathNode
|
||||
{
|
||||
#region Public Properties
|
||||
/// <summary>
|
||||
/// Represents a Directory Path Table entry on a CD-I disc
|
||||
/// </summary>
|
||||
public class CDIPathNode
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// The length of the directory name.
|
||||
/// </summary>
|
||||
public byte NameLength;
|
||||
/// <summary>
|
||||
/// The length of the directory name.
|
||||
/// </summary>
|
||||
public byte NameLength;
|
||||
|
||||
/// <summary>
|
||||
/// This is the length of the Extended Attribute record
|
||||
/// </summary>
|
||||
public byte ExtendedAttribRecordLength;
|
||||
/// <summary>
|
||||
/// This is the length of the Extended Attribute record
|
||||
/// </summary>
|
||||
public byte ExtendedAttribRecordLength;
|
||||
|
||||
/// <summary>
|
||||
/// This field contains the beginning logical block number (LBN) of the directory file on disc
|
||||
/// </summary>
|
||||
public int DirectoryBlockAddress;
|
||||
/// <summary>
|
||||
/// This field contains the beginning logical block number (LBN) of the directory file on disc
|
||||
/// </summary>
|
||||
public int DirectoryBlockAddress;
|
||||
|
||||
/// <summary>
|
||||
/// This is the number (relative to the beginning of the Path Table) of this directory's parent
|
||||
/// </summary>
|
||||
public int ParentDirectoryNumber;
|
||||
/// <summary>
|
||||
/// This is the number (relative to the beginning of the Path Table) of this directory's parent
|
||||
/// </summary>
|
||||
public int ParentDirectoryNumber;
|
||||
|
||||
/// <summary>
|
||||
/// The directory name.
|
||||
/// This variable length field is used to store the actual text representing the name of the directory.
|
||||
/// If the length of the file name is odd, a null padding byte is added to make the size of the Path Table record even.
|
||||
/// The padding byte is not included in the name size field.
|
||||
/// </summary>
|
||||
public string Name;
|
||||
/// <summary>
|
||||
/// The directory name.
|
||||
/// This variable length field is used to store the actual text representing the name of the directory.
|
||||
/// If the length of the file name is odd, a null padding byte is added to make the size of the Path Table record even.
|
||||
/// The padding byte is not included in the name size field.
|
||||
/// </summary>
|
||||
public string Name;
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Construction
|
||||
#region Construction
|
||||
|
||||
/// <summary>
|
||||
/// Empty Constructor
|
||||
/// </summary>
|
||||
public CDIPathNode()
|
||||
{
|
||||
/// <summary>
|
||||
/// Empty Constructor
|
||||
/// </summary>
|
||||
public CDIPathNode()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Parsing
|
||||
#region Parsing
|
||||
|
||||
/*
|
||||
BP Size in bytes Description
|
||||
1 1 Name size
|
||||
2 1 Extended Attribute record length
|
||||
3 4 Directory block address
|
||||
7 2 Parent Directory number
|
||||
9 n Directory file name
|
||||
*/
|
||||
/*
|
||||
BP Size in bytes Description
|
||||
1 1 Name size
|
||||
2 1 Extended Attribute record length
|
||||
3 4 Directory block address
|
||||
7 2 Parent Directory number
|
||||
9 n Directory file name
|
||||
*/
|
||||
|
||||
public static List<CDIPathNode> ParsePathTable(Stream s, int PathTableSize)
|
||||
{
|
||||
EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
public static List<CDIPathNode> ParsePathTable(Stream s, int PathTableSize)
|
||||
{
|
||||
EndianBitConverter bc = EndianBitConverter.CreateForLittleEndian();
|
||||
EndianBitConverter bcBig = EndianBitConverter.CreateForBigEndian();
|
||||
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
byte[] buffer = new byte[ISOFile.SECTOR_SIZE];
|
||||
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
// Read the entire structure
|
||||
s.Read(buffer, 0, ISOFile.SECTOR_SIZE);
|
||||
|
||||
int startCursor = 0;
|
||||
int startCursor = 0;
|
||||
|
||||
List<CDIPathNode> pathNodes = new List<CDIPathNode>();
|
||||
List<CDIPathNode> pathNodes = new List<CDIPathNode>();
|
||||
|
||||
int pad = 0;
|
||||
int pad = 0;
|
||||
|
||||
do
|
||||
{
|
||||
CDIPathNode node = new CDIPathNode();
|
||||
byte[] data = bc.ReadBytes(buffer, startCursor, ISOFile.SECTOR_SIZE - startCursor);
|
||||
node.NameLength = data[0];
|
||||
do
|
||||
{
|
||||
CDIPathNode node = new CDIPathNode();
|
||||
byte[] data = bc.ReadBytes(buffer, startCursor, ISOFile.SECTOR_SIZE - startCursor);
|
||||
node.NameLength = data[0];
|
||||
|
||||
node.ExtendedAttribRecordLength = data[1];
|
||||
node.DirectoryBlockAddress = bcBig.ReadIntValue(data, 2, 4);
|
||||
node.ParentDirectoryNumber = bcBig.ReadIntValue(data, 6, 2);
|
||||
node.Name = Encoding.ASCII.GetString(bc.ReadBytes(data, 8, data[0]));
|
||||
node.ExtendedAttribRecordLength = data[1];
|
||||
node.DirectoryBlockAddress = bcBig.ReadIntValue(data, 2, 4);
|
||||
node.ParentDirectoryNumber = bcBig.ReadIntValue(data, 6, 2);
|
||||
node.Name = Encoding.ASCII.GetString(bc.ReadBytes(data, 8, data[0]));
|
||||
|
||||
// if nameLength is odd a padding byte must be added
|
||||
|
||||
if (node.NameLength % 2 != 0)
|
||||
pad = 1;
|
||||
// if nameLength is odd a padding byte must be added
|
||||
|
||||
if (node.NameLength % 2 != 0)
|
||||
pad = 1;
|
||||
|
||||
pathNodes.Add(node);
|
||||
pathNodes.Add(node);
|
||||
|
||||
startCursor += node.NameLength + 8;
|
||||
startCursor += node.NameLength + 8;
|
||||
|
||||
} while (startCursor < PathTableSize + pad);
|
||||
} while (startCursor < PathTableSize + pad);
|
||||
|
||||
|
||||
return pathNodes;
|
||||
}
|
||||
return pathNodes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,45 +53,45 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
/// </summary>
|
||||
PCFX,
|
||||
|
||||
/// <summary>
|
||||
/// By Panasonic
|
||||
/// </summary>
|
||||
Panasonic3DO,
|
||||
/// <summary>
|
||||
/// By Panasonic
|
||||
/// </summary>
|
||||
Panasonic3DO,
|
||||
|
||||
/// <summary>
|
||||
/// Philips
|
||||
/// </summary>
|
||||
CDi,
|
||||
/// <summary>
|
||||
/// Philips
|
||||
/// </summary>
|
||||
CDi,
|
||||
|
||||
/// <summary>
|
||||
/// Nintendo Gamecube
|
||||
/// </summary>
|
||||
GameCube,
|
||||
/// <summary>
|
||||
/// Nintendo Gamecube
|
||||
/// </summary>
|
||||
GameCube,
|
||||
|
||||
/// <summary>
|
||||
/// Nintendo Wii
|
||||
/// </summary>
|
||||
Wii,
|
||||
/// <summary>
|
||||
/// Nintendo Wii
|
||||
/// </summary>
|
||||
Wii,
|
||||
|
||||
/// <summary>
|
||||
/// SNK NeoGeo
|
||||
/// </summary>
|
||||
NeoGeoCD,
|
||||
/// <summary>
|
||||
/// SNK NeoGeo
|
||||
/// </summary>
|
||||
NeoGeoCD,
|
||||
|
||||
/// <summary>
|
||||
/// Bandai Playdia
|
||||
/// </summary>
|
||||
Playdia,
|
||||
/// <summary>
|
||||
/// Bandai Playdia
|
||||
/// </summary>
|
||||
Playdia,
|
||||
|
||||
/// <summary>
|
||||
/// Either CDTV or CD32 (I havent found a reliable way of distinguishing between them yet -asni)
|
||||
/// </summary>
|
||||
Amiga,
|
||||
/// <summary>
|
||||
/// Either CDTV or CD32 (I havent found a reliable way of distinguishing between them yet -asni)
|
||||
/// </summary>
|
||||
Amiga,
|
||||
|
||||
/// <summary>
|
||||
/// Sega Dreamcast
|
||||
/// </summary>
|
||||
Dreamcast
|
||||
/// <summary>
|
||||
/// Sega Dreamcast
|
||||
/// </summary>
|
||||
Dreamcast
|
||||
}
|
||||
|
||||
public class DiscIdentifier
|
||||
|
@ -121,19 +121,19 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
if (DetectPCFX())
|
||||
return DiscType.PCFX;
|
||||
|
||||
if (DetectTurboCD())
|
||||
return DiscType.TurboCD;
|
||||
if (DetectTurboCD())
|
||||
return DiscType.TurboCD;
|
||||
|
||||
//check track 1's data type. if it's an audio track, further data-track testing is useless
|
||||
//furthermore, it's probably senseless (no binary data there to read)
|
||||
if (!_disc.TOC.TOCItems[1].IsData)
|
||||
//check track 1's data type. if it's an audio track, further data-track testing is useless
|
||||
//furthermore, it's probably senseless (no binary data there to read)
|
||||
if (!_disc.TOC.TOCItems[1].IsData)
|
||||
return DiscType.AudioDisc;
|
||||
|
||||
// if (_dsr.ReadLBA_Mode(_disc.TOC.TOCItems[1].LBA) == 0)
|
||||
// return DiscType.AudioDisc;
|
||||
|
||||
// sega doesnt put anything identifying in the cdfs volume info. but its consistent about putting its own header here in sector 0
|
||||
//asni - this isn't strictly true - SystemIdentifier in volume descriptor has been observed on occasion (see below)
|
||||
//asni - this isn't strictly true - SystemIdentifier in volume descriptor has been observed on occasion (see below)
|
||||
if (DetectSegaSaturn())
|
||||
return DiscType.SegaSaturn;
|
||||
|
||||
|
@ -145,79 +145,79 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
if (DetectPSX())
|
||||
return DiscType.SonyPSX;
|
||||
|
||||
if (Detect3DO())
|
||||
return DiscType.Panasonic3DO;
|
||||
if (Detect3DO())
|
||||
return DiscType.Panasonic3DO;
|
||||
|
||||
if (DetectCDi())
|
||||
return DiscType.CDi;
|
||||
if (DetectCDi())
|
||||
return DiscType.CDi;
|
||||
|
||||
if (DetectGameCube())
|
||||
return DiscType.GameCube;
|
||||
if (DetectGameCube())
|
||||
return DiscType.GameCube;
|
||||
|
||||
if (DetectWii())
|
||||
return DiscType.Wii;
|
||||
if (DetectWii())
|
||||
return DiscType.Wii;
|
||||
|
||||
var discView = EDiscStreamView.DiscStreamView_Mode1_2048;
|
||||
var discView = EDiscStreamView.DiscStreamView_Mode1_2048;
|
||||
if (_disc.TOC.Session1Format == SessionFormat.Type20_CDXA)
|
||||
discView = EDiscStreamView.DiscStreamView_Mode2_Form1_2048;
|
||||
|
||||
var iso = new ISOFile();
|
||||
bool isIso = iso.Parse(new DiscStream(_disc, discView, 0));
|
||||
|
||||
if (!isIso)
|
||||
{
|
||||
// its much quicker to detect dreamcast from ISO data. Only do this if ISO is not detected
|
||||
if (DetectDreamcast())
|
||||
return DiscType.Dreamcast;
|
||||
}
|
||||
if (!isIso)
|
||||
{
|
||||
// its much quicker to detect dreamcast from ISO data. Only do this if ISO is not detected
|
||||
if (DetectDreamcast())
|
||||
return DiscType.Dreamcast;
|
||||
}
|
||||
|
||||
//*** asni - 20171011 - Suggestion: move this to the beginning of the DetectDiscType() method before any longer running lookups?
|
||||
//its a cheap win for a lot of systems, but ONLY if the iso.Parse() method is quick running (might have to time it)
|
||||
//*** asni - 20171011 - Suggestion: move this to the beginning of the DetectDiscType() method before any longer running lookups?
|
||||
//its a cheap win for a lot of systems, but ONLY if the iso.Parse() method is quick running (might have to time it)
|
||||
if (isIso)
|
||||
{
|
||||
var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
|
||||
var sysId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].SystemIdentifier).TrimEnd('\0', ' ');
|
||||
var sysId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].SystemIdentifier).TrimEnd('\0', ' ');
|
||||
|
||||
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
|
||||
//but, some PSX games (junky rips) don't have the 'licensed by string' so we'll hope they get caught here
|
||||
if (appId == "PLAYSTATION")
|
||||
//for example: PSX magical drop F (JP SLPS_02337) doesn't have the correct iso PVD fields
|
||||
//but, some PSX games (junky rips) don't have the 'licensed by string' so we'll hope they get caught here
|
||||
if (appId == "PLAYSTATION")
|
||||
return DiscType.SonyPSX;
|
||||
|
||||
if (appId == "PSP GAME")
|
||||
return DiscType.SonyPSP;
|
||||
// in case the appId is not set correctly...
|
||||
if (iso.Root.Children.Where(a => a.Key == "PSP_GAME").FirstOrDefault().Value as ISODirectoryNode != null)
|
||||
return DiscType.SonyPSP;
|
||||
// in case the appId is not set correctly...
|
||||
if (iso.Root.Children.Where(a => a.Key == "PSP_GAME").FirstOrDefault().Value as ISODirectoryNode != null)
|
||||
return DiscType.SonyPSP;
|
||||
|
||||
if (sysId == "SEGA SEGASATURN")
|
||||
return DiscType.SegaSaturn;
|
||||
if (sysId == "SEGA SEGASATURN")
|
||||
return DiscType.SegaSaturn;
|
||||
|
||||
if (sysId.Contains("SEGAKATANA"))
|
||||
return DiscType.Dreamcast;
|
||||
if (sysId.Contains("SEGAKATANA"))
|
||||
return DiscType.Dreamcast;
|
||||
|
||||
if (sysId == "MEGA_CD")
|
||||
return DiscType.MegaCD;
|
||||
if (sysId == "MEGA_CD")
|
||||
return DiscType.MegaCD;
|
||||
|
||||
if (sysId == "ASAHI-CDV")
|
||||
return DiscType.Playdia;
|
||||
if (sysId == "ASAHI-CDV")
|
||||
return DiscType.Playdia;
|
||||
|
||||
if (sysId == "CDTV" || sysId == "AMIGA")
|
||||
return DiscType.Amiga;
|
||||
foreach (var f in iso.Root.Children)
|
||||
if (f.Key.ToLower().Contains("cd32"))
|
||||
return DiscType.Amiga;
|
||||
if (sysId == "CDTV" || sysId == "AMIGA")
|
||||
return DiscType.Amiga;
|
||||
foreach (var f in iso.Root.Children)
|
||||
if (f.Key.ToLower().Contains("cd32"))
|
||||
return DiscType.Amiga;
|
||||
|
||||
// NeoGeoCD Check
|
||||
var absTxt = iso.Root.Children.Where(a => a.Key.Contains("ABS.TXT")).ToList();
|
||||
if (absTxt.Count > 0)
|
||||
{
|
||||
if (SectorContains("abstracted by snk", Convert.ToInt32(absTxt.First().Value.Offset)))
|
||||
return DiscType.NeoGeoCD;
|
||||
}
|
||||
|
||||
// NeoGeoCD Check
|
||||
var absTxt = iso.Root.Children.Where(a => a.Key.Contains("ABS.TXT")).ToList();
|
||||
if (absTxt.Count > 0)
|
||||
{
|
||||
if (SectorContains("abstracted by snk", Convert.ToInt32(absTxt.First().Value.Offset)))
|
||||
return DiscType.NeoGeoCD;
|
||||
}
|
||||
|
||||
|
||||
return DiscType.UnknownCDFS;
|
||||
}
|
||||
return DiscType.UnknownCDFS;
|
||||
}
|
||||
|
||||
return DiscType.UnknownFormat;
|
||||
}
|
||||
|
@ -256,87 +256,87 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
t++)
|
||||
{
|
||||
var track = _disc.TOC.TOCItems[t];
|
||||
//asni - this search is less specific - turns out there are discs where 'Hu:' is not present
|
||||
//asni - this search is less specific - turns out there are discs where 'Hu:' is not present
|
||||
if (track.IsData && SectorContains("pc-fx", track.LBA))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//asni 20171011 - this ONLY works if a valid cuefile/ccd is passed into DiscIdentifier.
|
||||
//if an .iso is presented, the internally manufactured cue data does not work - possibly something to do with
|
||||
//track 01 being Audio. Not tested, but presumably PCFX has the same issue
|
||||
bool DetectTurboCD()
|
||||
{
|
||||
var toc = _disc.TOC;
|
||||
for (int t = toc.FirstRecordedTrackNumber;
|
||||
t <= toc.LastRecordedTrackNumber;
|
||||
t++)
|
||||
{
|
||||
var track = _disc.TOC.TOCItems[t];
|
||||
//asni - pcfx games also contain the 'PC Engine' string
|
||||
if ((track.IsData && SectorContains("pc engine", track.LBA + 1) && !SectorContains("pc-fx", track.LBA + 1)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//asni 20171011 - this ONLY works if a valid cuefile/ccd is passed into DiscIdentifier.
|
||||
//if an .iso is presented, the internally manufactured cue data does not work - possibly something to do with
|
||||
//track 01 being Audio. Not tested, but presumably PCFX has the same issue
|
||||
bool DetectTurboCD()
|
||||
{
|
||||
var toc = _disc.TOC;
|
||||
for (int t = toc.FirstRecordedTrackNumber;
|
||||
t <= toc.LastRecordedTrackNumber;
|
||||
t++)
|
||||
{
|
||||
var track = _disc.TOC.TOCItems[t];
|
||||
//asni - pcfx games also contain the 'PC Engine' string
|
||||
if ((track.IsData && SectorContains("pc engine", track.LBA + 1) && !SectorContains("pc-fx", track.LBA + 1)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Detect3DO()
|
||||
{
|
||||
var toc = _disc.TOC;
|
||||
for (int t = toc.FirstRecordedTrackNumber;
|
||||
t <= toc.LastRecordedTrackNumber;
|
||||
t++)
|
||||
{
|
||||
var track = _disc.TOC.TOCItems[t];
|
||||
if (track.IsData && SectorContains("iamaduckiamaduck", track.LBA))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool Detect3DO()
|
||||
{
|
||||
var toc = _disc.TOC;
|
||||
for (int t = toc.FirstRecordedTrackNumber;
|
||||
t <= toc.LastRecordedTrackNumber;
|
||||
t++)
|
||||
{
|
||||
var track = _disc.TOC.TOCItems[t];
|
||||
if (track.IsData && SectorContains("iamaduckiamaduck", track.LBA))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//asni - slightly longer running than the others due to its brute-force nature. Should run later in the method
|
||||
bool DetectDreamcast()
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (SectorContains("segakatana", i))
|
||||
return true;
|
||||
}
|
||||
//asni - slightly longer running than the others due to its brute-force nature. Should run later in the method
|
||||
bool DetectDreamcast()
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (SectorContains("segakatana", i))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DetectCDi()
|
||||
{
|
||||
return StringAt("CD-RTOS", 8, 16);
|
||||
}
|
||||
bool DetectCDi()
|
||||
{
|
||||
return StringAt("CD-RTOS", 8, 16);
|
||||
}
|
||||
|
||||
bool DetectGameCube()
|
||||
{
|
||||
var data = ReadSectorCached(0);
|
||||
if (data == null) return false;
|
||||
byte[] magic = data.Skip(28).Take(4).ToArray();
|
||||
string hexString = "";
|
||||
foreach (var b in magic)
|
||||
hexString += b.ToString("X2");
|
||||
bool DetectGameCube()
|
||||
{
|
||||
var data = ReadSectorCached(0);
|
||||
if (data == null) return false;
|
||||
byte[] magic = data.Skip(28).Take(4).ToArray();
|
||||
string hexString = "";
|
||||
foreach (var b in magic)
|
||||
hexString += b.ToString("X2");
|
||||
|
||||
return hexString == "C2339F3D";
|
||||
}
|
||||
return hexString == "C2339F3D";
|
||||
}
|
||||
|
||||
bool DetectWii()
|
||||
{
|
||||
var data = ReadSectorCached(0);
|
||||
if (data == null) return false;
|
||||
byte[] magic = data.Skip(24).Take(4).ToArray();
|
||||
string hexString = "";
|
||||
foreach (var b in magic)
|
||||
hexString += b.ToString("X2");
|
||||
bool DetectWii()
|
||||
{
|
||||
var data = ReadSectorCached(0);
|
||||
if (data == null) return false;
|
||||
byte[] magic = data.Skip(24).Take(4).ToArray();
|
||||
string hexString = "";
|
||||
foreach (var b in magic)
|
||||
hexString += b.ToString("X2");
|
||||
|
||||
return hexString == "5D1C9EA3";
|
||||
}
|
||||
return hexString == "5D1C9EA3";
|
||||
}
|
||||
|
||||
private byte[] ReadSectorCached(int lba)
|
||||
private byte[] ReadSectorCached(int lba)
|
||||
{
|
||||
//read it if we dont have it cached
|
||||
//we wont be caching very much here, it's no big deal
|
||||
|
@ -363,11 +363,11 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
return System.Linq.Enumerable.SequenceEqual(cmp, cmp2);
|
||||
}
|
||||
|
||||
private bool SectorContains(string s, int lba = 0)
|
||||
{
|
||||
var data = ReadSectorCached(lba);
|
||||
if (data == null) return false;
|
||||
return System.Text.Encoding.ASCII.GetString(data).ToLower().Contains(s.ToLower());
|
||||
}
|
||||
private bool SectorContains(string s, int lba = 0)
|
||||
{
|
||||
var data = ReadSectorCached(lba);
|
||||
if (data == null) return false;
|
||||
return System.Text.Encoding.ASCII.GetString(data).ToLower().Contains(s.ToLower());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -186,11 +186,11 @@ namespace BizHawk.Emulation.DiscSystem
|
|||
CCD_Format ccdLoader = new CCD_Format();
|
||||
OUT_Disc = ccdLoader.LoadCCDToDisc(IN_FromPath, IN_DiscMountPolicy);
|
||||
}
|
||||
else if (ext == ".mds")
|
||||
{
|
||||
MDS_Format mdsLoader = new MDS_Format();
|
||||
OUT_Disc = mdsLoader.LoadMDSToDisc(IN_FromPath, IN_DiscMountPolicy);
|
||||
}
|
||||
else if (ext == ".mds")
|
||||
{
|
||||
MDS_Format mdsLoader = new MDS_Format();
|
||||
OUT_Disc = mdsLoader.LoadMDSToDisc(IN_FromPath, IN_DiscMountPolicy);
|
||||
}
|
||||
|
||||
|
||||
DONE:
|
||||
|
|
|
@ -103,8 +103,8 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
sampler0.Set(tex);
|
||||
Owner.SetViewport(OutputSize);
|
||||
|
||||
float time = DateTime.Now.Second + (float)DateTime.Now.Millisecond / 1000;
|
||||
Pipeline["Time"].Set(time);
|
||||
float time = DateTime.Now.Second + (float)DateTime.Now.Millisecond / 1000;
|
||||
Pipeline["Time"].Set(time);
|
||||
|
||||
int w = OutputSize.Width;
|
||||
int h = OutputSize.Height;
|
||||
|
|
|
@ -4,58 +4,58 @@ using System.IO;
|
|||
|
||||
namespace BizHawk.Emulation.CPUs.M6502
|
||||
{
|
||||
public sealed partial class MOS6502
|
||||
{
|
||||
public MOS6502()
|
||||
{
|
||||
//InitTableNZ();
|
||||
Reset();
|
||||
}
|
||||
public sealed partial class MOS6502
|
||||
{
|
||||
public MOS6502()
|
||||
{
|
||||
//InitTableNZ();
|
||||
Reset();
|
||||
}
|
||||
/*
|
||||
private byte[] TableNZ;
|
||||
private void InitTableNZ()
|
||||
{
|
||||
TableNZ = new byte[256];
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
byte b = 0;
|
||||
if (i == 0) b |= 0x02;
|
||||
if (i > 127) b |= 0x80;
|
||||
TableNZ[i] = b;
|
||||
}
|
||||
}*/
|
||||
private byte[] TableNZ;
|
||||
private void InitTableNZ()
|
||||
{
|
||||
TableNZ = new byte[256];
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
byte b = 0;
|
||||
if (i == 0) b |= 0x02;
|
||||
if (i > 127) b |= 0x80;
|
||||
TableNZ[i] = b;
|
||||
}
|
||||
}*/
|
||||
|
||||
public bool debug;
|
||||
public bool throw_unhandled;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
A = 0;
|
||||
X = 0;
|
||||
Y = 0;
|
||||
P = 0;
|
||||
S = 0;
|
||||
PC = 0;
|
||||
PendingCycles = 0;
|
||||
TotalExecutedCycles = 0;
|
||||
}
|
||||
public void Reset()
|
||||
{
|
||||
A = 0;
|
||||
X = 0;
|
||||
Y = 0;
|
||||
P = 0;
|
||||
S = 0;
|
||||
PC = 0;
|
||||
PendingCycles = 0;
|
||||
TotalExecutedCycles = 0;
|
||||
}
|
||||
|
||||
public string State()
|
||||
{
|
||||
int notused;
|
||||
string a = string.Format("{0:X4} {1:X2} {2} ", PC, ReadMemory(PC), Disassemble(PC, out notused)).PadRight(30);
|
||||
string b = string.Format("A:{0:X2} X:{1:X2} Y:{2:X2} P:{3:X2} SP:{4:X2} Cy:{5}", A, X, Y, P, S, TotalExecutedCycles);
|
||||
string val = a + b + " ";
|
||||
if (FlagN) val = val + "N";
|
||||
if (FlagV) val = val + "V";
|
||||
if (FlagT) val = val + "T";
|
||||
if (FlagB) val = val + "B";
|
||||
if (FlagD) val = val + "D";
|
||||
if (FlagI) val = val + "I";
|
||||
if (FlagZ) val = val + "Z";
|
||||
if (FlagC) val = val + "C";
|
||||
return val;
|
||||
}
|
||||
public string State()
|
||||
{
|
||||
int notused;
|
||||
string a = string.Format("{0:X4} {1:X2} {2} ", PC, ReadMemory(PC), Disassemble(PC, out notused)).PadRight(30);
|
||||
string b = string.Format("A:{0:X2} X:{1:X2} Y:{2:X2} P:{3:X2} SP:{4:X2} Cy:{5}", A, X, Y, P, S, TotalExecutedCycles);
|
||||
string val = a + b + " ";
|
||||
if (FlagN) val = val + "N";
|
||||
if (FlagV) val = val + "V";
|
||||
if (FlagT) val = val + "T";
|
||||
if (FlagB) val = val + "B";
|
||||
if (FlagD) val = val + "D";
|
||||
if (FlagI) val = val + "I";
|
||||
if (FlagZ) val = val + "Z";
|
||||
if (FlagC) val = val + "C";
|
||||
return val;
|
||||
}
|
||||
|
||||
public const ushort NMIVector = 0xFFFA;
|
||||
public const ushort ResetVector = 0xFFFC;
|
||||
|
@ -92,17 +92,17 @@ namespace BizHawk.Emulation.CPUs.M6502
|
|||
PendingCycles -= 7;
|
||||
}
|
||||
|
||||
// ==== CPU State ====
|
||||
// ==== CPU State ====
|
||||
|
||||
public byte A;
|
||||
public byte X;
|
||||
public byte Y;
|
||||
public byte P;
|
||||
public ushort PC;
|
||||
public byte S;
|
||||
public byte A;
|
||||
public byte X;
|
||||
public byte Y;
|
||||
public byte P;
|
||||
public ushort PC;
|
||||
public byte S;
|
||||
|
||||
public bool IRQ;
|
||||
public bool NMI;
|
||||
public bool IRQ;
|
||||
public bool NMI;
|
||||
public bool CLI_Pending;
|
||||
public bool SEI_Pending;
|
||||
|
||||
|
@ -127,115 +127,115 @@ namespace BizHawk.Emulation.CPUs.M6502
|
|||
public void SaveStateBinary(BinaryWriter writer) { SyncState(Serializer.CreateBinaryWriter(writer)); }
|
||||
public void LoadStateBinary(BinaryReader reader) { SyncState(Serializer.CreateBinaryReader(reader)); }
|
||||
|
||||
// ==== End State ====
|
||||
// ==== End State ====
|
||||
|
||||
/// <summary>Carry Flag</summary>
|
||||
private bool FlagC
|
||||
{
|
||||
get { return (P & 0x01) != 0; }
|
||||
set { P = (byte)((P & ~0x01) | (value ? 0x01 : 0x00)); }
|
||||
}
|
||||
/// <summary>Carry Flag</summary>
|
||||
private bool FlagC
|
||||
{
|
||||
get { return (P & 0x01) != 0; }
|
||||
set { P = (byte)((P & ~0x01) | (value ? 0x01 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Zero Flag</summary>
|
||||
private bool FlagZ
|
||||
{
|
||||
get { return (P & 0x02) != 0; }
|
||||
set { P = (byte)((P & ~0x02) | (value ? 0x02 : 0x00)); }
|
||||
}
|
||||
/// <summary>Zero Flag</summary>
|
||||
private bool FlagZ
|
||||
{
|
||||
get { return (P & 0x02) != 0; }
|
||||
set { P = (byte)((P & ~0x02) | (value ? 0x02 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Interrupt Disable Flag</summary>
|
||||
public bool FlagI
|
||||
{
|
||||
get { return (P & 0x04) != 0; }
|
||||
set { P = (byte)((P & ~0x04) | (value ? 0x04 : 0x00)); }
|
||||
}
|
||||
/// <summary>Interrupt Disable Flag</summary>
|
||||
public bool FlagI
|
||||
{
|
||||
get { return (P & 0x04) != 0; }
|
||||
set { P = (byte)((P & ~0x04) | (value ? 0x04 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Decimal Mode Flag</summary>
|
||||
private bool FlagD
|
||||
{
|
||||
get { return (P & 0x08) != 0; }
|
||||
set { P = (byte)((P & ~0x08) | (value ? 0x08 : 0x00)); }
|
||||
}
|
||||
/// <summary>Decimal Mode Flag</summary>
|
||||
private bool FlagD
|
||||
{
|
||||
get { return (P & 0x08) != 0; }
|
||||
set { P = (byte)((P & ~0x08) | (value ? 0x08 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Break Flag</summary>
|
||||
private bool FlagB
|
||||
{
|
||||
get { return (P & 0x10) != 0; }
|
||||
set { P = (byte)((P & ~0x10) | (value ? 0x10 : 0x00)); }
|
||||
}
|
||||
/// <summary>Break Flag</summary>
|
||||
private bool FlagB
|
||||
{
|
||||
get { return (P & 0x10) != 0; }
|
||||
set { P = (byte)((P & ~0x10) | (value ? 0x10 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>T... Flag</summary>
|
||||
private bool FlagT
|
||||
{
|
||||
get { return (P & 0x20) != 0; }
|
||||
set { P = (byte)((P & ~0x20) | (value ? 0x20 : 0x00)); }
|
||||
}
|
||||
/// <summary>T... Flag</summary>
|
||||
private bool FlagT
|
||||
{
|
||||
get { return (P & 0x20) != 0; }
|
||||
set { P = (byte)((P & ~0x20) | (value ? 0x20 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Overflow Flag</summary>
|
||||
private bool FlagV
|
||||
{
|
||||
get { return (P & 0x40) != 0; }
|
||||
set { P = (byte)((P & ~0x40) | (value ? 0x40 : 0x00)); }
|
||||
}
|
||||
/// <summary>Overflow Flag</summary>
|
||||
private bool FlagV
|
||||
{
|
||||
get { return (P & 0x40) != 0; }
|
||||
set { P = (byte)((P & ~0x40) | (value ? 0x40 : 0x00)); }
|
||||
}
|
||||
|
||||
/// <summary>Negative Flag</summary>
|
||||
private bool FlagN
|
||||
{
|
||||
get { return (P & 0x80) != 0; }
|
||||
set { P = (byte)((P & ~0x80) | (value ? 0x80 : 0x00)); }
|
||||
}
|
||||
/// <summary>Negative Flag</summary>
|
||||
private bool FlagN
|
||||
{
|
||||
get { return (P & 0x80) != 0; }
|
||||
set { P = (byte)((P & ~0x80) | (value ? 0x80 : 0x00)); }
|
||||
}
|
||||
|
||||
public int TotalExecutedCycles;
|
||||
public int PendingCycles;
|
||||
public int TotalExecutedCycles;
|
||||
public int PendingCycles;
|
||||
|
||||
public Func<ushort, byte> ReadMemory;
|
||||
public Action<ushort, byte> WriteMemory;
|
||||
public Func<ushort, byte> ReadMemory;
|
||||
public Action<ushort, byte> WriteMemory;
|
||||
|
||||
public void UnregisterMemoryMapper()
|
||||
{
|
||||
ReadMemory = null;
|
||||
WriteMemory = null;
|
||||
}
|
||||
public void UnregisterMemoryMapper()
|
||||
{
|
||||
ReadMemory = null;
|
||||
WriteMemory = null;
|
||||
}
|
||||
|
||||
public ushort ReadWord(ushort address)
|
||||
{
|
||||
byte l = ReadMemory(address);
|
||||
byte h = ReadMemory(++address);
|
||||
return (ushort)((h << 8) | l);
|
||||
}
|
||||
public ushort ReadWord(ushort address)
|
||||
{
|
||||
byte l = ReadMemory(address);
|
||||
byte h = ReadMemory(++address);
|
||||
return (ushort)((h << 8) | l);
|
||||
}
|
||||
|
||||
private void WriteWord(ushort address, ushort value)
|
||||
{
|
||||
byte l = (byte)(value & 0xFF);
|
||||
byte h = (byte)(value >> 8);
|
||||
WriteMemory(address, l);
|
||||
WriteMemory(++address, h);
|
||||
}
|
||||
private void WriteWord(ushort address, ushort value)
|
||||
{
|
||||
byte l = (byte)(value & 0xFF);
|
||||
byte h = (byte)(value >> 8);
|
||||
WriteMemory(address, l);
|
||||
WriteMemory(++address, h);
|
||||
}
|
||||
|
||||
private ushort ReadWordPageWrap(ushort address)
|
||||
{
|
||||
ushort highAddress = (ushort)((address & 0xFF00) + ((address + 1) & 0xFF));
|
||||
return (ushort)(ReadMemory(address) | (ReadMemory(highAddress) << 8));
|
||||
}
|
||||
private ushort ReadWordPageWrap(ushort address)
|
||||
{
|
||||
ushort highAddress = (ushort)((address & 0xFF00) + ((address + 1) & 0xFF));
|
||||
return (ushort)(ReadMemory(address) | (ReadMemory(highAddress) << 8));
|
||||
}
|
||||
|
||||
private static readonly byte[] TableNZ =
|
||||
{
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
|
||||
};
|
||||
}
|
||||
private static readonly byte[] TableNZ =
|
||||
{
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue