give up on emulating non jp locale and launching in correct directory
This commit is contained in:
parent
6a357b5e32
commit
a84ea357ec
@ -10,6 +10,7 @@
|
|||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
@ -203,10 +204,9 @@ void MainWindow::AttachProcess()
|
|||||||
|
|
||||||
QStringList processList(allProcesses.uniqueKeys());
|
QStringList processList(allProcesses.uniqueKeys());
|
||||||
processList.sort(Qt::CaseInsensitive);
|
processList.sort(Qt::CaseInsensitive);
|
||||||
QString process = QInputDialog::getItem(this, SELECT_PROCESS, ATTACH_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint);
|
if (QString process = QInputDialog::getItem(this, SELECT_PROCESS, ATTACH_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint); ok)
|
||||||
if (!ok) return;
|
if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0));
|
||||||
if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0));
|
else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId);
|
||||||
else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LaunchProcess()
|
void MainWindow::LaunchProcess()
|
||||||
@ -219,30 +219,31 @@ void MainWindow::LaunchProcess()
|
|||||||
if (!ok) return;
|
if (!ok) return;
|
||||||
if (S(process) == SEARCH_GAME) process = S(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, SELECT_PROCESS, "C:\\", PROCESSES)));
|
if (S(process) == SEARCH_GAME) process = S(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, SELECT_PROCESS, "C:\\", PROCESSES)));
|
||||||
if (process.empty()) return;
|
if (process.empty()) return;
|
||||||
std::wstring path = std::wstring(process).erase(process.rfind(L'\\'));
|
|
||||||
PROCESS_INFORMATION info = {};
|
PROCESS_INFORMATION info = {};
|
||||||
if (HMODULE localeEmulator = LoadLibraryOnce(L"LoaderDll"))
|
if (QMessageBox::question(this, SELECT_PROCESS, USE_JP_LOCALE) == QMessageBox::Yes)
|
||||||
{
|
if (HMODULE localeEmulator = LoadLibraryOnce(L"LoaderDll"))
|
||||||
// see https://github.com/xupefei/Locale-Emulator/blob/aa99dec3b25708e676c90acf5fed9beaac319160/LEProc/LoaderWrapper.cs#L252
|
|
||||||
struct
|
|
||||||
{
|
{
|
||||||
ULONG AnsiCodePage = Host::defaultCodepage;
|
// see https://github.com/xupefei/Locale-Emulator/blob/aa99dec3b25708e676c90acf5fed9beaac319160/LEProc/LoaderWrapper.cs#L252
|
||||||
ULONG OemCodePage = Host::defaultCodepage;
|
struct
|
||||||
ULONG LocaleID = LANG_JAPANESE;
|
{
|
||||||
ULONG DefaultCharset = DEFAULT_CHARSET;
|
ULONG AnsiCodePage = SHIFT_JIS;
|
||||||
ULONG HookUiLanguageApi = FALSE;
|
ULONG OemCodePage = SHIFT_JIS;
|
||||||
WCHAR DefaultFaceName[LF_FACESIZE] = {};
|
ULONG LocaleID = LANG_JAPANESE;
|
||||||
TIME_ZONE_INFORMATION Timezone;
|
ULONG DefaultCharset = SHIFTJIS_CHARSET;
|
||||||
ULONG64 Unused = 0;
|
ULONG HookUiLanguageApi = FALSE;
|
||||||
} LEB;
|
WCHAR DefaultFaceName[LF_FACESIZE] = {};
|
||||||
GetTimeZoneInformation(&LEB.Timezone);
|
TIME_ZONE_INFORMATION Timezone;
|
||||||
((LONG(__stdcall*)(decltype(&LEB), LPCWSTR appName, LPWSTR commandLine, LPCWSTR currentDir, void*, void*, PROCESS_INFORMATION*, void*, void*, void*, void*))
|
ULONG64 Unused = 0;
|
||||||
GetProcAddress(localeEmulator, "LeCreateProcess"))(&LEB, process.c_str(), NULL, path.c_str(), NULL, NULL, &info, NULL, NULL, NULL, NULL);
|
} LEB;
|
||||||
}
|
GetTimeZoneInformation(&LEB.Timezone);
|
||||||
|
((LONG(__stdcall*)(decltype(&LEB), LPCWSTR appName, LPWSTR commandLine, LPCWSTR currentDir, void*, void*, PROCESS_INFORMATION*, void*, void*, void*, void*))
|
||||||
|
GetProcAddress(localeEmulator, "LeCreateProcess"))(&LEB, process.c_str(), NULL, NULL, NULL, NULL, &info, NULL, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
if (info.hProcess == NULL)
|
if (info.hProcess == NULL)
|
||||||
{
|
{
|
||||||
STARTUPINFOW DUMMY = { sizeof(DUMMY) };
|
STARTUPINFOW DUMMY = { sizeof(DUMMY) };
|
||||||
CreateProcessW(process.c_str(), NULL, nullptr, nullptr, FALSE, 0, nullptr, path.c_str(), &DUMMY, &info);
|
CreateProcessW(process.c_str(), NULL, nullptr, nullptr, FALSE, 0, nullptr, NULL, &DUMMY, &info);
|
||||||
}
|
}
|
||||||
if (info.hProcess == NULL) return Host::AddConsoleOutput(LAUNCH_FAILED);
|
if (info.hProcess == NULL) return Host::AddConsoleOutput(LAUNCH_FAILED);
|
||||||
Host::InjectProcess(info.dwProcessId);
|
Host::InjectProcess(info.dwProcessId);
|
||||||
@ -257,10 +258,9 @@ void MainWindow::DetachProcess()
|
|||||||
|
|
||||||
void MainWindow::AddHook()
|
void MainWindow::AddHook()
|
||||||
{
|
{
|
||||||
QString hookCode = QInputDialog::getText(this, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, "", &ok, Qt::WindowCloseButtonHint);
|
if (QString hookCode = QInputDialog::getText(this, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, "", &ok, Qt::WindowCloseButtonHint); ok)
|
||||||
if (!ok) return;
|
if (auto hp = ParseCode(hookCode)) Host::InsertHook(GetSelectedProcessId(), hp.value());
|
||||||
if (auto hp = ParseCode(hookCode)) Host::InsertHook(GetSelectedProcessId(), hp.value());
|
else Host::AddConsoleOutput(INVALID_CODE);
|
||||||
else Host::AddConsoleOutput(INVALID_CODE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SaveHooks()
|
void MainWindow::SaveHooks()
|
||||||
|
@ -37,6 +37,7 @@ constexpr auto EXTEN_WINDOW_INSTRUCTIONS = u8R"(Drag and drop extension (.dll) f
|
|||||||
Drag and drop within the list to reorder
|
Drag and drop within the list to reorder
|
||||||
Press delete with an extension selected to remove it)";
|
Press delete with an extension selected to remove it)";
|
||||||
constexpr auto WINDOW = u8"Window";
|
constexpr auto WINDOW = u8"Window";
|
||||||
|
constexpr auto USE_JP_LOCALE = u8"Emulate japanese locale?";
|
||||||
constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage";
|
constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage";
|
||||||
constexpr auto FLUSH_DELAY = u8"Flush Delay";
|
constexpr auto FLUSH_DELAY = u8"Flush Delay";
|
||||||
constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size";
|
constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size";
|
||||||
|
Loading…
Reference in New Issue
Block a user