mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
crashhandler: immediately terminate the game in release mode
This commit is contained in:
parent
5f51ca22e0
commit
979f78a8b6
1 changed files with 13 additions and 4 deletions
|
|
@ -965,7 +965,7 @@ int main() {
|
||||||
const TASKDIALOG_BUTTON buttons[]{
|
const TASKDIALOG_BUTTON buttons[]{
|
||||||
{IdButtonRestart, L"Restart\nRestart the game with the above-selected option."},
|
{IdButtonRestart, L"Restart\nRestart the game with the above-selected option."},
|
||||||
{IdButtonSaveTsPack, L"Save Troubleshooting Info\nSave a .tspack file containing information about this crash for analysis."},
|
{IdButtonSaveTsPack, L"Save Troubleshooting Info\nSave a .tspack file containing information about this crash for analysis."},
|
||||||
{IdButtonExit, L"Exit\nExit the game."},
|
{IdButtonExit, L"Exit\nExit without doing anything."},
|
||||||
};
|
};
|
||||||
|
|
||||||
config.cbSize = sizeof(config);
|
config.cbSize = sizeof(config);
|
||||||
|
|
@ -1061,11 +1061,20 @@ int main() {
|
||||||
pProgressDialog = NULL;
|
pProgressDialog = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto kill_game = [&] { TerminateProcess(g_hProcess, exinfo.ExceptionRecord.ExceptionCode); };
|
||||||
|
|
||||||
if (shutup) {
|
if (shutup) {
|
||||||
TerminateProcess(g_hProcess, exinfo.ExceptionRecord.ExceptionCode);
|
kill_game();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !_DEBUG
|
||||||
|
// In release mode, we can't resume the game, so just kill it. It's not safe to keep it running, as we
|
||||||
|
// don't know what state it's in and it may have crashed off-thread.
|
||||||
|
// Additionally, if the main thread crashed, Windows will show the ANR dialog, which will block our dialog.
|
||||||
|
kill_game();
|
||||||
|
#endif
|
||||||
|
|
||||||
int nButtonPressed = 0, nRadioButton = 0;
|
int nButtonPressed = 0, nRadioButton = 0;
|
||||||
if (FAILED(TaskDialogIndirect(&config, &nButtonPressed, &nRadioButton, nullptr))) {
|
if (FAILED(TaskDialogIndirect(&config, &nButtonPressed, &nRadioButton, nullptr))) {
|
||||||
SetEvent(exinfo.hEventHandle);
|
SetEvent(exinfo.hEventHandle);
|
||||||
|
|
@ -1073,7 +1082,7 @@ int main() {
|
||||||
switch (nButtonPressed) {
|
switch (nButtonPressed) {
|
||||||
case IdButtonRestart:
|
case IdButtonRestart:
|
||||||
{
|
{
|
||||||
TerminateProcess(g_hProcess, exinfo.ExceptionRecord.ExceptionCode);
|
kill_game();
|
||||||
restart_game_using_injector(nRadioButton, *launcherArgs);
|
restart_game_using_injector(nRadioButton, *launcherArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1081,7 +1090,7 @@ int main() {
|
||||||
if (attemptResume)
|
if (attemptResume)
|
||||||
SetEvent(exinfo.hEventHandle);
|
SetEvent(exinfo.hEventHandle);
|
||||||
else
|
else
|
||||||
TerminateProcess(g_hProcess, exinfo.ExceptionRecord.ExceptionCode);
|
kill_game();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue