mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Offer to generate .tspack from crash handler
This commit is contained in:
parent
921cf0087c
commit
8718de6121
11 changed files with 9371 additions and 9 deletions
|
|
@ -80,6 +80,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
|
|||
config.Language = json.value("Language", config.Language);
|
||||
config.GameVersion = json.value("GameVersion", config.GameVersion);
|
||||
config.DelayInitializeMs = json.value("DelayInitializeMs", config.DelayInitializeMs);
|
||||
config.TroubleshootingPackData = json.value("TroubleshootingPackData", std::string{});
|
||||
|
||||
config.BootLogPath = json.value("BootLogPath", config.BootLogPath);
|
||||
config.BootShowConsole = json.value("BootShowConsole", config.BootShowConsole);
|
||||
|
|
@ -100,6 +101,8 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
|
|||
for (const auto& val : *it)
|
||||
config.BootUnhookDlls.insert(unicode::convert<std::string>(val.get<std::string>(), &unicode::lower));
|
||||
}
|
||||
|
||||
config.CrashHandlerShow = json.value("CrashHandlerShow", config.CrashHandlerShow);
|
||||
}
|
||||
|
||||
void DalamudStartInfo::from_envvars() {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ struct DalamudStartInfo {
|
|||
ClientLanguage Language = ClientLanguage::English;
|
||||
std::string GameVersion;
|
||||
int DelayInitializeMs = 0;
|
||||
std::string TroubleshootingPackData;
|
||||
|
||||
std::string BootLogPath;
|
||||
bool BootShowConsole = false;
|
||||
|
|
@ -47,6 +48,8 @@ struct DalamudStartInfo {
|
|||
std::set<std::string> BootEnabledGameFixes{};
|
||||
std::set<std::string> BootUnhookDlls{};
|
||||
|
||||
bool CrashHandlerShow = false;
|
||||
|
||||
friend void from_json(const nlohmann::json&, DalamudStartInfo&);
|
||||
void from_envvars();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -15,4 +15,5 @@ struct exception_info
|
|||
uint64_t nLifetime;
|
||||
HANDLE hThreadHandle;
|
||||
DWORD dwStackTraceLength;
|
||||
DWORD dwTroubleshootingPackDataLength;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -175,12 +175,16 @@ LONG exception_handler(EXCEPTION_POINTERS* ex)
|
|||
}
|
||||
|
||||
exinfo.dwStackTraceLength = static_cast<DWORD>(stackTrace.size());
|
||||
exinfo.dwTroubleshootingPackDataLength = static_cast<DWORD>(g_startInfo.TroubleshootingPackData.size());
|
||||
if (DWORD written; !WriteFile(g_crashhandler_pipe_write, &exinfo, static_cast<DWORD>(sizeof exinfo), &written, nullptr) || sizeof exinfo != written)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
if (DWORD written; !WriteFile(g_crashhandler_pipe_write, &stackTrace[0], static_cast<DWORD>(std::span(stackTrace).size_bytes()), &written, nullptr) || std::span(stackTrace).size_bytes() != written)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
if (DWORD written; !WriteFile(g_crashhandler_pipe_write, &g_startInfo.TroubleshootingPackData[0], static_cast<DWORD>(std::span(g_startInfo.TroubleshootingPackData).size_bytes()), &written, nullptr) || std::span(g_startInfo.TroubleshootingPackData).size_bytes() != written)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
SuspendThread(GetCurrentThread());
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
|
@ -224,11 +228,7 @@ bool veh::add_handler(bool doFullDump, const std::string& workingDirectory)
|
|||
|
||||
siex.StartupInfo.cb = sizeof siex;
|
||||
siex.StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
|
||||
#ifdef NDEBUG
|
||||
siex.StartupInfo.wShowWindow = SW_HIDE;
|
||||
#else
|
||||
siex.StartupInfo.wShowWindow = SW_SHOW;
|
||||
#endif
|
||||
siex.StartupInfo.wShowWindow = g_startInfo.CrashHandlerShow ? SW_SHOW : SW_HIDE;
|
||||
|
||||
// set up list of handles to inherit to child process
|
||||
std::vector<char> attributeListBuf;
|
||||
|
|
@ -309,7 +309,7 @@ bool veh::add_handler(bool doFullDump, const std::string& workingDirectory)
|
|||
}
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
|
||||
g_crashhandler_process = pi.hProcess;
|
||||
g_crashhandler_pipe_write = hWritePipe->release();
|
||||
logging::I("Launched DalamudCrashHandler.exe: PID {}", pi.dwProcessId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue