Compare commits

...

70 Commits

Author SHA1 Message Date
Akash Mozumdar
df5b830d17 revert the dumbest change I ever made 2023-08-26 07:36:48 -04:00
Akash Mozumdar
f3fbe04409 standardize file names 2023-04-24 14:48:16 -04:00
Glaringsoul
5adeb1fab7 Update README_GER.md 2023-04-24 14:40:55 -04:00
Glaringsoul
5c7b41dd84 Create README_GER.md
Translated the README.MD by hand into German.

Will probably tackle the text.ccp next, although I haven't looked at it, so I cannot really say how long that can take.

Some parts especially words that are commonly used in German as Anglicisms are left as is, this is not an oversight by me, but intentional.
2023-04-24 14:40:55 -04:00
秋庭里香
92e2e85191 Update Chinese (Simplified) translation
and add a link to text.cpp in the README.md
2023-04-24 14:34:40 -04:00
Blu3train
0bc23ba2c7 update ShinaRio 2.50+ 2023-04-24 14:28:49 -04:00
Akash Mozumdar
fd8a090e28 remove workaround for fixed msvc bug 2023-04-21 19:43:32 -04:00
Akash Mozumdar
aa00d9e789 ignore extra parameters #947 2023-04-21 19:42:54 -04:00
Akash Mozumdar
cfa11c5646 use drive relative path 2023-04-21 19:23:14 -04:00
Akash Mozumdar
446f6d44e6 upgrade build configuration to not rely on qt creator which is no longer required by qt installer 2023-04-21 18:31:17 -04:00
Akash Mozumdar
ff1a7a358c handle toggling of cache properly, error cases consistently, and stop saving cache unnecessarily 2023-04-21 17:23:25 -04:00
Akash Mozumdar
60a5d74eda improve config loading and prevent crashes 2023-04-21 16:49:22 -04:00
Akash Mozumdar
4cebe9462f insane hack to work around false positive in SearchForText 2023-04-21 16:41:00 -04:00
Akash Mozumdar
d97ebd4fbb edge is also usable for devtools 2023-04-21 16:35:19 -04:00
Akash Mozumdar
233e75225c add link to stylesheets 2022-09-10 20:01:48 -04:00
Akash Mozumdar
72ad51f039 tighten abel detection 2022-08-09 00:02:27 -04:00
Akash Mozumdar
39fcfaf644 restore shinario hook 2022-08-08 23:13:51 -04:00
RoARene317
5eb0440f01 Fix some typos 2022-08-08 18:39:16 -06:00
RoARene317
c4ca84d39b Change from text --> Teks in Indonesian 2022-08-08 18:39:16 -06:00
RoARene317
c7b818aa75 Removing some english and fix translations
Fix some Indonesian translations that still english to make it Indonesian but still understandable for young people.
2022-08-08 18:39:16 -06:00
Blu3train
2cb45ab9e3 DeepL Translate: Added Turkish and Indonesian 2022-07-26 23:14:57 -06:00
Blu3train
72132239a5 new browser size setting for DeepL blocking in hidden mode 2022-07-26 22:29:29 -06:00
Blu3train
5eaafbe81c Devtools extensions: chrome user data cache error if there are spaces in path 2022-07-26 22:29:29 -06:00
Akash Mozumdar
97f2bc6304 change qt version to make alpha builds compatible with releases 2022-07-26 23:59:26 -04:00
Akash Mozumdar
f732f488e6
update translation tasks 2022-01-31 05:05:03 -07:00
Blu3train
3e283975c8 Fix auto detect source language selection 2022-01-31 01:18:10 -07:00
Akash Mozumdar
5b35f121d2 reorganize and update docs 2022-01-31 01:16:53 -07:00
Akash Mozumdar
b28aa3d189 clarify text 2022-01-31 00:48:50 -07:00
Akash Mozumdar
faeda02f2b allow users to type capital x 2022-01-30 01:00:00 -07:00
Akash Mozumdar
ef55ef0c61 improve chrome locating and ignore empty translation 2022-01-29 14:20:57 -07:00
Akash Mozumdar
c9240d9e68 improve process selection 2022-01-29 12:49:48 -07:00
Akash Mozumdar
6ba4f9c909 fix incorrect reading 2022-01-23 00:52:15 -07:00
Akash Mozumdar
7c9f861926 most people won't bother with styler 2022-01-23 00:30:57 -07:00
Akash Mozumdar
e158219266 small corrections 2022-01-23 00:29:48 -07:00
Akash Mozumdar
3a9fdfb9ae fix error messaging 2022-01-02 00:50:25 -07:00
Akash Mozumdar
dad036083a destroy garbage sentences 2022-01-01 22:06:10 -07:00
Blu3train
b09783d111 Moved test after filter 2022-01-01 22:06:10 -07:00
Blu3train
306b9f0525 Don't translate text consisting of spaces only 2022-01-01 22:06:10 -07:00
Akash Mozumdar
823987e79f fix crash on windows 11 2022-01-01 22:05:53 -07:00
Akash Mozumdar
fdc8a13b36 clarify instructions 2022-01-01 22:05:53 -07:00
Akash Mozumdar
90b58da867 move file parsing to load time 2022-01-01 22:05:53 -07:00
Blu3train
2316f59415 Added global modifier option 2022-01-01 22:05:53 -07:00
Blu3train
06b93e3def Added ignore case modifier option 2022-01-01 22:05:53 -07:00
Blu3train
fde588d922 Corrected text translation 2022-01-01 22:05:53 -07:00
Blu3train
8e0e17c59b Regex Replacer Extension 2022-01-01 22:05:53 -07:00
Blu3train
e6ee5ecf3d Regex Replacer Extension 2022-01-01 22:05:53 -07:00
k1mlka
49133974b3 add hook artemis3 2022-01-01 22:05:34 -07:00
Akash Mozumdar
4b67b8a5cf make logic clearer, remove second call to size 2022-01-01 22:05:21 -07:00
Blu3train
663bb97fff fix rateLimitTimespan issue #665 2022-01-01 22:05:21 -07:00
Akash Mozumdar
953a537cb8 squashing final bugs with resizing 2022-01-01 22:05:07 -07:00
Akash Mozumdar
8ac4a072a9 bug bashing 2022-01-01 22:05:07 -07:00
Akash Mozumdar
45279d26dc consolidate features and add context menu to edge 2022-01-01 22:05:07 -07:00
Blu3train
5df90e2c01 Added all the features developed by the last PR 2022-01-01 22:05:07 -07:00
Akash Mozumdar
0346f95707 fix x64 build 2022-01-01 22:05:07 -07:00
Akash Mozumdar
1f19a9e74d use system global hotkey 2022-01-01 22:05:07 -07:00
Blu3train
b236a50a8f Fixed bug in calculating height in autoresize mode 2022-01-01 22:05:07 -07:00
Blu3train
2f08ab1e9b added Auto Resize and Click Through features 2022-01-01 22:05:07 -07:00
Akash Mozumdar
ad3f09d8ef bing api update 2022-01-01 21:58:04 -07:00
Akash Mozumdar
44c8e4f94c be more careful inserting waffle 2022-01-01 21:29:13 -07:00
Akash Mozumdar
a17d8d5993 bundle unicode font 2021-11-28 04:57:16 -07:00
Akash Mozumdar
bf49f0bca6 rename 2021-11-13 14:08:16 -07:00
Akash Mozumdar
15db478e62 rearrange build for less confusion and to build CLI faster 2021-11-13 13:38:32 -07:00
Akash Mozumdar
46bc6ec84b add emails 2021-11-08 07:24:22 -07:00
Akash Mozumdar
b3b665fb65 fix debug build 2021-11-08 07:07:34 -07:00
Akash Mozumdar
17b5884149 add basic upstream upgrades 2021-11-08 06:41:28 -07:00
Akash Mozumdar
742b7cacf3 update docs 2021-11-08 06:21:17 -07:00
Akash Mozumdar
4ff150b674 update docs 2021-11-07 06:18:42 -07:00
Akash Mozumdar
e83579ed7c hopefully remove dependency on vcredist for good 2021-11-07 05:54:34 -07:00
Akash Mozumdar
febff243d3 fix bing translate 2021-11-06 17:48:45 -06:00
Akash Mozumdar
1a29f5670a fix crash 2021-11-06 04:53:31 -06:00
68 changed files with 807 additions and 440 deletions

View File

@ -5,20 +5,21 @@ skip_branch_with_pr: false
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
arch: x64
platform: x64
qtbin: msvc2019_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
qtbin: msvc2017_64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
arch: x86
platform: Win32
qtbin: msvc2019
qtbin: msvc2017
before_build:
- git submodule update --init
- cd C:\
- mkdir %arch%
- cd %arch%
- cmake -G "Visual Studio 16 2019" -A "%platform%" -DQt5_DIR="C:\Qt\5.15\%qtbin%\lib\cmake\Qt5" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DVERSION="" ../Textractor
- cmake -G "Visual Studio 15 2017" -A %platform% -DQt5_DIR="C:\Qt\5.13.2\%qtbin%\lib\cmake\Qt5" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DVERSION="" ../Textractor
build:
project: C:\%arch%\Textractor.sln

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "texthook/minhook"]
path = texthook/minhook
url = https://github.com/TsudaKageyu/minhook.git

View File

@ -18,11 +18,11 @@ add_compile_options(
)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
link_directories(x64libs)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x64)
link_directories(x64libs)
else()
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
link_directories(x86libs)
set(CMAKE_FINAL_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/builds/${CMAKE_BUILD_TYPE}_x86)
link_directories(x86libs)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<1:${CMAKE_FINAL_OUTPUT_DIRECTORY}>)
@ -35,15 +35,16 @@ target_precompile_headers(pch PUBLIC include/common.h)
file(GLOB ASSETS assets/*)
file(COPY ${ASSETS} DESTINATION ${CMAKE_FINAL_OUTPUT_DIRECTORY})
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WinExtras WebSockets)
add_library(text text.cpp)
target_compile_definitions(text PRIVATE ${TEXT_LANGUAGE})
link_libraries(text)
add_subdirectory(GUI)
add_subdirectory(host)
add_subdirectory(texthook)
add_subdirectory(GUI)
add_subdirectory(extensions)
add_subdirectory(test)
if (DEFINED VERSION)
add_subdirectory(GUI/host)
endif()
#add_subdirectory(GUI/host)

View File

@ -1,40 +1,31 @@
{
// See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"cmakeCommandArgs": "-DQT_ROOT=/Qt",
"inheritEnvironments": [ "msvc_x86" ]
},
{
"name": "x86-RelWithDebInfo",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x86" ]
},
{
"name": "x86-Release",
"generator": "Ninja",
"configurationType": "Release",
"cmakeCommandArgs": "-DQT_ROOT=/Qt",
"inheritEnvironments": [ "msvc_x86" ]
},
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"cmakeCommandArgs": "-DQT_ROOT=/Qt",
"inheritEnvironments": [ "msvc_x64" ]
},
{
"name": "x64-RelWithDebInfo",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64" ]
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"cmakeCommandArgs": "-DQT_ROOT=/Qt",
"inheritEnvironments": [ "msvc_x64" ]
}
]

View File

@ -1,21 +1,14 @@
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WinExtras)
add_executable(Textractor WIN32
main.cpp
exception.cpp
mainwindow.cpp
extenwindow.cpp
attachprocessdialog.cpp
host/exception.cpp
host/host.cpp
host/textthread.cpp
host/hookcode.cpp
Textractor.rc
Textractor.ico
)
target_precompile_headers(Textractor REUSE_FROM pch)
target_link_libraries(Textractor Qt5::Widgets Qt5::WinExtras shell32 winhttp)
target_link_libraries(Textractor host Qt5::Widgets Qt5::WinExtras shell32 winhttp)
if (NOT EXISTS ${CMAKE_FINAL_OUTPUT_DIRECTORY}/Qt5Core.dll AND NOT EXISTS ${CMAKE_FINAL_OUTPUT_DIRECTORY}/Qt5Cored.dll)
add_custom_command(TARGET Textractor

View File

@ -4,14 +4,13 @@
extern const char* SELECT_PROCESS;
extern const char* ATTACH_INFO;
AttachProcessDialog::AttachProcessDialog(QWidget *parent, std::vector<std::pair<QString, HICON>> processIcons) :
AttachProcessDialog::AttachProcessDialog(QWidget* parent, std::vector<std::pair<QString, HICON>> processIcons) :
QDialog(parent, Qt::WindowCloseButtonHint),
model(this)
{
ui.setupUi(this);
setWindowTitle(SELECT_PROCESS);
ui.label->setText(ATTACH_INFO);
ui.processIdEdit->setValidator(new QIntValidator(0, INT_MAX, this));
ui.processList->setModel(&model);
QPixmap transparent(100, 100);
@ -25,24 +24,16 @@ AttachProcessDialog::AttachProcessDialog(QWidget *parent, std::vector<std::pair<
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(ui.processList, &QListView::clicked, [this](QModelIndex index)
connect(ui.processList, &QListView::clicked, [this](QModelIndex index) { ui.processEdit->setText(model.item(index.row())->text()); });
connect(ui.processList, &QListView::doubleClicked, this, &QDialog::accept);
connect(ui.processEdit, &QLineEdit::textEdited, [this](QString process)
{
selectedProcess = model.item(index.row())->text();
for (int i = 0; i < model.rowCount(); ++i) ui.processList->setRowHidden(i, !model.item(i)->text().contains(process, Qt::CaseInsensitive));
});
connect(ui.processList, &QListView::doubleClicked, [this](QModelIndex index)
{
selectedProcess = model.item(index.row())->text();
accept();
});
connect(ui.processIdEdit, &QLineEdit::returnPressed, [this]
{
selectedProcess = ui.processIdEdit->text();
accept();
});
connect(ui.processEdit, &QLineEdit::returnPressed, this, &QDialog::accept);
}
QString AttachProcessDialog::SelectedProcess()
{
return selectedProcess.isEmpty() ? ui.processIdEdit->text() : selectedProcess;
return ui.processEdit->text();
}

View File

@ -7,7 +7,7 @@
class AttachProcessDialog : public QDialog
{
public:
explicit AttachProcessDialog(QWidget *parent, std::vector<std::pair<QString, HICON>> processIcons);
explicit AttachProcessDialog(QWidget* parent, std::vector<std::pair<QString, HICON>> processIcons);
QString SelectedProcess();
private:

View File

@ -18,11 +18,7 @@
<widget class="QLabel" name="label"/>
</item>
<item>
<widget class="QLineEdit" name="processIdEdit">
<property name="placeholderText">
<string>Process id</string>
</property>
</widget>
<widget class="QLineEdit" name="processEdit"/>
</item>
<item>
<widget class="QListView" name="processList"/>

View File

@ -18,7 +18,7 @@ extern const char* EXTEN_WINDOW_INSTRUCTIONS;
namespace
{
constexpr auto EXTEN_SAVE_FILE = u8"SavedExtensions.txt";
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repeated Characters>Regex Filter>Copy to Clipboard>Google Translate>Extra Window>Extra Newlines>Styler";
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repeated Characters>Regex Filter>Copy to Clipboard>Google Translate>Extra Window>Extra Newlines";
struct Extension
{
@ -55,7 +55,7 @@ namespace
void Unload(int index)
{
std::scoped_lock writeLock(extenMutex);
std::scoped_lock lock(extenMutex);
FreeLibrary(GetModuleHandleW((extensions.at(index).name + L".xdll").c_str()));
extensions.erase(extensions.begin() + index);
}

View File

@ -3,8 +3,8 @@
#include "defs.h"
#include "module.h"
#include "extenwindow.h"
#include "host/host.h"
#include "host/hookcode.h"
#include "../host/host.h"
#include "../host/hookcode.h"
#include "attachprocessdialog.h"
#include <shellapi.h>
#include <process.h>
@ -88,6 +88,8 @@ namespace
TextThread* current = nullptr;
MainWindow* This = nullptr;
void FindHooks();
QString TextThreadString(TextThread& thread)
{
return QString("%1:%2:%3:%4:%5: %6").arg(
@ -274,7 +276,8 @@ namespace
void AddHook(QString hook)
{
if (QString hookCode = QInputDialog::getText(This, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, hook, &ok, Qt::WindowCloseButtonHint); ok)
if (auto hp = HookCode::Parse(S(hookCode))) try { Host::InsertHook(selectedProcessId, hp.value()); } catch (std::out_of_range) {}
if (hookCode.startsWith("S") || hookCode.startsWith("/S")) FindHooks(); // backwards compatibility for old hook search UX
else if (auto hp = HookCode::Parse(S(hookCode))) try { Host::InsertHook(selectedProcessId, hp.value()); } catch (std::out_of_range) {}
else Host::AddConsoleOutput(INVALID_CODE);
}

View File

@ -77,7 +77,7 @@
<widget class="QPlainTextEdit" name="textOutput">
<property name="font">
<font>
<family>Meiryo UI</family>
<family>Arial Unicode MS</family>
<pointsize>13</pointsize>
</font>
</property>

Binary file not shown.

View File

@ -2,17 +2,16 @@
![How it looks](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a. NextHooker) is an open-source x86/x64 video game text hooker for Windows/Wine based off of [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Watch the [tutorial video](https://tinyurl.com/textractor-tutorial) for a quick rundown on using it.
**Textractor** (a.k.a. NextHooker) is an open-source x86/x64 video game text hooker for Windows 7+ (and Wine) based off of [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Watch the [tutorial video](docs/TUTORIAL.md) for a quick rundown on using it.
## Download
Official stable releases of Textractor can be found [here](https://github.com/Artikash/Textractor/releases).<br>
The last release of ITHVNR can be found [here](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Experimental builds of Textractor (with debug info) from the latest source can be found [here](https://ci.appveyor.com/project/Artikash/textractor/history) in the 'Artifacts' section of each job.<br>
Try running vcredist if you get an error when starting Textractor or if nothing happens when you try attaching to a game.
Experimental builds of Textractor (with debug info) from the latest source can be found [here](https://ci.appveyor.com/project/Artikash/textractor/history) in the 'Artifacts' section of each job.
## Features
@ -23,8 +22,8 @@ Try running vcredist if you get an error when starting Textractor or if nothing
## Support
Please let me know of any bugs, games that Textractor has trouble hooking, feature requests, or other suggestions.<br>
If you have trouble hooking a game please email me a place where I can freely download it, or gift it to me on [Steam](https://steamcommunity.com/profiles/76561198097566313/).
Let me know of any bugs, games that Textractor has trouble hooking, feature requests, or other suggestions by posting an issue.<br>
If you have trouble hooking a game, please show me a way to freely download it or gift it to me on [Steam](https://steamcommunity.com/profiles/76561198097566313/).
## Extensions
@ -33,21 +32,21 @@ See the extensions folder for examples of what extensions can do.
## Contributing
All contributions are appreciated! Please email (no, I'm not busy!) me at akashmozumdar@gmail.com if you have any questions about the codebase.<br>
All contributions are appreciated! Please email me at akashmozumdar@gmail.com if you have any questions about the codebase.<br>
You should use the standard process of making a pull request (fork, branch, commit changes, make PR from your branch to my master).<br>
Contributing a translation is easy: just translate the strings in text.cpp as well as this README and the subtitles of the tutorial video.
Contributing a translation is easy: [text.cpp](text.cpp) contains all of the text strings that you need to translate. Translations of this README or the tutorial video transcript are also welcome.
## Compiling
Before compiling Textractor, you should get Qt version 5.13 and Visual Studio with CMake support. You should then be able to just open the source folder in Visual Studio and build.
Before compiling Textractor, you need Qt version 5.13 and Visual Studio with CMake support.
Clone Textractor's source and initialize submodules with `git clone https://github.com/Artikash/Textractor.git` and `git submodule update --init`.
You should then be able to just open the source folder in Visual Studio and build.
## Project Architecture
The host (see GUI/host folder) injects texthook.dll (created from the texthook folder) into the target process and connects to it via 2 pipe files.<br>
Host writes to hostPipe, texthook writes to hookPipe.<br>
The host injects texthook into the target process and connects to it via 2 pipe files.
texthook waits for the pipe to be connected, then injects a few instructions into any text outputting functions (e.g. TextOut, GetGlyphOutline) that cause their input to be sent through the pipe.<br>
Additional information about hooks is exchanged via shared memory.<br>
The text that the host receives through the pipe is then processed a little before being dispatched back to the GUI.<br>
Finally, the GUI dispatches the text to extensions before displaying it.
## [Developers](CREDITS.md)
## [Developers](docs/CREDITS.md)

52
README_DE.md Normal file
View File

@ -0,0 +1,52 @@
# Textractor
![Wie es aussieht](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.b.a. NextHooker) ist ein open-source x86/x64 Video spiel Text hooker für Windows 7+ (und Wine) basierend auf [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Schau das [Tutorial Video](docs/TUTORIAL.md) (auf Englisch) an für einen schnellen Überblick wie du Textractor verwendest.
## Download
Der offizielle Release ist [hier](https://github.com/Artikash/Textractor/releases) zu finden.<br>
Der letzte Release von ITHVNR ist [hier](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Der experimentelle Release von Textractor (mit debug Informationen) ist [hier](https://ci.appveyor.com/project/Artikash/textractor/history) in der 'Artifacts'
Kategorie des jeweiligen Jobs.
## Features
- Modular und Anpassbar
- Automatischen 'hooken' von mehreren Engines (einige davon welche keine VNR Support haben!)
- Text 'hooken' mithilfe von /H "hook" Codes (die meisten AGTH codes funktionieren)
- Automatische suche nach funktionierenden Hook's
## Support
Wenn ihr irgendwelche Fehler, Spiele bei denen Textractor nicht funktioniert, oder Fragen/Anmerkungen habt lasst es mich bitte wissen.<br>
Falls ihr Probleme mit einem Spiel habt, schickt mir einen kostenlosen download Link von dem Spiel oder schenkt es mir auf [Steam](https://steamcommunity.com/profiles/76561198097566313/).
## Erweiterungen
Siehe [Example Extension project](https://github.com/Artikash/ExampleExtension) für Anleitungen, wie man eine Erweiterung erstellt.<br>
Im 'Extensions' Ordner sind Beispiele für Erweiterungen.
## Unterstützen
Ich bin dankbar für alle Unterstützungen! Schickt mir eine E-Mail an akashmozumdar@gmail.com falls ihr Fragen zur Codebasis habt.<br>
Verwendet bitte als Standard eine pull Request (fork, branch, commit) zum Master Release.<br>
Zu Übersetzungen beizutragen ist einfach: [text.cpp](text.cpp) enthält alle text Strings welche übersetzt werden sollen. Übersetzungen der README oder des Tutorial Video Transkripts sind ebenfalls willkommen.
## Compiling
Zum Compilen braucht ihr Qt Version 5.13 und Visual Studio mit CMake Unterstützung.
Erstellt einen Clone vom Quellcode und initialisiert die submodule mit 'git clone https://github.com/Artikash/Textractor.git' und 'git submodule update --init'.
Ihr solltet danach in der Lage sein, den Quellordner in Visual Studio zu öffnen und anzufangen.
## Projekt Architektur
Der Host injiziert texthooks in den ziel Prozess und verbindet ihn mit 2 Pipe Dateien.
Texthook wartet auf die Pipe und injiziert Instruktionen für den Text Output (z.b. TextOut, GetGlyphOutline) welche durch die Pipe gesendet werden.<br>
Weitere Informationen werden durch geteilten Speicher ausgetauscht.<br>
Der Text, welchen der Host durch die Pipe erhält, wird dann verarbeitet, bevor er wieder an die GUI gesendet wird.<br>
Zu guter Letzt, sendet die GUI den Text an die Erweiterung, welche einen lesbaren Output anzeigt.
## [Entwickler](docs/CREDITS.md)

View File

@ -1,8 +1,8 @@
# Textractor
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
## [Video tutorial](https://tinyurl.com/textractor-tutorial)
## [Video tutorial](docs/TUTORIAL.md)
## Descripción general

View File

@ -2,16 +2,15 @@
![À quoi ça ressemble](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a. NextHooker) est un traducteur de jeux-videos basé surtout sur du texte en open source x86/x64 pour Windows/Wine [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Regarde le [tutorial video](https://tinyurl.com/textractor-tutorial) pour un aperçu rapide de son utilisation.
Regarde le [tutorial video](docs/TUTORIAL.md) pour un aperçu rapide de son utilisation.
## Téléchargement
Les versions de Textractor peuvent être trouvées[here](https://github.com/Artikash/Textractor/releases).<br>
Le denière version de THVNR peut etre trouvé [here](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Essayez de démarrer Vcredist si vous avez une erreur en lançant Textractor.
Le denière version de THVNR peut etre trouvé [here](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## Nouveautés
- Hautement extensible et personnalisable
@ -31,9 +30,9 @@ Voir le dossier des extensions pour des exemples de ce que les extensions peuven
## Contribution
Toutes les contributions sont appréciées! Veuillez m'envoyer un e-mail (non, je ne suis pas occupé!) À akashmozumdar@gmail.com si vous avez des questions sur la base de code. <br>
Toutes les contributions sont appréciées! Veuillez m'envoyer un e-mail À akashmozumdar@gmail.com si vous avez des questions sur la base de code. <br>
Vous devez utiliser le processus standard de création d'une demande d'extraction (fork, branch, commit changes, make PR from your branch to my master). <br>
Contribuer à une traduction est simple: il suffit de traduire les chaînes dans text.cpp ainsi que ce fichier README.
Contribuer à une traduction est simple: il suffit de traduire les chaînes dans [text.cpp](text.cpp) ainsi que ce fichier README.
## Compilation
@ -49,4 +48,4 @@ Des informations supplémentaires sur les hooks sont échangées via la mémoire
Le texte que l'hôte reçoit via le canal est ensuite traité un peu avant d'être renvoyé à l'interface graphique. <br>
Enfin, l'interface graphique envoie le texte aux extensions avant de l'afficher.
## [Développeurs](CREDITS.md)
## [Développeurs](docs/CREDITS.md)

View File

@ -2,16 +2,15 @@
![How it looks](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a NextHooker) adalah text hooker video game untuk Windows/Wine x86/x64 berbasis open-source yang didasari oleh [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Lihat [video tutorial](https://tinyurl.com/textractor-tutorial) untuk mengetahui bagaimana cara menggunakannya.
**Textractor** (a.k.a NextHooker) adalah teks hooker video game untuk Windows/Wine x86/x64 berbasis open-source yang didasari oleh [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Lihat [video tutorial](docs/TUTORIAL.md) untuk mengetahui bagaimana cara menggunakannya.
## Pengunduhan
Rilisan Textractor dapat diunduh [disini](https://github.com/Artikash/Textractor/releases).<br>
Rilisan Terakhir ITHVNR dapat diunduh [disini](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Coba jalankan vcredist.x86.exe jika kamu memiliki masalah ketika menjalankan Textractor.
Rilisan Terakhir ITHVNR dapat diunduh [disini](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## Fitur
@ -22,36 +21,33 @@ Coba jalankan vcredist.x86.exe jika kamu memiliki masalah ketika menjalankan Tex
## Dukungan
Please let me know of any bugs, games that Textractor has trouble hooking, feature requests, or other suggestions.<br>
If you have trouble hooking a game please email me a place where I can freely download it, or gift it to me on [Steam](https://steamcommunity.com/profiles/76561198097566313/).
Tolong beritahu saya jika kamu menemukan bug, game yang tidak dapat di tempel oleh Textractor, permintaan fitur, atau usulan lain.<br>
Jika kamu memiliki masalah dalam menempelkan kedalam game tolong email saya link agar saya dapat mendownload game tersebut, atau gift game tersebut di [Steam](https://steamcommunity.com/profiles/76561198097566313/).
Tolong beritahu saya jika kamu menemukan kutu, game yang tidak dapat di tempel oleh Textractor, permintaan fitur, atau usulan lain.<br>
Jika kamu memiliki masalah dalam menempelkan kedalam game tolong email saya link agar saya dapat mengunduh game tersebut, atau hadiahkan game tersebut di [Steam](https://steamcommunity.com/profiles/76561198097566313/).
## Ekstensi
Lihat [project sampel ekstensi saya](https://github.com/Artikash/ExampleExtension) untuk melihat bagaimana cara membuat ekstensi.<br>
Lihat folder extensions untuk melihat sampel ekstensi.
Lihat ekstensi folder untuk melihat sampel ekstensi.
## Kontribusi
Seluruh kontribusi diapresiasi! Tolong email (tidak, saya tidak sibuk!) saya di akashmozumdar@gmail.com jika kamu memiliki pertanyaan mengenai codebase nya.<br>
Kamu harus menggunakan proses standar dalam membuat permintaan pull(fork, branch, commit changes, membuat PR dari branch kamu ke master saya).<br>
Berkontribusi dalam penerjemahan dapat dilakukan dengan mudah : cukup terjemahkan string dari text.cpp lalu terjemahkan README ini.
Seluruh kontribusi diapresiasi! Tolong email saya di akashmozumdar@gmail.com jika kamu memiliki pertanyaan mengenai kode dasar nya.<br>
Kamu harus menggunakan proses standar dalam membuat permintaan pull(fork, cabang, perubahan commit, membuat PR dari cabang kamu ke master saya).<br>
Berkontribusi dalam penerjemahan dapat dilakukan dengan mudah : cukup terjemahkan string dari [text.cpp](text.cpp) lalu terjemahkan README ini.
## Compiling
## Mengcompile
Sebelum melakukan proses compile *Textractor*, kamu harus memiliki Visual Studio dengan dukungan Cmake, juga dengan Qt version 5.13<br>
Lalu kamu dapat membuka folder di Visual Studio, dan build. Run Textractor.exe.
Lalu kamu dapat membuka folder di Visual Studio, dan build. Jalankan Textractor.exe.
## Arsitektur Project
Host (lihat folder GUI/host) menginject texthook.dll (dibuat dari folder texthook) kedalam target process dan disambungkan lewat 2 file pipe.<br>
Host (lihat folder host) menyuntikan texthook.dll (dibuat dari folder texthook) kedalam target proses dan disambungkan lewat 2 file pipe.<br>
Host menulis ke hostPipe, texthook menulis ke hookPipe.<br>
texthook menunggu pipe tersambung, lalu menginject beberapa instruksi ke teks yang menghasilkan fungsi (contoh: TextOut, GetGlyphOutline) yang membuat input dikirim melewati pipa.<br>
texthook menunggu pipe tersambung, lalu menyuntikan beberapa instruksi ke teks yang menghasilkan fungsi (contoh: TextOut, GetGlyphOutline) yang membuat input dikirim melewati pipa.<br>
Informasi tambahan tentang hook dipindahkan melewati shared memory.<br>
Text yang diterima host melewati pipe lalu diproses lagi sebelum dikembalikan ke GUI.<br>
Dan pada akhirnya, GUI melepas text ke ekstensi sebelum menampilkan teks.
Teks yang diterima host melewati pipe lalu diproses lagi sebelum dikembalikan ke GUI.<br>
Dan pada akhirnya, GUI melepas teks ke ekstensi sebelum menampilkan teks.
## [Pengembang](CREDITS.md)
## [Pengembang](docs/CREDITS.md)

View File

@ -2,16 +2,15 @@
![Come si vede](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a. NextHooker) è un agganciatore di testi di videogiochi open-source per Windows/Wine basato su[ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Guarda il [video tutorial](https://tinyurl.com/textractor-tutorial) per una sintesi veloce sul suo utilizzo.
Guarda il [video tutorial](docs/TUTORIAL.md) per una sintesi veloce sul suo utilizzo.
## Scarica
Le uscite di Textractor possono essere trovate [qui](https://github.com/Artikash/Textractor/releases).<br>
L'ultima uscita di ITHVNR può essere trovata [qui](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Prova ad avviare vcredist se ti esce un errore quando avvi Textractor.
L'ultima uscita di ITHVNR può essere trovata [qui](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## Caratteristiche
@ -34,7 +33,7 @@ Guardate la cartella delle estenzioni per esempi di cosa possono fare le estenzi
Tutti i contributi sono apprezzati! Inviatemi un email a akashmozumdar@gmail.com se avete delle domande sul codebase.<br>
Dovreste usare il processo standard di creare una pull request (fork, branch, commit changes, crea PR dal vostro ramo al mio master).<br>
Contribuire alla traduzione è semplice: traduci le stringhe in text.cpp cosi come questo README.
Contribuire alla traduzione è semplice: traduci le stringhe in [text.cpp](text.cpp) cosi come questo README.
## Compiling
@ -43,11 +42,11 @@ Dovresti essere in grado di aprire la cartella in Visual Studio, e costruire. Av
## Architettura del progetto
L'host (guarda la cartella GUI/host) innietta texthook.dll (creato dalla cartella texthook) nel processo e lo connette attraverso due file pipe.<br>
L'host (guarda la cartella host) innietta texthook.dll (creato dalla cartella texthook) nel processo e lo connette attraverso due file pipe.<br>
L'host scrive a hostPipe, texthook scrive a hookPipe.<br>
Texthook aspetta per il pipe di essere connesso, poi innietta alcune istruzione in qualunque funzione di immissione del testo (es. TextOut, GetGlyphOutline) che causa il loro input di essere inviato attraverso il pipe.<br>
Informazioni aggiuntive sui ganci soo scambiati attraverso la memorio condivisa.<br>
Il testo che l'host riceve attraverso il pipe è poi processato un poco prima di essere rinviato alla GUI.<br>
Infine, la GUI dispone il testo alle estenzioni prima di mostrarle.
## [Sviluppatori](CREDITS.md)
## [Sviluppatori](docs/CREDITS.md)

View File

@ -1,6 +1,6 @@
# Textractor
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** はビジュアルノベル文字抽出プログラム。

View File

@ -2,16 +2,15 @@
![How it looks](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a. NextHooker)는 Windows/Wine에서 작동하는 [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine)을 기반으로 한 오픈소스 x86/x64 비디오게임 텍스트 후커 입니다.<br>
빠른 사용법의 이해를 위해 [tutorial video](https://tinyurl.com/textractor-tutorial) 를 참고하세요.
빠른 사용법의 이해를 위해 [tutorial video](docs/TUTORIAL.md) 를 참고하세요.
## 다운로드
[여기](https://github.com/Artikash/Textractor/releases)에서 Textractor 최신버전을 받으실 수 있습니다.<br>
최신버전의 ITHVNR은 [여기](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO)서 받을 수 있습니다.<br>
Textractor 실행오류를 겪는다면 vcredist를 실행해 보시기 바랍니다.
최신버전의 ITHVNR은 [여기](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO)서 받을 수 있습니다.
## 특징
@ -41,11 +40,11 @@ Textractor 실행오류를 겪는다면 vcredist를 실행해 보시기 바랍
## 프로젝트 아키텍쳐
The host (see GUI/host folder) injects texthook.dll (created from the texthook folder) into the target process and connects to it via 2 pipe files.<br>
The host (see host folder) injects texthook.dll (created from the texthook folder) into the target process and connects to it via 2 pipe files.<br>
Host writes to hostPipe, texthook writes to hookPipe.<br>
texthook waits for the pipe to be connected, then injects a few instructions into any text outputting functions (e.g. TextOut, GetGlyphOutline) that cause their input to be sent through the pipe.<br>
Additional information about hooks is exchanged via shared memory.<br>
The text that the host receives through the pipe is then processed a little before being dispatched back to the GUI.<br>
Finally, the GUI dispatches the text to extensions before displaying it.
## [개발자들](CREDITS.md)
## [개발자들](docs/CREDITS.md)

View File

@ -2,16 +2,15 @@
![Como se Parece](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (também conhecido como NextHooker) é um extrator de textos de video-games x86/x64 para Windows/Wine baseado no [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Assista ao [vídeo tutorial](https://tinyurl.com/textractor-tutorial) para uma rápida apresentação de como utilizá-lo.
Assista ao [vídeo tutorial](docs/TUTORIAL.md) para uma rápida apresentação de como utilizá-lo.
## Download
As versões lançadas podem ser encontradas [aqui](https://github.com/Artikash/Textractor/releases).<br>
A última versão lançada do ITHVNR pode ser encontrada [aqui](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Tente rodar o vcredist se você encontrar algum erro ao iniciar o Textractor.
A última versão lançada do ITHVNR pode ser encontrada [aqui](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## Recursos e Funções
@ -32,9 +31,9 @@ Veja a pasta de extensões para mais exemplos do que as extensões são capazes
## Contribuindo
Todas contribuições são bem-vindas! Por favor, me mande um e-mail (não, não sou ocupado!) no endereço akashmozumdar@gmail.com caso tenha alguma dúvida quanto ao codebase.<br>
Todas contribuições são bem-vindas! Por favor, me mande um e-mail no endereço akashmozumdar@gmail.com caso tenha alguma dúvida quanto ao codebase.<br>
Você deve seguir o processo padrão de fazer um pull request (fork, branch, realizar mudanças, realizar o PR do seu branch para o meu master).<br>
Contribuir com uma tradução é fácil: basta traduzir as linhas do text.cpp assim como esse README.
Contribuir com uma tradução é fácil: basta traduzir as linhas do [text.cpp](text.cpp) assim como esse README.
## Compilando
@ -43,11 +42,11 @@ Você deverá então ser capaz de simplesmente abrir uma pasta no Visual Studio
## Arquitetura do Projeto
O host (veja a pasta GUI/host) injeta o texthook.dll (criado a partir da pasta texthook) dentro do processo-alvo e se conecta a ele por meio de 2 arquivos pipe.<br>
O host (veja a pasta host) injeta o texthook.dll (criado a partir da pasta texthook) dentro do processo-alvo e se conecta a ele por meio de 2 arquivos pipe.<br>
O Host escreve para hostPipe, o texthook escreve para hookPipe.<br>
O texthook espera pelo pipe estar conectado e então injeta algumas intruções dentro de quaisquer funções que produzam texto (por exemplo: TextOut, GetGlyphOutline) o que faz com que seu produto seja mandado por meio do pipe.<br>
Informação adicional sobre os hooks é trocada por meio da memória compartilhada.<br>
O texto que o host recebe por meio do pipe é então processado um pouco antes de ser despachado devolta para a IGU/GUI.<br>
Finalmente, a IGU/GUI despacha o texto para as extensões antes de mostrá-lo.
## [Desenvolvedores](CREDITS.md)
## [Desenvolvedores](docs/CREDITS.md)

View File

@ -2,16 +2,15 @@
![Как это выглядит](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor** (a.k.a. NextHooker) это проект x86/x64 Windows/Wine программы для захвата текста из видеоигр, основанный на [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
Смотреть [обучающее видео](https://tinyurl.com/textractor-tutorial) для быстрого ознакомления.
Смотреть [обучающее видео](docs/TUTORIAL.md) для быстрого ознакомления.
## Загрузка
Выпуски Textractor могут быть найдены [здесь](https://github.com/Artikash/Textractor/releases).<br>
Последний выпуск ITHVNR может быть найден [здесь](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
Установите библиотеки Visual C redist(vcredist.x86.exe), если получаете ошибку при запуске Textractor.
Последний выпуск ITHVNR может быть найден [здесь](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## Возможности
@ -32,9 +31,9 @@
## Вклад
Любой вклад приветствуется! Пишите мне(автору)(нет, я не занят!) на akashmozumdar@gmail.com, если у вас есть любые вопросы о кодовой базе.<br>
Любой вклад приветствуется! Пишите мне(автору) на akashmozumdar@gmail.com, если у вас есть любые вопросы о кодовой базе.<br>
Используйте стандартные действия для создания pull request (fork, branch, commit changes, создайте PR из своей ветки branch на мой master).<br>
Вклад в перевод совсем не сложен: просто переведите строки в text.cpp, также, как и этот README.
Вклад в перевод совсем не сложен: просто переведите строки в [text.cpp](text.cpp), также, как и этот README.
## Компиляция
@ -43,11 +42,11 @@
## Архитектура проекта
Хост (смотрите папку GUI/host) внедряет texthook.dll (созданной из папки texthook) в целевой процесс и подключается к нему через два файла-канала (pipe).<br>
Хост (смотрите папку host) внедряет texthook.dll (созданной из папки texthook) в целевой процесс и подключается к нему через два файла-канала (pipe).<br>
Хост пишет в hostPipe, texthook пишет в hookPipe.<br>
texthook ждет присоединения канала, тогда внедряет некоторые инструкции в любые выводящие текст функции (такие как TextOut, GetGlyphOutline), что вызывает пересылку поступающего в них текста через канал.<br>
Дополнительная информация о хуках размещена через файл просмотра (a.k.a. section object), который сопоставлен с ссылкой на класс TextHook.<br>
Текст, который хост получает через канал, затем немного обрабатывается перед отправкой обратно в графический интерфейс (GUI).<br>
Наконец, GUI отправляет текст расширениям, перед его отображением.
## [Разработчики](CREDITS.md)
## [Разработчики](docs/CREDITS.md)

View File

@ -1,6 +1,6 @@
# Textractor
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
## 概述
@ -28,9 +28,9 @@ Textractor 的发行版可以在[这里](https://github.com/Artikash/Textractor/
## 贡献
欢迎一切贡献!如有任何关于代码的疑问,请向 akashmozumdar@gmail.com 发邮件 (不,我并不忙!).<br>
欢迎一切贡献!如有任何关于代码的疑问,请向 akashmozumdar@gmail.com 发邮件.<br>
你应当使用创建 PR 的标准过程 (分岔 (fork), 分支 (branch), 提交变化, 创建从你的分支到我的 master 分支的 PR).<br>
提供翻译贡献很简单: 只需翻译 text.cpp 中的字符串和这份 README 即可.
提供翻译贡献很简单: 只需翻译 [text.cpp](text.cpp) 中的字符串和这份 README 即可.
## 编译
@ -39,11 +39,11 @@ Textractor 的发行版可以在[这里](https://github.com/Artikash/Textractor/
## 项目架构
宿主 (位于 GUI/host 文件夹) 向目标进程注入 texthook.dll (由 texthook 文件夹创建) 并通过两个管道文件互联.<br>
宿主 (位于 host 文件夹) 向目标进程注入 texthook.dll (由 texthook 文件夹创建) 并通过两个管道文件互联.<br>
宿主向 hostPipe 写入, texthook 向 hookPipe 写入.<br>
texthook 等待管道连接, 之后向一些文本输出函数 (如 TextOut, GetGlyphOutline) 注入一系列指令, 使得它们的输入被沿着管道发送.<br>
其它关于钩子的信息通过一个被 TextHook 类保有引用的文件视图 (曾用名: 段对象) 共享.<br>
之后, 宿主通过管道接收到的文本在传回 GUI 前被简单处理.<br>
最后, GUI 在显示文本前将其分发给扩展.
## [开发者](CREDITS.md)
## [开发者](docs/CREDITS.md)

View File

@ -2,17 +2,16 @@
![How it looks](screenshot.png)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa](README_ID.md) ● [Português](README_PT.md)
[English](README.md) ● [Español](README_ES.md) ● [简体中文](README_SC.md) ● [Русский](README_RU.md) ● [한국어](README_KR.md) ● [ภาษาไทย](README_TH.md) ● [Français](README_FR.md) ● [Italiano](README_IT.md) ● [日本語](README_JP.md) ● [Bahasa Indonesia](README_ID.md) ● [Português](README_PT.md) ● [Deutsch](README_DE.md)
**Textractor**
(หรือ NextHooker) คือโปรแกรมโอเพนซอร์ซสำหรับปฏิบัติการที่มีหน้าที่เพื่อเชื่อมกับตัวอักษรกับเกมจากที่มาจากระบบปฏิบัติการ Window/Wine โดยมีแบบดังเดิมมาจาก [ITHVNR](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine).<br>
สามารถดูตัวอย่างวิธีการใช้งาน [วีดีโอตัวอย่างการใช้งาน](https://tinyurl.com/textractor-tutorial) เพื่อที่จะแสดงความเข้าใจคร่าวๆเกี่ยวกับโปรแกรม.
สามารถดูตัวอย่างวิธีการใช้งาน [วีดีโอตัวอย่างการใช้งาน](docs/TUTORIAL.md) เพื่อที่จะแสดงความเข้าใจคร่าวๆเกี่ยวกับโปรแกรม.
## ดาวน์โหลด
Textractor รุ่นล่าสุดสามารถดาวน์โหลดจาก [ที่นี้](https://github.com/Artikash/Textractor/releases).<br>
ITHVNR รุ่นสุดท้ายสามารถดาวน์โหลดได้ [ที่นี้](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).<br>
ถ้าหากมีปัญหาขณะที่เปิด Textractor ลองเปิด vcredist
ITHVNR รุ่นสุดท้ายสามารถดาวน์โหลดได้ [ที่นี้](https://drive.google.com/open?id=13aHF4uIXWn-3YML_k2YCDWhtGgn5-tnO).
## คุณสมบัติ
@ -38,7 +37,7 @@ ITHVNR รุ่นสุดท้ายสามารถดาวน์โห
## โครงสร้างโปรแกรม
ฐานของโปรแกรม (โฟลเดอร์ GUI/host) ส่งข้อมูลจาก texthook.dll (ที่ถูกสร้างจาก texthook โฟลเดอร์) ไปยังเกมเป้าหมาย และ เชื่อมทั่งสองอย่างเข้าด้วยกัน<br>
ฐานของโปรแกรม (โฟลเดอร์ host) ส่งข้อมูลจาก texthook.dll (ที่ถูกสร้างจาก texthook โฟลเดอร์) ไปยังเกมเป้าหมาย และ เชื่อมทั่งสองอย่างเข้าด้วยกัน<br>
ฐานโปรแกรมเขียนผ่านฝั่ง hostPipe(ท่อเชื่อมฝั่งฐานข้อมูล) ในขณะที่ตัวดึงตัวอักษรที่ทางฝั่ง hookPipe(ท่อเชื่อมฝั่งดึงข้อมูล).<br>
ตัวดึงตัวอักษรรอการเชื่อมเข้ากับของทั่งสองท่อ หลังจากนั่นส่งคำสั่งไปยังข้อมูลนั่น (เช่น แสดงผลข้อมูล เป็นต้น) และทำให้ข้อมูลส่งผ่านต่อมาออกมาได้ถูกต้อง<br>
ข้อมูลบางอย่างเกี่ยวกับการเชื่อมจะถูกแลกเปลี่ยนผ่านความทรงจำของระบบ (shared memory)
@ -46,4 +45,4 @@ ITHVNR รุ่นสุดท้ายสามารถดาวน์โห
ตัวอักษรที่ฐานโปรแกรมรับผ่านท่อจะถูกแปลงเล็กน้อยก่อนที่จะแสดงผ่าน GUI <br>
สุดท้ายแล้ว GUI จะส่งข้อมูลตัวอักษรไปยังส่วนขยายต่างๆก่อนที่จะแสดงให้เห็นในหน้าจอ
## [นักพัฒนา](CREDITS.md)
## [นักพัฒนา](docs/CREDITS.md)

View File

@ -1,12 +1,14 @@
macro(msvc_registry_search)
if(NOT DEFINED Qt5_DIR)
# look for user-registry pointing to qtcreator
get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
if (NOT EXISTS ${QT_ROOT})
# look for user-registry pointing to qtcreator
get_filename_component(QT_ROOT [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH)
# get root path so we can search for 5.3, 5.4, 5.5, etc
string(REPLACE "/Tools" ";" QT_BIN "${QT_BIN}")
list(GET QT_BIN 0 QT_BIN)
file(GLOB QT_VERSIONS "${QT_BIN}/5.1*")
# get root path
string(REPLACE "/Tools" ";" QT_ROOT "${QT_ROOT}")
list(GET QT_ROOT 0 QT_ROOT)
endif()
file(GLOB QT_VERSIONS "${QT_ROOT}/5.13*")
list(SORT QT_VERSIONS)
# assume the latest version will be last alphabetically

View File

@ -52,6 +52,7 @@ foreach ($language in @{
"Google Translate",
"Lua",
"Regex Filter",
"Regex Replacer",
"Remove Repeated Characters",
"Remove Repeated Phrases",
"Remove Repeated Phrases 2",
@ -93,7 +94,7 @@ foreach ($arch in @("x86", "x64"))
rm -Force -Recurse -Verbose "Textractor";
mkdir -Force -Verbose "Textractor";
copy -Force -Recurse -Verbose -Destination "Textractor" -Path @("Runtime/*", "Textractor--$version/*");
&"C:\Program Files\7-Zip\7z" a "Textractor-$version-Zip-Version-English-Only.zip" Textractor/
&"C:\Program Files\7-Zip\7z" a "Textractor-$version-Zip-Version-English-Only.zip" Textractor/ ../INSTALL_THIS_UNICODE_FONT.ttf
cd ..;
&"C:\Program Files (x86)\Inno Setup 6\iscc" -DVERSION="$version" installer.iss;

View File

@ -1,33 +1,32 @@
# Developers
If you're on this list and want your link changed let me know.
- Textractor mainly made by [Artikash](https://github.com/Artikash) with the contributions of
- Build system improvements by [DoumanAsh](https://github.com/DoumanAsh)
- Original text removal in Extra Window by [Niakr1s](https://github.com/Niakr1s)
- CLI bugfixes by [tinyAdapter](https://github.com/tinyAdapter)
- Hook codes for WAFFLE and WillPlus by [lgztx96](https://github.com/lgztx96)
- Hook codes for TokyoNecro by [Jazzinghen](https://github.com/Jazzinghen)
- Hook codes for ShinyDays by [luojunyuan](https://github.com/luojunyuan)
- Hook codes for ShinyDays and Artemis by [luojunyuan](https://github.com/luojunyuan)
- Google Chrome DevTools integration by [zeheyler](https://github.com/zeheyler)
- AppVeyor setup by [silas1037](https://github.com/silas1037)
- Improved attach dialog by [tera8m4](https://github.com/tera8m4)
- DevTools bugfixes and Papago/Systran translate integration by [Blu3train](https://github.com/Blu3train)
- French translation by Racky and [Gratusfr](https://github.com/Gratusfr)
- Regex Replacer, Papago, Systran, improvements to Extra Window, and bugfixes by [Blu3train](https://github.com/Blu3train)
- French translation by [Racky](mailto:maitrenoah@gmail.com) and [Gratusfr](https://github.com/Gratusfr)
- Spanish translation by [scese250](https://github.com/scese250)
- Turkish translation by [niisokusu](https://reddit.com/u/niisokusu)
- Simplified Chinese translation by [tinyAdapter](https://github.com/tinyAdapter) and [lgztx96](https://github.com/lgztx96)
- Simplified Chinese translation by [tinyAdapter](https://github.com/tinyAdapter), [lgztx96](https://github.com/lgztx96) and [chinanoahli](https://github.com/chinanoahli)
- Russian translation by [TokcDK](https://github.com/TokcDK)
- Indonesian translation by [Hawxone](https://github.com/Hawxone)
- Portuguese translation by [TsumiHokiro](https://github.com/TsumiHokiro)
- Thai translation by [azmadoppler](https://github.com/azmadoppler)
- Korean translation by O SK
- Korean translation by [O SK](mailto:afkl11@outlook.kr)
- Italian translation by [StarFang208](https://github.com/StarFang208)
- ITHVNR updated by [mireado](https://github.com/mireado), [Eguni](https://github.com/Eguni), and [IJEMIN](https://github.com/IJEMIN)
- ITHVNR originally made by [Stomp](https://web.archive.org/web/20160202084144/http://www.hongfire.com/forum/showthread.php/438331-ITHVNR-ITH-with-the-VNR-engine)
- ITHVNR originally made by [Stomp](mailto:zorkzero@hotmail.com)
- VNR engine made by [jichi](https://github.com/jichifly)
- ITH updated by [Andys](https://github.com/AndyScull)
- ITH originally made by [kaosu](https://code.google.com/archive/p/interactive-text-hooker)
- Locale Emulator library made by [xupefei](https://github.com/xupefei)
- MinHook library made by [TsudaKageyu](https://github.com/TsudaKageyu)
If you're on this list and want your link changed let Artikash know.
# THANK YOU!!

7
docs/TUTORIAL.md Normal file
View File

@ -0,0 +1,7 @@
# Tutorial Video
https://www.youtube.com/watch?v=eecEOacF6mw
## Updates/Corrections
Automatically finding hooks is now done via the `Search for hooks` button, the method shown in the video is found in the `Search for specific text` option.

View File

@ -1,6 +1,3 @@
include(QtUtils)
msvc_registry_search()
find_qt5(Core Widgets WebSockets)
cmake_policy(SET CMP0037 OLD)
add_library(Bing\ Translate MODULE bingtranslate.cpp translatewrapper.cpp network.cpp extensionimpl.cpp)
@ -14,6 +11,7 @@ add_library(Extra\ Window MODULE extrawindow.cpp extensionimpl.cpp)
add_library(Google\ Translate MODULE googletranslate.cpp translatewrapper.cpp network.cpp extensionimpl.cpp)
add_library(Lua MODULE lua.cpp extensionimpl.cpp)
add_library(Regex\ Filter MODULE regexfilter.cpp extensionimpl.cpp)
add_library(Regex\ Replacer MODULE regexreplacer.cpp extensionimpl.cpp)
add_library(Remove\ Repeated\ Characters MODULE removerepeatchar.cpp extensionimpl.cpp)
add_library(Remove\ Repeated\ Phrases MODULE removerepeatphrase.cpp extensionimpl.cpp)
add_library(Remove\ Repeated\ Phrases\ 2 MODULE removerepeatphrase2.cpp extensionimpl.cpp)
@ -33,6 +31,7 @@ target_precompile_headers(Extra\ Window REUSE_FROM pch)
target_precompile_headers(Google\ Translate REUSE_FROM pch)
target_precompile_headers(Lua REUSE_FROM pch)
target_precompile_headers(Regex\ Filter REUSE_FROM pch)
target_precompile_headers(Regex\ Replacer REUSE_FROM pch)
target_precompile_headers(Remove\ Repeated\ Characters REUSE_FROM pch)
target_precompile_headers(Remove\ Repeated\ Phrases REUSE_FROM pch)
target_precompile_headers(Remove\ Repeated\ Phrases\ 2 REUSE_FROM pch)

View File

@ -213,18 +213,27 @@ std::pair<bool, std::wstring> Translate(const std::wstring& text, TranslationPar
else return { false, FormatString(L"%s (code=%u)", TRANSLATION_ERROR, httpRequest.errorCode) };
}
static std::atomic<int> i = 0;
static Synchronized<std::wstring> token;
if (token->empty())
if (HttpRequest httpRequest{ L"Mozilla/5.0 Textractor", L"www.bing.com", L"GET", L"translator" })
if (auto tokenPos = httpRequest.response.find(L"[" + std::to_wstring(time(nullptr) / 100)); tokenPos != std::string::npos)
token->assign(FormatString(L"&key=%s&token=%s", httpRequest.response.substr(tokenPos + 1, 13), httpRequest.response.substr(tokenPos + 16, 32)));
else return { false, FormatString(L"%s: %s\ntoken not found", TRANSLATION_ERROR, httpRequest.response) };
else return { false, FormatString(L"%s: could not acquire token", TRANSLATION_ERROR) };
if (token->empty()) if (HttpRequest httpRequest{ L"Mozilla/5.0 Textractor", L"www.bing.com", L"GET", L"translator" })
{
std::wstring tokenBuilder;
if (auto tokenPos = httpRequest.response.find(L"[" + std::to_wstring(time(nullptr) / 100)); tokenPos != std::string::npos)
tokenBuilder = FormatString(L"&key=%s&token=%s", httpRequest.response.substr(tokenPos + 1, 13), httpRequest.response.substr(tokenPos + 16, 32));
if (auto tokenPos = httpRequest.response.find(L"IG:\""); tokenPos != std::string::npos)
tokenBuilder += L"&IG=" + httpRequest.response.substr(tokenPos + 4, 32);
if (auto tokenPos = httpRequest.response.find(L"data-iid=\""); tokenPos != std::string::npos)
tokenBuilder += L"&IID=" + httpRequest.response.substr(tokenPos + 10, 15);
if (!tokenBuilder.empty()) token->assign(tokenBuilder);
else return { false, FormatString(L"%s: %s\ntoken not found", TRANSLATION_ERROR, httpRequest.response) };
}
else return { false, FormatString(L"%s: could not acquire token", TRANSLATION_ERROR) };
if (HttpRequest httpRequest{
L"Mozilla/5.0 Textractor",
L"www.bing.com",
L"POST",
FormatString(L"/ttranslatev3?fromLang=%s&to=%s&text=%s%s", codes.at(tlp.translateFrom), codes.at(tlp.translateTo), Escape(text), token.Copy()).c_str()
FormatString(L"/ttranslatev3?fromLang=%s&to=%s&text=%s%s.%d", codes.at(tlp.translateFrom), codes.at(tlp.translateTo), Escape(text), token.Copy(), i++).c_str()
})
if (auto translation = Copy(JSON::Parse(httpRequest.response)[0][L"translations"][0][L"text"].String())) return { true, translation.value() };
else return { false, FormatString(L"%s (token=%s): %s", TRANSLATION_ERROR, std::exchange(token.Acquire().contents, L""), httpRequest.response) };

View File

@ -49,7 +49,7 @@ private:
}
static constexpr C endImpl[5] = { '|', 'E', 'N', 'D', '|' };
static constexpr std::basic_string_view end{ endImpl, 5 };
static constexpr std::basic_string_view<C> end{ endImpl, 5 };
std::basic_streambuf<char>& streambuf;
std::basic_string<C> buffer;

View File

@ -22,6 +22,7 @@ extern const QStringList languagesTo
"German",
"Greek",
"Hungarian",
"Indonesian",
"Italian",
"Japanese",
"Latvian",
@ -34,7 +35,8 @@ extern const QStringList languagesTo
"Slovak",
"Slovenian",
"Spanish",
"Swedish"
"Swedish",
"Turkish"
},
languagesFrom
{
@ -50,6 +52,7 @@ languagesFrom
"German",
"Greek",
"Hungarian",
"Indonesian",
"Italian",
"Japanese",
"Latvian",
@ -61,7 +64,8 @@ languagesFrom
"Slovak",
"Slovenian",
"Spanish",
"Swedish"
"Swedish",
"Turkish"
};
extern const std::unordered_map<std::wstring, std::wstring> codes
{
@ -80,6 +84,7 @@ extern const std::unordered_map<std::wstring, std::wstring> codes
{ { L"German" }, { L"DE" } },
{ { L"Greek" }, { L"EL" } },
{ { L"Hungarian" }, { L"HU" } },
{ { L"Indonesian" }, { L"ID" } },
{ { L"Italian" }, { L"IT" } },
{ { L"Japanese" }, { L"JA" } },
{ { L"Latvian" }, { L"LV" } },
@ -94,6 +99,7 @@ extern const std::unordered_map<std::wstring, std::wstring> codes
{ { L"Slovenian" }, { L"SL" } },
{ { L"Spanish" }, { L"ES" } },
{ { L"Swedish" }, { L"SV" } },
{ { L"Turkish" }, { L"TR" } },
{ { L"?" }, { L"auto" } }
};

View File

@ -1,4 +1,5 @@
#include "devtools.h"
#include "module.h"
#include <ppltasks.h>
#include <ShlObj.h>
#include <QWebSocket>
@ -9,7 +10,7 @@
extern const char* CHROME_LOCATION;
extern const char* START_DEVTOOLS;
extern const char* STOP_DEVTOOLS;
extern const char* HEADLESS_MODE;
extern const char* HIDE_CHROME;
extern const char* DEVTOOLS_STATUS;
extern const char* AUTO_START;
@ -35,11 +36,11 @@ namespace
if (process) DevTools::Close();
auto args = FormatString(
L"%s --proxy-server=direct:// --disable-extensions --disable-gpu --user-data-dir=%s\\devtoolscache --remote-debugging-port=9222",
L"%s --proxy-server=direct:// --disable-extensions --disable-gpu --no-first-run --user-data-dir=\"%s\\devtoolscache\" --remote-debugging-port=9222",
chromePath,
std::filesystem::current_path().wstring()
);
if (headless) args += L" --headless";
args += headless ? L" --window-size=1920,1080 --headless" : L" --window-size=850,900";
DWORD exitCode = 0;
STARTUPINFOW DUMMY = { sizeof(DUMMY) };
PROCESS_INFORMATION processInfo = {};
@ -89,12 +90,17 @@ namespace DevTools
void Initialize()
{
QString chromePath = settings.value(CHROME_LOCATION).toString();
wchar_t programFiles[MAX_PATH + 100] = {};
if (chromePath.isEmpty()) for (auto folder : { CSIDL_PROGRAM_FILESX86, CSIDL_PROGRAM_FILES, CSIDL_LOCAL_APPDATA })
if (chromePath.isEmpty())
{
SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, programFiles);
wcscat_s(programFiles, L"/Google/Chrome/Application/chrome.exe");
if (std::filesystem::exists(programFiles)) chromePath = S(programFiles);
for (auto [_, process] : GetAllProcesses())
if (process && (process->find(L"\\chrome.exe") != std::string::npos || process->find(L"\\msedge.exe") != std::string::npos)) chromePath = S(process.value());
wchar_t programFiles[MAX_PATH + 100] = {};
for (auto folder : { CSIDL_PROGRAM_FILESX86, CSIDL_PROGRAM_FILES, CSIDL_LOCAL_APPDATA })
{
SHGetFolderPathW(NULL, folder, NULL, SHGFP_TYPE_CURRENT, programFiles);
wcscat_s(programFiles, L"/Google/Chrome/Application/chrome.exe");
if (std::filesystem::exists(programFiles)) chromePath = S(programFiles);
}
}
auto chromePathEdit = new QLineEdit(chromePath);
static struct : QObject
@ -113,14 +119,14 @@ namespace DevTools
display->addRow(CHROME_LOCATION, chromePathEdit);
auto headlessCheck = new QCheckBox();
auto startButton = new QPushButton(START_DEVTOOLS), stopButton = new QPushButton(STOP_DEVTOOLS);
headlessCheck->setChecked(settings.value(HEADLESS_MODE, true).toBool());
QObject::connect(headlessCheck, &QCheckBox::clicked, [](bool headless) { settings.setValue(HEADLESS_MODE, headless); });
headlessCheck->setChecked(settings.value(HIDE_CHROME, true).toBool());
QObject::connect(headlessCheck, &QCheckBox::clicked, [](bool headless) { settings.setValue(HIDE_CHROME, headless); });
QObject::connect(startButton, &QPushButton::clicked, [chromePathEdit, headlessCheck] { Start(S(chromePathEdit->text()), headlessCheck->isChecked()); });
QObject::connect(stopButton, &QPushButton::clicked, &Close);
auto buttons = new QHBoxLayout();
buttons->addWidget(startButton);
buttons->addWidget(stopButton);
display->addRow(HEADLESS_MODE, headlessCheck);
display->addRow(HIDE_CHROME, headlessCheck);
auto autoStartCheck = new QCheckBox();
autoStartCheck->setChecked(settings.value(AUTO_START, false).toBool());
QObject::connect(autoStartCheck, &QCheckBox::clicked, [](bool autoStart) { settings.setValue(AUTO_START, autoStart); });

View File

@ -94,7 +94,7 @@ extern const std::unordered_map<std::wstring, std::wstring> codes
{ { L"Slovenian" }, { L"Slovenian" } },
{ { L"Spanish" }, { L"Spanish" } },
{ { L"Swedish" }, { L"Swedish" } },
{ { L"?" }, { L"Any language (detect)" } }
{ { L"?" }, { L"Detect language" } }
};
bool translateSelectedOnly = true, useRateLimiter = true, rateLimitSelected = false, useCache = true, useFilter = true;

View File

@ -13,15 +13,20 @@
#include <QFontMetrics>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QScrollArea>
#include <QAbstractNativeEventFilter>
extern const char* EXTRA_WINDOW_INFO;
extern const char* SENTENCE_TOO_BIG;
extern const char* MAX_SENTENCE_SIZE;
extern const char* TOPMOST;
extern const char* OPACITY;
extern const char* SHOW_ORIGINAL;
extern const char* SHOW_ORIGINAL_INFO;
extern const char* ORIGINAL_AFTER_TRANSLATION;
extern const char* SIZE_LOCK;
extern const char* POSITION_LOCK;
extern const char* CENTERED_TEXT;
extern const char* AUTO_RESIZE_WINDOW_HEIGHT;
extern const char* CLICK_THROUGH;
extern const char* HIDE_MOUSEOVER;
extern const char* DICTIONARY;
extern const char* DICTIONARY_INSTRUCTIONS;
extern const char* BG_COLOR;
@ -31,9 +36,9 @@ extern const char* OUTLINE_COLOR;
extern const char* OUTLINE_SIZE;
extern const char* OUTLINE_SIZE_INFO;
extern const char* FONT;
extern const char* SAVE_SETTINGS;
constexpr auto DICTIONARY_SAVE_FILE = u8"SavedDictionary.txt";
constexpr int CLICK_THROUGH_HOTKEY = 0xc0d0;
QColor colorPrompt(QWidget* parent, QColor default, const QString& title, bool customOpacity = true)
{
@ -58,13 +63,19 @@ struct PrettyWindow : QDialog, Localizer
SetTextColor(settings.value(TEXT_COLOR, TextColor()).value<QColor>());
outliner->color = settings.value(OUTLINE_COLOR, outliner->color).value<QColor>();
outliner->size = settings.value(OUTLINE_SIZE, outliner->size).toDouble();
autoHide = settings.value(HIDE_MOUSEOVER, autoHide).toBool();
menu.addAction(FONT, this, &PrettyWindow::RequestFont);
menu.addAction(BG_COLOR, [this] { SetBackgroundColor(colorPrompt(this, backgroundColor, BG_COLOR)); });
menu.addAction(TEXT_COLOR, [this] { SetTextColor(colorPrompt(this, TextColor(), TEXT_COLOR)); });
QAction* outlineAction = menu.addAction(TEXT_OUTLINE, this, &PrettyWindow::SetOutline);
outlineAction->setCheckable(true);
outlineAction->setChecked(outliner->size >= 0);
connect(ui.display, &QLabel::customContextMenuRequested, [this](QPoint point) { menu.exec(mapToGlobal(point)); });
QAction* autoHideAction = menu.addAction(HIDE_MOUSEOVER, this, [this](bool autoHide) { settings.setValue(HIDE_MOUSEOVER, this->autoHide = autoHide); });
autoHideAction->setCheckable(true);
autoHideAction->setChecked(autoHide);
connect(this, &QDialog::customContextMenuRequested, [this](QPoint point) { menu.exec(mapToGlobal(point)); });
connect(ui.display, &QLabel::customContextMenuRequested, [this](QPoint point) { menu.exec(ui.display->mapToGlobal(point)); });
startTimer(50);
}
~PrettyWindow()
@ -75,6 +86,31 @@ struct PrettyWindow : QDialog, Localizer
Ui::ExtraWindow ui;
protected:
void timerEvent(QTimerEvent*) override
{
if (autoHide && geometry().contains(QCursor::pos()))
{
if (!hidden)
{
if (backgroundColor.alphaF() > 0.05) backgroundColor.setAlphaF(0.05);
if (outliner->color.alphaF() > 0.05) outliner->color.setAlphaF(0.05);
QColor hiddenTextColor = TextColor();
if (hiddenTextColor.alphaF() > 0.05) hiddenTextColor.setAlphaF(0.05);
ui.display->setPalette(QPalette(hiddenTextColor, {}, {}, {}, {}, {}, {}));
hidden = true;
repaint();
}
}
else if (hidden)
{
backgroundColor.setAlpha(settings.value(BG_COLOR).value<QColor>().alpha());
outliner->color.setAlpha(settings.value(OUTLINE_COLOR).value<QColor>().alpha());
ui.display->setPalette(QPalette(settings.value(TEXT_COLOR).value<QColor>(), {}, {}, {}, {}, {}, {}));
hidden = false;
repaint();
}
}
QMenu menu{ ui.display };
Settings settings{ this };
@ -115,9 +151,9 @@ private:
{
QColor color = colorPrompt(this, outliner->color, OUTLINE_COLOR);
if (color.isValid()) outliner->color = color;
outliner->size = QInputDialog::getDouble(this, OUTLINE_SIZE, OUTLINE_SIZE_INFO, 0.5, 0, INT_MAX, 2, nullptr, Qt::WindowCloseButtonHint);
outliner->size = QInputDialog::getDouble(this, OUTLINE_SIZE, OUTLINE_SIZE_INFO, -outliner->size, 0, INT_MAX, 2, nullptr, Qt::WindowCloseButtonHint);
}
else outliner->size = -1;
else outliner->size = -outliner->size;
settings.setValue(OUTLINE_COLOR, outliner->color.name(QColor::HexArgb));
settings.setValue(OUTLINE_SIZE, outliner->size);
}
@ -127,6 +163,7 @@ private:
QPainter(this).fillRect(rect(), backgroundColor);
}
bool autoHide = false, hidden = false;
QColor backgroundColor{ palette().window().color() };
struct Outliner : QGraphicsEffect
{
@ -147,23 +184,26 @@ private:
painter->drawPixmap(offset, pixmap);
}
QColor color{ Qt::black };
double size = -1;
double size = -0.5;
}* outliner;
};
class ExtraWindow : public PrettyWindow
class ExtraWindow : public PrettyWindow, QAbstractNativeEventFilter
{
public:
ExtraWindow() : PrettyWindow("Extra Window")
{
ui.display->setTextFormat(Qt::PlainText);
if (settings.contains(WINDOW) && QApplication::screenAt(settings.value(WINDOW).toRect().bottomRight())) setGeometry(settings.value(WINDOW).toRect());
maxSentenceSize = settings.value(MAX_SENTENCE_SIZE, maxSentenceSize).toInt();
for (auto [name, default, slot] : Array<const char*, bool, void(ExtraWindow::*)(bool)>{
{ TOPMOST, false, &ExtraWindow::SetTopmost },
{ SIZE_LOCK, false, &ExtraWindow::SetLock },
{ SIZE_LOCK, false, &ExtraWindow::SetSizeLock },
{ POSITION_LOCK, false, &ExtraWindow::SetPositionLock },
{ CENTERED_TEXT, false, &ExtraWindow::SetCenteredText },
{ AUTO_RESIZE_WINDOW_HEIGHT, false, &ExtraWindow::SetAutoResize },
{ SHOW_ORIGINAL, true, &ExtraWindow::SetShowOriginal },
{ ORIGINAL_AFTER_TRANSLATION, true, &ExtraWindow::SetShowOriginalAfterTranslation },
{ DICTIONARY, false, &ExtraWindow::SetUseDictionary },
})
{
@ -173,15 +213,15 @@ public:
action->setCheckable(true);
action->setChecked(default);
}
menu.addAction(MAX_SENTENCE_SIZE, this, [this]
{
settings.setValue(MAX_SENTENCE_SIZE, maxSentenceSize = QInputDialog::getInt(this, MAX_SENTENCE_SIZE, "", maxSentenceSize, 0, INT_MAX, 1, nullptr, Qt::WindowCloseButtonHint));
});
menu.addAction(CLICK_THROUGH, this, &ExtraWindow::ToggleClickThrough);
ui.display->installEventFilter(this);
ui.display->setMouseTracking(true);
qApp->installNativeEventFilter(this);
QMetaObject::invokeMethod(this, [this]
{
RegisterHotKey((HWND)winId(), CLICK_THROUGH_HOTKEY, MOD_ALT | MOD_NOREPEAT, 0x58);
show();
AddSentence(EXTRA_WINDOW_INFO);
}, Qt::QueuedConnection);
@ -194,16 +234,47 @@ public:
void AddSentence(QString sentence)
{
if (sentence.size() > maxSentenceSize) sentence = SENTENCE_TOO_BIG;
if (!showOriginal && sentence.contains(u8"\x200b \n")) sentence = sentence.split(u8"\x200b \n")[1];
sanitize(sentence);
sentence.chop(std::distance(std::remove(sentence.begin(), sentence.end(), QChar::Tabulation), sentence.end()));
sentenceHistory.push_back(sentence);
if (sentenceHistory.size() > 1000) sentenceHistory.erase(sentenceHistory.begin());
historyIndex = sentenceHistory.size() - 1;
ui.display->setText(sentence);
DisplaySentence();
}
private:
void DisplaySentence()
{
if (sentenceHistory.empty()) return;
QString sentence = sentenceHistory[historyIndex];
if (sentence.contains(u8"\x200b \n"))
if (!showOriginal) sentence = sentence.split(u8"\x200b \n")[1];
else if (showOriginalAfterTranslation) sentence = sentence.split(u8"\x200b \n")[1] + "\n" + sentence.split(u8"\x200b \n")[0];
if (sizeLock && !autoResize)
{
QFontMetrics fontMetrics(ui.display->font(), ui.display);
int low = 0, high = sentence.size(), last = 0;
while (low <= high)
{
int mid = (low + high) / 2;
if (fontMetrics.boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence.left(mid)).height() <= ui.display->height())
{
last = mid;
low = mid + 1;
}
else high = mid - 1;
}
sentence = sentence.left(last);
}
ui.display->setText(sentence);
if (autoResize)
resize(width(), height() - ui.display->height() +
QFontMetrics(ui.display->font(), ui.display).boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence).height()
);
}
void SetTopmost(bool topmost)
{
for (auto window : { winId(), dictionaryWindow.winId() })
@ -211,16 +282,39 @@ private:
settings.setValue(TOPMOST, topmost);
};
void SetLock(bool locked)
void SetPositionLock(bool locked)
{
settings.setValue(POSITION_LOCK, posLock = locked);
};
void SetSizeLock(bool locked)
{
setSizeGripEnabled(!locked);
settings.setValue(SIZE_LOCK, this->locked = locked);
settings.setValue(SIZE_LOCK, sizeLock = locked);
};
void SetCenteredText(bool centeredText)
{
ui.display->setAlignment(centeredText ? Qt::AlignHCenter : Qt::AlignLeft);
settings.setValue(CENTERED_TEXT, this->centeredText = centeredText);
};
void SetAutoResize(bool autoResize)
{
settings.setValue(AUTO_RESIZE_WINDOW_HEIGHT, this->autoResize = autoResize);
DisplaySentence();
};
void SetShowOriginal(bool showOriginal)
{
if (!showOriginal && settings.value(SHOW_ORIGINAL, false).toBool()) QMessageBox::information(this, SHOW_ORIGINAL, SHOW_ORIGINAL_INFO);
settings.setValue(SHOW_ORIGINAL, this->showOriginal = showOriginal);
DisplaySentence();
};
void SetShowOriginalAfterTranslation(bool showOriginalAfterTranslation)
{
settings.setValue(ORIGINAL_AFTER_TRANSLATION, this->showOriginalAfterTranslation = showOriginalAfterTranslation);
DisplaySentence();
};
void SetUseDictionary(bool useDictionary)
@ -237,27 +331,40 @@ private:
settings.setValue(DICTIONARY, this->useDictionary = useDictionary);
}
void ComputeDictionaryPosition(QPoint mouse)
void ToggleClickThrough()
{
clickThrough = !clickThrough;
for (auto window : { winId(), dictionaryWindow.winId() })
{
unsigned exStyle = GetWindowLongPtrW((HWND)window, GWL_EXSTYLE);
if (clickThrough) exStyle |= WS_EX_TRANSPARENT;
else exStyle &= ~WS_EX_TRANSPARENT;
SetWindowLongPtrW((HWND)window, GWL_EXSTYLE, exStyle);
}
};
void ShowDictionary(QPoint mouse)
{
QString sentence = ui.display->text();
const QFont& font = ui.display->font();
if (cachedDisplayInfo.CompareExchange(ui.display))
{
QFontMetrics fontMetrics(font, ui.display);
int flags = Qt::TextWordWrap | (ui.display->alignment() & (Qt::AlignLeft | Qt::AlignHCenter));
textPositionMap.clear();
for (int i = 0, height = 0, lineBreak = 0; i < sentence.size(); ++i)
{
int block = 1;
for (int charHeight = fontMetrics.boundingRect(0, 0, 1, INT_MAX, Qt::TextWordWrap, sentence.mid(i, 1)).height();
i + block < sentence.size() && fontMetrics.boundingRect(0, 0, 1, INT_MAX, Qt::TextWordWrap, sentence.mid(i, block + 1)).height() < charHeight * 1.5; ++block);
auto boundingRect = fontMetrics.boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence.left(i + block));
for (int charHeight = fontMetrics.boundingRect(0, 0, 1, INT_MAX, flags, sentence.mid(i, 1)).height();
i + block < sentence.size() && fontMetrics.boundingRect(0, 0, 1, INT_MAX, flags, sentence.mid(i, block + 1)).height() < charHeight * 1.5; ++block);
auto boundingRect = fontMetrics.boundingRect(0, 0, ui.display->width(), INT_MAX, flags, sentence.left(i + block));
if (boundingRect.height() > height)
{
height = boundingRect.height();
lineBreak = i;
}
textPositionMap.push_back({
fontMetrics.boundingRect(0, 0, ui.display->width(), INT_MAX, Qt::TextWordWrap, sentence.mid(lineBreak, i - lineBreak + 1)).width(),
fontMetrics.boundingRect(0, 0, ui.display->width(), INT_MAX, flags, sentence.mid(lineBreak, i - lineBreak + 1)).right() + 1,
height
});
}
@ -274,13 +381,27 @@ private:
dictionaryWindow.move(ui.display->mapToGlobal(QPoint(x, y - dictionaryWindow.height())));
}
bool nativeEventFilter(const QByteArray&, void* message, long* result) override
{
auto msg = (MSG*)message;
if (msg->message == WM_HOTKEY)
if (msg->wParam == CLICK_THROUGH_HOTKEY) return ToggleClickThrough(), true;
return false;
}
bool eventFilter(QObject*, QEvent* event) override
{
if (useDictionary && event->type() == QEvent::MouseMove) ComputeDictionaryPosition(((QMouseEvent*)event)->localPos().toPoint());
if (event->type() == QEvent::MouseButtonPress) dictionaryWindow.hide();
if (event->type() == QEvent::MouseButtonPress) mousePressEvent((QMouseEvent*)event);
return false;
}
void timerEvent(QTimerEvent* event) override
{
if (useDictionary && QCursor::pos() != oldPos && (!dictionaryWindow.isVisible() || !dictionaryWindow.geometry().contains(QCursor::pos())))
ShowDictionary(ui.display->mapFromGlobal(QCursor::pos()));
PrettyWindow::timerEvent(event);
}
void mousePressEvent(QMouseEvent* event) override
{
dictionaryWindow.hide();
@ -289,19 +410,19 @@ private:
void mouseMoveEvent(QMouseEvent* event) override
{
if (!locked) move(pos() + event->globalPos() - oldPos);
if (!posLock) move(pos() + event->globalPos() - oldPos);
oldPos = event->globalPos();
}
void wheelEvent(QWheelEvent* event) override
{
int scroll = event->angleDelta().y();
if (scroll > 0 && historyIndex > 0) ui.display->setText(sentenceHistory[--historyIndex]);
if (scroll < 0 && historyIndex + 1 < sentenceHistory.size()) ui.display->setText(sentenceHistory[++historyIndex]);
if (scroll > 0 && historyIndex > 0) --historyIndex;
if (scroll < 0 && historyIndex + 1 < sentenceHistory.size()) ++historyIndex;
DisplaySentence();
}
bool locked, showOriginal, useDictionary;
int maxSentenceSize = 1000;
bool sizeLock, posLock, centeredText, autoResize, showOriginal, showOriginalAfterTranslation, useDictionary, clickThrough;
QPoint oldPos;
class
@ -309,10 +430,11 @@ private:
public:
bool CompareExchange(QLabel* display)
{
if (display->text() == text && display->font() == font && display->width() == width) return false;
if (display->text() == text && display->font() == font && display->width() == width && display->alignment() == alignment) return false;
text = display->text();
font = display->font();
width = display->width();
alignment = display->alignment();
return true;
}
@ -320,6 +442,7 @@ private:
QString text;
QFont font;
int width;
Qt::Alignment alignment;
} cachedDisplayInfo;
std::vector<QPoint> textPositionMap;

View File

@ -10,6 +10,9 @@
<height>300</height>
</rect>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="display">

View File

@ -14,7 +14,7 @@ const char* REGEX_SAVE_FILE = "SavedRegexFilters.txt";
std::optional<std::wregex> regex;
std::wstring replace = L"$1";
concurrency::reader_writer_lock m;
DWORD (*GetSelectedProcessId)() = nullptr;
DWORD (*GetSelectedProcessId)() = [] { return 0UL; };
class Window : public QDialog, Localizer
{

View File

@ -0,0 +1,72 @@
#include "extension.h"
#include "module.h"
#include "blockmarkup.h"
#include <fstream>
#include <process.h>
extern const wchar_t* REGEX_REPLACER_INSTRUCTIONS;
const char* REPLACE_SAVE_FILE = "SavedRegexReplacements.txt";
std::atomic<std::filesystem::file_time_type> replaceFileLastWrite = {};
concurrency::reader_writer_lock m;
std::vector<std::tuple<std::wregex, std::wstring, std::regex_constants::match_flag_type>> replacements;
void UpdateReplacements()
{
try
{
if (replaceFileLastWrite.exchange(std::filesystem::last_write_time(REPLACE_SAVE_FILE)) == std::filesystem::last_write_time(REPLACE_SAVE_FILE)) return;
std::scoped_lock lock(m);
replacements.clear();
std::ifstream stream(REPLACE_SAVE_FILE, std::ios::binary);
BlockMarkupIterator savedFilters(stream, Array<std::wstring_view>{ L"|REGEX|", L"|BECOMES|", L"|MODIFIER|" });
while (auto read = savedFilters.Next())
{
const auto& [regex, replacement, modifier] = read.value();
try
{
replacements.emplace_back(
std::wregex(regex, modifier.find(L'i') == std::string::npos ? std::regex::ECMAScript : std::regex::icase),
replacement,
modifier.find(L'g') == std::string::npos ? std::regex_constants::format_first_only : std::regex_constants::format_default
);
}
catch (std::regex_error) {}
}
}
catch (std::filesystem::filesystem_error) { replaceFileLastWrite.store({}); }
}
BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
UpdateReplacements();
if (replacements.empty())
{
auto file = std::ofstream(REPLACE_SAVE_FILE, std::ios::binary) << "\xff\xfe";
for (auto ch : std::wstring_view(REGEX_REPLACER_INSTRUCTIONS))
file << (ch == L'\n' ? std::string_view("\r\0\n", 4) : std::string_view((char*)&ch, 2));
SpawnThread([] { _spawnlp(_P_DETACH, "notepad", "notepad", REPLACE_SAVE_FILE, NULL); }); // show file to user
}
}
break;
case DLL_PROCESS_DETACH:
{
}
break;
}
return TRUE;
}
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
UpdateReplacements();
concurrency::reader_writer_lock::scoped_lock_read readLock(m);
for (const auto& [regex, replacement, flags] : replacements) sentence = std::regex_replace(sentence, regex, replacement, flags);
return true;
}

View File

@ -10,7 +10,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
{
wchar_t filePath[MAX_PATH];
GetModuleFileNameW(hModule, filePath, MAX_PATH);
if (wchar_t* fileName = wcsrchr(filePath, L'\\')) swscanf_s(fileName, L"\\Remove %d Repeated Sentences.dll", &sentenceCacheSize);
if (wchar_t* fileName = wcsrchr(filePath, L'\\')) swscanf_s(fileName, L"\\Remove %d Repeated Sentences.xdll", &sentenceCacheSize);
}
break;
case DLL_PROCESS_DETACH:

View File

@ -105,7 +105,7 @@ BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved
auto file = std::ofstream(REPLACE_SAVE_FILE, std::ios::binary) << "\xff\xfe";
for (auto ch : std::wstring_view(REPLACER_INSTRUCTIONS))
file << (ch == L'\n' ? std::string_view("\r\0\n", 4) : std::string_view((char*)&ch, 2));
_spawnlp(_P_DETACH, "notepad", "notepad", REPLACE_SAVE_FILE, NULL); // show file to user
SpawnThread([] { _spawnlp(_P_DETACH, "notepad", "notepad", REPLACE_SAVE_FILE, NULL); }); // show file to user
}
}
break;

View File

@ -4,7 +4,7 @@
extern const char* LOAD_SCRIPT;
constexpr auto STYLE_SAVE_FILE = u8"Textractor.css";
constexpr auto STYLE_SAVE_FILE = u8"Textractor.qss";
class Window : public QDialog, Localizer
{
@ -13,7 +13,8 @@ public:
{
connect(&loadButton, &QPushButton::clicked, this, &Window::LoadScript);
if (scriptEditor.toPlainText().isEmpty()) scriptEditor.setPlainText("/*https://doc.qt.io/qt-5/stylesheet-syntax.html*/");
if (scriptEditor.toPlainText().isEmpty())
scriptEditor.setPlainText("/*\nhttps://www.google.com/search?q=Qt+stylesheet+gallery\nhttps://doc.qt.io/qt-5/stylesheet-syntax.html\n*/");
layout.addWidget(&scriptEditor);
layout.addWidget(&loadButton);

View File

@ -18,6 +18,8 @@ extern const char* MAX_TRANSLATIONS_IN_TIMESPAN;
extern const char* TIMESPAN;
extern const char* MAX_SENTENCE_SIZE;
extern const char* API_KEY;
extern const wchar_t* SENTENCE_TOO_LARGE_TO_TRANS;
extern const wchar_t* TRANSLATION_ERROR;
extern const wchar_t* TOO_MANY_TRANS_REQUESTS;
extern const char* TRANSLATION_PROVIDER;
@ -34,7 +36,6 @@ namespace
{
Synchronized<TranslationParam> tlp;
Synchronized<std::unordered_map<std::wstring, std::wstring>> translationCache;
int savedSize = 0;
std::string CacheFile()
{
@ -46,7 +47,6 @@ namespace
for (const auto& [sentence, translation] : translationCache.Acquire().contents)
allTranslations.append(L"|SENTENCE|").append(sentence).append(L"|TRANSLATION|").append(translation).append(L"|END|\r\n");
std::ofstream(CacheFile(), std::ios::binary | std::ios::trunc).write((const char*)allTranslations.c_str(), allTranslations.size() * sizeof(wchar_t));
savedSize = translationCache->size();
}
void LoadCache()
{
@ -59,7 +59,6 @@ namespace
auto& [sentence, translation] = read.value();
translationCache->try_emplace(std::move(sentence), std::move(translation));
}
savedSize = translationCache->size();
}
}
@ -141,7 +140,7 @@ public:
private:
void SaveTranslateTo(QString language)
{
if (translationCache->size() > savedSize) SaveCache();
SaveCache();
settings.setValue(TRANSLATE_TO, S(tlp->translateTo = S(language)));
LoadCache();
}
@ -153,7 +152,7 @@ private:
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{
if (sentenceInfo["text number"] == 0 || sentence.size() > maxSentenceSize) return false;
if (sentenceInfo["text number"] == 0) return false;
static class
{
@ -166,20 +165,15 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
tokens.push(token); // popped one too many
break;
}
tokens.push(current);
return tokens.size() <= tokenCount;
bool available = tokens.size() < tokenCount;
if (available) tokens.push(current);
return available;
}
private:
concurrency::concurrent_priority_queue<DWORD64, std::greater<DWORD64>> tokens;
} rateLimiter;
auto Trim = [](std::wstring& text)
{
text.erase(text.begin(), std::find_if_not(text.begin(), text.end(), iswspace));
text.erase(std::find_if_not(text.rbegin(), text.rend(), iswspace).base(), text.end());
};
bool cache = false;
std::wstring translation;
if (useFilter)
@ -187,20 +181,22 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
Trim(sentence);
sentence.erase(std::remove_if(sentence.begin(), sentence.end(), [](wchar_t ch) { return ch < ' ' && ch != '\n'; }), sentence.end());
}
if (sentence.empty()) return true;
if (sentence.size() > maxSentenceSize) translation = SENTENCE_TOO_LARGE_TO_TRANS;
if (useCache)
{
auto translationCache = ::translationCache.Acquire();
if (auto it = translationCache->find(sentence); it != translationCache->end()) translation = it->second + L"\x200b"; // dumb hack to not try to translate if stored empty translation
if (auto it = translationCache->find(sentence); it != translationCache->end()) translation = it->second;
}
if (translation.empty() && (!translateSelectedOnly || sentenceInfo["current select"]))
if (rateLimiter.Request() || !useRateLimiter || (!rateLimitSelected && sentenceInfo["current select"])) std::tie(cache, translation) = Translate(sentence, tlp.Copy());
else translation = TOO_MANY_TRANS_REQUESTS;
if (useFilter) Trim(translation);
if (cache) translationCache->try_emplace(sentence, translation);
if (cache && translationCache->size() > savedSize + 50) SaveCache();
if (cache) translationCache->operator[](sentence) = translation;
if (useFilter) Trim(translation);
for (int i = 0; i < translation.size(); ++i) if (translation[i] == '\r' && translation[i + 1] == '\n') translation[i] = 0x200b; // for some reason \r appears as newline - no need to double
if (!translation.empty()) (sentence += L"\x200b \n") += translation;
if (translation.empty()) translation = TRANSLATION_ERROR;
(sentence += L"\x200b \n") += translation;
return true;
}

View File

@ -1,9 +1,4 @@
# The CLI isn't used by Textractor itself, but is here for other people that want to build projects on top of Textractor
add_executable(TextractorCLI
cli.cpp
exception.cpp
host.cpp
textthread.cpp
hookcode.cpp
)
add_executable(TextractorCLI main.cpp)
target_precompile_headers(TextractorCLI REUSE_FROM pch)
target_link_libraries(TextractorCLI host)

View File

@ -1,5 +1,5 @@
#include "host.h"
#include "hookcode.h"
#include "../host.h"
#include "../hookcode.h"
#include <io.h>
#include <fcntl.h>
#include <iostream>

8
host/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
add_library(host
host.cpp
textthread.cpp
hookcode.cpp
)
target_precompile_headers(host REUSE_FROM pch)
add_subdirectory(CLI)

View File

@ -276,7 +276,9 @@ namespace HookCode
{
std::optional<HookParam> Parse(std::wstring code)
{
if (code[0] == L'/') code.erase(0, 1); // legacy/AGTH compatibility
if (code[0] == L'/') code.erase(0, 1);
code.erase(std::find(code.begin(), code.end(), L'/'), code.end()); // legacy/AGTH compatibility
Trim(code);
if (code[0] == L'R') return ParseRCode(code.erase(0, 1));
else if (code[0] == L'H') return ParseHCode(code.erase(0, 1));
return {};
@ -292,6 +294,7 @@ namespace HookCode
assert(HexString(-12) == L"-C"),
assert(HexString(12) == L"C"),
assert(Parse(L"/HQN936#-c*C:C*1C@4AA:gdi.dll:GetTextOutA")),
assert(Parse(L"/HQN936#-c*C:C*1C@4AA:gdi.dll:GetTextOutA /KF")),
assert(Parse(L"HB4@0")),
assert(Parse(L"/RS65001#@44")),
assert(Parse(L"HQ@4")),

View File

@ -76,7 +76,19 @@ private:
M m;
};
static struct // should be inline but MSVC (linker) is bugged
template <typename F>
void SpawnThread(const F& f) // works in DllMain unlike std thread
{
F* copy = new F(f);
CloseHandle(CreateThread(nullptr, 0, [](void* copy)
{
(*(F*)copy)();
delete (F*)copy;
return 0UL;
}, copy, 0, nullptr));
}
inline struct
{
inline static BYTE DUMMY[100];
template <typename T> operator T*() { static_assert(sizeof(T) < sizeof(DUMMY)); return (T*)DUMMY; }
@ -108,6 +120,12 @@ inline std::wstring FormatString(const wchar_t* format, const Args&... args)
}
#pragma warning(pop)
inline void Trim(std::wstring& text)
{
text.erase(text.begin(), std::find_if_not(text.begin(), text.end(), iswspace));
text.erase(std::find_if_not(text.rbegin(), text.rend(), iswspace).base(), text.end());
}
inline std::optional<std::wstring> StringToWideString(const std::string& text, UINT encoding)
{
std::vector<wchar_t> buffer(text.size() + 1);
@ -134,7 +152,7 @@ template <typename... Args>
inline void TEXTRACTOR_MESSAGE(const wchar_t* format, const Args&... args) { MessageBoxW(NULL, FormatString(format, args...).c_str(), L"Textractor", MB_OK); }
template <typename... Args>
inline void TEXTRACTOR_DEBUG(const wchar_t* format, const Args&... args) { std::thread([=] { TEXTRACTOR_MESSAGE(format, args...); }).detach(); }
inline void TEXTRACTOR_DEBUG(const wchar_t* format, const Args&... args) { SpawnThread([=] { TEXTRACTOR_MESSAGE(format, args...); }); }
void Localize();

View File

@ -10,7 +10,8 @@ DefaultGroupName=Textractor
MinVersion=6.1
OutputBaseFilename=Textractor-{#VERSION}-Setup
OutputDir=Builds
PrivilegesRequired=lowest
PrivilegesRequired=admin
PrivilegesRequiredOverridesAllowed=dialog
SolidCompression=yes
Uninstallable=no
@ -41,3 +42,4 @@ Source: "Builds\Textractor-Thai-{#VERSION}\*"; DestDir: "{app}"; Languages: th;
Source: "Builds\Textractor-Korean-{#VERSION}\*"; DestDir: "{app}"; Languages: ko; Flags: recursesubdirs ignoreversion
Source: "Builds\Textractor-Italian-{#VERSION}\*"; DestDir: "{app}"; Languages: it; Flags: recursesubdirs ignoreversion
Source: "Builds\Textractor-French-{#VERSION}\*"; DestDir: "{app}"; Languages: fr; Flags: recursesubdirs ignoreversion
Source: "INSTALL_THIS_UNICODE_FONT.ttf"; DestDir: "{autofonts}"; DestName: "ARIAL_UNICODE_MS.ttf"; FontInstall: "Arial Unicode MS";

209
text.cpp
View File

@ -33,8 +33,8 @@ const char* SETTINGS = u8"Settings";
const char* EXTENSIONS = u8"Extensions";
const char* SELECT_PROCESS = u8"Select process";
const char* ATTACH_INFO = u8R"(If you don't see the process you want to attach, try running with admin rights
You can also type in the process id)";
const char* SELECT_PROCESS_INFO = u8"If you manually type in the process file name, please use the absolute path";
You can also type in the process ID)";
const char* SELECT_PROCESS_INFO = u8"If you manually type in the process file name, use the absolute path";
const char* FROM_COMPUTER = u8"Select from computer";
const char* PROCESSES = u8"Processes (*.exe)";
const char* CODE_INFODUMP = u8R"(Enter read code
@ -99,14 +99,14 @@ const wchar_t* CONSOLE = L"Console";
const wchar_t* CLIPBOARD = L"Clipboard";
const wchar_t* ABOUT = L"Textractor " ARCH L" v" VERSION LR"( made by Artikash (email: akashmozumdar@gmail.com)
Project homepage: https://github.com/Artikash/Textractor
Tutorial video: https://tinyurl.com/textractor-tutorial
Tutorial video: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
FAQ: https://github.com/Artikash/Textractor/wiki/FAQ
Please contact Artikash with any problems, feature requests, or questions relating to Textractor
You can do so via the project homepage (issues section) or via email
Source code available under GPLv3 at project homepage
If you like this project, please tell everyone about it! It's time to put AGTH down :))";
const wchar_t* CL_OPTIONS = LR"(usage: Textractor [-p{process id|"process name"}]...
example: Textractor -p4466 -p"My Game.exe" tries to inject processes with id 4466 or with name My Game.exe)";
const wchar_t* CL_OPTIONS = LR"(usage: Textractor [-p{process ID|"process name"}]...
example: Textractor -p4466 -p"My Game.exe" tries to inject processes with ID 4466 or with name My Game.exe)";
const wchar_t* UPDATE_AVAILABLE = L"Update available: download it from https://github.com/Artikash/Textractor/releases";
const wchar_t* ALREADY_INJECTED = L"Textractor: already injected";
const wchar_t* NEED_32_BIT = L"Textractor: architecture mismatch: only Textractor x86 can inject this process";
@ -143,6 +143,7 @@ const char* RATE_LIMIT_SELECTED_THREAD = u8"Rate limit selected text thread";
const char* USE_TRANS_CACHE = u8"Use translation cache";
const char* MAX_TRANSLATIONS_IN_TIMESPAN = u8"Max translation requests in timespan";
const char* TIMESPAN = u8"Timespan (ms)";
const wchar_t* SENTENCE_TOO_LARGE_TO_TRANS = L"Sentence too large to translate";
const wchar_t* TOO_MANY_TRANS_REQUESTS = L"Rate limit exceeded: refuse to make more translation requests";
const wchar_t* TRANSLATION_ERROR = L"Error while translating";
const char* USE_PREV_SENTENCE_CONTEXT = u8"Use previous sentence as context";
@ -150,13 +151,12 @@ const char* API_KEY = u8"API key";
const char* CHROME_LOCATION = u8"Google Chrome file location";
const char* START_DEVTOOLS = u8"Start DevTools";
const char* STOP_DEVTOOLS = u8"Stop DevTools";
const char* HEADLESS_MODE = u8"Headless mode";
const char* HIDE_CHROME = u8"Hide Chrome window";
const char* DEVTOOLS_STATUS = u8"DevTools status";
const char* AUTO_START = u8"Start automatically";
const wchar_t* ERROR_START_CHROME = L"failed to start Chrome or to connect to it";
const char* EXTRA_WINDOW_INFO = u8R"(Right click to change settings
Click and drag on window edges to move, or the bottom right corner to resize)";
const char* SENTENCE_TOO_BIG = u8"Sentence too large to display";
const char* MAX_SENTENCE_SIZE = u8"Max sentence size";
const char* TOPMOST = u8"Always on top";
const char* DICTIONARY = u8"Dictionary";
@ -178,7 +178,13 @@ This file must be encoded in UTF-8.)";
const char* SHOW_ORIGINAL = u8"Original text";
const char* SHOW_ORIGINAL_INFO = u8R"(Original text will not be shown
Only works if this extension is used directly after a translation extension)";
const char* ORIGINAL_AFTER_TRANSLATION = u8"Original text after translation";
const char* SIZE_LOCK = u8"Size lock";
const char* POSITION_LOCK = u8"Position lock";
const char* CENTERED_TEXT = u8"Centered text";
const char* AUTO_RESIZE_WINDOW_HEIGHT = u8"Auto resize window height";
const char* CLICK_THROUGH = u8"Click through\tAlt+X";
const char* HIDE_MOUSEOVER = u8"Hide while mouse on top";
const char* OPACITY = u8"Opacity";
const char* BG_COLOR = u8"Background color";
const char* TEXT_COLOR = u8"Text color";
@ -201,7 +207,7 @@ Modifications to global variables from ProcessSentence are not guaranteed to per
Properties in sentenceInfo:
"current select": 0 unless sentence is in the text thread currently selected by the user.
"process id": process id that the sentence is coming from. 0 for console and clipboard.
"process id": process ID that the sentence is coming from. 0 for console and clipboard.
"text number": number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.
--]]
function ProcessSentence(sentence, sentenceInfo)
@ -219,6 +225,17 @@ All text in this file outside of a replacement command is ignored.
A caret (^) acts as a wildcard that matches any other single character.
Whitespace in original_text is ignored, but replacement_text can contain spaces, newlines, etc.
This file must be encoded in Unicode (UTF-16 Little Endian).)";
const wchar_t* REGEX_REPLACER_INSTRUCTIONS = LR"(This file only does anything when the "Regex Replacer" extension is used.
Replacement commands must be formatted like this:
|REGEX|regular_expression|BECOMES|replacement_text|MODIFIER|modifiers|END|
replacement_text can reference capture groups with a $ followed by their number (e.g. $1 references first capture group).
modifiers can contain the following:
"g" the replacement is global.
"i" the replacement ignores the case.
If empty the replacement is only for the first match and case sensitive.
All text in this file outside of a replacement command is ignored.
This file must be encoded in Unicode (UTF-16 Little Endian).
Learn, build, & test Regular Expressions: https://regexr.com/)";
const char* THREAD_LINKER = u8"Thread Linker";
const char* LINK = u8"Link";
const char* UNLINK = u8"Unlink";
@ -288,7 +305,7 @@ Presiona supr en una extension seleccionada para removerla)";
CLIPBOARD = L"Portapapeles";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( hecho por mí: Artikash (correo: akashmozumdar@gmail.com)
Página del proyecto: https://github.com/Artikash/Textractor
Video tutorial: https://tinyurl.com/textractor-tutorial
Video tutorial: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
No dudes en conectarme si tienes algún problema, petición de característica o preguntas relacionadas con Textractor
Puedes hacerlo en la página del proyecto (en el apartado de "Issues") o por correo. Usa el inglés para comunicarte.
Código fuente disponible bajo GPLv3 en la página del proyecto)";
@ -337,28 +354,30 @@ Clic y arrastra los bordes de la ventana para moverla, o en la esquina inferior
SETTINGS = u8"设置";
EXTENSIONS = u8"扩展";
SELECT_PROCESS = u8"选择进程";
ATTACH_INFO = u8R"(如果没看见想要附加的进程,尝试使用管理员权限运行
ATTACH_INFO = u8R"(如果没看见想要附加的进程,尝试使用管理员权限运行Textractor
ID)";
SELECT_PROCESS_INFO = u8"如果手动输入游戏名,请使用绝对路径";
FROM_COMPUTER = u8"计算机中选择";
PROCESSES = u8"进程 (*.exe)";
FROM_COMPUTER = u8"资源管理器中选择";
PROCESSES = u8"可执行文件 (*.exe)";
SAVE_SETTINGS = u8"保存设置";
EXTEN_WINDOW_INSTRUCTIONS = u8R"(从计算机拖拽扩展 (.dll) 文件到这里来添加
(使)
使 delete )";
EXTEN_WINDOW_INSTRUCTIONS = u8R"(在列表中单击右键以添加或移除扩展
,
)";
ADD_EXTENSION = u8"添加扩展";
REMOVE_EXTENSION = u8"移除扩展";
INVALID_EXTENSION = u8"%1 是一个无效扩展";
CONFIRM_EXTENSION_OVERWRITE = u8"此扩展的另一个版本已启用,是否删除并覆盖它?";
EXTENSION_WRITE_ERROR = u8"保存扩展失败";
USE_JP_LOCALE = u8"模拟日本区域设置?";
FAILED_TO_CREATE_CONFIG_FILE = u8"无法创建配置文件 \"%1\"";
HOOK_SEARCH_UNSTABLE_WARNING = u8"搜索钩子的功能是不稳定的! 可能会导致你的游戏崩溃! ";
HOOK_SEARCH_STARTING_VIEW_CONSOLE = u8"正在初始化钩子搜索 - 请查看控制台以获取更多提示";
SEARCH_CJK = u8"搜索中文/日文/韩文";
SEARCH_PATTERN = u8"搜索匹配特征 (hex byte array)";
SEARCH_DURATION = u8"搜索持续时间 (ms)";
SEARCH_MODULE = u8"搜索指定模块";
PATTERN_OFFSET = u8"相对于特征地址的偏移值";
MAX_HOOK_SEARCH_RECORDS = u8"搜索结果上限";
MAX_HOOK_SEARCH_RECORDS = u8"搜索结果达到上限";
MIN_ADDRESS = u8"起始地址 (hex)";
MAX_ADDRESS = u8"结束地址 (hex)";
STRING_OFFSET = u8"字符串偏移值 (hex)";
@ -372,7 +391,7 @@ Clic y arrastra los bordes de la ventana para moverla, o en la esquina inferior
DOUBLE_CLICK_TO_REMOVE_HOOK = u8"双击移除不需要的钩子";
FILTER_REPETITION = u8"过滤重复文本";
AUTO_ATTACH = u8"自动附加";
ATTACH_SAVED_ONLY = u8"自动附加 (saved only)";
ATTACH_SAVED_ONLY = u8"自动附加 (仅限保存过配置的游戏)";
SHOW_SYSTEM_PROCESSES = u8"显示系统进程";
DEFAULT_CODEPAGE = u8"默认代码页";
FLUSH_DELAY = u8"刷新延迟";
@ -383,9 +402,9 @@ Clic y arrastra los bordes de la ventana para moverla, o en la esquina inferior
CLIPBOARD = L"剪贴板";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( 作者: Artikash (email: akashmozumdar@gmail.com)
: https://github.com/Artikash/Textractor
: https://tinyurl.com/textractor-tutorial
: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Textractor
()
(Issues )
GPLv3 )";
UPDATE_AVAILABLE = L"有可用的更新: 请从 https://github.com/Artikash/Textractor/releases 下载";
ALREADY_INJECTED = L"Textractor: 已经注入";
@ -401,7 +420,8 @@ Clic y arrastra los bordes de la ventana para moverla, o en la esquina inferior
HOOK_FAILED = u8"Textractor: 钩子注入失败";
TOO_MANY_HOOKS = u8"Textractor: 钩子数量已达上限: 无法注入";
HOOK_SEARCH_STARTING = u8"Textractor: 开始搜索钩子";
NOT_ENOUGH_TEXT = u8"Textractor: 没有足够的文本用来精确搜索";
HOOK_SEARCH_INITIALIZING = u8"Textractor: 初始化钩子搜索 (%f%%)";
NOT_ENOUGH_TEXT = u8"Textractor: 文本长度不足, 无法精确搜索";
HOOK_SEARCH_INITIALIZED = u8"Textractor: 搜索初始化完成, 创建了 %zd 个钩子";
MAKE_GAME_PROCESS_TEXT = u8"Textractor: 请点击游戏区域, 在接下来的 %d 秒内使游戏强制处理文本";
HOOK_SEARCH_FINISHED = u8"Textractor: 钩子搜索完毕, 找到了 %d 条结果";
@ -414,47 +434,65 @@ Clic y arrastra los bordes de la ventana para moverla, o en la esquina inferior
HIJACK_ERROR = u8"Textractor: Hijack 错误";
COULD_NOT_FIND = u8"Textractor: 无法找到文本";
TRANSLATE_TO = u8"翻译为";
TRANSLATE_FROM = u8"原文语言";
FILTER_GARBAGE = u8"过滤无意义字符";
TRANSLATE_SELECTED_THREAD_ONLY = u8"仅翻译当前选择的文本线程";
RATE_LIMIT_ALL_THREADS = u8"限制所有文本线程的请求频率";
RATE_LIMIT_SELECTED_THREAD = u8"限制当前选择线程的请求频率";
RATE_LIMIT_ALL_THREADS = u8"限制请求频率";
RATE_LIMIT_SELECTED_THREAD = u8"限制选中线程的请求频率";
USE_TRANS_CACHE = u8"使用缓存的翻译结果";
MAX_TRANSLATIONS_IN_TIMESPAN = u8"限流器令牌";
TIMESPAN = u8"限流器令牌重置时间 (ms)";
TOO_MANY_TRANS_REQUESTS = L"太多翻译请求: 拒绝生成更多";
MAX_TRANSLATIONS_IN_TIMESPAN = u8"单位时间内最大请求次";
TIMESPAN = u8"单位时间长度 (ms)";
TOO_MANY_TRANS_REQUESTS = L"超出频率限制: 拒绝发出翻译请求";
TRANSLATION_ERROR = L"翻译时出错";
USE_PREV_SENTENCE_CONTEXT = u8"使用之前的句子作为上下文";
API_KEY = u8"API key";
EXTRA_WINDOW_INFO = u8R"(右键修改设置
)";
SENTENCE_TOO_BIG = u8"文本过长无法显示";
CHROME_LOCATION = u8"Google Chrome 安装位置";
START_DEVTOOLS = u8"启动 DevTools";
STOP_DEVTOOLS = u8"停止 DevTools";
HIDE_CHROME = u8"隐藏 Chrome 窗口";
DEVTOOLS_STATUS = u8"DevTools 状态";
AUTO_START = u8"自动启动";
ERROR_START_CHROME = L"无法启动或连接到 Chrome";
EXTRA_WINDOW_INFO = u8R"(在此点击右键以修改设置
, )";
MAX_SENTENCE_SIZE = u8"最大文本长度";
TOPMOST = u8"窗口总是置顶";
DICTIONARY = u8"字典";
SHOW_ORIGINAL = u8"显示原文";
SHOW_ORIGINAL_INFO = u8R"(将不显示原文
使)";
OPACITY = u8"透明度";
SHOW_ORIGINAL_INFO = u8R"(原文将被隐藏
使)";
ORIGINAL_AFTER_TRANSLATION = u8"把原文显示在翻译文本的后面";
SIZE_LOCK = u8"锁定窗口大小";
POSITION_LOCK = u8"锁定窗口位置";
CENTERED_TEXT = u8"居中显示文本";
AUTO_RESIZE_WINDOW_HEIGHT = u8"自动改变窗口高度";
CLICK_THROUGH = u8"点击穿透\tAlt+X";
HIDE_MOUSEOVER = u8"鼠标经过时隐藏窗口";
OPACITY = u8"透明度";
BG_COLOR = u8"背景颜色";
TEXT_COLOR = u8"文本颜色";
TEXT_OUTLINE = u8"文字边框";
OUTLINE_COLOR = u8"边框颜色";
OUTLINE_SIZE = u8"边框大小";
OUTLINE_SIZE_INFO = u8"以像素为单位的大小(建议保持在字体大小的20%以下)";
TEXT_OUTLINE = u8"文字";
OUTLINE_COLOR = u8"文字描边颜色";
OUTLINE_SIZE = u8"文字描边大小";
OUTLINE_SIZE_INFO = u8"描边的单位为px (建议保持在字体大小的20%以下)";
FONT = u8"字体";
LUA_INTRO = u8R"(--[[
ProcessSentence Textractor每接收到一句文本时都会调用的函数
sentence: Textractor接收到的文本 (UTF-8)
sentenceInfo: table
nil
使Lua解释器的副本用于保证线程安全
ProcessSentence函数中对全局变量的修改可能不会生效
sentenceInfo有以下成员:
"current select": 线0
"process id": id. 0 线
"text number": 线id. 线 0 , 1
ProcessSentence Textractor每接收到一句文本时都会调用的函数.
sentence: Textractor接收到的文本 (UTF-8), string.
sentenceInfo: , tabel.
.
nil, .
使Lua解释器的副本用于保证线程安全.
ProcessSentence .
sentenceInfo :
current select: 线, 0. number.
process id: ID. 0 线. number.
text number: 线ID. 线. 0 , 1 . number.
--]]
function ProcessSentence(sentence, sentenceInfo)
--...
end)";
@ -466,13 +504,28 @@ end)";
REPLACER_INSTRUCTIONS = LR"(使用"Replace"扩展时会使用此文件
:
|ORIG||BECOMES||END|
.
.
^ .
.
使Unicode字符集(UTF-16 little endian).)";
使 Unicode (UTF-16 little endian).)";
REGEX_REPLACER_INSTRUCTIONS = LR"(使用"Regex Replace"扩展时会使用此文件
:
|REGEX||BECOMES||MODIFIER||END|
$[] (: $1 1).
:
g .
i .
, 1, .
.
使 Unicode (UTF-16 little endian).
线:
https://www.runoob.com/regexp/regexp-intro.html
https://regexr.com/)";
THREAD_LINKER = u8"线程链接器";
LINK = u8"链接";
THREAD_LINK_FROM = u8"需要链接的线程id";
THREAD_LINK_TO = u8"链接到的线程id";
UNLINK = u8"断开";
THREAD_LINK_FROM = u8"需要链接的线程ID";
THREAD_LINK_TO = u8"链接到的线程ID";
HEXADECIMAL = u8"十六进制";
#endif // SIMPLIFIED_CHINESE
@ -491,7 +544,7 @@ end)";
EXTENSIONS = u8"Расширения";
SELECT_PROCESS = u8"Выберете процесс";
ATTACH_INFO = u8R"(Если вы не видите процесс, к которому хотите присоединить, попробуйте запуск с правами администратора
Вы также можете ввести id процесса)";
Вы также можете ввести ID процесса)";
SELECT_PROCESS_INFO = u8"При ручном вводе имени файла процесса используйте абсолютный путь";
FROM_COMPUTER = u8"Найти в проводнике";
PROCESSES = u8"Процессы (*.exe)";
@ -556,13 +609,13 @@ padding: длина добавочных данных перед строкой
CLIPBOARD = L"Буфер обмена";
ABOUT = L"Textractor " ARCH L" в." VERSION LR"( автор: Artikash (email: akashmozumdar@gmail.com)
Домашняя страница: https://github.com/Artikash/Textractor
Обучающее видео: https://tinyurl.com/textractor-tutorial
Обучающее видео: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Сообщайте о любых проблемах, желаемых для добавления функциях, или задавайте вопросы, касающиеся Textractor
Сделать это вы можете на домашней странице (секция issues) или через электронную почту
Исходный код доступен по лицензии GPLv3 на домашней странице проекта
Если эта программа вам понравилась, расскажите всем о ней :))";
CL_OPTIONS = LR"(использование: Textractor [-p{process id|"process name"}]...
пример: Textractor -p4466 -p"My Game.exe" попробует присоединиться к процессу с id 4466 или с именем My Game.exe)";
CL_OPTIONS = LR"(использование: Textractor [-p{process ID|"process name"}]...
пример: Textractor -p4466 -p"My Game.exe" попробует присоединиться к процессу с ID 4466 или с именем My Game.exe)";
UPDATE_AVAILABLE = L"Доступно обновление: загрузите его на https://github.com/Artikash/Textractor/releases";
ALREADY_INJECTED = L"Textractor: уже присоединен";
NEED_32_BIT = L"Textractor: несоответствие архитектуры: попробуйте Textractor x86 вместо этого";
@ -601,7 +654,6 @@ padding: длина добавочных данных перед строкой
API_KEY = u8"Ключ API";
EXTRA_WINDOW_INFO = u8R"(Правый клик для изменения настроек
Нажмите и перетащите за края - для перемещения, или за правый-нижний угол - для изменения размера)";
SENTENCE_TOO_BIG = u8"Предложение слишком длинное для отображения";
MAX_SENTENCE_SIZE = u8"Максимальная длина предложения";
TOPMOST = u8"Поверх всех окон";
DICTIONARY = u8"Словарь";
@ -646,7 +698,7 @@ Param sentenceInfo: таблица различной информации о п
Параметры в sentenceInfo:
"current select": равно 0, если предложение не находится в текстовой нити, выбранной в данный момент пользователем.
"process id": id процесса, из которого предложение поступило. Равно 0, когда это консоль или буфер обмена.
"process id": ID процесса, из которого предложение поступило. Равно 0, когда это консоль или буфер обмена.
"text number": номер текущей текстовой нити. Растет один за другим по мере создания текстовых нитей. 0 для консоли, 1 для буфера обмена.
--]]
function ProcessSentence(sentence, sentenceInfo)
@ -680,7 +732,7 @@ end)";
EXTENSIONS = u8"Ekstensi";
SELECT_PROCESS = u8"Pilih Proses";
ATTACH_INFO = u8R"(Jika kamu tidak dapat melihat proses yang akan ditempelkan, coba menjalankan dengan mode administrator
Kamu juga dapat mengetik process id game yang akan ditempel)";
Kamu juga dapat mengetik process ID game yang akan ditempel)";
FROM_COMPUTER = u8"Pilih dari komputer";
PROCESSES = u8"Proses (*.exe)";
SAVE_SETTINGS = u8"Simpan pengaturan";
@ -696,7 +748,7 @@ Tekan delete pada ekstensi yang dipilih untuk menghapus ekstensi)";
CLIPBOARD = L"Papan clipboard";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( dibuat oleh saya: Artikash (email: akashmozumdar@gmail.com)
Halaman project: https://github.com/Artikash/Textractor
Video tutorial : https://tinyurl.com/textractor-tutorial
Video tutorial : https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Tolong hubungi saya jika kamu memiliki masalah terkait masalah, permintaan fitur, atau pertanyaan terkait Textractor
Kamu dapat melakukannya lewat halaman utama project (bagian issues) atau lewat email
Source code tersedia dibawah lisensi GPLv3 di halaman utama project
@ -813,13 +865,13 @@ Per rimuovere un estenzione, selezionala e premi rimuovi)";
CLIPBOARD = L"Appunti";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( creato da me: Artikash (email: akashmozumdar@gmail.com)
Pagina principale del progetto: https://github.com/Artikash/Textractor
Video tutorial: https://tinyurl.com/textractor-tutorial
Video tutorial: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Contattatemi per ogni problema, richiesta futura, o domande legate a Textractor
Puoi farlo attraverso la pagina principale del progetto (sezione issues) o via email
Il codice sorgente è disponibile sotto il GPLv3 nella pagina principale
Al momento sono in cerca di un nuovo lavoro: contattatemi per email se conoscete qualcuno che ingaggia periti informatici statunitensi
Se ti piace questo progetto, parlane con tutti per favore :))";
CL_OPTIONS = LR"(utilizzo: Textractor [-p{process id|"process name"}]...
CL_OPTIONS = LR"(utilizzo: Textractor [-p{process ID|"process name"}]...
esempio: Textractor -p4466 -p"My Game.exe" sta tentando di inniettare i processi con l'ID 4466 o con il nome My Game.exe)";
UPDATE_AVAILABLE = L"Aggiornamento disponibile: scaricala da https://github.com/Artikash/Textractor/releases";
ALREADY_INJECTED = L"Textractor: già inniettato";
@ -860,7 +912,6 @@ esempio: Textractor -p4466 -p"My Game.exe" sta tentando di inniettare i processi
API_KEY = u8"Chiave API";
EXTRA_WINDOW_INFO = u8R"(Tasto destro per cambiare le impostazioni
Clicca e trascina i bordi della finestra per muoverla, oppure nell'angolo in basso a destra per ridimensionare)";
SENTENCE_TOO_BIG = u8"Sentenza troppo grande da visualizzare";
MAX_SENTENCE_SIZE = u8"Dimensione massima sentenza";
TOPMOST = u8"Sempre in primo piano";
DICTIONARY = u8"Dizionario";
@ -883,7 +934,13 @@ Questo file deve essere codificato in UTF-8.)";
SHOW_ORIGINAL = u8"Testo originale";
SHOW_ORIGINAL_INFO = u8R"(Testo originale non sarà mostrato
Funziona solo se questa estenzione è usata direttamente dopo un'estensione di traduzione)";
ORIGINAL_AFTER_TRANSLATION = u8"Mostra testo originale dopo traduzione";
SIZE_LOCK = u8"Lock delle dimensione";
POSITION_LOCK = u8"Lock delle posizione";
CENTERED_TEXT = u8"Testo centrato";
AUTO_RESIZE_WINDOW_HEIGHT = u8"Auto resize altezza finestra";
CLICK_THROUGH = u8"Clicca attraverso\tAlt+X";
HIDE_MOUSEOVER = u8"Nascondi testo mouseover";
OPACITY = u8"Opacità";
BG_COLOR = u8"Colore dello sfondo";
TEXT_COLOR = u8"Colore del testo";
@ -906,7 +963,7 @@ Modifiche alle variabili globali da ProcessSentence non sono garantite di persis
Proprietà in sentenceInfo:
"current select": 0 a meno che la sentenza è nel thread di testo attualmente scelto dall'utente.
"process id": id del processo che da cui proviene la sentenza. 0 per console e per appunti.
"process id": ID del processo che da cui proviene la sentenza. 0 per console e per appunti.
"text number": numero dell'attuale thread di testo. Conta uno ad uno quando i thread di testo sono creati. 0 per console, 1 per appunti.
--]]
function ProcessSentence(sentence, sentenceInfo)
@ -923,6 +980,17 @@ I comandi di rimpiazzo devono essere formattati cosi:
Tutto il testo in questo file all'infuori di un comando di rimpiazzo è ignorato.
La spaziatura nel testo_originale è ignorato, ma testo_sostituito può contenere spaziature, ritorni a capo, ecc.
Questo file deve essere codificato in Unicode (UTF-16 Little Endian).)";
REGEX_REPLACER_INSTRUCTIONS = LR"(Questo file fa qualcosa solo quando l'estenzione "Regex Replacer" è utilizzata.
I comandi di sostituzione devono essere formattati cosi:
|REGEX|espressione_regolare|BECOMES|testo_sostituito|MODIFIER|modificatori|END|
Il parametro "MODIFIER" può contenere i seguenti modificatori:
"g" la sostituzione è globale.
"i" la sostituzione ignora maiuscole/minuscole.
Se il modificatore è vuoto, la sostituzione viene applicata alla sola prima corrispondenza
e fa distinzione tra maiuscole e minuscole.
Tutto il testo in questo file all'infuori di un comando di sostituzione è ignorato.
Questo file deve essere codificato in Unicode (UTF-16 Little Endian).
Apprendere, creare e testare Espressioni Regolari: https://regexr.com/)";
THREAD_LINKER = u8"Collegatore di thread";
LINK = u8"Collegamento";
THREAD_LINK_FROM = u8"Numero di thread da cui collegarsi";
@ -962,7 +1030,7 @@ Pressione delete com uma extensão selecionada para removê-la.)";
CLIPBOARD = L"Área de Transferência";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( Feito por mim: Artikash (e-mail: akashmozumdar@gmail.com)
Homepage do Projeto: https://github.com/Artikash/Textractor
Vídeo Tutorial: https://tinyurl.com/textractor-tutorial
Vídeo Tutorial: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Por favor, em caso de problemas, requisição de recurso e/ou funções e de dúvidas, entrar em contato comigo. Use o Inglês para se comunicar.
Você pode fazê-lo por meio da Homepage do Projeto (na aba "Issues") ou via E-mail.
O código-fonte se encontra disponível na Homepage do projeto sob a licença GPLv3.
@ -1039,7 +1107,7 @@ Esse arquívo deve ser codifícado em (UTF-16 little endian).)";
CLIPBOARD = L"ข้อมูลชั่วคราว";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( ได้ถูกพัฒนาโดย: Artikash (email: akashmozumdar@gmail.com)
: https://github.com/Artikash/Textractor
: https://tinyurl.com/textractor-tutorial
: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
Textractor
Issue
Source code GPLv3 )";
@ -1089,7 +1157,7 @@ Source code สามารถหาได้จากส่วนของ GPLv
SETTINGS = u8"설정";
EXTENSIONS = u8"확장기능";
SELECT_PROCESS = u8"프로세스 선택";
ATTACH_INFO = u8R"(부착하려는 게임이 보이지 않는다면, 관리자 권한으로 실행해보세요. 프로세스 id를 입력 할 수도 있습니다.)";
ATTACH_INFO = u8R"(부착하려는 게임이 보이지 않는다면, 관리자 권한으로 실행해보세요. 프로세스 ID를 입력 할 수도 있습니다.)";
SELECT_PROCESS_INFO = u8"직접 프로세스파일 이름을 타이핑한다면, 정확한 경로를 입력하세요";
FROM_COMPUTER = u8"컴퓨터로부터 선택";
PROCESSES = u8"프로세스 (*.exe)";
@ -1233,14 +1301,14 @@ Pour supprimer une extension, sélectionnez-la et appuyez sur supprimer)";
CLIPBOARD = L"Presse-papier";
ABOUT = L"Textractor " ARCH L" v" VERSION LR"( Fait par moi: Artikash (email: akashmozumdar@gmail.com)
Page d'acceuil du projet: https://github.com/Artikash/Textractor
Vidéo tuto: https://tinyurl.com/textractor-tutorial
Vidéo tuto: https://github.com/Artikash/Textractor/blob/master/docs/TUTORIAL.md
FAQ: https://github.com/Artikash/Textractor/wiki/FAQ
Veuillez me contacter pour tout problème, demande de fonctionnalité ou question concernant Textractor
Vous pouvez le faire via la page d'accueil du projet (section problèmes) ou par e-mail
Code source disponible sous GPLv3 sur la page d'accueil du projet
Si vous aimez ce projet, parlez-en à tout le monde :))";
CL_OPTIONS = LR"(usage: Textractor [-p{process id|"process name"}]...
example: Textractor -p4466 -p"My Game.exe" tries to inject processes with id 4466 or with name My Game.exe)";
CL_OPTIONS = LR"(usage: Textractor [-p{process ID|"process name"}]...
example: Textractor -p4466 -p"My Game.exe" tries to inject processes with ID 4466 or with name My Game.exe)";
UPDATE_AVAILABLE = L"Mise à jour disponible: téléchargez-la depuis https://github.com/Artikash/Textractor/releases";
ALREADY_INJECTED = L"Textractor: déjà injecté";
NEED_32_BIT = L"Textractor: incompatibilité d'architecture: seul Textractor x86 peut injecter ce processus";
@ -1280,7 +1348,6 @@ example: Textractor -p4466 -p"My Game.exe" tries to inject processes with id 446
API_KEY = u8"API key";
EXTRA_WINDOW_INFO = u8R"(Clic droit pour modifier les paramètres
Cliquez et faites glisser sur les bords de la fenêtre pour vous déplacer ou dans le coin inférieur droit pour redimensionner)";
SENTENCE_TOO_BIG = u8"Phrase trop grande pour être affichée";
MAX_SENTENCE_SIZE = u8"Taille maximale de la phrase";
TOPMOST = u8"Toujours au dessus";
DICTIONARY = u8"Dictionnaire";
@ -1321,7 +1388,7 @@ Cette extension utilise plusieurs copies de l'interpréteur Lua pour la sécurit
Les modifications apportées aux variables globales à partir de ProcessSentence ne sont pas garanties de persister.
Properties in sentenceInfo:
"current select": 0 unless sentence is in the text thread currently selected by the user.
"process id": process id that the sentence is coming from. 0 for console and clipboard.
"process id": process ID that the sentence is coming from. 0 for console and clipboard.
"text number": number of the current text thread. Counts up one by one as text threads are created. 0 for console, 1 for clipboard.
--]]
function ProcessSentence(sentence, sentenceInfo)

View File

@ -1,32 +1,51 @@
include_directories(. util)
include_directories(. util minhook/include)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(texthook_src
main.cc
texthook.cc
hookfinder.cc
engine/match.cc
engine/match64.cc
engine/native/pchooks.cc
util/ithsys/ithsys.cc
util/util.cc
)
set(minhook_src
minhook/src/buffer.c
minhook/src/hook.c
minhook/src/trampoline.c
minhook/src/hde/hde64.c
)
set(texthook_src
main.cc
texthook.cc
hookfinder.cc
engine/match.cc
engine/match64.cc
engine/native/pchooks.cc
util/ithsys/ithsys.cc
util/util.cc
)
else()
set(texthook_src
main.cc
texthook.cc
hookfinder.cc
engine/engine.cc
engine/match.cc
engine/match32.cc
engine/native/pchooks.cc
util/util.cc
util/ithsys/ithsys.cc
util/disasm/disasm.cc
util/memdbg/memsearch.cc
)
set(minhook_src
minhook/src/buffer.c
minhook/src/hook.c
minhook/src/trampoline.c
minhook/src/hde/hde32.c
)
set(texthook_src
main.cc
texthook.cc
hookfinder.cc
engine/engine.cc
engine/match.cc
engine/match32.cc
engine/native/pchooks.cc
util/util.cc
util/ithsys/ithsys.cc
util/disasm/disasm.cc
util/memdbg/memsearch.cc
)
endif()
add_library(minhook ${minhook_src})
add_library(texthook MODULE ${texthook_src})
target_precompile_headers(texthook REUSE_FROM pch)
# isn't there a better way to do this?
target_precompile_headers(texthook PRIVATE ../include/common.h)
if(NOT CMAKE_BUILD_TYPE MATCHES Debug)
target_compile_options(minhook PRIVATE /MT)
target_compile_options(texthook PRIVATE /MT)
target_link_options(texthook PRIVATE /NODEFAULTLIB:MSVCRT)
endif()
target_link_libraries(texthook minhook)

View File

@ -5730,21 +5730,21 @@ void SpecialHookShina2(DWORD esp_base, HookParam *, BYTE, DWORD *data, DWORD *sp
// Used to merge correct text thread.
// 1. Only keep threads with 0 and -1 split
// 2. Skip the thread withb 0 split and with minimum return address
void SpecialHookShina1(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
{
static DWORD min_retaddr = -1;
DWORD s = *(DWORD *)(esp_base + hp->split);
if (s == 0 || (s & 0xffff) == 0xffff) { // only keep threads with 0 and -1 split
if (s == 0 && retof(esp_base) <= min_retaddr) {
min_retaddr = retof(esp_base);
return;
}
*split = FIXED_SPLIT_VALUE;
// Follow the same logic as the hook.
*data = *(DWORD *)*data; // DATA_INDIRECT
*len = LeadByteTable[*data & 0xff];
}
}
//void SpecialHookShina1(DWORD esp_base, HookParam *hp, BYTE, DWORD *data, DWORD *split, DWORD *len)
//{
// static DWORD min_retaddr = -1;
// DWORD s = *(DWORD *)(esp_base + hp->split);
// if (s == 0 || (s & 0xffff) == 0xffff) { // only keep threads with 0 and -1 split
// if (s == 0 && retof(esp_base) <= min_retaddr) {
// min_retaddr = retof(esp_base);
// return;
// }
// *split = FIXED_SPLIT_VALUE;
// // Follow the same logic as the hook.
// *data = *(DWORD *)*data; // DATA_INDIRECT
// *len = LeadByteTable[*data & 0xff];
// }
//}
// jichi 8/27/2013
// Return ShinaRio version number
@ -5803,7 +5803,7 @@ bool InsertShinaHook()
trigger_fun = [](LPVOID funcAddr, DWORD, DWORD stack)
{
bool ret = false;
if (funcAddr != GetGlyphOutlineA) return false;
if (funcAddr != GetGlyphOutlineA && funcAddr != GetTextExtentPoint32A) return false;
for (int i = 0; i < 100; ++i)
{
// Address of text is somewhere on stack in call to func. Search for it.
@ -5817,7 +5817,7 @@ bool InsertShinaHook()
hp.type = DIRECT_READ;
hp.address = addr;
ConsoleOutput("Textractor: triggered: adding dynamic reader");
NewHook(hp, "READ");
NewHook(hp, "ShinaRio READ");
ret = true;
}
};
@ -5825,9 +5825,8 @@ bool InsertShinaHook()
return ret;
};
ConsoleOutput("Textractor: ShinaRio 2.50+: adding trigger");
return true;
}
else if (ver >= 48) { // v2.48, v2.49
if (ver >= 48) { // v2.48, v2.49
HookParam hp = {};
hp.address = (DWORD)::GetTextExtentPoint32A;
hp.text_fun = SpecialHookShina2;
@ -5984,7 +5983,7 @@ bool InsertWaffleHook()
{
bool found = false;
for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 4; i++)
if (*(DWORD *)i == 0xac68) {
if (*(DWORD *)i == 0xac68 && *(BYTE*)(i + 4) == 0) {
HookParam hp = {};
hp.address = i;
hp.length_offset = 1;
@ -10775,8 +10774,59 @@ bool InsertArtemis2Hook()
return true;
}
bool InsertArtemis3Hook()
{
const BYTE bytes[] = {
0x55, // 005FD780 | 55 | push ebp |
0x8B, 0xEC, // 005FD781 | 8BEC | mov ebp,esp |
0x83, 0xE4, 0xF8, // 005FD783 | 83E4 F8 | and esp,FFFFFFF8 |
0x83, 0xEC, 0x3C, // 005FD786 | 83EC 3C | sub esp,3C |
0xA1, XX4, // 005FD789 | A1 6C908600 | mov eax,dword ptr ds:[86906C] |
0x33, 0xC4, // 005FD78E | 33C4 | xor eax,esp |
0x89, 0x44, 0x24, 0x38, // 005FD790 | 894424 38 | mov dword ptr ss:[esp+38],eax |
0x53, // 005FD794 | 53 | push ebx |
0x56, // 005FD795 | 56 | push esi |
0x8B, 0xC1, // 005FD796 | 8BC1 | mov eax,ecx |
0xC7, 0x44, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00, // 005FD798 | C74424 14 00000000 | mov dword ptr ss:[esp+14],0 |
0x8B, 0x4D, 0x0C, // 005FD7A0 | 8B4D 0C | mov ecx,dword ptr ss:[ebp+C] |
0x33, 0xF6, // 005FD7A3 | 33F6 | xor esi,esi |
0x57, // 005FD7A5 | 57 | push edi |
0x8B, 0x7D, 0x08, // 005FD7A6 | 8B7D 08 | mov edi,dword ptr ss:[ebp+8] |
0x89, 0x44, 0x24, 0x14, // 005FD7A9 | 894424 14 | mov dword ptr ss:[esp+14],eax |
0x89, 0x4C, 0x24, 0x28, // 005FD7AD | 894C24 28 | mov dword ptr ss:[esp+28],ecx |
0x80, 0x3F, 0x00, // 005FD7B1 | 803F 00 | cmp byte ptr ds:[edi],0 |
0x0F, 0x84, XX4, // 005FD7B4 | 0F84 88040000 | je ヘンタイ・プリズンsplit 1.5FDC42 |
0x83, 0xB8, XX4, 0x00, // 005FD7BA | 83B8 74030000 00 | cmp dword ptr ds:[eax+374],0 |
0x8B, 0xDF, // 005FD7C1 | 8BDF | mov ebx,edi |
};
enum { addr_offset = 0 }; // distance to the beginning of the function, which is 0x55 (push ebp)
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) {
ConsoleOutput("Textractor:Artemis3: pattern not found");
return false;
}
addr += addr_offset;
enum { push_ebp = 0x55 }; // beginning of the function
if (*(BYTE *)addr != push_ebp) {
ConsoleOutput("Textractor:Artemis3: beginning of the function not found");
return false;
}
HookParam hp = {};
hp.address = addr;
hp.offset = pusha_ebx_off - 4;
hp.type = USING_UTF8;
ConsoleOutput("Textractor: INSERT Artemis3");
NewHook(hp, "Artemis3");
return true;
}
bool InsertArtemisHook()
{ return InsertArtemis1Hook() || InsertArtemis2Hook(); }
{ return InsertArtemis1Hook() || InsertArtemis2Hook() || InsertArtemis3Hook(); }
/**
* jichi 1/2/2014: Taskforce2 Engine
@ -16951,7 +17001,7 @@ void InsertMonoHook(HMODULE h)
if (!getDomain || !getName || !getJitInfo) goto failed;
static auto domain = getDomain();
if (!domain) goto failed;
ConsoleOutput("Textractor: Mono Dynamic ENTER (hooks = %s)", loadedConfig ? loadedConfig : "brute force");
ConsoleOutput("Textractor: Mono Dynamic ENTER (hooks = %s)", *loadedConfig ? loadedConfig : "brute force");
const BYTE prolog[] = { 0x55, 0x8b, 0xec };
for (auto addr : Util::SearchMemory(prolog, sizeof(prolog), PAGE_EXECUTE_READWRITE))
{
@ -16966,7 +17016,7 @@ void InsertMonoHook(HMODULE h)
HookParam hp = {};
hp.address = addr;
hp.type = USING_UNICODE | FULL_STRING;
if (!loadedConfig) hp.type |= KNOWN_UNSTABLE;
if (!*loadedConfig) hp.type |= KNOWN_UNSTABLE;
hp.offset = 4;
char nameForUser[HOOK_NAME_SIZE] = {};
strncpy_s(nameForUser, name + 1, HOOK_NAME_SIZE - 1);
@ -16984,7 +17034,7 @@ void InsertMonoHook(HMODULE h)
__except (EXCEPTION_EXECUTE_HANDLER) {}
}(addr);
}
if (!loadedConfig) ConsoleOutput("Textractor: Mono Dynamic used brute force: if performance issues arise, please specify the correct hook in the game configuration");
if (!*loadedConfig) ConsoleOutput("Textractor: Mono Dynamic used brute force: if performance issues arise, please specify the correct hook in the game configuration");
return true;
failed:
ConsoleOutput("Textractor: Mono Dynamic failed");
@ -17041,7 +17091,7 @@ bool InsertMonoHooks()
if (FARPROC addr = ::GetProcAddress(h, func.functionName)) {
hp.address = (DWORD)addr;
hp.type = func.hookType;
if (loadedConfig) hp.type |= HOOK_EMPTY;
if (*loadedConfig) hp.type |= HOOK_EMPTY;
hp.filter_fun = NoAsciiFilter;
hp.offset = func.textIndex * 4;
hp.length_offset = func.lengthIndex * 4;

View File

@ -14,7 +14,7 @@ namespace Engine {
// Global variables
extern wchar_t *processName, // cached
processPath[MAX_PATH]; // cached
inline const char *requestedEngine = nullptr, *loadedConfig = nullptr;
inline const char *requestedEngine = "", * loadedConfig = "";
bool InsertMonoHooks(); // Mono

View File

@ -45,13 +45,13 @@ namespace Engine
if (AutoHandle<> configFile = CreateFileW(configFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL))
{
ReadFile(configFile, configFileData, sizeof(configFileData) - 1, DUMMY, nullptr);
if (strncmp(configFileData, "Engine:", 7) == 0)
if (strnicmp(configFileData, "engine:", 7) == 0)
{
if (loadedConfig = strchr(configFileData, '\n')) *(char*)loadedConfig++ = 0;
ConsoleOutput("Textractor: Engine = %s", requestedEngine = configFileData + 7);
if (const char* config = strchr(configFileData, '\n')) *(char*)(loadedConfig = config)++ = 0;
ConsoleOutput("Textractor: Engine = %s", requestedEngine = strlwr(configFileData + 7));
}
else loadedConfig = configFileData;
if ((loadedConfig && !*loadedConfig) || strstr(configFileData, "https://")) loadedConfig = nullptr;
if (!*loadedConfig || strstr(configFileData, "https://")) loadedConfig = "";
else ConsoleOutput("Textractor: game configuration loaded");
}
@ -67,14 +67,14 @@ namespace Engine
spDefault.maxAddress = processStopAddress;
ConsoleOutput("Textractor: hijacking process located from 0x%p to 0x%p", processStartAddress, processStopAddress);
DetermineEngineType();
if (!strstr(requestedEngine, "none")) DetermineEngineType();
if (processStartAddress + 0x40000 > processStopAddress) ConsoleOutput("Textractor: WARNING injected process is very small, possibly a dummy!");
}(), 0);
}
bool ShouldMonoHook(const char* name)
{
if (!loadedConfig) return strstr(name, "string:") && !strstr(name, "string:mem");
if (!*loadedConfig) return strstr(name, "string:") && !strstr(name, "string:mem");
for (const char* hook = loadedConfig; hook; hook = strchr(hook + 1, '\t'))
for (auto start = name; *start; ++start)
for (int i = 0; ; ++i)

View File

@ -629,10 +629,9 @@ bool DetermineEngineAtLast()
}
if (Util::CheckFile(L"MovieTexture.dll") && (InsertPensilHook() || Insert2RMHook())) // MovieTexture.dll also exists in 2RM games such as 母子愛2体験版, which is checked first
return true;
if ((Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) || Util::CheckFile(L"*01")) { // jichi 7/31/2015 & Artikash 6/15/2018
InsertAbelHook();
return true;
}
if ((Util::CheckFile(L"system") && Util::CheckFile(L"system.dat")) || Util::CheckFile(L"*01")) // jichi 7/31/2015 & Artikash 6/15/2018
if (InsertAbelHook())
return true;
if (Util::CheckFile(L"data\\*.cpk")) { // jichi 12/2/2014
Insert5pbHook();
return true;

View File

@ -80,7 +80,7 @@ namespace Engine
if (!getDomain || !getName || !getJitInfo) goto failed;
static auto domain = getDomain();
if (!domain) goto failed;
ConsoleOutput("Textractor: Mono Dynamic ENTER (hooks = %s)", loadedConfig ? loadedConfig : "brute force");
ConsoleOutput("Textractor: Mono Dynamic ENTER (hooks = %s)", *loadedConfig ? loadedConfig : "brute force");
const BYTE prolog1[] = { 0x55, 0x48, 0x8b, 0xec };
const BYTE prolog2[] = { 0x48, 0x83, 0xec };
for (auto [prolog, size] : Array<const BYTE*, size_t>{ { prolog1, sizeof(prolog1) }, { prolog2, sizeof(prolog2) } })
@ -97,7 +97,7 @@ namespace Engine
HookParam hp = {};
hp.address = addr;
hp.type = USING_STRING | USING_UNICODE | FULL_STRING;
if (!loadedConfig) hp.type |= KNOWN_UNSTABLE;
if (!*loadedConfig) hp.type |= KNOWN_UNSTABLE;
hp.offset = -0x20; // rcx
hp.padding = 20;
char nameForUser[HOOK_NAME_SIZE] = {};
@ -119,7 +119,7 @@ namespace Engine
}(addr);
}
if (!loadedConfig) ConsoleOutput("Textractor: Mono Dynamic used brute force: if performance issues arise, please specify the correct hook in the game configuration");
if (!*loadedConfig) ConsoleOutput("Textractor: Mono Dynamic used brute force: if performance issues arise, please specify the correct hook in the game configuration");
return true;
failed:
ConsoleOutput("Textractor: Mono Dynamic failed");

View File

@ -2,6 +2,7 @@
#include "defs.h"
#include "main.h"
#include "util.h"
#include "MinHook.h"
extern const char* HOOK_SEARCH_STARTING;
extern const char* HOOK_SEARCH_INITIALIZING;

View File

@ -9,6 +9,7 @@
#include "texthook.h"
#include "hookfinder.h"
#include "util.h"
#include "MinHook.h"
extern const char* PIPE_CONNECTED;
extern const char* INSERTING_HOOK;

View File

@ -15,49 +15,6 @@ void RemoveHook(uint64_t addr, int maxOffset = 9);
inline SearchParam spDefault;
extern "C" // minhook library
{
enum MH_STATUS
{
MH_OK,
MH_ERROR_ALREADY_INITIALIZED,
MH_ERROR_NOT_INITIALIZED,
MH_ERROR_ALREADY_CREATED,
MH_ERROR_NOT_CREATED,
MH_ERROR_ENABLED,
MH_ERROR_DISABLED,
MH_ERROR_NOT_EXECUTABLE,
MH_ERROR_UNSUPPORTED_FUNCTION,
MH_ERROR_MEMORY_ALLOC,
MH_ERROR_MEMORY_PROTECT,
MH_ERROR_MODULE_NOT_FOUND,
MH_ERROR_FUNCTION_NOT_FOUND
};
MH_STATUS WINAPI MH_Initialize(VOID);
MH_STATUS WINAPI MH_Uninitialize(VOID);
// Creates a Hook for the specified target function, in disabled state.
// Parameters:
// pTarget [in] A pointer to the target function, which will be
// overridden by the detour function.
// pDetour [in] A pointer to the detour function, which will override
// the target function.
// ppOriginal [out] A pointer to the trampoline function, which will be
// used to call the original target function.
// This parameter can be NULL.
MH_STATUS WINAPI MH_CreateHook(LPVOID pTarget, LPVOID pDetour, LPVOID *ppOriginal);
MH_STATUS WINAPI MH_EnableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_DisableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_RemoveHook(LPVOID pTarget);
MH_STATUS WINAPI MH_QueueEnableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_QueueDisableHook(LPVOID pTarget);
MH_STATUS WINAPI MH_ApplyQueued(VOID);
const char* WINAPI MH_StatusToString(MH_STATUS status);
}
#define MH_ALL_HOOKS NULL
#define ITH_RAISE (*(int*)0 = 0) // raise C000005, for debugging only
#define ITH_TRY __try
#define ITH_EXCEPT __except(EXCEPTION_EXECUTE_HANDLER)

1
texthook/minhook Submodule

@ -0,0 +1 @@
Subproject commit 423d1e45af2ed2719a5c31e990e935ef301ed9c3

View File

@ -6,6 +6,7 @@
#include "texthook.h"
#include "main.h"
#include "ithsys/ithsys.h"
#include "MinHook.h"
extern const char* FUNC_MISSING;
extern const char* MODULE_MISSING;
@ -192,6 +193,7 @@ void TextHook::Send(uintptr_t dwDataBase)
TextOutput(tp, buffer, count);
#endif // _WIN64
++*pbData;
}
__except (EXCEPTION_EXECUTE_HANDLER)
{

Binary file not shown.

Binary file not shown.