split text declarations
This commit is contained in:
parent
cf423fa525
commit
0345181484
@ -1,7 +1,6 @@
|
||||
#include "extenwindow.h"
|
||||
#include "ui_extenwindow.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include "misc.h"
|
||||
#include <concrt.h>
|
||||
#include <QDragEnterEvent>
|
||||
@ -10,6 +9,9 @@
|
||||
#include <QUrl>
|
||||
#include <QLabel>
|
||||
|
||||
extern const char* EXTENSIONS;
|
||||
extern const char* EXTEN_WINDOW_INSTRUCTIONS;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Extension
|
||||
|
@ -1,9 +1,14 @@
|
||||
#include "host.h"
|
||||
#include "text.h"
|
||||
#include "defs.h"
|
||||
#include "util.h"
|
||||
#include "../vnrhook/texthook.h"
|
||||
|
||||
extern const wchar_t* ALREADY_INJECTED;
|
||||
extern const wchar_t* ARCHITECTURE_MISMATCH;
|
||||
extern const wchar_t* INJECT_FAILED;
|
||||
extern const wchar_t* CONSOLE;
|
||||
extern const wchar_t* CLIPBOARD;
|
||||
|
||||
namespace
|
||||
{
|
||||
class ProcessRecord
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "textthread.h"
|
||||
#include "text.h"
|
||||
#include "host.h"
|
||||
#include "util.h"
|
||||
|
||||
extern const wchar_t* INVALID_CODEPAGE;
|
||||
|
||||
TextThread::TextThread(ThreadParam tp, HookParam hp, std::optional<std::wstring> name) :
|
||||
handle(threadCounter++),
|
||||
name(name.value_or(Util::StringToWideString(hp.name).value())),
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include "extenwindow.h"
|
||||
#include "misc.h"
|
||||
#include "host/util.h"
|
||||
@ -15,6 +14,30 @@
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
extern const char* ATTACH;
|
||||
extern const char* LAUNCH;
|
||||
extern const char* DETACH;
|
||||
extern const char* ADD_HOOK;
|
||||
extern const char* SAVE_HOOKS;
|
||||
extern const char* SETTINGS;
|
||||
extern const char* EXTENSIONS;
|
||||
extern const char* SELECT_PROCESS;
|
||||
extern const char* ATTACH_INFO;
|
||||
extern const char* SEARCH_GAME;
|
||||
extern const char* PROCESSES;
|
||||
extern const char* CODE_INFODUMP;
|
||||
extern const char* SAVE_SETTINGS;
|
||||
extern const char* USE_JP_LOCALE;
|
||||
extern const char* FILTER_REPETITION;
|
||||
extern const char* DEFAULT_CODEPAGE;
|
||||
extern const char* FLUSH_DELAY;
|
||||
extern const char* MAX_BUFFER_SIZE;
|
||||
extern const wchar_t* ABOUT;
|
||||
extern const wchar_t* CL_OPTIONS;
|
||||
extern const wchar_t* UPDATE_AVAILABLE;
|
||||
extern const wchar_t* LAUNCH_FAILED;
|
||||
extern const wchar_t* INVALID_CODE;
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
@ -121,7 +144,7 @@ void MainWindow::ProcessConnected(DWORD processId)
|
||||
if (hookList != allProcesses.rend())
|
||||
for (auto hookInfo : hookList->split(" , "))
|
||||
if (auto hp = Util::ParseCode(S(hookInfo))) Host::InsertHook(processId, hp.value());
|
||||
else swscanf_s(S(hookInfo).c_str(), L"|%I64d:%I64d:%[^\n]", &savedThreadCtx.first, &savedThreadCtx.second, savedThreadCode, std::size(savedThreadCode));
|
||||
else swscanf_s(S(hookInfo).c_str(), L"|%I64d:%I64d:%[^\n]", &savedThreadCtx.first, &savedThreadCtx.second, savedThreadCode, (unsigned)std::size(savedThreadCode));
|
||||
}
|
||||
|
||||
void MainWindow::ProcessDisconnected(DWORD processId)
|
||||
|
@ -1,9 +1,13 @@
|
||||
#include "extension.h"
|
||||
#include "text.h"
|
||||
#include "network.h"
|
||||
#include <QInputDialog>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* SELECT_LANGUAGE;
|
||||
extern const wchar_t* TOO_MANY_TRANS_REQUESTS;
|
||||
extern const wchar_t* TRANSLATION_ERROR;
|
||||
extern const char* BING_PROMPT;
|
||||
|
||||
QStringList languages
|
||||
{
|
||||
"English: en",
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "extension.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include <QDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QColorDialog>
|
||||
@ -12,6 +11,13 @@
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* EXTRA_WINDOW_INFO;
|
||||
extern const char* TOPMOST;
|
||||
extern const char* SIZE_LOCK;
|
||||
extern const char* BG_COLOR;
|
||||
extern const char* TEXT_COLOR;
|
||||
extern const char* FONT_SIZE;
|
||||
|
||||
std::mutex m;
|
||||
|
||||
struct : QDialog
|
||||
|
@ -1,11 +1,15 @@
|
||||
#include "extension.h"
|
||||
#include "text.h"
|
||||
#include "util.h"
|
||||
#include "network.h"
|
||||
#include <ctime>
|
||||
#include <QInputDialog>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* SELECT_LANGUAGE;
|
||||
extern const wchar_t* TOO_MANY_TRANS_REQUESTS;
|
||||
extern const wchar_t* TRANSLATION_ERROR;
|
||||
extern const char* GOOGLE_PROMPT;
|
||||
|
||||
QStringList languages
|
||||
{
|
||||
"English: en",
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "extension.h"
|
||||
#include "util.h"
|
||||
#include "text.h"
|
||||
#include <fstream>
|
||||
#include <QMainWindow>
|
||||
#include <QLayout>
|
||||
@ -8,6 +7,10 @@
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* LUA_INTRO;
|
||||
extern const char* LOAD_LUA_SCRIPT;
|
||||
extern const wchar_t* LUA_ERROR;
|
||||
|
||||
constexpr auto LUA_SAVE_FILE = u8"Textractor.lua";
|
||||
|
||||
extern "C" // Lua library
|
||||
|
@ -1,11 +1,14 @@
|
||||
#include "extension.h"
|
||||
#include "text.h"
|
||||
#include <QMainWindow>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* REGEX_FILTER;
|
||||
extern const char* INVALID_REGEX;
|
||||
extern const char* CURRENT_FILTER;
|
||||
|
||||
std::wregex regex;
|
||||
std::shared_mutex m;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "extension.h"
|
||||
#include "text.h"
|
||||
#include <cwctype>
|
||||
#include <fstream>
|
||||
#include <atomic>
|
||||
#include <filesystem>
|
||||
#include <process.h>
|
||||
|
||||
extern const wchar_t* REPLACER_INSTRUCTIONS;
|
||||
constexpr auto REPLACE_SAVE_FILE = u8"SavedReplacements.txt";
|
||||
|
||||
std::atomic<std::filesystem::file_time_type> replaceFileLastWrite;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "extension.h"
|
||||
#include "text.h"
|
||||
#include <QMainWindow>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
@ -8,6 +7,11 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QTimer>
|
||||
|
||||
extern const char* THREAD_LINKER;
|
||||
extern const char* LINK;
|
||||
extern const char* THREAD_LINK_FROM;
|
||||
extern const char* THREAD_LINK_TO;
|
||||
|
||||
std::mutex m;
|
||||
std::unordered_map<int64_t, std::unordered_multiset<int64_t>> linkedTextHandles;
|
||||
|
||||
|
@ -29,5 +29,7 @@ constexpr auto CONFIG_FILE = u8"Textractor.ini";
|
||||
// Misc
|
||||
|
||||
constexpr auto DEFAULT_EXTENSIONS = u8"Remove Repetition>Lua>Copy to Clipboard>Bing Translate>Extra Window>Extra Newlines";
|
||||
constexpr auto WINDOW = u8"Window";
|
||||
#define CURRENT_VERSION "3.0.0"
|
||||
|
||||
// EOF
|
||||
|
@ -1,70 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#define CURRENT_VERSION "3.0.0"
|
||||
|
||||
extern const char* ATTACH;
|
||||
extern const char* LAUNCH;
|
||||
extern const char* DETACH;
|
||||
extern const char* ADD_HOOK;
|
||||
extern const char* SAVE_HOOKS;
|
||||
extern const char* SETTINGS;
|
||||
extern const char* EXTENSIONS;
|
||||
extern const char* SELECT_PROCESS;
|
||||
extern const char* ATTACH_INFO;
|
||||
extern const char* SEARCH_GAME;
|
||||
extern const char* PROCESSES;
|
||||
extern const char* CODE_INFODUMP;
|
||||
extern const char* SAVE_SETTINGS;
|
||||
extern const char* EXTEN_WINDOW_INSTRUCTIONS;
|
||||
extern const char* WINDOW;
|
||||
extern const char* USE_JP_LOCALE;
|
||||
extern const char* FILTER_REPETITION;
|
||||
extern const char* DEFAULT_CODEPAGE;
|
||||
extern const char* FLUSH_DELAY;
|
||||
extern const char* MAX_BUFFER_SIZE;
|
||||
extern const wchar_t* CONSOLE;
|
||||
extern const wchar_t* CLIPBOARD;
|
||||
extern const wchar_t* ABOUT;
|
||||
extern const wchar_t* CL_OPTIONS;
|
||||
extern const wchar_t* UPDATE_AVAILABLE;
|
||||
extern const wchar_t* ALREADY_INJECTED;
|
||||
extern const wchar_t* ARCHITECTURE_MISMATCH;
|
||||
extern const wchar_t* INJECT_FAILED;
|
||||
extern const wchar_t* LAUNCH_FAILED;
|
||||
extern const wchar_t* INVALID_CODE;
|
||||
extern const wchar_t* INVALID_CODEPAGE;
|
||||
extern const char* PIPE_CONNECTED;
|
||||
extern const char* INSERTING_HOOK;
|
||||
extern const char* REMOVING_HOOK;
|
||||
extern const char* HOOK_FAILED;
|
||||
extern const char* TOO_MANY_HOOKS;
|
||||
extern const char* NOT_ENOUGH_TEXT;
|
||||
extern const char* FUNC_MISSING;
|
||||
extern const char* MODULE_MISSING;
|
||||
extern const char* GARBAGE_MEMORY;
|
||||
extern const char* SEND_ERROR;
|
||||
extern const char* READ_ERROR;
|
||||
extern const char* HIJACK_ERROR;
|
||||
extern const char* COULD_NOT_FIND;
|
||||
extern const char* SELECT_LANGUAGE;
|
||||
extern const char* BING_PROMPT;
|
||||
extern const char* GOOGLE_PROMPT;
|
||||
extern const wchar_t* TOO_MANY_TRANS_REQUESTS;
|
||||
extern const wchar_t* TRANSLATION_ERROR;
|
||||
extern const char* EXTRA_WINDOW_INFO;
|
||||
extern const char* TOPMOST;
|
||||
extern const char* SIZE_LOCK;
|
||||
extern const char* BG_COLOR;
|
||||
extern const char* TEXT_COLOR;
|
||||
extern const char* FONT_SIZE;
|
||||
extern const char* LUA_INTRO;
|
||||
extern const char* LOAD_LUA_SCRIPT;
|
||||
extern const wchar_t* LUA_ERROR;
|
||||
extern const char* REGEX_FILTER;
|
||||
extern const char* INVALID_REGEX;
|
||||
extern const char* CURRENT_FILTER;
|
||||
extern const wchar_t* REPLACER_INSTRUCTIONS;
|
||||
extern const char* THREAD_LINKER;
|
||||
extern const char* LINK;
|
||||
extern const char* THREAD_LINK_FROM;
|
||||
extern const char* THREAD_LINK_TO;
|
6
text.cpp
6
text.cpp
@ -1,4 +1,4 @@
|
||||
#include "text.h"
|
||||
#include "defs.h"
|
||||
|
||||
//#define TURKISH
|
||||
//#define SPANISH
|
||||
@ -37,7 +37,6 @@ const char* EXTEN_WINDOW_INSTRUCTIONS = u8R"(Drag and drop extension (.dll) file
|
||||
(Does not work if running as administrator)
|
||||
Drag and drop within the list to reorder
|
||||
Press delete with an extension selected to remove it)";
|
||||
const char* WINDOW = u8"Window";
|
||||
const char* USE_JP_LOCALE = u8"Emulate japanese locale?";
|
||||
const char* FILTER_REPETITION = u8"Repetition Filter";
|
||||
const char* DEFAULT_CODEPAGE = u8"Default Codepage";
|
||||
@ -133,7 +132,6 @@ inline auto _ = []
|
||||
EXTENSIONS = u8"Uzantılar";
|
||||
SELECT_PROCESS = u8"İşlem Seçin";
|
||||
ATTACH_INFO = u8"Bağlanmak istediğiniz işlemi görmüyorsanız yönetici olarak çalıştırmayı deneyin";
|
||||
WINDOW = u8"Pencere";
|
||||
DEFAULT_CODEPAGE = u8"Varsayılan Kod Sayfası";
|
||||
FLUSH_DELAY = u8"Temizleme Gecikmesi";
|
||||
MAX_BUFFER_SIZE = u8"Maksimum Arabellek Boyu";
|
||||
@ -192,7 +190,6 @@ Negatives for data/split offset refer to registers
|
||||
EXTEN_WINDOW_INSTRUCTIONS = u8R"(Arrrastra y suelta la extension (.dll) aquí desde tu computadora para añadirlos
|
||||
Arrastra y suelta la lista para reordenar
|
||||
Presiona supr en una extension seleccionada para removerla)";
|
||||
WINDOW = u8"Ventana";
|
||||
USE_JP_LOCALE = u8"¿Emular idioma japonés?";
|
||||
DEFAULT_CODEPAGE = u8"Default Codepage";
|
||||
FLUSH_DELAY = u8"Flush Delay";
|
||||
@ -276,7 +273,6 @@ S/Q/V: 代码页/UTF-16/UTF-8 字符串
|
||||
(如果使用超级管理员运行,则无法工作)
|
||||
在列表中拖拽来重新排序
|
||||
使用 delete 键移除选中的扩展)";
|
||||
WINDOW = u8"窗口";
|
||||
USE_JP_LOCALE = u8"模拟日本区域设置?";
|
||||
DEFAULT_CODEPAGE = u8"默认代码页";
|
||||
FLUSH_DELAY = u8"刷新延迟";
|
||||
|
@ -13,9 +13,10 @@
|
||||
#include "util/growl.h"
|
||||
#include "util/util.h"
|
||||
#include "main.h"
|
||||
#include "text.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
|
||||
extern const char* HIJACK_ERROR;
|
||||
|
||||
//#define ConsoleOutput(...) (void)0 // jichi 8/18/2013: I don't need ConsoleOutput
|
||||
|
||||
enum { MAX_REL_ADDR = 0x200000 }; // jichi 8/18/2013: maximum relative address
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "match.h"
|
||||
#include "main.h"
|
||||
#include "text.h"
|
||||
#include "native/pchooks.h"
|
||||
|
||||
extern const char* HIJACK_ERROR;
|
||||
|
||||
namespace Engine
|
||||
{
|
||||
void HookDirectX()
|
||||
|
@ -5,11 +5,18 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include "engine/match.h"
|
||||
#include "texthook.h"
|
||||
#include "util.h"
|
||||
|
||||
extern const char* PIPE_CONNECTED;
|
||||
extern const char* INSERTING_HOOK;
|
||||
extern const char* REMOVING_HOOK;
|
||||
extern const char* HOOK_FAILED;
|
||||
extern const char* TOO_MANY_HOOKS;
|
||||
extern const char* NOT_ENOUGH_TEXT;
|
||||
extern const char* COULD_NOT_FIND;
|
||||
|
||||
WinMutex viewMutex;
|
||||
|
||||
namespace
|
||||
@ -88,8 +95,9 @@ void ConsoleOutput(LPCSTR text, ...)
|
||||
WriteFile(hookPipe, &buffer, sizeof(buffer), &DUMMY, nullptr);
|
||||
}
|
||||
|
||||
void NotifyHookRemove(uint64_t addr)
|
||||
void NotifyHookRemove(uint64_t addr, LPCSTR name)
|
||||
{
|
||||
if (name) ConsoleOutput(REMOVING_HOOK, name);
|
||||
HookRemovedNotif buffer(addr);
|
||||
WriteFile(hookPipe, &buffer, sizeof(buffer), &DUMMY, nullptr);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
void TextOutput(ThreadParam tp, BYTE* text, int len);
|
||||
void ConsoleOutput(LPCSTR text, ...);
|
||||
void NotifyHookRemove(uint64_t addr);
|
||||
void NotifyHookRemove(uint64_t addr, LPCSTR name);
|
||||
void NewHook(HookParam hp, LPCSTR name, DWORD flag = HOOK_ENGINE);
|
||||
void RemoveHook(uint64_t addr, int maxOffset = 9);
|
||||
|
||||
|
@ -4,11 +4,16 @@
|
||||
// 8/24/2013 TODO: Clean up this file
|
||||
|
||||
#include "texthook.h"
|
||||
#include "engine/match.h"
|
||||
#include "main.h"
|
||||
#include "text.h"
|
||||
#include "engine/match.h"
|
||||
#include "ithsys/ithsys.h"
|
||||
|
||||
extern const char* FUNC_MISSING;
|
||||
extern const char* MODULE_MISSING;
|
||||
extern const char* GARBAGE_MEMORY;
|
||||
extern const char* SEND_ERROR;
|
||||
extern const char* READ_ERROR;
|
||||
|
||||
extern WinMutex viewMutex;
|
||||
|
||||
// - Unnamed helpers -
|
||||
@ -282,10 +287,9 @@ void TextHook::RemoveReadCode()
|
||||
void TextHook::Clear()
|
||||
{
|
||||
std::scoped_lock lock(viewMutex);
|
||||
if (*hp.name) ConsoleOutput(REMOVING_HOOK, hp.name);
|
||||
if (hp.type & DIRECT_READ) RemoveReadCode();
|
||||
else RemoveHookCode();
|
||||
NotifyHookRemove(address);
|
||||
NotifyHookRemove(address, hp.name);
|
||||
memset(this, 0, sizeof(TextHook)); // jichi 11/30/2013: This is the original code of ITH
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user