From dc9482589165fe041891069df6d864d03f1f936d Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Sat, 9 Feb 2019 16:46:36 -0600 Subject: [PATCH] various code cleanup --- .../GBHawkLink/GBHawkLink.ICodeDataLog.cs | 1 - .../GBHawkLink/GBHawkLink.IEmulator.cs | 7 ++---- .../GBHawkLink/GBHawkLink.IMemoryDomains.cs | 1 - .../Nintendo/GBHawkLink/GBHawkLink.cs | 4 --- .../GGHawkLink/GGHawkLink.ICodeDataLog.cs | 25 ++++++------------- .../Sega/GGHawkLink/GGHawkLink.IEmulator.cs | 8 ++---- .../GGHawkLink/GGHawkLink.IMemoryDomains.cs | 3 +-- .../Sega/GGHawkLink/GGHawkLink.IStatable.cs | 1 - .../Sega/GGHawkLink/GGHawkLinkControllers.cs | 1 - .../Consoles/Sega/SMS/SMS.ICodeDataLogger.cs | 18 ++++++------- .../Consoles/Sega/SMS/SMS.IDebuggable.cs | 1 - .../Consoles/Sega/SMS/SMS.cs | 1 - .../Consoles/Sega/SMS/VDP.ModeTMS.cs | 1 - .../Consoles/Sega/SMS/VDP.cs | 3 --- 14 files changed, 22 insertions(+), 53 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.ICodeDataLog.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.ICodeDataLog.cs index cfc841d321..6ce439f161 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.ICodeDataLog.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.ICodeDataLog.cs @@ -1,6 +1,5 @@ using System; using System.IO; -using System.Collections.Generic; using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.Components.LR35902; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs index 5187308752..6b32a8b273 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IEmulator.cs @@ -1,9 +1,6 @@ -using BizHawk.Common.NumberExtensions; -using BizHawk.Emulation.Common; -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; +using System; +using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Nintendo.GBHawk; namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IMemoryDomains.cs index d28fdaba55..baa6162919 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.IMemoryDomains.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using BizHawk.Emulation.Common; diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs index 094270ce05..486fa0255d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawkLink/GBHawkLink.cs @@ -1,12 +1,8 @@ using System; -using BizHawk.Common.BufferExtensions; using BizHawk.Emulation.Common; -using BizHawk.Emulation.Common.Components.LR35902; -using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy; using BizHawk.Emulation.Cores.Nintendo.GBHawk; -using System.Runtime.InteropServices; namespace BizHawk.Emulation.Cores.Nintendo.GBHawkLink { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.ICodeDataLog.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.ICodeDataLog.cs index 2371961b33..14bdaaa32d 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.ICodeDataLog.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.ICodeDataLog.cs @@ -1,9 +1,8 @@ using System; using System.IO; -using System.Collections.Generic; using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Components.Z80A; +using BizHawk.Emulation.Cores.Sega.MasterSystem; namespace BizHawk.Emulation.Cores.Sega.GGHawkLink { @@ -68,28 +67,20 @@ namespace BizHawk.Emulation.Cores.Sega.GGHawkLink Data = 0x04 }; - private struct CDLog_MapResults - { - public CDLog_AddrType Type; - public int Address; - } - - private delegate CDLog_MapResults MapMemoryDelegate(ushort addr, bool write); - private MapMemoryDelegate MapMemory; private ICodeDataLog CDL; private void RunCDL(ushort address, CDLog_Flags flags) { - if (MapMemory != null) + if (L.MapMemory != null) { - CDLog_MapResults results = MapMemory(address, false); + SMS.CDLog_MapResults results = L.MapMemory(address, false); switch (results.Type) { - case CDLog_AddrType.None: break; - case CDLog_AddrType.ROM: CDL["ROM"][results.Address] |= (byte)flags; break; - case CDLog_AddrType.MainRAM: CDL["Main RAM"][results.Address] |= (byte)flags; break; - case CDLog_AddrType.SaveRAM: CDL["Save RAM"][results.Address] |= (byte)flags; break; - case CDLog_AddrType.CartRAM: CDL["Cart (Volatile) RAM"][results.Address] |= (byte)flags; break; + case SMS.CDLog_AddrType.None: break; + case SMS.CDLog_AddrType.ROM: CDL["ROM"][results.Address] |= (byte)flags; break; + case SMS.CDLog_AddrType.MainRAM: CDL["Main RAM"][results.Address] |= (byte)flags; break; + case SMS.CDLog_AddrType.SaveRAM: CDL["Save RAM"][results.Address] |= (byte)flags; break; + case SMS.CDLog_AddrType.CartRAM: CDL["Cart (Volatile) RAM"][results.Address] |= (byte)flags; break; } } } diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs index 104ca4fea4..26ce78049c 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IEmulator.cs @@ -1,10 +1,6 @@ -using BizHawk.Common.NumberExtensions; -using BizHawk.Emulation.Common; -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; +using System; -using BizHawk.Emulation.Cores.Sega.MasterSystem; +using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sega.GGHawkLink { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IMemoryDomains.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IMemoryDomains.cs index c4914e0baa..9c2f9977c8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IMemoryDomains.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IMemoryDomains.cs @@ -1,7 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sega.GGHawkLink diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IStatable.cs index eb87c70ae6..cf789a0f58 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IStatable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLink.IStatable.cs @@ -3,7 +3,6 @@ using Newtonsoft.Json; using BizHawk.Common; using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Sega.MasterSystem; namespace BizHawk.Emulation.Cores.Sega.GGHawkLink { diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLinkControllers.cs b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLinkControllers.cs index 83c5aa1b67..7c1bc51e16 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLinkControllers.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/GGHawkLink/GGHawkLinkControllers.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.ComponentModel; using System.Linq; diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ICodeDataLogger.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ICodeDataLogger.cs index 08d49d04ad..746277efee 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ICodeDataLogger.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.ICodeDataLogger.cs @@ -48,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } - private enum CDLog_AddrType + public enum CDLog_AddrType { None, ROM, @@ -58,24 +58,24 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem } [Flags] - private enum CDLog_Flags + public enum CDLog_Flags { ExecFirst = 0x01, ExecOperand = 0x02, Data = 0x04 }; - private struct CDLog_MapResults + public struct CDLog_MapResults { public CDLog_AddrType Type; public int Address; } - private delegate CDLog_MapResults MapMemoryDelegate(ushort addr, bool write); - private MapMemoryDelegate MapMemory; - private ICodeDataLog CDL; + public delegate CDLog_MapResults MapMemoryDelegate(ushort addr, bool write); + public MapMemoryDelegate MapMemory; + public ICodeDataLog CDL; - private void RunCDL(ushort address, CDLog_Flags flags) + public void RunCDL(ushort address, CDLog_Flags flags) { if (MapMemory != null) { @@ -94,7 +94,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem /// /// A wrapper for FetchMemory which inserts CDL logic /// - private byte FetchMemory_CDL(ushort address) + public byte FetchMemory_CDL(ushort address) { RunCDL(address, CDLog_Flags.ExecFirst); return ReadMemory(address); @@ -103,7 +103,7 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem /// /// A wrapper for ReadMemory which inserts CDL logic /// - private byte ReadMemory_CDL(ushort address) + public byte ReadMemory_CDL(ushort address) { RunCDL(address, CDLog_Flags.Data); return ReadMemory(address); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IDebuggable.cs index c0043478f0..753c9eb7d8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.IDebuggable.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; -using BizHawk.Common.NumberExtensions; using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Sega.MasterSystem diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index b320887d91..6d0e1f7426 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -5,7 +5,6 @@ using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.Components; using BizHawk.Emulation.Cores.Components; using BizHawk.Emulation.Cores.Components.Z80A; -using BizHawk.Common.BufferExtensions; /***************************************************** TODO: diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs index 408c9fb2f3..8b302be1c9 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.ModeTMS.cs @@ -1,5 +1,4 @@ // Contains rendering functions for legacy TMS9918 modes. - using System; namespace BizHawk.Emulation.Cores.Sega.MasterSystem diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs index 2d72e9fccf..100707dcc8 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/VDP.cs @@ -1,12 +1,9 @@ using System; -using System.Globalization; -using System.IO; using BizHawk.Common; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Components.Z80A; - namespace BizHawk.Emulation.Cores.Sega.MasterSystem { public enum VdpMode { SMS, GameGear }