static void Main(String[] args) { if (args.Length == 4) { Thread thd = new Thread(new ThreadStart(delegate { while (true) { if (ChangeIcon) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } 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]; Int32 Renderer = Convert.ToInt32(args[3]); GSDXWrapper wrap = new GSDXWrapper(); wrap.Load(DLLPath); if (Operation == "GSReplay") { ChangeIcon = true; if (Renderer != -1) wrap.GSReplayDump(Renderer + " " + DumpPath); else wrap.GSReplayDump(DumpPath); } else wrap.GSConfig(); wrap.Unload(); } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); } }
public void ReloadGSDXs() { txtIntLog.Text += "Starting GSDX Loading Procedures" + Environment.NewLine + Environment.NewLine; txtGSDXDirectory.Text = Properties.Settings.Default.GSDXDir; txtDumpsDirectory.Text = Properties.Settings.Default.DumpDir; lstGSDX.Items.Clear(); lstDumps.Items.Clear(); if (Directory.Exists(txtGSDXDirectory.Text)) { String[] File = Directory.GetFiles(txtGSDXDirectory.Text, "*.dll", SearchOption.TopDirectoryOnly); GSDXWrapper wrap = new GSDXWrapper(); foreach (var itm in File) { try { wrap.Load(itm); lstGSDX.Items.Add(Path.GetFileName(itm) + " | " + wrap.PSEGetLibName()); txtIntLog.Text += "\"" + itm + "\" correctly identified as " + wrap.PSEGetLibName() + Environment.NewLine; wrap.Unload(); } catch (InvalidGSPlugin) { txtIntLog.Text += "Failed to load \"" + itm + "\". Is it really a GSDX DLL?" + Environment.NewLine; } } } txtIntLog.Text += Environment.NewLine + "Completed GSDX Loading Procedures" + Environment.NewLine + Environment.NewLine; txtIntLog.Text += "Starting GSDX Dumps Loading Procedures : " + Environment.NewLine + Environment.NewLine; if (Directory.Exists(txtDumpsDirectory.Text)) { String[] Dumps = Directory.GetFiles(txtDumpsDirectory.Text, "*.gs", SearchOption.TopDirectoryOnly); foreach (var itm in Dumps) { BinaryReader br = new BinaryReader(System.IO.File.Open(itm, FileMode.Open)); Int32 CRC = br.ReadInt32(); br.Close(); lstDumps.Items.Add(Path.GetFileName(itm) + " | CRC : " + CRC.ToString("X")); txtIntLog.Text += "Identified Dump for game (" + CRC.ToString("X") + ") with filename \"" + itm + "\"" + Environment.NewLine; } } txtIntLog.Text += Environment.NewLine + "Completed GSDX Dumps Loading Procedures : " + Environment.NewLine + Environment.NewLine; txtIntLog.SelectionStart = txtIntLog.TextLength; txtIntLog.ScrollToCaret(); }
static void Main(String[] args) { if (args.Length == 5) { // do this first, else racy mess ;) wrap = new GSDXWrapper(); var port = Convert.ToInt32(args[4]); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", port); } catch (Exception) { Client = null; } Thread thd = new Thread(new ThreadStart(delegate { while (true) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (ChangeIcon) { if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } 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]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); ChangeIcon = true; } else { wrap.GSConfig(); } wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) { Client.Disconnect(); } } else { Clients = new List <TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); Server.Enabled = false; } }
static void Main(String[] args) { if (args.Length == 5) { hMainIcon = Resources.AppIcon.Handle; // do this first, else racy mess ;) wrap = new GSDXWrapper(); var port = Convert.ToInt32(args[4]); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", port); } catch (Exception) { Client = null; } // Retrieve parameters String DLLPath = args[0]; String DumpPath = args[1]; String Operation = args[2]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); } else { wrap.GSConfig(); } wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) { Client.Disconnect(); } } else { Clients = new List <TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (frmMain = new GSDumpGUI()) { Application.Run(frmMain); } Server.Enabled = false; } }
public void ReloadGSDXs() { txtGSDXDirectory.Text = Properties.Settings.Default.GSDXDir; txtDumpsDirectory.Text = Properties.Settings.Default.DumpDir; lstGSDX.Items.Clear(); lstDumps.Items.Clear(); if (Directory.Exists(txtGSDXDirectory.Text)) { String[] File = Directory.GetFiles(txtGSDXDirectory.Text, "*.dll", SearchOption.TopDirectoryOnly); GSDXWrapper wrap = new GSDXWrapper(); foreach (var itm in File) { if (GSDXWrapper.IsValidGSDX(itm)) { wrap.Load(itm); lstGSDX.Items.Add(Path.GetFileName(itm) + " | " + wrap.PSEGetLibName()); wrap.Unload(); } } String[] Dumps = Directory.GetFiles(txtDumpsDirectory.Text, "*.gs", SearchOption.TopDirectoryOnly); foreach (var itm in Dumps) { BinaryReader br = new BinaryReader(System.IO.File.Open(itm, FileMode.Open)); Int32 CRC = br.ReadInt32(); br.Close(); lstDumps.Items.Add(Path.GetFileName(itm) + " | CRC : " + CRC.ToString("X")); } } }
static void Main(String[] args) { if (args.Length == 4) { // do this first, else racy mess ;) wrap = new GSDXWrapper(); try { Client = new TCPLibrary.MessageBased.Core.BaseMessageClient(); Client.OnMessageReceived += new TCPLibrary.MessageBased.Core.BaseMessageClient.MessageReceivedHandler(Client_OnMessageReceived); Client.Connect("localhost", 9999); } catch (Exception) { Client = null; } Thread thd = new Thread(new ThreadStart(delegate { while (true) { IntPtr pt = Process.GetCurrentProcess().MainWindowHandle; if (ChangeIcon) { if (pt.ToInt64() != 0) { NativeMethods.SetClassLong(pt, -14, Resources.AppIcon.Handle.ToInt64()); ChangeIcon = false; } } 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]; Int32 Renderer = Convert.ToInt32(args[3]); wrap.Load(DLLPath); Directory.SetCurrentDirectory(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory + "GSDumpGSDXConfigs\\" + Path.GetFileName(DLLPath) + "\\")); if (Operation == "GSReplay") { dump = GSDump.LoadDump(DumpPath); if (Client != null) { SendStatistics(); SendDumpSize(); } wrap.Run(dump, Renderer); ChangeIcon = true; } else wrap.GSConfig(); wrap.Unload(); if (GSDXWrapper.DumpTooOld) { if (Client != null) { TCPMessage msg = new TCPMessage(); msg.MessageType = MessageType.StateOld; Client.Send(msg); } } if (Client != null) Client.Disconnect(); } else { Clients = new List<TCPLibrary.MessageBased.Core.BaseMessageClientS>(); Server = new TCPLibrary.MessageBased.Core.BaseMessageServer(); Server.OnClientMessageReceived += new BaseMessageServer.MessageReceivedHandler(Server_OnClientMessageReceived); Server.OnClientAfterConnect += new TCPLibrary.Core.Server.ConnectedHandler(Server_OnClientAfterConnect); Server.OnClientAfterDisconnected += new TCPLibrary.Core.Server.DisconnectedHandler(Server_OnClientAfterDisconnected); Server.Port = 9999; Server.Enabled = true; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmMain = new GSDumpGUI(); Application.Run(frmMain); Server.Enabled = false; } }