BizHawk/BizHawk.MultiClient/tools/Cheat.cs

63 lines
1.5 KiB
C#
Raw Normal View History

2011-03-16 03:56:22 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.MultiClient
{
2011-03-16 15:48:47 +00:00
public class Cheat
2011-03-16 03:56:22 +00:00
{
//TODO: compare value (for NES)
2011-03-16 03:56:22 +00:00
public string name { get; set; }
public int address { get; set; }
public byte value { get; set; }
2011-03-17 17:00:06 +00:00
public MemoryDomain domain { get; set; }
2011-03-17 17:43:57 +00:00
private bool enabled;
2011-03-16 03:56:22 +00:00
public Cheat()
{
name = "";
address = 0;
value = 0;
enabled = false;
2011-03-17 17:00:06 +00:00
domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { });
2011-03-16 03:56:22 +00:00
}
public Cheat(Cheat c)
{
name = c.name;
address = c.address;
value = c.value;
enabled = c.enabled;
2011-03-17 17:00:06 +00:00
domain = c.domain;
2011-03-16 03:56:22 +00:00
}
public Cheat(string cname, int addr, byte val, bool e, MemoryDomain d)
2011-03-16 03:56:22 +00:00
{
name = cname;
address = addr;
value = val;
enabled = e;
2011-03-17 17:00:06 +00:00
domain = d;
2011-03-16 03:56:22 +00:00
}
2011-03-17 17:43:57 +00:00
public void Enable()
{
enabled = true;
2011-03-19 01:44:16 +00:00
domain.SetFreeze(address, new MemoryDomain.FreezeData(MemoryDomain.FreezeData.Flag.Frozen, value));
2011-03-17 17:43:57 +00:00
}
public void Disable()
{
enabled = false;
2011-03-19 01:44:16 +00:00
domain.SetFreeze(address, MemoryDomain.FreezeData.Empty);
2011-03-17 17:43:57 +00:00
}
public bool IsEnabled()
{
return enabled;
}
2011-03-16 03:56:22 +00:00
}
}