2010-03-04 14:54:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Runtime.InteropServices;
|
2010-12-19 10:48:09 +00:00
|
|
|
|
using System.IO;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
using TCPLibrary.MessageBased.Core;
|
|
|
|
|
using System.Threading;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
|
|
|
|
|
namespace GSDumpGUI
|
|
|
|
|
{
|
2010-12-19 16:03:21 +00:00
|
|
|
|
public delegate void GSgifTransfer(IntPtr data, int size);
|
2010-12-21 07:29:33 +00:00
|
|
|
|
public delegate void GSgifTransfer1(IntPtr data, int size);
|
2010-12-19 21:32:09 +00:00
|
|
|
|
public delegate void GSgifTransfer2(IntPtr data, int size);
|
|
|
|
|
public delegate void GSgifTransfer3(IntPtr data, int size);
|
2010-12-19 14:41:11 +00:00
|
|
|
|
public delegate void GSVSync(byte field);
|
|
|
|
|
public delegate void GSreadFIFO2(IntPtr data, int size);
|
|
|
|
|
public delegate void GSsetGameCRC(int crc, int options);
|
2010-12-21 07:29:33 +00:00
|
|
|
|
public delegate int GSfreeze(int mode, IntPtr data);
|
2010-12-19 14:41:11 +00:00
|
|
|
|
public delegate void GSopen(IntPtr hwnd, String Title, int renderer);
|
|
|
|
|
public delegate void GSclose();
|
|
|
|
|
public delegate void GSshutdown();
|
|
|
|
|
public delegate void GSConfigure();
|
|
|
|
|
public delegate void GSsetBaseMem(IntPtr data);
|
|
|
|
|
public delegate IntPtr PSEgetLibName();
|
|
|
|
|
public delegate void GSinit();
|
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
public class GSDXWrapper
|
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
static public bool DumpTooOld = false;
|
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
private GSConfigure gsConfigure;
|
|
|
|
|
private PSEgetLibName PsegetLibName;
|
2010-12-19 16:03:21 +00:00
|
|
|
|
private GSgifTransfer GSgifTransfer;
|
2010-12-21 07:29:33 +00:00
|
|
|
|
private GSgifTransfer1 GSgifTransfer1;
|
2010-12-19 21:32:09 +00:00
|
|
|
|
private GSgifTransfer2 GSgifTransfer2;
|
|
|
|
|
private GSgifTransfer3 GSgifTransfer3;
|
2010-12-19 14:41:11 +00:00
|
|
|
|
private GSVSync GSVSync;
|
|
|
|
|
private GSreadFIFO2 GSreadFIFO2;
|
|
|
|
|
private GSsetGameCRC GSsetGameCRC;
|
|
|
|
|
private GSfreeze GSfreeze;
|
|
|
|
|
private GSopen GSopen;
|
|
|
|
|
private GSclose GSclose;
|
|
|
|
|
private GSshutdown GSshutdown;
|
|
|
|
|
private GSsetBaseMem GSsetBaseMem;
|
|
|
|
|
private GSinit GSinit;
|
2010-03-04 14:54:20 +00:00
|
|
|
|
|
|
|
|
|
private Boolean Loaded;
|
|
|
|
|
|
|
|
|
|
private String DLL;
|
|
|
|
|
private IntPtr DLLAddr;
|
|
|
|
|
|
2010-12-19 14:41:11 +00:00
|
|
|
|
private Boolean Running;
|
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
public Queue<TCPMessage> QueueMessage;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
public Boolean DebugMode;
|
|
|
|
|
public GSData CurrentGIFPacket;
|
2010-12-22 09:19:58 +00:00
|
|
|
|
public bool ThereIsWork;
|
|
|
|
|
public AutoResetEvent ExternalEvent;
|
|
|
|
|
public int RunTo;
|
2010-12-22 06:59:53 +00:00
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
static public Boolean IsValidGSDX(String DLL)
|
|
|
|
|
{
|
|
|
|
|
NativeMethods.SetErrorMode(0x8007);
|
|
|
|
|
Boolean Ris = true;
|
2010-12-19 10:48:09 +00:00
|
|
|
|
|
|
|
|
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(DLL));
|
2010-03-04 14:54:20 +00:00
|
|
|
|
IntPtr hmod = NativeMethods.LoadLibrary(DLL);
|
|
|
|
|
if (hmod.ToInt64() > 0)
|
|
|
|
|
{
|
2010-03-19 20:27:06 +00:00
|
|
|
|
IntPtr funcaddrLibName = NativeMethods.GetProcAddress(hmod, "PS2EgetLibName");
|
2010-03-04 14:54:20 +00:00
|
|
|
|
IntPtr funcaddrConfig = NativeMethods.GetProcAddress(hmod, "GSconfigure");
|
|
|
|
|
|
2010-12-19 16:03:21 +00:00
|
|
|
|
IntPtr funcaddrGIF = NativeMethods.GetProcAddress(hmod, "GSgifTransfer");
|
2010-12-19 14:41:11 +00:00
|
|
|
|
IntPtr funcaddrVSync = NativeMethods.GetProcAddress(hmod, "GSvsync");
|
|
|
|
|
IntPtr funcaddrSetBaseMem = NativeMethods.GetProcAddress(hmod, "GSsetBaseMem");
|
|
|
|
|
IntPtr funcaddrOpen = NativeMethods.GetProcAddress(hmod, "GSopen");
|
|
|
|
|
IntPtr funcaddrSetCRC = NativeMethods.GetProcAddress(hmod, "GSsetGameCRC");
|
|
|
|
|
IntPtr funcaddrClose = NativeMethods.GetProcAddress(hmod, "GSclose");
|
|
|
|
|
IntPtr funcaddrShutdown = NativeMethods.GetProcAddress(hmod, "GSshutdown");
|
|
|
|
|
IntPtr funcaddrFreeze = NativeMethods.GetProcAddress(hmod, "GSfreeze");
|
|
|
|
|
IntPtr funcaddrGSreadFIFO2 = NativeMethods.GetProcAddress(hmod, "GSreadFIFO2");
|
|
|
|
|
IntPtr funcaddrinit = NativeMethods.GetProcAddress(hmod, "GSinit");
|
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
NativeMethods.FreeLibrary(hmod);
|
2010-12-19 16:54:56 +00:00
|
|
|
|
if (!((funcaddrConfig.ToInt64() > 0) && (funcaddrLibName.ToInt64() > 0) && (funcaddrGIF.ToInt64() > 0)))
|
2010-03-04 14:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
Int32 id = NativeMethods.GetLastError();
|
2010-12-19 10:48:09 +00:00
|
|
|
|
System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "log.txt", DLL + " failed to load. Error " + id + Environment.NewLine);
|
2010-03-04 14:54:20 +00:00
|
|
|
|
Ris = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Int32 id = NativeMethods.GetLastError();
|
2010-12-19 10:48:09 +00:00
|
|
|
|
System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "log.txt", DLL + " failed to load. Error " + id + Environment.NewLine);
|
2010-03-04 14:54:20 +00:00
|
|
|
|
Ris = false;
|
|
|
|
|
}
|
2010-12-19 10:48:09 +00:00
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
NativeMethods.SetErrorMode(0x0000);
|
|
|
|
|
return Ris;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Load(String DLL)
|
|
|
|
|
{
|
|
|
|
|
this.DLL = DLL;
|
|
|
|
|
NativeMethods.SetErrorMode(0x8007);
|
2010-12-19 11:28:38 +00:00
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
if (!IsValidGSDX(DLL))
|
|
|
|
|
throw new Exception("Invalid GSDX DLL");
|
|
|
|
|
|
|
|
|
|
if (Loaded)
|
|
|
|
|
Unload();
|
|
|
|
|
|
|
|
|
|
Loaded = true;
|
2010-12-19 10:48:09 +00:00
|
|
|
|
Directory.SetCurrentDirectory(Path.GetDirectoryName(DLL));
|
2010-03-04 14:54:20 +00:00
|
|
|
|
IntPtr hmod = NativeMethods.LoadLibrary(DLL);
|
|
|
|
|
if (hmod.ToInt64() > 0)
|
|
|
|
|
{
|
2010-03-19 20:27:06 +00:00
|
|
|
|
IntPtr funcaddrLibName = NativeMethods.GetProcAddress(hmod, "PS2EgetLibName");
|
2010-03-04 14:54:20 +00:00
|
|
|
|
IntPtr funcaddrConfig = NativeMethods.GetProcAddress(hmod, "GSconfigure");
|
|
|
|
|
|
2010-12-19 16:03:21 +00:00
|
|
|
|
IntPtr funcaddrGIF = NativeMethods.GetProcAddress(hmod, "GSgifTransfer");
|
2010-12-21 07:29:33 +00:00
|
|
|
|
IntPtr funcaddrGIF1 = NativeMethods.GetProcAddress(hmod, "GSgifTransfer1");
|
2010-12-19 21:32:09 +00:00
|
|
|
|
IntPtr funcaddrGIF2 = NativeMethods.GetProcAddress(hmod, "GSgifTransfer2");
|
|
|
|
|
IntPtr funcaddrGIF3 = NativeMethods.GetProcAddress(hmod, "GSgifTransfer3");
|
2010-12-19 14:41:11 +00:00
|
|
|
|
IntPtr funcaddrVSync = NativeMethods.GetProcAddress(hmod, "GSvsync");
|
|
|
|
|
IntPtr funcaddrSetBaseMem = NativeMethods.GetProcAddress(hmod, "GSsetBaseMem");
|
|
|
|
|
IntPtr funcaddrOpen = NativeMethods.GetProcAddress(hmod, "GSopen");
|
|
|
|
|
IntPtr funcaddrSetCRC = NativeMethods.GetProcAddress(hmod, "GSsetGameCRC");
|
|
|
|
|
IntPtr funcaddrClose = NativeMethods.GetProcAddress(hmod, "GSclose");
|
|
|
|
|
IntPtr funcaddrShutdown = NativeMethods.GetProcAddress(hmod, "GSshutdown");
|
|
|
|
|
IntPtr funcaddrFreeze = NativeMethods.GetProcAddress(hmod, "GSfreeze");
|
|
|
|
|
IntPtr funcaddrGSreadFIFO2 = NativeMethods.GetProcAddress(hmod, "GSreadFIFO2");
|
|
|
|
|
IntPtr funcaddrinit = NativeMethods.GetProcAddress(hmod, "GSinit");
|
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
gsConfigure = (GSConfigure)Marshal.GetDelegateForFunctionPointer(funcaddrConfig, typeof(GSConfigure));
|
|
|
|
|
PsegetLibName = (PSEgetLibName)Marshal.GetDelegateForFunctionPointer(funcaddrLibName, typeof(PSEgetLibName));
|
2010-12-19 14:41:11 +00:00
|
|
|
|
|
2010-12-19 16:03:21 +00:00
|
|
|
|
this.GSgifTransfer = (GSgifTransfer)Marshal.GetDelegateForFunctionPointer(funcaddrGIF, typeof(GSgifTransfer));
|
2010-12-21 07:29:33 +00:00
|
|
|
|
this.GSgifTransfer1 = (GSgifTransfer1)Marshal.GetDelegateForFunctionPointer(funcaddrGIF1, typeof(GSgifTransfer1));
|
2010-12-19 21:32:09 +00:00
|
|
|
|
this.GSgifTransfer2 = (GSgifTransfer2)Marshal.GetDelegateForFunctionPointer(funcaddrGIF2, typeof(GSgifTransfer2));
|
|
|
|
|
this.GSgifTransfer3 = (GSgifTransfer3)Marshal.GetDelegateForFunctionPointer(funcaddrGIF3, typeof(GSgifTransfer3));
|
2010-12-19 14:41:11 +00:00
|
|
|
|
this.GSVSync = (GSVSync)Marshal.GetDelegateForFunctionPointer(funcaddrVSync, typeof(GSVSync));
|
|
|
|
|
this.GSsetBaseMem = (GSsetBaseMem)Marshal.GetDelegateForFunctionPointer(funcaddrSetBaseMem, typeof(GSsetBaseMem));
|
|
|
|
|
this.GSopen = (GSopen)Marshal.GetDelegateForFunctionPointer(funcaddrOpen, typeof(GSopen));
|
|
|
|
|
this.GSsetGameCRC = (GSsetGameCRC)Marshal.GetDelegateForFunctionPointer(funcaddrSetCRC, typeof(GSsetGameCRC));
|
|
|
|
|
this.GSclose = (GSclose)Marshal.GetDelegateForFunctionPointer(funcaddrClose, typeof(GSclose));
|
|
|
|
|
this.GSshutdown = (GSshutdown)Marshal.GetDelegateForFunctionPointer(funcaddrShutdown, typeof(GSshutdown));
|
|
|
|
|
this.GSfreeze = (GSfreeze)Marshal.GetDelegateForFunctionPointer(funcaddrFreeze, typeof(GSfreeze));
|
|
|
|
|
this.GSreadFIFO2 = (GSreadFIFO2)Marshal.GetDelegateForFunctionPointer(funcaddrGSreadFIFO2, typeof(GSreadFIFO2));
|
|
|
|
|
this.GSinit = (GSinit)Marshal.GetDelegateForFunctionPointer(funcaddrinit, typeof(GSinit));
|
|
|
|
|
|
2010-03-04 14:54:20 +00:00
|
|
|
|
DLLAddr = hmod;
|
|
|
|
|
}
|
|
|
|
|
NativeMethods.SetErrorMode(0x0000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Unload()
|
|
|
|
|
{
|
|
|
|
|
NativeMethods.FreeLibrary(DLLAddr);
|
|
|
|
|
Loaded = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GSConfig()
|
|
|
|
|
{
|
|
|
|
|
if (!Loaded)
|
|
|
|
|
throw new Exception("GSDX is not loaded");
|
|
|
|
|
gsConfigure.Invoke();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String PSEGetLibName()
|
|
|
|
|
{
|
|
|
|
|
if (!Loaded)
|
|
|
|
|
throw new Exception("GSDX is not loaded");
|
|
|
|
|
return Marshal.PtrToStringAnsi(PsegetLibName.Invoke());
|
|
|
|
|
}
|
2010-12-19 14:41:11 +00:00
|
|
|
|
|
|
|
|
|
public unsafe void Run(GSDump dump, int rendererOverride)
|
|
|
|
|
{
|
2010-12-22 09:19:58 +00:00
|
|
|
|
QueueMessage = new Queue<TCPMessage>();
|
2010-12-19 14:41:11 +00:00
|
|
|
|
Running = true;
|
2010-12-22 09:19:58 +00:00
|
|
|
|
ExternalEvent = new AutoResetEvent(true);
|
2010-12-22 06:59:53 +00:00
|
|
|
|
|
2010-12-19 14:41:11 +00:00
|
|
|
|
GSinit();
|
|
|
|
|
fixed (byte* pointer = dump.Registers)
|
|
|
|
|
{
|
|
|
|
|
GSsetBaseMem(new IntPtr(pointer));
|
|
|
|
|
Int32 HWND = 0;
|
|
|
|
|
GSopen(new IntPtr(&HWND), "", rendererOverride);
|
|
|
|
|
GSsetGameCRC(dump.CRC, 0);
|
|
|
|
|
fixed (byte* freeze = dump.StateData)
|
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
byte[] GSFreez = new byte[8];
|
|
|
|
|
Array.Copy(BitConverter.GetBytes(dump.StateData.Length), 0, GSFreez, 0, 4);
|
|
|
|
|
Array.Copy(BitConverter.GetBytes(new IntPtr(freeze).ToInt32()), 0, GSFreez, 4, 4);
|
2010-12-19 14:41:11 +00:00
|
|
|
|
|
2010-12-21 07:29:33 +00:00
|
|
|
|
fixed (byte* fr = GSFreez)
|
2010-12-19 14:44:09 +00:00
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
int ris = GSfreeze(0, new IntPtr(fr));
|
|
|
|
|
if (ris == -1)
|
2010-12-19 14:41:11 +00:00
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
DumpTooOld = true;
|
|
|
|
|
return;
|
2010-12-19 14:41:11 +00:00
|
|
|
|
}
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSVSync(1);
|
|
|
|
|
|
|
|
|
|
while (Running)
|
2010-12-19 14:41:11 +00:00
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
if (!NativeMethods.IsWindowVisible(new IntPtr(HWND)))
|
|
|
|
|
{
|
|
|
|
|
Running = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2010-12-22 06:59:53 +00:00
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
for (int i = 0; i < dump.Data.Count; i++)
|
2010-12-21 07:29:33 +00:00
|
|
|
|
{
|
2010-12-22 09:19:58 +00:00
|
|
|
|
GSData itm = dump.Data[i];
|
2010-12-22 06:59:53 +00:00
|
|
|
|
CurrentGIFPacket = itm;
|
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
if (DebugMode)
|
|
|
|
|
{
|
|
|
|
|
if (RunTo != -1)
|
|
|
|
|
{
|
|
|
|
|
if (i == RunTo)
|
|
|
|
|
{
|
|
|
|
|
RunTo = -1;
|
|
|
|
|
|
2010-12-22 18:33:53 +00:00
|
|
|
|
GSData g = new GSData();
|
|
|
|
|
g.id = GSType.VSync;
|
|
|
|
|
g.data = new byte[1];
|
|
|
|
|
g.data[0] = 0;
|
|
|
|
|
Step(g, pointer);
|
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
TCPMessage Msg = new TCPMessage();
|
|
|
|
|
Msg.MessageType = MessageType.RunToCursor;
|
|
|
|
|
Msg.Parameters.Add(i);
|
|
|
|
|
Program.Client.Send(Msg);
|
|
|
|
|
|
|
|
|
|
ExternalEvent.Set();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Step(itm, pointer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
while (!ThereIsWork && Running)
|
|
|
|
|
{
|
|
|
|
|
NativeMessage message;
|
|
|
|
|
while (NativeMethods.PeekMessage(out message, IntPtr.Zero, 0, 0, 1))
|
|
|
|
|
{
|
|
|
|
|
if (!NativeMethods.IsWindowVisible(new IntPtr(HWND)))
|
|
|
|
|
{
|
|
|
|
|
Running = false;
|
|
|
|
|
}
|
|
|
|
|
NativeMethods.TranslateMessage(ref message);
|
|
|
|
|
NativeMethods.DispatchMessage(ref message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThereIsWork = false;
|
|
|
|
|
if (QueueMessage.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
TCPMessage Mess = QueueMessage.Dequeue();
|
|
|
|
|
if (Mess.MessageType == MessageType.Step)
|
|
|
|
|
{
|
|
|
|
|
Step(itm, pointer);
|
|
|
|
|
|
2010-12-22 18:33:53 +00:00
|
|
|
|
GSData g = new GSData();
|
|
|
|
|
g.id = GSType.VSync;
|
|
|
|
|
g.data = new byte[1];
|
|
|
|
|
g.data[0] = 0;
|
|
|
|
|
Step(g, pointer);
|
|
|
|
|
|
2010-12-22 09:19:58 +00:00
|
|
|
|
TCPMessage Msg = new TCPMessage();
|
|
|
|
|
Msg.MessageType = MessageType.Step;
|
|
|
|
|
Msg.Parameters.Add(i);
|
|
|
|
|
Program.Client.Send(Msg);
|
|
|
|
|
|
|
|
|
|
ExternalEvent.Set();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (Mess.MessageType == MessageType.RunToCursor)
|
|
|
|
|
{
|
|
|
|
|
RunTo = (int)Mess.Parameters[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Step(itm, pointer);
|
|
|
|
|
}
|
2010-12-21 07:29:33 +00:00
|
|
|
|
}
|
2010-12-19 14:41:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSclose();
|
|
|
|
|
GSshutdown();
|
|
|
|
|
}
|
2010-12-19 14:41:11 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 15:55:52 +00:00
|
|
|
|
private unsafe void Step(GSData itm, byte* registers)
|
|
|
|
|
{
|
2010-12-19 21:32:09 +00:00
|
|
|
|
/*"C:\Users\Alessio\Desktop\Plugins\Dll\gsdx-sse4-r3878.dll" "C:\Users\Alessio\Desktop\Plugins\Dumps\gsdx_20101219182059.gs" "GSReplay" 0*/
|
2010-12-19 15:55:52 +00:00
|
|
|
|
switch (itm.id)
|
|
|
|
|
{
|
|
|
|
|
case GSType.Transfer:
|
2010-12-20 16:28:59 +00:00
|
|
|
|
switch (((GSTransfer)itm).Path)
|
2010-12-19 21:32:09 +00:00
|
|
|
|
{
|
2010-12-20 16:28:59 +00:00
|
|
|
|
case GSTransferPath.Path1Old:
|
2010-12-21 07:29:33 +00:00
|
|
|
|
byte[] data = new byte[16384];
|
|
|
|
|
int addr = 16384 - itm.data.Length;
|
|
|
|
|
Array.Copy(itm.data, 0, data, addr, itm.data.Length);
|
|
|
|
|
fixed (byte* gifdata = data)
|
2010-12-19 21:32:09 +00:00
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSgifTransfer1(new IntPtr(gifdata), addr);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
2010-12-19 21:32:09 +00:00
|
|
|
|
break;
|
2010-12-20 16:28:59 +00:00
|
|
|
|
case GSTransferPath.Path2:
|
2010-12-19 15:55:52 +00:00
|
|
|
|
fixed (byte* gifdata = itm.data)
|
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSgifTransfer2(new IntPtr(gifdata), (itm.data.Length) / 16);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
2010-12-19 21:32:09 +00:00
|
|
|
|
break;
|
2010-12-20 16:28:59 +00:00
|
|
|
|
case GSTransferPath.Path3:
|
2010-12-19 15:55:52 +00:00
|
|
|
|
fixed (byte* gifdata = itm.data)
|
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSgifTransfer3(new IntPtr(gifdata), (itm.data.Length) / 16);
|
2010-12-19 21:32:09 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2010-12-20 16:28:59 +00:00
|
|
|
|
case GSTransferPath.Path1New:
|
2010-12-19 21:32:09 +00:00
|
|
|
|
fixed (byte* gifdata = itm.data)
|
|
|
|
|
{
|
2010-12-21 07:29:33 +00:00
|
|
|
|
GSgifTransfer(new IntPtr(gifdata), (itm.data.Length) / 16);
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
2010-12-19 21:32:09 +00:00
|
|
|
|
break;
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GSType.VSync:
|
|
|
|
|
GSVSync(itm.data[0]);
|
|
|
|
|
break;
|
|
|
|
|
case GSType.ReadFIFO2:
|
|
|
|
|
fixed (byte* FIFO = itm.data)
|
|
|
|
|
{
|
2010-12-19 21:32:09 +00:00
|
|
|
|
byte[] arrnew = new byte[*((int*)FIFO)];
|
|
|
|
|
fixed (byte* arrn = arrnew)
|
|
|
|
|
{
|
|
|
|
|
GSreadFIFO2(new IntPtr(arrn), *((int*)FIFO));
|
|
|
|
|
}
|
2010-12-19 15:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GSType.Registers:
|
|
|
|
|
Marshal.Copy(itm.data, 0, new IntPtr(registers), 8192);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-19 14:41:11 +00:00
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
Running = false;
|
|
|
|
|
}
|
2010-12-22 06:59:53 +00:00
|
|
|
|
|
|
|
|
|
internal List<Object> GetGifPackets(GSDump dump)
|
|
|
|
|
{
|
|
|
|
|
List<Object> Data = new List<Object>();
|
|
|
|
|
for (int i = 0; i < dump.Data.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
String act = i.ToString() + "|";
|
|
|
|
|
act += dump.Data[i].id.ToString() + "|";
|
|
|
|
|
if (dump.Data[i].GetType().IsSubclassOf(typeof(GSData)))
|
|
|
|
|
{
|
|
|
|
|
act += ((GSTransfer)dump.Data[i]).Path.ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Data.Add(act);
|
|
|
|
|
}
|
|
|
|
|
return Data;
|
|
|
|
|
}
|
2010-03-04 14:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|