public static void SetUpHooks() { if (hooked) { return; } hooked = true; // first, kick out the original splash screen completely: // remove creation of the splash screen // copy important code to the top Process.Write(0x004267F1, 0x8B, 0xE9, 0xC7, 0x05, 0xD4, 0xDC, 0x8C, 0x00, 0x30, 0x5F, 0x42, 0x00, 0x33, 0xFF); // jmp over everything else Process.Write(0x004267FF, 0xEB, 0x28); Process.Write(0x426868, 0x83, 0xC4, 0x04); // add esp, 4 (original code) Process.Nop(0x42686B, 20); // NOP everything else Process.AddHook(RemoveSplashScreen, 0x42686B, 5); // add hook to remove our splash screen Logger.Log("Gothic-SplashScreen hooked."); }
public static void AddHooks() { Process.AddHook(BeginInit, 0x44AFD3, 7); Process.AddHook(EndInit, 0x44AFE2, 5); Process.AddHook(VDFS_Open, 0x44920F, 5); // open Process.AddHook(VDFS_Exists, 0x44909B, 6); // Exists var h = Process.AddHook(File_Open, 0x7D2010, 6); // fopen Process.Write(h.OldInNewAddress, (byte)0xC3); h = Process.AddHook(File_Exists, 0x7D197A, 0xA); // fexists h.SetSkipOldCode(true); Process.Write(0x44AEDF, 0xE9, 0x8C, 0x00, 0x00, 0x00); // skip visual vdfs init (vdfs32g.exe) Process.Write(0x00470846, 0xE9, 0x96, 0x02, 0x00, 0x00); // skip forced vdfs intialization Process.AddHook(File_FindFirst, 0x7D2517, 0xA); Process.AddHook(File_FindNext, 0x7D25E3, 0xA); Process.AddHook(File_FindClose, 0x7D269B, 0xA); Process.AddHook(DirectFileConvert, 0x442390, 0x6); Logger.Log("Added new file system hooks."); }
static void SetupProject() { _GothicPath = Environment.GetEnvironmentVariable("GUCGothicPath").ToUpperInvariant(); if (string.IsNullOrWhiteSpace(_GothicPath) || !Directory.Exists(_GothicPath)) { throw new Exception("Gothic folder environment variable is null or not found!"); } Process.AddHook(SetRootPathHook, 0x44235E, 7); Process.AddHook(SetRootPathHook, 0x44237A, 7); _GothicRootPath = Path.Combine(_GothicPath, "SYSTEM").ToUpperInvariant(); _ProjectPath = Environment.GetEnvironmentVariable("GUCProjectPath").ToUpperInvariant(); if (string.IsNullOrWhiteSpace(_ProjectPath) || !Directory.Exists(_ProjectPath)) { throw new Exception("Project folder environment variable is null or not found!"); } _ServerIP = Environment.GetEnvironmentVariable("GUCServerIP"); if (string.IsNullOrWhiteSpace(_ServerIP)) { throw new Exception("Server IP environment variable is null or white space!"); } if (!ushort.TryParse(Environment.GetEnvironmentVariable("GUCServerPort"), out _ServerPort)) { throw new Exception("Could not parse server port environment variable to ushort!"); } _Password = Environment.GetEnvironmentVariable("GUCServerPassword"); if (string.IsNullOrWhiteSpace(_Password)) { _Password = null; } AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; const string iniString = "SYSTEM\\GOTHIC.INI"; string destIni = Path.Combine(ProjectPath, iniString); if (!File.Exists(destIni)) { string srcIni = Path.Combine(GothicPath, iniString); if (File.Exists(srcIni)) { Directory.CreateDirectory(Path.GetDirectoryName(destIni)); File.Copy(srcIni, destIni); } } }
public static void AddHooks() { if (inited) { return; } inited = true; // hook hero creating Process.Write(0x006C434B, 0xE9, 0xBD, 0x00, 0x00, 0x00); Process.AddHook(CreatePlayerVob, 0x006C440D, 5).SetSkipOldCode(true); Process.Write(0x006C4662, 0xEB, 0x67); //skip instance check Logger.Log("Added player hero creation hooks."); }
public static void AddHooks() { if (inited) { return; } inited = true; Process.AddHook(hook_LoadDat, 0x0078E900, 7); var h = Process.AddHook(hook_LoadParserFile, 0x006C4BE0, 6); Process.Write(h.OldInNewAddress, 0x33, 0xC0, 0xC2, 0x04, 0x00, 0x00); // block it Logger.Log("Added parser hooks."); }