I've been trying to get an old game working and think I have found the issue. In the code below It shows "IntPtr" and "IntPtr2". I think the first IntPtr containing Settings.Default.XTrapArgKey
needs to be somehow bypassed or disabled so the game can launch without having to download XTrap.
Now I have got no clue on how to do this or how to make it ignore that line of code as removing it will give me 100s of errors. Any help?
private unsafe void DoStartGame()
{
string text = Environment.CurrentDirectory + Program.SClientName;
try
{
btnStartEnable = true;
btnFileCheckEnable = false;
btnInitEnable = false;
IntPtr intPtr = Marshal.StringToHGlobalAnsi(Settings.Default.XTrapArgKey);
string s = Environment.CurrentDirectory + "\\Binaries\\Win32\\";
IntPtr intPtr2 = Marshal.StringToHGlobalAnsi(s);
Launcher.PatchC((sbyte*)(void*)intPtr, (sbyte*)(void*)intPtr2, 60u, 1u);
if (IntPtr.Zero != intPtr2)
{
Marshal.FreeHGlobal(intPtr2);
}
if (IntPtr.Zero != intPtr)
{
Marshal.FreeHGlobal(intPtr);
}
Process.Start(text, $"/VER:{FVersion.CurVersion}");
Close();
}
catch (Exception ex)
{
btnStartEnable = true;
btnFileCheckEnable = true;
btnInitEnable = true;
FLogWrite(ELogType.ERROR, "[PATCH] Client program execution failed.\r\nFile: {0}\r\nError: {1}", text, ex.Message);
MessageBox.Show("Client program execution failed.\nError: " + ex.Message, Program.SMessageTitle, MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
EDIT: Removing part of code worked, now game process launches but doesn't do anything. I've tried the adding the following code but this just acts as if I double clicked the game executable which gives me the popup "please launch through dekstop shortcut" which is the launcher.
ProcessStartInfo renaissanceHeroesInfo = new ProcessStartInfo();
renaissanceHeroesInfo.FileName = (@"E:\Steam\steamapps\common\Renaissance Heroes\Binaries\Win32\DVGame.exe");
renaissanceHeroesInfo.WorkingDirectory = Path.GetDirectoryName(@"E:\Steam\steamapps\common\Renaissance Heroes\Binaries\Win32\DVGame.exe");
Process DVGame = Process.Start(renaissanceHeroesInfo);