static void UpdateContent(int processPointer, byte[] dialogueMemory, uint memoryPointer, ref string content) { var newLines = GetContent(processPointer, dialogueMemory, memoryPointer); var newContent = String.Join("\n", newLines.Item2); if (newContent != content) { byte[] nearby = new byte[2048]; MemoryUtil.Fill(processPointer, nearby, memoryPointer - 512); File.WriteAllBytes("ed6_tmp.txt", nearby); //var search = MemoryUtil.Search(processPointer, query, 0x3000000, startIndex: memoryPointer); var search = MemoryUtil.Search(processPointer, query, 0x3000000, startIndex: memoryPointer); var fileIndex = 1; while (search != 0) { MemoryUtil.Fill(processPointer, nearby, search - 64); File.WriteAllBytes("ed6_tmp" + fileIndex + ".txt", nearby); //search = MemoryUtil.Search(processPointer, query, 0x3000000, startIndex: search + 64); search = MemoryUtil.Search(processPointer, query, 0x3000000, startIndex: search + 64); fileIndex++; } content = newContent; var outputContent = content; var stringBytes = Encoding.UTF8.GetBytes(outputContent); if (stringBytes.Length >= 2 && stringBytes[0] == 7) { //Console.WriteLine(Encoding.UTF8.GetBytes(content).ToByteString()); //outputContent = outputContent.Substring(2, outputContent.Length - 2); outputContent = Encoding.UTF8.GetString(stringBytes.SubArray(2, stringBytes.Length - 2)); // outputContent.Substring(3); } //Console.WriteLine(outputContent); //Console.WriteLine(Encoding.UTF8.GetBytes(content).ToByteString()); //Console.WriteLine(Encoding.UTF8.GetBytes(outputContent).ToByteString()); //Request.MakeRequest("http://localhost:1414/new-text?text=", "〜" + newLines.Item1 + "〜"); foreach (var line in newLines.Item2) { var outline = StripPrefix(line); var lineBytes = Encoding.UTF8.GetBytes(outline); if (lineBytes.Length >= 2 && stringBytes[0] == 7) { outline = Encoding.UTF8.GetString(stringBytes.SubArray(2, stringBytes.Length - 2)); } //Console.WriteLine("l:" + outline); Console.WriteLine(lineBytes.ToByteString()); File.WriteAllText("out_text.txt", outline); var requestText = CleanForRequest(outline); if (requestText != "\n" && requestText != "") { Request.MakeRequest("http://localhost:1414/new-text?text=", requestText); } } } }
public static uint SearchDialogueStart(int processPointer) { //var search = MemoryUtil.Search(processPointer, query, 0x3000000, startIndex: 0x1180000); var search = MemoryUtil.Search(processPointer, query, 0x4000000, startIndex: 0x2A00000); MemoryUtil.Fill(processPointer, shortBuffer, search + 146); if (!ByteUtil.ByteCompare(isSpokenDialogueQuery, shortBuffer, 0)) { search = MemoryUtil.Search(processPointer, query, 0x4000000, startIndex: search + 302); MemoryUtil.Fill(processPointer, shortBuffer, search + 146); } Console.WriteLine("code: " + shortBuffer.ToByteString()); if (search != 0) { return(search + 302); } else { return(0); } }