Add SetCpuRegister() to IEmulator. Implemented it in Atari 2600, 7800, C64, Neshawk, and technically dual gameboy (passes it to L and R where it will fail). The rest throw NotImplementedExceptions. Lua - add emu.setregister(), catches NotImplementedExceptions and informs the user.
This commit is contained in:
parent
37d0510444
commit
51660dd023
BizHawk.Client.Common/lua
BizHawk.Emulation.Common/Interfaces
BizHawk.Emulation.Cores
Calculator
Computers/Commodore64
Consoles
Atari
Coleco
Intellivision
Nintendo
GBA
Gameboy
N64
NES
QuickNES
SNES
PC Engine
Sega
Sony
WonderSwan
|
@ -99,6 +99,24 @@ namespace BizHawk.Client.Common
|
|||
return table;
|
||||
}
|
||||
|
||||
[LuaMethodAttributes(
|
||||
"setregister",
|
||||
"sets the given register name to the given value"
|
||||
)]
|
||||
public void SetRegister(string register, int value)
|
||||
{
|
||||
try
|
||||
{
|
||||
Global.Emulator.SetCpuRegister(register, value);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
Log(string.Format(
|
||||
"Error: {0} does not yet implement setregister()",
|
||||
Global.Emulator.Attributes().CoreName));
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodAttributes(
|
||||
"getsystemid",
|
||||
"Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL"
|
||||
|
|
|
@ -88,6 +88,8 @@ namespace BizHawk.Emulation.Common
|
|||
return new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value) { }
|
||||
|
||||
bool xmas;
|
||||
Pleg pleg;
|
||||
|
||||
|
|
|
@ -145,6 +145,13 @@ namespace BizHawk.Emulation.Common
|
|||
/// <returns></returns>
|
||||
Dictionary<string, int> GetCpuFlagsAndRegisters();
|
||||
|
||||
/// <summary>
|
||||
/// Sets a given Cpu register to the given value
|
||||
/// </summary>
|
||||
/// <param name="register"></param>
|
||||
/// <param name="value"></param>
|
||||
void SetCpuRegister(string register, int value);
|
||||
|
||||
// ====settings interface====
|
||||
|
||||
// in addition to these methods, it's expected that the constructor or Load() method
|
||||
|
|
|
@ -1046,5 +1046,10 @@ namespace BizHawk.Emulation.Cores.Calculators
|
|||
{ "Flag S", cpu.RegisterF.Bit(7) ? 1 : 0 }
|
||||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -103,6 +103,30 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64
|
|||
{ "Flag T", board.cpu.FlagT ? 1 : 0 }
|
||||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
switch (register)
|
||||
{
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
case "A":
|
||||
board.cpu.A = (byte)value;
|
||||
break;
|
||||
case "X":
|
||||
board.cpu.X = (byte)value;
|
||||
break;
|
||||
case "Y":
|
||||
board.cpu.Y = (byte)value;
|
||||
break;
|
||||
case "S":
|
||||
board.cpu.S = (byte)value;
|
||||
break;
|
||||
case "PC":
|
||||
board.cpu.PC = (byte)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static public class C64Util
|
||||
|
|
|
@ -193,6 +193,33 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
switch(register)
|
||||
{
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
case "A":
|
||||
Cpu.A = (byte)value;
|
||||
break;
|
||||
case "X":
|
||||
Cpu.X = (byte)value;
|
||||
break;
|
||||
case "Y":
|
||||
Cpu.Y = (byte)value;
|
||||
break;
|
||||
case "S":
|
||||
Cpu.S = (byte)value;
|
||||
break;
|
||||
case "PC":
|
||||
Cpu.PC = (byte)value;
|
||||
break;
|
||||
case "Flag I":
|
||||
Cpu.FlagI = value > 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartAsyncSound() { return true; }
|
||||
|
||||
public void EndAsyncSound() { }
|
||||
|
|
|
@ -35,5 +35,32 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
|
|||
{ "Flag Z", theMachine.CPU.fZ ? 1 : 0 }
|
||||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
switch (register)
|
||||
{
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
case "A":
|
||||
theMachine.CPU.A = (byte)value;
|
||||
break;
|
||||
case "P":
|
||||
theMachine.CPU.P = (byte)value;
|
||||
break;
|
||||
case "PC":
|
||||
theMachine.CPU.PC = (byte)value;
|
||||
break;
|
||||
case "S":
|
||||
theMachine.CPU.S = (byte)value;
|
||||
break;
|
||||
case "X":
|
||||
theMachine.CPU.X = (byte)value;
|
||||
break;
|
||||
case "Y":
|
||||
theMachine.CPU.Y = (byte)value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -293,5 +293,10 @@ namespace BizHawk.Emulation.Cores.ColecoVision
|
|||
{ "Flag S", Cpu.RegisterF.Bit(7) ? 1 : 0 }
|
||||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28,6 +28,11 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Connect()
|
||||
{
|
||||
Cpu.SetIntRM(Stic.GetSr1());
|
||||
|
|
|
@ -26,6 +26,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static readonly ControllerDefinition GBAController =
|
||||
new ControllerDefinition
|
||||
{
|
||||
|
|
|
@ -201,6 +201,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// true if the emulator is currently emulating CGB
|
||||
/// </summary>
|
||||
|
|
|
@ -30,6 +30,21 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
|
|||
return left.Union(right).ToList().ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
if (register.StartsWith("Left "))
|
||||
{
|
||||
L.SetCpuRegister(register.Replace("Left ", ""), value);
|
||||
}
|
||||
|
||||
else if (register.StartsWith("Right "))
|
||||
{
|
||||
L.SetCpuRegister(register.Replace("Right ", ""), value);
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
Gameboy L;
|
||||
Gameboy R;
|
||||
// counter to ensure we do 35112 samples per frame
|
||||
|
|
|
@ -394,6 +394,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.N64
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private mupen64plusApi.MemoryCallback readcb;
|
||||
private mupen64plusApi.MemoryCallback writecb;
|
||||
|
||||
|
|
|
@ -887,6 +887,33 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
switch (register)
|
||||
{
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
case "A":
|
||||
cpu.A = (byte)value;
|
||||
break;
|
||||
case "X":
|
||||
cpu.X = (byte)value;
|
||||
break;
|
||||
case "Y":
|
||||
cpu.Y = (byte)value;
|
||||
break;
|
||||
case "S":
|
||||
cpu.S = (byte)value;
|
||||
break;
|
||||
case "PC":
|
||||
cpu.PC = (byte)value;
|
||||
break;
|
||||
case "Flag I":
|
||||
cpu.FlagI = value > 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NESSettings Settings = new NESSettings();
|
||||
NESSyncSettings SyncSettings = new NESSyncSettings();
|
||||
|
||||
|
|
|
@ -373,6 +373,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region settings
|
||||
|
|
|
@ -125,6 +125,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public class MyScanlineHookManager : ScanlineHookManager
|
||||
{
|
||||
public MyScanlineHookManager(LibsnesCore core)
|
||||
|
|
|
@ -545,6 +545,11 @@ namespace BizHawk.Emulation.Cores.PCEngine
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (disc != null)
|
||||
|
|
|
@ -279,6 +279,11 @@ namespace BizHawk.Emulation.Cores.Sega.Genesis
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
int vdpcallback(int level) // Musashi handler
|
||||
{
|
||||
InterruptCallback(level);
|
||||
|
|
|
@ -510,6 +510,11 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
|
|||
};
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public object GetSettings() { return Settings.Clone(); }
|
||||
|
|
|
@ -139,6 +139,11 @@ namespace BizHawk.Emulation.Cores.Sega.Saturn
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool GLMode { get; private set; }
|
||||
|
||||
public void SetGLRes(int factor, int width, int height)
|
||||
|
|
|
@ -586,6 +586,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UpdateVDPViewContext(LibGPGX.VDPView view)
|
||||
{
|
||||
LibGPGX.gpgx_get_vdp_view(view);
|
||||
|
|
|
@ -67,6 +67,11 @@ namespace BizHawk.Emulation.Cores.Sony.PSP
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
bool disposed = false;
|
||||
static PSP attachedcore = null;
|
||||
GCHandle vidhandle;
|
||||
|
|
|
@ -36,6 +36,11 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public static bool CheckIsPSX(DiscSystem.Disc disc)
|
||||
{
|
||||
bool ret = false;
|
||||
|
|
|
@ -296,6 +296,11 @@ namespace BizHawk.Emulation.Cores.WonderSwan
|
|||
return ret;
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Settings
|
||||
|
|
|
@ -380,6 +380,11 @@ namespace BizHawk.Emulation.Cores
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
|
|
Loading…
Reference in New Issue