Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2.1k stars 203 forks source link

PlaMemo - Extracting text with some characters missing #808

Open hiroshiyuri opened 2 years ago

hiroshiyuri commented 2 years ago

Hi!

I'm testing Textractor 5.2.0 with PlaMemo PC. 🎮🙂

You can get the VN here: Plastic Memories - Subreddit

Maybe it's using the KiriKiri game engine for the scenario. I don't know much about him.

I read this in the FAQ - About the text with some characters missing

But I noticed that when I hide and show the text box the text is completely extracted.

Show text box: Screenshot_test1 Hide text box: Screenshot_test2 Show text box: Screenshot_test3

Question: Is possible add a time sleep with some milliseconds before read the text from hook? (I suspect this is the root of the issue. 🤔)

Thanks for you help.

hiroshiyuri commented 2 years ago

Screenshot_DueTime

https://github.com/Artikash/Textractor/blob/f732f488e644f3508e925049318c9c3f261ec177/host/textthread.cpp#L25

I changed DueTime to 3 seconds but it isn't worked. Three seconds is very long, I know.

I'm investigating. 🧐

hiroshiyuri commented 2 years ago

I wrote this small console app using C# to create the "TEXTRACTOR_HOOK" pipe connection and write a txt file with all data received and then to do a debugging.

using System;
using System.IO;
using System.IO.Pipes;
using System.Text;

namespace PipeStreamExample
{
    internal class Program
    {
        static void Main()
        {
            string HOOK_PIPE = "TEXTRACTOR_HOOK";

            NamedPipeServerStream server = new NamedPipeServerStream(
                HOOK_PIPE,
                PipeDirection.In,
                NamedPipeServerStream.MaxAllowedServerInstances,
                PipeTransmissionMode.Byte
            );

            Console.WriteLine("Wait for connection...");
            server.WaitForConnection();
            Console.WriteLine("Writing file...");

            using (StreamReader sReader = new StreamReader(server))
            {
                StreamWriter file = new StreamWriter(
                    @"C:\Users\Administrator\Desktop\PlaMemo\test_pipe.txt"
                );

                byte[] buffer = new byte[256];

                while (server.Read(buffer, 0, buffer.Length) != 0)
                {
                    var serverMsg = Encoding.Unicode.GetString(buffer, 0, buffer.Length);
                    file.WriteLine(serverMsg);
                }

                file.Close();
            }

            server.Close();
            Console.ReadLine();
        }
    }
}

After a debugging I identified that this issue isn't in the hook reading but in the injection.

I'm investigating. 🧐

hiroshiyuri commented 2 years ago

screenshot-cheat-engine

screenshot-x32dbg

How to find what the next memory address will be written or who is doing the writing?

It's brain surgery 👨‍💻

hiroshiyuri commented 2 years ago

AGTH works without truncate the text. 🙂

Just put agth.exe and agth.dll in the same folder as the game exe and run agth.exe /NH /HWN-20*0@402D50 "Plastic Memories.exe" with the game closed. Use the Command Prompt, not PowerShell.

screenshot-agth-it-works

I created a batch script:

@echo off
start "" agth.exe /NH /HWN-20*0@402D50 "Plastic Memories.exe"

Thanks to @Double Eyepatch from Discord Server https://discord.gg/Xr24uv4W

But I'll continue investigating that for Textractor. 🔎