Artikash / Textractor

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

LunaHook: The next generation of visual novel text hooker #1252

Open HIllya51 opened 4 months ago

HIllya51 commented 4 months ago

I have created a next generation of visual novel text hooker which is called LunaHook (Download). (AGTH->ITH->vnrhook->ITHVNR->Textractor->LunaHook)

1.Textractor has not been officially maintained for a long time, with numerous errors and inability to support the latest games in a timely manner 2.Almost all of Textractor's code is concentrated on one engine/engine.cc file, making it difficult to maintain 3.Textractor does not support Windows XP

Therefore, I spent over half a year refactoring a large amount of code, creating a new generation of text hooker. Compared to Textractor, it has the following advantages:

1.Providing additional support for hundreds of games compared to Textractor and it will support the latest games every month at the fastest speed possible 2.Almost perfect support for Unity/Renpy/Tyrano Engine. 3.Supports Windows XP 4.Provides DLL/CLI for other programs to call conveniently 5.Compatible with all Textractor plugins 6.For some game engines, it even supports embedding translations into the game

Additionally, if your operating system is Windows 7 or above, I would recommend you to use LunaTranslator (Download). LunaTranslator not only supports using LunaHook to hook text, but also supports the use of OCR (including built-in OCR models, as well as tesseract and Windows OCR). And it supports over 40 different online translation APIs as well as many offline language model APIs.

askrates commented 4 months ago

Great initiative, however the Lunahook is flagged by Windows Defender as a virus with severe rating...

Screenshot 2024-03-03 110921
HIllya51 commented 4 months ago

Great initiative, however the Lunahook is flagged by Windows Defender as a virus with severe rating...

It may be caused by using an older compiler to support windows xp, and programs that can run on windows xp are especially easy to identify as viruses. You can clone the source code and try to compile it on your own to try it out, the program doesn't need to rely on external libraries such as Qt, it only needs vs2017-vs2022 to compile.

rampaa commented 3 months ago

Hey, thanks for your hard work!

Providing additional support for hundreds of games compared to Textractor

Any concrete examples as to what games/engines it supports that Textractor doesn't support (with https://github.com/Artikash/Textractor/issues/868#issuecomment-1249146885)?

I've given LunaHook a short try and here are some of my observations:

As is, LunaHook seems to offer less functionality compared to Textractor instead of more (or I am dumb and can't find some of the functionalities that are already there, which is quite possible). Will those missing functionalities be added in the future versions of LuneHook or were they removed intentionally?

HIllya51 commented 3 months ago

Hey, thanks for your hard work!

Providing additional support for hundreds of games compared to Textractor

Any concrete examples as to what games/engines it supports that Textractor doesn't support (with #868 (comment))?

I've given LunaHook a short try and here are some of my observations:

  • It doesn't seem to be able to auto-attach itself to the games with the last selected/saved hook.
  • It doesn't seem to allow us to manually search for hooks (w/ or w/o specific text search).
  • InsertHook functionality does not seem to work as expected. To try out LunaHook I've used it with Kinkoi and found the hook I'm happy with and right clicked and copied it with the CopyHookCode button (for the records, it was EXHQFX0@18775538) and removed all the hooks found (including EXHQFX0@18775538) with the RemoveHook button. After that I've tried to re-add the aforementioned hook but LunaHook complained that it's an "Invalid HookCode".
  • LunaHook seems to have fewer settings. e.g., Textractor lets us change the max buffer/history size etc., LunaHook does not.
  • If I am not mistaken, to clipboard takes effect before plugins so it cannot be meaningfully used with Regex filter plugin etc. It seems like we need to disable the to clipboard setting and add a Textractor plugin like Copy to Clipboard to apply regex and then copy it to clipboard. If that's the case, instead of adding a setting like to clipboard, wouldn't it be more convenient/less confusing if LuneHook came preinstalled with the Copy to Clipboard plugin?

As is, LunaHook seems to offer less functionality compared to Textractor instead of more (or I am dumb and can't find some of the functionalities that are already there, which is quite possible). Will those missing functionalities be added in the future versions of LuneHook or were they removed intentionally?

A simple example is Unity/TyranoScript/RPGMaker, LuneHook provides perfect support for these engines. Compared to # 868, LuneHook not only combines all hooks(about 100) from # 868 , but also adds more than 200 additional hooks, and some hooks of # 868 are also based on my implementation. The HookCode which contains "X" is not ordinary hooks, it contains special text extraction methods and cannot be simply inserted. And for Textractor it's also Invalid if HookCode contains "X". In fact, LunaHook is just a "core", a "text hooker". Initially, this program did not even provide a GUI, and the reason for providing this GUI was only because I wanted to support games on Windows XP. Therefore, I developed this GUI using the pure WIN32 API to support Windows XP. Actually I don't recommend using LunaHook directly in daily life, but rather using "LunaTranslator". LunaTranslator includes all the features you mentioned (e.g. clipboard/hook-search/regex/auto-attach), as well as various improvements brought by 500+issues over the past year and a half, which offers much more and richer functionality compared to Textractor. I only want LunaHook as a low-level core rather than a more complex upper level application. And then I develop LunaTranslator based on this core.

HIllya51 commented 3 months ago
  • If I am not mistaken, to clipboard takes effect before plugins so it cannot be meaningfully used with Regex filter plugin etc. It seems like we need to disable the to clipboard setting and add a Textractor plugin like Copy to Clipboard to apply regex and then copy it to clipboard. If that's the case, instead of adding a setting like to clipboard, wouldn't it be more convenient/less confusing if LuneHook came preinstalled with the Copy to Clipboard plugin?

It's a small bug that I add the "InternalClipBoard" at the first. I have move it to end in new version.

rampaa commented 3 months ago

but also adds more than 200 additional hooks

Are those hooks mainly for Unity/TyranoScript/RPGMaker as well?

The HookCode which contains "X" is not ordinary hooks

Oh, right, sorry. I was just confused when LunaHook called it an invalid hook even though I copied it with the CopyHookCode button.

I only want LunaHook as a low-level core rather than a more complex upper level application.

That's a pity. I personally don't need or want a translator, and to look up words I just use JL so I am not interested in LunaTranslator. I am, however, interested in an alternative to Textractor that is maintained. I personally think features like auto-attach (even ITHVNR had that functionality) etc. should be within the scope of a tool that calls itself "the next generation of visual novel text hooker", but welp.

I will not be able to switch from Textractor to LunaHook due to aforementioned reasons but at least we now have an alternative tool we can try to use when Textractor fails to find a hook. Thanks for your hard work again!

HIllya51 commented 3 months ago

Are those hooks mainly for Unity/TyranoScript/RPGMaker as well?

No, it's just one of the hooks

I am, however, interested in an alternative to Textractor that is maintained. I personally think features like auto-attach (even ITHVNR had that functionality) etc. should be within the scope of a tool that calls itself "the next generation of visual novel text hooker", but welp.

I will add this feature later. And actually you can only use the LunaTranslator to extract text and auto attach, without using its translation function.

I will not be able to switch from Textractor to LunaHook due to aforementioned reasons but at least we now have an alternative tool we can try to use when Textractor fails to find a hook. Thanks for your hard work again!

Thank you equally for your suggestion. I hope it can be helpful to you

HIllya51 commented 3 months ago

but also adds more than 200 additional hooks

Are those hooks mainly for Unity/TyranoScript/RPGMaker as well?

The HookCode which contains "X" is not ordinary hooks

Oh, right, sorry. I was just confused when LunaHook called it an invalid hook even though I copied it with the CopyHookCode button.

I only want LunaHook as a low-level core rather than a more complex upper level application.

That's a pity. I personally don't need or want a translator, and to look up words I just use JL so I am not interested in LunaTranslator. I am, however, interested in an alternative to Textractor that is maintained. I personally think features like auto-attach (even ITHVNR had that functionality) etc. should be within the scope of a tool that calls itself "the next generation of visual novel text hooker", but welp.

I will not be able to switch from Textractor to LunaHook due to aforementioned reasons but at least we now have an alternative tool we can try to use when Textractor fails to find a hook. Thanks for your hard work again!

I have already added all the features you mentioned.

rampaa commented 3 months ago

I have already added all the features you mentioned.

Thanks a lot! Though I can't seem to find the manual hook search feature. :(

Also, just curious, what's the "max history size" of LunaHook, or rather, does it even have one? I don't particularly miss it being configurable but I would prefer it being a big number rather than a small one if it does have a max history size (I believe I have it set to 999999999 in Textractor).

Also, here's a bug report about the auto-attach feature (if you'd prefer me to open an issue in the LunaHook repo please let me know): 1) Enable auto attach 2) Attach LunaHook to a game and select the appropriate hook and press the "Remember Hook Selection" button 3) Close the game but do not close LunaHook 4) Run the game again and notice how LunaHook does not re-attach itself to the game

HIllya51 commented 3 months ago

Also, just curious, what's the "max history size" of LunaHook, or rather, does it even have one? I don't particularly miss it being configurable but I would prefer it being a big number rather than a small one if it does have a max history size (I believe I have it set to 999999999 in Textractor).

I just added this setting in the latest version

Also, here's a bug report about the auto-attach feature (if you'd prefer me to open an issue in the LunaHook repo please let me know):

  1. Enable auto attach
  2. Attach LunaHook to a game and select the appropriate hook and press the "Remember Hook Selection" button
  3. Close the game but do not close LunaHook
  4. Run the game again and notice how LunaHook does not re-attach itself to the game

Opening an issue is also a good idea, so that we can communicate more conveniently. I tested according to the steps you mentioned, but did not reproduce the issue. Can you give me the config file and tell me the name of the game you are playing? Thanks!

rampaa commented 3 months ago

I just added this setting in the latest version

Thanks!

Opening an issue is also a good idea, so that we can communicate more conveniently.

I will be sure to do that from now on!

I tested according to the steps you mentioned, but did not reproduce the issue.

Sorry, I think I've been mistaken about the exact issue. It's not that LunaHook is not re-attaching to the game, it does re-attach to the game but can't re-select the hook selected with the "Remember Hook Selection" button. It might be due to the fact that the hook in question contains "X".

Can you give me the config file and tell me the name of the game you are playing?

The game I've tried it with: r69887 (only interested in the Japanese text) The config file: config64.json

HIllya51 commented 3 months ago

I just added this setting in the latest version

Thanks!

Opening an issue is also a good idea, so that we can communicate more conveniently.

I will be sure to do that from now on!

I tested according to the steps you mentioned, but did not reproduce the issue.

Sorry, I think I've been mistaken about the exact issue. It's not that LunaHook is not re-attaching to the game, it does re-attach to the game but can't re-select the hook selected with the "Remember Hook Selection" button. It might be due to the fact that the hook in question contains "X".

Can you give me the config file and tell me the name of the game you are playing?

The game I've tried it with: r69887 (only interested in the Japanese text) The config file: config64.json

I see, this is not a bug. This is because this game is a Unity engine game, and Unity's mono/il2cpp performs JIT, which randomly releases code to a non fixed address each time it runs. The same thing happens in games simulated by PPSSPP/yuzu-emu emulators. Therefore, we cannot determine whether the previously saved hook is a new one. But I have probably come up with a solution that may optimize it. (Failed , because not only the absolute address is changed but also the address relative to module base is changed. So we have no idea how to check whether the hook is the saved hook ,for Unity and some other engines with JIT)

Sapeih commented 3 months ago

Please add Indonesian language for the translator

jenyjj commented 1 month ago

Hello, I like the initiative of this project, I don't know if it is completed or in process because I don't understand how to use lunahook and lunatranslator, I feel that it is not as intuitive as textractor or I definitely don't know how to use it, is there a tutorial please?

HIllya51 commented 1 month ago

Hello, I like the initiative of this project, I don't know if it is completed or in process because I don't understand how to use lunahook and lunatranslator, I feel that it is not as intuitive as textractor or I definitely don't know how to use it, is there a tutorial please?你好,我喜欢这个项目的倡议,我不知道它是完成或在过程中,因为我不明白如何使用lunahook和lunattranslator,我觉得它是不直观的textractor或我肯定不知道如何使用它,有教程吗?

You can search it on YouTube, some people else made tutorials for them. And If you think LunaTranslator is comlex, you can just only use LunaHook for Text Hooking, I think it is enough simple and intuitive