mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
Committed the first revision of the new GSDX Dump Viewer. At the moment it contains the PThreads dll inside the build process and output to the bin directory of the tools directory till I know for sure I can output the exe directly into pcsx2 bin directory. :P Report here or on the issue tracker any bug you find. (in this application) :P git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2652 96395faa-99c1-11dd-bbfe-3dabce05a288
73 lines
2.7 KiB
C#
73 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using Specialized = System.Collections.Specialized;
|
|
using Reflection = System.Reflection;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
using System.Diagnostics;
|
|
|
|
namespace GSDumpGUI
|
|
{
|
|
static class Program
|
|
{
|
|
static public GSDumpGUI frmMain;
|
|
|
|
[STAThread]
|
|
static void Main(String[] args)
|
|
{
|
|
if (args.Length == 3)
|
|
{
|
|
Thread thd = new Thread(new ThreadStart(delegate
|
|
{
|
|
while (true)
|
|
{
|
|
Int32 tmp = NativeMethods.GetAsyncKeyState(0x1b) & 0xf;
|
|
if (tmp != 0)
|
|
Process.GetCurrentProcess().Kill();
|
|
Thread.Sleep(16);
|
|
}
|
|
}));
|
|
thd.IsBackground = true;
|
|
thd.Start();
|
|
|
|
// Retrieve parameters
|
|
String DLLPath = args[0];
|
|
String DumpPath = args[1];
|
|
String Operation = args[2];
|
|
|
|
// Try to load the DLL in memory
|
|
IntPtr hmod = NativeMethods.LoadLibrary(DLLPath);
|
|
if (hmod.ToInt64() > 0)
|
|
{
|
|
// Search if the DLL has the requested operation
|
|
IntPtr funcaddr = NativeMethods.GetProcAddress(hmod, Operation);
|
|
if (funcaddr.ToInt64() > 0)
|
|
{
|
|
// Execute the appropriate function pointer by casting it to a delegate.
|
|
if (Operation == "GSReplay")
|
|
{
|
|
GSDXImport.GSReplay dg = (GSDXImport.GSReplay)Marshal.GetDelegateForFunctionPointer(funcaddr, typeof(GSDXImport.GSReplay));
|
|
dg.Invoke(new IntPtr(0), new IntPtr(0), DumpPath, false);
|
|
}
|
|
else
|
|
{
|
|
GSDXImport.GSConfigure dg = (GSDXImport.GSConfigure)Marshal.GetDelegateForFunctionPointer(funcaddr, typeof(GSDXImport.GSConfigure));
|
|
dg.Invoke();
|
|
}
|
|
}
|
|
// Unload the library.
|
|
NativeMethods.FreeLibrary(hmod);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
frmMain = new GSDumpGUI();
|
|
Application.Run(frmMain);
|
|
}
|
|
}
|
|
}
|
|
}
|