// basically only for music system static void DirectFileConvert(RegisterMemory mem) { zString zStr = new zString(mem.GetArg(0)); StringBuilder sb = new StringBuilder(zStr.ToString()); if (sb.Length > 0) { if (sb.ToString().StartsWith(Program.GothicRootPath, StringComparison.OrdinalIgnoreCase)) { sb.Remove(0, Program.GothicRootPath.Length); } if (sb[0] != '\\') { sb.Insert(0, '\\'); } sb.Insert(0, Program.ProjectPath); string path = sb.ToString(); if (Directory.Exists(path)) { zStr.Set(path); } } }
static void VDFS_Open(Hook hook, RegisterMemory mem) { zString path = new zString(mem[Registers.EAX]); string pathStr = path.ToString(); if (pathStr.EndsWith("CAMERA.DAT")) // f**k this { path.Set(@"_WORK\DATA\SCRIPTS\_COMPILED\CAMERA.DAT"); } // check if it exists in vdfs int filePtr = mem[Registers.ESI]; if (Process.THISCALL <BoolArg>(filePtr, 0x449020) && Process.ReadInt(filePtr + 0x2A00) == VDF_VIRTUAL) { return; } // check if it's in the project's folder string projectPath = GetProjectFilePath(pathStr); if (File.Exists(projectPath)) { path.Set(projectPath); } }
static void hook_LoadDat(Hook hook, RegisterMemory rmem) { try { zString str = new zString(rmem[0]); string datName = str.ToString().Trim().ToUpper(); Logger.Log("Hook loaddat: " + datName); if (datName == "GOTHIC.DAT" || datName == "FIGHT.DAT" || datName == "MENU.DAT") { if (datName == "GOTHIC.DAT") { initDefaultScripts(); } Process.Write(hook.OldInNewAddress, 0x33, 0xC0, 0xC2, 0x04, 0x00, 0x00, 0x00); // block it Logger.Log("LoadDat: '{0}', blocked!", str); } else { hook.RestoreOldInNewCode(); // unblock it Logger.Log("LoadDat: '{0}'", str); } } catch (Exception ex) { Logger.LogError(ex); } }
static void DirectFileConvert(Hook hook, RegisterMemory mem) { zString fileName = new zString(mem[0]); string projPath = GetProjectFilePath(fileName.ToString()); if (Directory.Exists(projPath)) { fileName.Set(projPath); } }
public String GetVisualName() { int str = Process.Alloc(20).ToInt32(); IntArg arg = Process.THISCALL <IntArg>(Address, FuncAddresses.GetVisualName, new IntArg(str)); zString zString = new zString(arg.Value); String v = null; if (zString.Length < 500) { v = zString.ToString().Trim(); } zString.Dispose(); return(v); }