diff --git a/BizHawk.Emulation/Consoles/Calculator/TI83.cs b/BizHawk.Emulation/Consoles/Calculator/TI83.cs index ed83bddfb3..0cdf84bb5e 100644 --- a/BizHawk.Emulation/Consoles/Calculator/TI83.cs +++ b/BizHawk.Emulation/Consoles/Calculator/TI83.cs @@ -25,17 +25,25 @@ namespace BizHawk.Emulation.Consoles.Calculator uint disp_x, disp_y; int m_LinkOutput, m_LinkState; bool m_CursorMoved; + + MemoryDomain.FreezeData[] sysbus_freeze = new MemoryDomain.FreezeData[0x10000]; //------- public byte ReadMemory(ushort addr) { + byte ret; int romPage = romPageLow3Bits | (romPageHighBit << 3); //Console.WriteLine("read memory: {0:X4}", addr); if (addr < 0x4000) - return rom[addr]; //ROM zero-page + ret = rom[addr]; //ROM zero-page else if (addr < 0x8000) - return rom[romPage * 0x4000 + addr - 0x4000]; //other rom page - else return ram[addr - 0x8000]; + 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; } public void WriteMemory(ushort addr, byte value) @@ -581,6 +589,9 @@ 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.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index b74cda8adc..2cb2202f49 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -161,7 +161,6 @@ namespace BizHawk.MultiClient case "SG": case "GG": case "PCE": - case "TI83": AddCheatGroup.Enabled = false; CheatListView.Enabled = false; MessageLabel.Text = Global.Emulator.SystemId + " not supported."; @@ -645,7 +644,10 @@ namespace BizHawk.MultiClient else c.Enable(); } - catch { } + catch + { + NotSupportedError(); + } y = s.IndexOf('\t') + 1; s = s.Substring(y, s.Length - y); //Name @@ -668,6 +670,12 @@ namespace BizHawk.MultiClient return true; //TODO } + private void NotSupportedError() + { + MessageBox.Show("Unable to enable cheat for this platform, cheats are not supported for " + Global.Emulator.SystemId, "Cheat error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + private void OpenCheatFile() { var file = GetFileFromUser(); @@ -729,8 +737,12 @@ namespace BizHawk.MultiClient c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: validation c.value = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber)); c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex]; - try { c.Enable(); } - catch { } + try { + c.Enable(); + } + catch { + NotSupportedError(); + } return c; } @@ -841,8 +853,14 @@ namespace BizHawk.MultiClient cheatList[indexes[x]].Disable(); else { - try { cheatList[indexes[x]].Enable(); } - catch { } + try + { + cheatList[indexes[x]].Enable(); + } + catch + { + NotSupportedError(); + } } } CheatListView.Refresh();