Cheats implemented in the TI83 core, show messagebox on Cheat enable failure
This commit is contained in:
parent
19d0cc627e
commit
183ef7f14c
|
@ -25,17 +25,25 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
||||||
uint disp_x, disp_y;
|
uint disp_x, disp_y;
|
||||||
int m_LinkOutput, m_LinkState;
|
int m_LinkOutput, m_LinkState;
|
||||||
bool m_CursorMoved;
|
bool m_CursorMoved;
|
||||||
|
|
||||||
|
MemoryDomain.FreezeData[] sysbus_freeze = new MemoryDomain.FreezeData[0x10000];
|
||||||
//-------
|
//-------
|
||||||
|
|
||||||
public byte ReadMemory(ushort addr)
|
public byte ReadMemory(ushort addr)
|
||||||
{
|
{
|
||||||
|
byte ret;
|
||||||
int romPage = romPageLow3Bits | (romPageHighBit << 3);
|
int romPage = romPageLow3Bits | (romPageHighBit << 3);
|
||||||
//Console.WriteLine("read memory: {0:X4}", addr);
|
//Console.WriteLine("read memory: {0:X4}", addr);
|
||||||
if (addr < 0x4000)
|
if (addr < 0x4000)
|
||||||
return rom[addr]; //ROM zero-page
|
ret = rom[addr]; //ROM zero-page
|
||||||
else if (addr < 0x8000)
|
else if (addr < 0x8000)
|
||||||
return rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
|
ret = rom[romPage * 0x4000 + addr - 0x4000]; //other rom page
|
||||||
else return ram[addr - 0x8000];
|
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)
|
public void WriteMemory(ushort addr, byte value)
|
||||||
|
@ -581,6 +589,9 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
||||||
(addr, value) => ram[addr & RamSizeMask] = value);
|
(addr, value) => ram[addr & RamSizeMask] = value);
|
||||||
domains.Add(MainMemoryDomain);
|
domains.Add(MainMemoryDomain);
|
||||||
memoryDomains = domains.AsReadOnly();
|
memoryDomains = domains.AsReadOnly();
|
||||||
|
|
||||||
|
MainMemoryDomain.GetFreeze = addr => sysbus_freeze[addr];
|
||||||
|
MainMemoryDomain.SetFreeze = (addr, value) => sysbus_freeze[addr] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
||||||
|
|
|
@ -161,7 +161,6 @@ namespace BizHawk.MultiClient
|
||||||
case "SG":
|
case "SG":
|
||||||
case "GG":
|
case "GG":
|
||||||
case "PCE":
|
case "PCE":
|
||||||
case "TI83":
|
|
||||||
AddCheatGroup.Enabled = false;
|
AddCheatGroup.Enabled = false;
|
||||||
CheatListView.Enabled = false;
|
CheatListView.Enabled = false;
|
||||||
MessageLabel.Text = Global.Emulator.SystemId + " not supported.";
|
MessageLabel.Text = Global.Emulator.SystemId + " not supported.";
|
||||||
|
@ -645,7 +644,10 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
c.Enable();
|
c.Enable();
|
||||||
}
|
}
|
||||||
catch { }
|
catch
|
||||||
|
{
|
||||||
|
NotSupportedError();
|
||||||
|
}
|
||||||
|
|
||||||
y = s.IndexOf('\t') + 1;
|
y = s.IndexOf('\t') + 1;
|
||||||
s = s.Substring(y, s.Length - y); //Name
|
s = s.Substring(y, s.Length - y); //Name
|
||||||
|
@ -668,6 +670,12 @@ namespace BizHawk.MultiClient
|
||||||
return true; //TODO
|
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()
|
private void OpenCheatFile()
|
||||||
{
|
{
|
||||||
var file = GetFileFromUser();
|
var file = GetFileFromUser();
|
||||||
|
@ -729,8 +737,12 @@ namespace BizHawk.MultiClient
|
||||||
c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: validation
|
c.address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); //TODO: validation
|
||||||
c.value = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber));
|
c.value = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber));
|
||||||
c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
|
c.domain = Global.Emulator.MemoryDomains[DomainComboBox.SelectedIndex];
|
||||||
try { c.Enable(); }
|
try {
|
||||||
catch { }
|
c.Enable();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
NotSupportedError();
|
||||||
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,8 +853,14 @@ namespace BizHawk.MultiClient
|
||||||
cheatList[indexes[x]].Disable();
|
cheatList[indexes[x]].Disable();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try { cheatList[indexes[x]].Enable(); }
|
try
|
||||||
catch { }
|
{
|
||||||
|
cheatList[indexes[x]].Enable();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
NotSupportedError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheatListView.Refresh();
|
CheatListView.Refresh();
|
||||||
|
|
Loading…
Reference in New Issue