setup psx tracer because why not
arguments string doesn't arrive for some reason, otherwise all looks good move psx disasm functionality to separate files (disassembler doesn't do anything yet)
This commit is contained in:
parent
5c926eefe1
commit
91fd016868
|
@ -984,6 +984,15 @@
|
|||
<Compile Include="Consoles\Sony\PSX\Octoshock.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sony\PSX\Octoshock.IDebuggable.cs">
|
||||
<DependentUpon>Octoshock.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sony\PSX\Octoshock.IDisassemblable.cs">
|
||||
<DependentUpon>Octoshock.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sony\PSX\Octoshock.ITraceable.cs">
|
||||
<DependentUpon>Octoshock.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Consoles\Sony\PSX\OctoshockDll.cs" />
|
||||
<Compile Include="Consoles\Sony\PSX\OctoshockFIOConfig.cs" />
|
||||
<Compile Include="Consoles\Sony\PSX\PSF.cs" />
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||
{
|
||||
public unsafe partial class Octoshock : IDebuggable
|
||||
{
|
||||
// TODO: don't cast to int, and are any of these not 32 bit?
|
||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
Dictionary<string, RegisterValue> ret = new Dictionary<string, RegisterValue>();
|
||||
var regs = new OctoshockDll.ShockRegisters_CPU();
|
||||
|
||||
OctoshockDll.shock_GetRegisters_CPU(psx, ref regs);
|
||||
|
||||
//ret[ "r1"] = (int)regs.GPR[ 1]; ret[ "r2"] = (int)regs.GPR[ 2]; ret[ "r3"] = (int)regs.GPR[ 3];
|
||||
//ret[ "r4"] = (int)regs.GPR[ 4]; ret[ "r5"] = (int)regs.GPR[ 5]; ret[ "r6"] = (int)regs.GPR[ 6]; ret[ "r7"] = (int)regs.GPR[ 7];
|
||||
//ret[ "r8"] = (int)regs.GPR[ 8]; ret[ "r9"] = (int)regs.GPR[ 9]; ret["r10"] = (int)regs.GPR[10]; ret["r11"] = (int)regs.GPR[11];
|
||||
//ret["r12"] = (int)regs.GPR[12]; ret["r13"] = (int)regs.GPR[13]; ret["r14"] = (int)regs.GPR[14]; ret["r15"] = (int)regs.GPR[15];
|
||||
//ret["r16"] = (int)regs.GPR[16]; ret["r17"] = (int)regs.GPR[17]; ret["r18"] = (int)regs.GPR[18]; ret["r19"] = (int)regs.GPR[19];
|
||||
//ret["r20"] = (int)regs.GPR[20]; ret["r21"] = (int)regs.GPR[21]; ret["r22"] = (int)regs.GPR[22]; ret["r23"] = (int)regs.GPR[23];
|
||||
//ret["r24"] = (int)regs.GPR[24]; ret["r25"] = (int)regs.GPR[25]; ret["r26"] = (int)regs.GPR[26]; ret["r27"] = (int)regs.GPR[27];
|
||||
//ret["r28"] = (int)regs.GPR[28]; ret["r29"] = (int)regs.GPR[29]; ret["r30"] = (int)regs.GPR[30]; ret["r31"] = (int)regs.GPR[31];
|
||||
|
||||
ret[ "at"] = (int)regs.GPR[ 1];
|
||||
ret[ "v0"] = (int)regs.GPR[ 2]; ret[ "v1"] = (int)regs.GPR[ 3];
|
||||
ret[ "a0"] = (int)regs.GPR[ 4]; ret[ "a1"] = (int)regs.GPR[ 5]; ret[ "a2"] = (int)regs.GPR[ 6]; ret[ "a3"] = (int)regs.GPR[ 7];
|
||||
ret[ "t0"] = (int)regs.GPR[ 8]; ret[ "t1"] = (int)regs.GPR[ 9]; ret[ "t2"] = (int)regs.GPR[10]; ret[ "t3"] = (int)regs.GPR[11];
|
||||
ret[ "t4"] = (int)regs.GPR[12]; ret[ "t5"] = (int)regs.GPR[13]; ret[ "t6"] = (int)regs.GPR[14]; ret[ "t7"] = (int)regs.GPR[15];
|
||||
ret[ "s0"] = (int)regs.GPR[16]; ret[ "s1"] = (int)regs.GPR[17]; ret[ "s2"] = (int)regs.GPR[18]; ret[ "s3"] = (int)regs.GPR[19];
|
||||
ret[ "s4"] = (int)regs.GPR[20]; ret[ "s5"] = (int)regs.GPR[21]; ret[ "s6"] = (int)regs.GPR[22]; ret[ "s7"] = (int)regs.GPR[23];
|
||||
ret[ "t8"] = (int)regs.GPR[24]; ret[ "t9"] = (int)regs.GPR[25];
|
||||
ret[ "k0"] = (int)regs.GPR[26]; ret[ "k1"] = (int)regs.GPR[27];
|
||||
ret[ "gp"] = (int)regs.GPR[28];
|
||||
ret[ "sp"] = (int)regs.GPR[29];
|
||||
ret[ "fp"] = (int)regs.GPR[30];
|
||||
ret[ "ra"] = (int)regs.GPR[31];
|
||||
|
||||
ret[ "pc"] = (int)regs.PC;
|
||||
ret[ "lo"] = (int)regs.LO;
|
||||
ret[ "hi"] = (int)regs.HI;
|
||||
ret[ "sr"] = (int)regs.SR;
|
||||
ret["cause"] = (int)regs.CAUSE;
|
||||
ret[ "epc"] = (int)regs.EPC;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Dictionary<string, int> CpuRegisterIndices = new Dictionary<string, int>() {
|
||||
{ "r1", 1 }, { "r2", 2 }, { "r3", 3 }, { "r4", 4 }, { "r5", 5 }, { "r6", 6 }, { "r7", 7 },
|
||||
{ "r8", 8 }, { "r9", 9 }, { "r10", 10 }, { "r11", 11 }, { "r12", 12 }, { "r13", 13 }, { "r14", 14 }, { "r15", 15 },
|
||||
{ "r16", 16 }, { "r17", 17 }, { "r18", 18 }, { "r19", 19 }, { "r20", 20 }, { "r21", 21 }, { "r22", 22 }, { "r23", 23 },
|
||||
{ "r24", 24 }, { "r25", 25 }, { "r26", 26 }, { "r27", 27 }, { "r28", 28 }, { "r29", 29 }, { "r30", 30 }, { "r31", 31 },
|
||||
|
||||
{ "at", 1 }, { "v0", 2 }, { "v1", 3 },
|
||||
{ "a0", 4 }, { "a1", 5 }, { "a2", 6 }, { "a3", 7 },
|
||||
{ "t0", 8 }, { "t1", 9 }, { "t2", 10 }, { "t3", 11 }, { "t4", 12 }, { "t5", 13 }, { "t6", 14 }, { "t7", 15 },
|
||||
{ "s0", 16 }, { "s1", 17 }, { "s2", 18 }, { "s3", 19 }, { "s4", 20 }, { "s5", 21 }, { "s6", 22 }, { "s7", 23 },
|
||||
{ "t8", 24 }, { "t9", 25 },
|
||||
{ "k0", 26 }, { "k1", 27 },
|
||||
{ "gp", 28 }, { "sp", 29 }, { "fp", 30 }, { "ra", 31 },
|
||||
|
||||
{ "pc", 32 },
|
||||
//33 - PC_NEXT
|
||||
//34 - IN_BD_SLOT
|
||||
{ "lo", 35 },
|
||||
{ "hi", 36 },
|
||||
{ "sr", 37 },
|
||||
{"cause", 38 },
|
||||
{ "epc", 39 },
|
||||
};
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
int index = CpuRegisterIndices[register];
|
||||
OctoshockDll.shock_SetRegister_CPU(psx, index, (uint)value);
|
||||
}
|
||||
|
||||
private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem();
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get { return _memoryCallbacks; } }
|
||||
|
||||
public bool CanStep(StepType type) { return false; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void Step(StepType type) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||
{
|
||||
public partial class Octoshock : IDisassemblable
|
||||
{
|
||||
public string Cpu
|
||||
{
|
||||
get { return "R3000A"; }
|
||||
set { }
|
||||
}
|
||||
|
||||
public IEnumerable<string> AvailableCpus
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "R3000A";
|
||||
}
|
||||
}
|
||||
|
||||
public string PCRegisterName
|
||||
{
|
||||
get { return "pc"; }
|
||||
}
|
||||
|
||||
public string Disassemble(MemoryDomain m, uint addr, out int length)
|
||||
{
|
||||
length = 4;
|
||||
//var result = OctoshockDll.shock_Util_DisassembleMIPS();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
|
||||
namespace BizHawk.Emulation.Cores.Sony.PSX
|
||||
{
|
||||
public partial class Octoshock
|
||||
{
|
||||
public ITraceable Tracer { get { return tracer; } }
|
||||
|
||||
public static string TraceHeader = "R3000A: PC, raw bytes, mnemonic, registers (GPRs, lo, hi, sr, cause, epc)";
|
||||
|
||||
public void ShockTraceCallback(IntPtr opaque, uint PC, uint inst, string dis)
|
||||
{
|
||||
var regs = GetCpuFlagsAndRegisters();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (var r in regs)
|
||||
{
|
||||
if (r.Key != "pc")
|
||||
sb.Append(
|
||||
string.Format("{0}:{1} ",
|
||||
r.Key,
|
||||
r.Value.Value.ToHexString(r.Value.BitSize / 4)));
|
||||
}
|
||||
|
||||
Tracer.Put(new TraceInfo
|
||||
{
|
||||
Disassembly = string.Format("{0:X8}: {1:X8} {2}", PC, inst, dis.PadRight(20)),
|
||||
RegisterInfo = sb.ToString().Trim()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,6 @@ using System.Linq;
|
|||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Common;
|
||||
|
||||
|
@ -32,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
isPorted: true,
|
||||
isReleased: true
|
||||
)]
|
||||
public unsafe class Octoshock : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IDriveLight, ISettable<Octoshock.Settings, Octoshock.SyncSettings>, IDebuggable, IRegionable, IInputPollable
|
||||
public unsafe partial class Octoshock : IEmulator, IVideoProvider, ISyncSoundProvider, ISaveRam, IStatable, IDriveLight, ISettable<Octoshock.Settings, Octoshock.SyncSettings>, IRegionable, IInputPollable
|
||||
{
|
||||
public string SystemId { get { return "PSX"; } }
|
||||
|
||||
|
@ -40,15 +39,15 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
{
|
||||
ControllerDefinition definition = new ControllerDefinition();
|
||||
definition.Name = "PSX DualShock Controller"; // <-- for compatibility
|
||||
//ControllerDefinition.Name = "PSX FrontIO"; // TODO - later rename to this, I guess, so it's less misleading. don't want to wreck keybindings yet.
|
||||
//ControllerDefinition.Name = "PSX FrontIO"; // TODO - later rename to this, I guess, so it's less misleading. don't want to wreck keybindings yet.
|
||||
|
||||
var cfg = syncSettings.FIOConfig.ToLogical();
|
||||
|
||||
for (int i = 0; i < cfg.NumPlayers; i++)
|
||||
{
|
||||
int pnum = i + 1;
|
||||
definition.BoolButtons.AddRange(new[]
|
||||
{
|
||||
definition.BoolButtons.AddRange(new[]
|
||||
{
|
||||
"P" + pnum + " Up",
|
||||
"P" + pnum + " Down",
|
||||
"P" + pnum + " Left",
|
||||
|
@ -59,34 +58,34 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
"P" + pnum + " Triangle",
|
||||
"P" + pnum + " Circle",
|
||||
"P" + pnum + " Cross",
|
||||
"P" + pnum + " L1",
|
||||
"P" + pnum + " L1",
|
||||
"P" + pnum + " R1",
|
||||
"P" + pnum + " L2",
|
||||
"P" + pnum + " R2",
|
||||
});
|
||||
|
||||
var type = cfg.DevicesPlayer[i];
|
||||
var type = cfg.DevicesPlayer[i];
|
||||
|
||||
if (type == OctoshockDll.ePeripheralType.DualShock || type == OctoshockDll.ePeripheralType.DualAnalog)
|
||||
if (type == OctoshockDll.ePeripheralType.DualShock || type == OctoshockDll.ePeripheralType.DualAnalog)
|
||||
{
|
||||
definition.BoolButtons.Add("P" + pnum + " L3");
|
||||
definition.BoolButtons.Add("P" + pnum + " R3");
|
||||
definition.BoolButtons.Add("P" + pnum + " MODE");
|
||||
|
||||
definition.FloatControls.AddRange(new[]
|
||||
{
|
||||
definition.BoolButtons.Add("P" + pnum + " L3");
|
||||
definition.BoolButtons.Add("P" + pnum + " R3");
|
||||
definition.BoolButtons.Add("P" + pnum + " MODE");
|
||||
|
||||
definition.FloatControls.AddRange(new[]
|
||||
{
|
||||
"P" + pnum + " LStick X",
|
||||
"P" + pnum + " LStick Y",
|
||||
"P" + pnum + " RStick X",
|
||||
"P" + pnum + " RStick Y"
|
||||
});
|
||||
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f });
|
||||
}
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f });
|
||||
definition.FloatRanges.Add(new[] { 0.0f, 128.0f, 255.0f });
|
||||
definition.FloatRanges.Add(new[] { 255.0f, 128.0f, 0.0f });
|
||||
}
|
||||
}
|
||||
|
||||
definition.BoolButtons.AddRange(new[]
|
||||
{
|
||||
|
@ -122,7 +121,10 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
static Octoshock CurrOctoshockCore;
|
||||
|
||||
IntPtr psx;
|
||||
TraceBuffer tracer = new TraceBuffer();
|
||||
TraceBuffer tracer = new TraceBuffer()
|
||||
{
|
||||
Header = TraceHeader
|
||||
};
|
||||
|
||||
bool disposed = false;
|
||||
public void Dispose()
|
||||
|
@ -1247,100 +1249,5 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDebuggable
|
||||
|
||||
// TODO: don't cast to int, and are any of these not 32 bit?
|
||||
public IDictionary<string, RegisterValue> GetCpuFlagsAndRegisters()
|
||||
{
|
||||
Dictionary<string, RegisterValue> ret = new Dictionary<string, RegisterValue>();
|
||||
var regs = new OctoshockDll.ShockRegisters_CPU();
|
||||
|
||||
OctoshockDll.shock_GetRegisters_CPU(psx, ref regs);
|
||||
|
||||
ret["r1"] = (int)regs.GPR[1]; ret["r2"] = (int)regs.GPR[2]; ret["r3"] = (int)regs.GPR[3];
|
||||
ret["r4"] = (int)regs.GPR[4]; ret["r5"] = (int)regs.GPR[5]; ret["r6"] = (int)regs.GPR[6]; ret["r7"] = (int)regs.GPR[7];
|
||||
ret["r8"] = (int)regs.GPR[8]; ret["r9"] = (int)regs.GPR[9]; ret["r10"] = (int)regs.GPR[10]; ret["r11"] = (int)regs.GPR[11];
|
||||
ret["r12"] = (int)regs.GPR[12]; ret["r13"] = (int)regs.GPR[13]; ret["r14"] = (int)regs.GPR[14]; ret["r15"] = (int)regs.GPR[15];
|
||||
ret["r16"] = (int)regs.GPR[16]; ret["r17"] = (int)regs.GPR[17]; ret["r18"] = (int)regs.GPR[18]; ret["r19"] = (int)regs.GPR[19];
|
||||
ret["r20"] = (int)regs.GPR[20]; ret["r21"] = (int)regs.GPR[21]; ret["r22"] = (int)regs.GPR[22]; ret["r23"] = (int)regs.GPR[23];
|
||||
ret["r24"] = (int)regs.GPR[24]; ret["r25"] = (int)regs.GPR[25]; ret["r26"] = (int)regs.GPR[26]; ret["r27"] = (int)regs.GPR[27];
|
||||
ret["r28"] = (int)regs.GPR[28]; ret["r29"] = (int)regs.GPR[29]; ret["r30"] = (int)regs.GPR[30]; ret["r31"] = (int)regs.GPR[31];
|
||||
|
||||
ret["at"] = (int)regs.GPR[1];
|
||||
ret["v0"] = (int)regs.GPR[2]; ret["v1"] = (int)regs.GPR[3];
|
||||
ret["a0"] = (int)regs.GPR[4]; ret["a1"] = (int)regs.GPR[5]; ret["a2"] = (int)regs.GPR[6]; ret["a3"] = (int)regs.GPR[7];
|
||||
ret["t0"] = (int)regs.GPR[8]; ret["t1"] = (int)regs.GPR[9]; ret["t2"] = (int)regs.GPR[10]; ret["t3"] = (int)regs.GPR[11];
|
||||
ret["t4"] = (int)regs.GPR[12]; ret["t5"] = (int)regs.GPR[13]; ret["t6"] = (int)regs.GPR[14]; ret["t7"] = (int)regs.GPR[15];
|
||||
ret["s0"] = (int)regs.GPR[16]; ret["s1"] = (int)regs.GPR[17]; ret["s2"] = (int)regs.GPR[18]; ret["s3"] = (int)regs.GPR[19];
|
||||
ret["s4"] = (int)regs.GPR[20]; ret["s5"] = (int)regs.GPR[21]; ret["s6"] = (int)regs.GPR[22]; ret["s7"] = (int)regs.GPR[23];
|
||||
ret["t8"] = (int)regs.GPR[24]; ret["t9"] = (int)regs.GPR[25];
|
||||
ret["k0"] = (int)regs.GPR[26]; ret["k1"] = (int)regs.GPR[27];
|
||||
ret["gp"] = (int)regs.GPR[28];
|
||||
ret["sp"] = (int)regs.GPR[29];
|
||||
ret["fp"] = (int)regs.GPR[30];
|
||||
ret["ra"] = (int)regs.GPR[31];
|
||||
|
||||
ret["pc"] = (int)regs.PC;
|
||||
ret["lo"] = (int)regs.LO;
|
||||
ret["hi"] = (int)regs.HI;
|
||||
ret["sr"] = (int)regs.SR;
|
||||
ret["cause"] = (int)regs.CAUSE;
|
||||
ret["epc"] = (int)regs.EPC;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Dictionary<string, int> CpuRegisterIndices = new Dictionary<string, int>() {
|
||||
{"r1",1},{"r2",2},{"r3",3},{"r4",4},{"r5",5},{"r6",6},{"r7",7},
|
||||
{"r8",8},{"r9",9},{"r10",10},{"r11",11},{"r12",12},{"r13",13},{"r14",14},{"r15",15},
|
||||
{"r16",16},{"r17",17},{"r18",18},{"r19",19},{"r20",20},{"r21",21},{"r22",22},{"r23",23},
|
||||
{"r24",24},{"r25",25},{"r26",26},{"r27",27},{"r28",28},{"r29",29},{"r30",30},{"r31",31},
|
||||
{"at",1},{"v0",2},{"v1",3},
|
||||
{"a0",4},{"a1",5},{"a2",6},{"a3",7},
|
||||
{"t0",8},{"t1",9},{"t2",10},{"t3",11},
|
||||
{"t4",12},{"t5",13},{"t6",14},{"t7",15},
|
||||
{"s0",16},{"s1",17},{"s2",18},{"s3",19},
|
||||
{"s4",20},{"s5",21},{"s6",22},{"s7",23},
|
||||
{"t8",24},{"t9",25},
|
||||
{"k0",26},{"k1",27},
|
||||
{"gp",28},{"sp",29},{"fp",30},{"ra",31},
|
||||
{"pc",32},
|
||||
//33 - PC_NEXT
|
||||
//34 - IN_BD_SLOT
|
||||
{"lo",35},
|
||||
{"hi",36},
|
||||
{"sr",37},
|
||||
{"cause",38},
|
||||
{"epc",39},
|
||||
};
|
||||
|
||||
public void SetCpuRegister(string register, int value)
|
||||
{
|
||||
int index = CpuRegisterIndices[register];
|
||||
OctoshockDll.shock_SetRegister_CPU(psx, index, (uint)value);
|
||||
}
|
||||
|
||||
public ITraceable Tracer { get { return tracer; } }
|
||||
|
||||
public void ShockTraceCallback(IntPtr opaque, uint PC, uint inst, string dis)
|
||||
{
|
||||
// Tracer refactor TODO: fix this
|
||||
Tracer.Put(new TraceInfo
|
||||
{
|
||||
Disassembly = dis,
|
||||
RegisterInfo = "TODO"
|
||||
});
|
||||
}
|
||||
|
||||
private readonly MemoryCallbackSystem _memoryCallbacks = new MemoryCallbackSystem();
|
||||
public IMemoryCallbackSystem MemoryCallbacks { get { return _memoryCallbacks; } }
|
||||
|
||||
public bool CanStep(StepType type) { return false; }
|
||||
|
||||
[FeatureNotImplemented]
|
||||
public void Step(StepType type) { throw new NotImplementedException(); }
|
||||
|
||||
#endregion //IDebuggable
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -31,6 +31,7 @@ void* g_ShockTraceCallbackOpaque = NULL;
|
|||
ShockCallback_Trace g_ShockTraceCallback = NULL;
|
||||
ShockCallback_Mem g_ShockMemCallback;
|
||||
eShockMemCb g_ShockMemCbType;
|
||||
const char *disasm_buf = NULL;
|
||||
|
||||
/* TODO
|
||||
Make sure load delays are correct.
|
||||
|
@ -56,6 +57,7 @@ PS_CPU::PS_CPU()
|
|||
|
||||
memset(FastMap, 0, sizeof(FastMap));
|
||||
memset(DummyPage, 0xFF, sizeof(DummyPage)); // 0xFF to trigger an illegal instruction exception, so we'll know what's up when debugging.
|
||||
disasm_buf = (char*)malloc(100);
|
||||
|
||||
for(uint64 a = 0x00000000; a < (1ULL << 32); a += FAST_MAP_PSIZE)
|
||||
SetFastMap(DummyPage, a, FAST_MAP_PSIZE);
|
||||
|
@ -546,23 +548,23 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
|||
|
||||
switch(PC & 0xC)
|
||||
{
|
||||
case 0x0:
|
||||
timestamp++;
|
||||
ICI[0x00].TV &= ~0x2;
|
||||
ICI[0x00].Data = MDFN_de32lsb<true>(&FMP[0x0]);
|
||||
case 0x4:
|
||||
timestamp++;
|
||||
ICI[0x01].TV &= ~0x2;
|
||||
ICI[0x01].Data = MDFN_de32lsb<true>(&FMP[0x4]);
|
||||
case 0x8:
|
||||
timestamp++;
|
||||
ICI[0x02].TV &= ~0x2;
|
||||
ICI[0x02].Data = MDFN_de32lsb<true>(&FMP[0x8]);
|
||||
case 0xC:
|
||||
timestamp++;
|
||||
ICI[0x03].TV &= ~0x2;
|
||||
ICI[0x03].Data = MDFN_de32lsb<true>(&FMP[0xC]);
|
||||
break;
|
||||
case 0x0:
|
||||
timestamp++;
|
||||
ICI[0x00].TV &= ~0x2;
|
||||
ICI[0x00].Data = MDFN_de32lsb<true>(&FMP[0x0]);
|
||||
case 0x4:
|
||||
timestamp++;
|
||||
ICI[0x01].TV &= ~0x2;
|
||||
ICI[0x01].Data = MDFN_de32lsb<true>(&FMP[0x4]);
|
||||
case 0x8:
|
||||
timestamp++;
|
||||
ICI[0x02].TV &= ~0x2;
|
||||
ICI[0x02].Data = MDFN_de32lsb<true>(&FMP[0x8]);
|
||||
case 0xC:
|
||||
timestamp++;
|
||||
ICI[0x03].TV &= ~0x2;
|
||||
ICI[0x03].Data = MDFN_de32lsb<true>(&FMP[0xC]);
|
||||
break;
|
||||
}
|
||||
instr = ICache[(PC & 0xFFC) >> 2].Data;
|
||||
}
|
||||
|
@ -572,6 +574,12 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
|||
//for(int i = 0; i < 32; i++)
|
||||
// printf("%02x : %08x\n", i, GPR[i]);
|
||||
//printf("\n");
|
||||
if (g_ShockTraceCallback)
|
||||
{
|
||||
//_asm int 3;
|
||||
shock_Util_DisassembleMIPS(PC, instr, (void *)disasm_buf, sizeof(disasm_buf));
|
||||
g_ShockTraceCallback(NULL, PC, instr, disasm_buf);
|
||||
}
|
||||
|
||||
opf = instr & 0x3F;
|
||||
|
||||
|
|
|
@ -224,8 +224,8 @@ namespace MDFN_IEN_PSX
|
|||
public:
|
||||
void SetCPUHook(void(*cpuh)(const pscpu_timestamp_t timestamp, uint32 pc), void(*addbt)(uint32 from, uint32 to, bool exception));
|
||||
void CheckBreakpoints(void(*callback)(bool write, uint32 address, unsigned int len), uint32 instr);
|
||||
void* debug_GetScratchRAMPtr() { return ScratchRAM.data8; }
|
||||
void* debug_GetGPRPtr() { return GPR; }
|
||||
void* debug_GetScratchRAMPtr() { return ScratchRAM.data8; }
|
||||
void* debug_GetGPRPtr() { return GPR; }
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -2681,9 +2681,9 @@ EW_EXPORT s32 shock_GetRegisters_CPU(void* psx, ShockRegisters_CPU* buffer)
|
|||
{
|
||||
memcpy(buffer->GPR,CPU->debug_GetGPRPtr(),32*4);
|
||||
buffer->PC = CPU->GetRegister(PS_CPU::GSREG_PC_NEXT,NULL,0);
|
||||
buffer->PC_NEXT = CPU->GetRegister(PS_CPU::GSREG_PC_NEXT,NULL,0);
|
||||
buffer->IN_BD_SLOT = CPU->GetRegister(PS_CPU::GSREG_IN_BD_SLOT,NULL,0);
|
||||
buffer->LO = CPU->GetRegister(PS_CPU::GSREG_LO,NULL,0);
|
||||
buffer->PC_NEXT = CPU->GetRegister(PS_CPU::GSREG_PC_NEXT,NULL,0);
|
||||
buffer->IN_BD_SLOT = CPU->GetRegister(PS_CPU::GSREG_IN_BD_SLOT,NULL,0);
|
||||
buffer->LO = CPU->GetRegister(PS_CPU::GSREG_LO,NULL,0);
|
||||
buffer->HI = CPU->GetRegister(PS_CPU::GSREG_HI,NULL,0);
|
||||
buffer->SR = CPU->GetRegister(PS_CPU::GSREG_SR,NULL,0);
|
||||
buffer->CAUSE = CPU->GetRegister(PS_CPU::GSREG_CAUSE,NULL,0);
|
||||
|
|
Loading…
Reference in New Issue