forked from Public-Mirror/Textractor
refactor
This commit is contained in:
parent
46c4f163ba
commit
f9e1e61d51
@ -36,7 +36,7 @@ namespace
|
|||||||
{
|
{
|
||||||
if (HMODULE module = LoadLibraryW(S(extenName).c_str()))
|
if (HMODULE module = LoadLibraryW(S(extenName).c_str()))
|
||||||
{
|
{
|
||||||
if (auto callback = (decltype(Extension::callback))GetProcAddress(LoadLibraryOnce(S(extenName)), "OnNewSentence"))
|
if (auto callback = (decltype(Extension::callback))GetProcAddress(module, "OnNewSentence"))
|
||||||
{
|
{
|
||||||
std::scoped_lock writeLock(extenMutex);
|
std::scoped_lock writeLock(extenMutex);
|
||||||
extensions.push_back({ S(extenName), callback });
|
extensions.push_back({ S(extenName), callback });
|
||||||
|
@ -34,5 +34,3 @@ private:
|
|||||||
|
|
||||||
Ui::ExtenWindow* ui;
|
Ui::ExtenWindow* ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline HMODULE LoadLibraryOnce(std::wstring fileName) { if (HMODULE module = GetModuleHandleW(fileName.c_str())) return module; return LoadLibraryW(fileName.c_str()); }
|
|
||||||
|
@ -309,7 +309,7 @@ void MainWindow::LaunchProcess()
|
|||||||
PROCESS_INFORMATION info = {};
|
PROCESS_INFORMATION info = {};
|
||||||
if (!x64 && QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes)
|
if (!x64 && QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
if (HMODULE localeEmulator = LoadLibraryOnce(L"LoaderDll"))
|
if (HMODULE localeEmulator = LoadLibraryW(L"LoaderDll"))
|
||||||
{
|
{
|
||||||
// see https://github.com/xupefei/Locale-Emulator/blob/aa99dec3b25708e676c90acf5fed9beaac319160/LEProc/LoaderWrapper.cs#L252
|
// see https://github.com/xupefei/Locale-Emulator/blob/aa99dec3b25708e676c90acf5fed9beaac319160/LEProc/LoaderWrapper.cs#L252
|
||||||
struct
|
struct
|
||||||
|
@ -19,8 +19,6 @@ private:
|
|||||||
inline static constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
|
inline static constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
|
||||||
inline static constexpr auto GAME_SAVE_FILE = u8"SavedGames.txt";
|
inline static constexpr auto GAME_SAVE_FILE = u8"SavedGames.txt";
|
||||||
|
|
||||||
inline static thread_local bool ok = false;
|
|
||||||
|
|
||||||
void closeEvent(QCloseEvent*) override;
|
void closeEvent(QCloseEvent*) override;
|
||||||
void ProcessConnected(DWORD processId);
|
void ProcessConnected(DWORD processId);
|
||||||
void ProcessDisconnected(DWORD processId);
|
void ProcessDisconnected(DWORD processId);
|
||||||
|
@ -59,7 +59,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void RequestFont()
|
void RequestFont()
|
||||||
{
|
{
|
||||||
bool ok;
|
|
||||||
if (QFont font = QFontDialog::getFont(&ok, ui.display->font(), this, FONT); ok)
|
if (QFont font = QFontDialog::getFont(&ok, ui.display->font(), this, FONT); ok)
|
||||||
{
|
{
|
||||||
settings.setValue(FONT, font.toString());
|
settings.setValue(FONT, font.toString());
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
|
static thread_local bool ok;
|
||||||
|
|
||||||
struct QTextFile : QFile { QTextFile(QString name, QIODevice::OpenMode mode) : QFile(name) { open(mode | QIODevice::Text); } };
|
struct QTextFile : QFile { QTextFile(QString name, QIODevice::OpenMode mode) : QFile(name) { open(mode | QIODevice::Text); } };
|
||||||
inline std::wstring S(const QString& S) { return { S.toStdWString() }; }
|
inline std::wstring S(const QString& S) { return { S.toStdWString() }; }
|
||||||
inline QString S(const std::string& S) { return QString::fromStdString(S); }
|
inline QString S(const std::string& S) { return QString::fromStdString(S); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user