From 6f379cee766552e70c83c21bda459b03c010d457 Mon Sep 17 00:00:00 2001 From: beirich Date: Wed, 3 Aug 2011 02:13:42 +0000 Subject: [PATCH] remove freeze system; replacement incoming --- BizHawk.Emulation/Consoles/Calculator/TI83.cs | 7 ----- .../Consoles/Nintendo/NES/Core.cs | 26 ------------------- .../Consoles/Nintendo/NES/NES.cs | 9 ------- BizHawk.Emulation/Interfaces/IEmulator.cs | 25 +----------------- BizHawk.MultiClient/tools/Cheat.cs | 4 +-- 5 files changed, 3 insertions(+), 68 deletions(-) diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index 0cdf84bb5e..15a661cc59 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -26,7 +26,6 @@ namespace BizHawk.Emulation.Consoles.Calculator int m_LinkOutput, m_LinkState; bool m_CursorMoved; - MemoryDomain.FreezeData[] sysbus_freeze = new MemoryDomain.FreezeData[0x10000]; //------- public byte ReadMemory(ushort addr) @@ -40,9 +39,6 @@ namespace BizHawk.Emulation.Consoles.Calculator ret = rom[romPage * 0x4000 + addr - 0x4000]; //other rom page else ret = ram[addr - 0x8000]; - //apply freeze - if (sysbus_freeze[addr].IsFrozen) ret = sysbus_freeze[addr].value; - return ret; } @@ -589,9 +585,6 @@ namespace BizHawk.Emulation.Consoles.Calculator (addr, value) => ram[addr & RamSizeMask] = value); domains.Add(MainMemoryDomain); memoryDomains = domains.AsReadOnly(); - - MainMemoryDomain.GetFreeze = addr => sysbus_freeze[addr]; - MainMemoryDomain.SetFreeze = (addr, value) => sysbus_freeze[addr] = value; } public IList MemoryDomains { get { return memoryDomains; } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs index 49f8aacd65..605278d34b 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Core.cs @@ -23,32 +23,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo CartInfo cart; //the current cart prototype. should be moved into the board, perhaps INESBoard board; //the board hardware that is currently driving things - private struct FreezeRecord - { - public int Address; - public MemoryDomain.FreezeData Data; - } - List sysbus_freeze_list = new List(); - List ppubus_freeze_list = new List(); - - MemoryDomain.FreezeData GetFreeze(List list, int addr) - { - int index = list.FindIndex((fd) => fd.Address == addr); - if (index == -1) return MemoryDomain.FreezeData.Empty; - return list[index].Data; - } - - void SetFreeze(List list, int addr, MemoryDomain.FreezeData data) - { - int index = list.FindIndex((fd) => fd.Address == addr); - if (index != -1) list.RemoveAt(index); - if(!data.IsFrozen) return; - FreezeRecord fr = new FreezeRecord(); - fr.Data = data; - fr.Address = addr; - list.Add(fr); - } - bool _irq_apu, _irq_cart; public bool irq_apu { get { return _irq_apu; } set { _irq_apu = value; sync_irq(); } } public bool irq_cart { get { return _irq_cart; } set { _irq_cart = value; sync_irq(); } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs index acb0cac5f5..d076284af3 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/NES.cs @@ -291,15 +291,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo var CIRAMdomain = new MemoryDomain("CIRAM (nametables)", 0x800, Endian.Little, addr => CIRAM[addr & 0x07FF], (addr, value) => CIRAM[addr & 0x07FF] = value); - SystemBus.GetFreeze = addr => GetFreeze(sysbus_freeze_list, addr); - SystemBus.SetFreeze = (addr, value) => SetFreeze(sysbus_freeze_list, addr, value); - - RAM.GetFreeze = addr => GetFreeze(sysbus_freeze_list, addr); - RAM.SetFreeze = (addr, value) => SetFreeze(sysbus_freeze_list, addr & 0x07FF, value); - - PPUBus.GetFreeze = addr => GetFreeze(ppubus_freeze_list, addr); - PPUBus.SetFreeze = (addr, value) => SetFreeze(ppubus_freeze_list, addr, value); - //demo a game genie code GetWatch(NESWatch.EDomain.Sysbus, 0xB424).SetGameGenie(-1, 0x10); GetWatch(NESWatch.EDomain.Sysbus, 0xB424).RemoveGameGenie(); diff --git a/BizHawk.Emulation/Interfaces/IEmulator.cs b/BizHawk.Emulation/Interfaces/IEmulator.cs index 6147a5f820..df401d493d 100644 --- a/BizHawk.Emulation/Interfaces/IEmulator.cs +++ b/BizHawk.Emulation/Interfaces/IEmulator.cs @@ -48,32 +48,9 @@ namespace BizHawk public readonly int Size; public readonly Endian Endian; - //perhaps inconveniently, this is a struct. - //this is a premature optimization, since I anticipate having millions of these and i didnt want millions of objects - public struct FreezeData - { - public FreezeData(Flag flags, byte value) - { - this.flags = flags; - this.value = value; - } - public readonly byte value; - public readonly Flag flags; - public enum Flag : byte - { - None = 0, - Frozen = 1, - } - - public bool IsFrozen { get { return (flags & Flag.Frozen) != 0; } } - public static FreezeData Empty { get { return new FreezeData(); } } - } - public readonly Func PeekByte; public readonly Action PokeByte; - public Func GetFreeze; - public Action SetFreeze; - + public MemoryDomain(string name, int size, Endian endian, Func peekByte, Action pokeByte) { Name = name; diff --git a/BizHawk.MultiClient/tools/Cheat.cs b/BizHawk.MultiClient/tools/Cheat.cs index af31acd379..ddb2f453fe 100644 --- a/BizHawk.MultiClient/tools/Cheat.cs +++ b/BizHawk.MultiClient/tools/Cheat.cs @@ -44,13 +44,13 @@ namespace BizHawk.MultiClient public void Enable() { enabled = true; - domain.SetFreeze(address, new MemoryDomain.FreezeData(MemoryDomain.FreezeData.Flag.Frozen, value)); + //domain.SetFreeze(address, new MemoryDomain.FreezeData(MemoryDomain.FreezeData.Flag.Frozen, value)); } public void Disable() { enabled = false; - domain.SetFreeze(address, MemoryDomain.FreezeData.Empty); + //domain.ClearFreeze(address); } public bool IsEnabled()