forked from Public-Mirror/Textractor
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 <QPushButton>
|
||||
#include <QSpinBox>
|
||||
#include <QMessageBox>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
|
||||
@ -203,8 +204,7 @@ void MainWindow::AttachProcess()
|
||||
|
||||
QStringList processList(allProcesses.uniqueKeys());
|
||||
processList.sort(Qt::CaseInsensitive);
|
||||
QString process = QInputDialog::getItem(this, SELECT_PROCESS, ATTACH_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint);
|
||||
if (!ok) return;
|
||||
if (QString process = QInputDialog::getItem(this, SELECT_PROCESS, ATTACH_INFO, processList, 0, true, &ok, Qt::WindowCloseButtonHint); ok)
|
||||
if (process.toInt(nullptr, 0)) Host::InjectProcess(process.toInt(nullptr, 0));
|
||||
else for (auto processId : allProcesses.values(process)) Host::InjectProcess(processId);
|
||||
}
|
||||
@ -219,17 +219,18 @@ void MainWindow::LaunchProcess()
|
||||
if (!ok) return;
|
||||
if (S(process) == SEARCH_GAME) process = S(QDir::toNativeSeparators(QFileDialog::getOpenFileName(this, SELECT_PROCESS, "C:\\", PROCESSES)));
|
||||
if (process.empty()) return;
|
||||
std::wstring path = std::wstring(process).erase(process.rfind(L'\\'));
|
||||
|
||||
PROCESS_INFORMATION info = {};
|
||||
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;
|
||||
ULONG OemCodePage = Host::defaultCodepage;
|
||||
ULONG AnsiCodePage = SHIFT_JIS;
|
||||
ULONG OemCodePage = SHIFT_JIS;
|
||||
ULONG LocaleID = LANG_JAPANESE;
|
||||
ULONG DefaultCharset = DEFAULT_CHARSET;
|
||||
ULONG DefaultCharset = SHIFTJIS_CHARSET;
|
||||
ULONG HookUiLanguageApi = FALSE;
|
||||
WCHAR DefaultFaceName[LF_FACESIZE] = {};
|
||||
TIME_ZONE_INFORMATION Timezone;
|
||||
@ -237,12 +238,12 @@ void MainWindow::LaunchProcess()
|
||||
} 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, path.c_str(), NULL, NULL, &info, NULL, NULL, NULL, NULL);
|
||||
GetProcAddress(localeEmulator, "LeCreateProcess"))(&LEB, process.c_str(), NULL, NULL, NULL, NULL, &info, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
if (info.hProcess == NULL)
|
||||
{
|
||||
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);
|
||||
Host::InjectProcess(info.dwProcessId);
|
||||
@ -257,8 +258,7 @@ void MainWindow::DetachProcess()
|
||||
|
||||
void MainWindow::AddHook()
|
||||
{
|
||||
QString hookCode = QInputDialog::getText(this, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, "", &ok, Qt::WindowCloseButtonHint);
|
||||
if (!ok) return;
|
||||
if (QString hookCode = QInputDialog::getText(this, ADD_HOOK, CODE_INFODUMP, QLineEdit::Normal, "", &ok, Qt::WindowCloseButtonHint); ok)
|
||||
if (auto hp = ParseCode(hookCode)) Host::InsertHook(GetSelectedProcessId(), hp.value());
|
||||
else Host::AddConsoleOutput(INVALID_CODE);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ constexpr auto EXTEN_WINDOW_INSTRUCTIONS = u8R"(Drag and drop extension (.dll) f
|
||||
Drag and drop within the list to reorder
|
||||
Press delete with an extension selected to remove it)";
|
||||
constexpr auto WINDOW = u8"Window";
|
||||
constexpr auto USE_JP_LOCALE = u8"Emulate japanese locale?";
|
||||
constexpr auto DEFAULT_CODEPAGE = u8"Default Codepage";
|
||||
constexpr auto FLUSH_DELAY = u8"Flush Delay";
|
||||
constexpr auto MAX_BUFFER_SIZE = u8"Max Buffer Size";
|
||||
|
Loading…
x
Reference in New Issue
Block a user