Merge pull request #14728 from unknownbrackets/dialog-bad-start

Dialog: Avoid crash with hacked dialog start
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2021-08-14 17:50:16 +02:00
commit f01d4d697e
2 files changed
+9 -1

No files matched your search

+3 -1
View File
@@ -121,10 +121,12 @@ void PSPDialog::ChangeStatusInit(int delayUs) {
}
void PSPDialog::ChangeStatusShutdown(int delayUs) {
// If we're doing shutdown right away and skipped start, we don't run the dialog thread.
bool skipDialogShutdown = status == SCE_UTILITY_STATUS_NONE;
ChangeStatus(SCE_UTILITY_STATUS_SHUTDOWN, 0);
auto params = GetCommonParam();
if (params)
if (params && !skipDialogShutdown)
UtilityDialogShutdown(DialogType(), delayUs, params->accessThread);
else
ChangeStatus(SCE_UTILITY_STATUS_NONE, delayUs);
+6
View File
@@ -37,6 +37,7 @@
#include "Core/HLE/sceKernel.h"
#include "Core/HLE/sceKernelMemory.h"
#include "Core/HLE/sceKernelThread.h"
#include "Core/HLE/scePower.h"
#include "Core/HLE/sceUtility.h"
#include "Core/Dialog/PSPSaveDialog.h"
@@ -358,6 +359,11 @@ static int sceUtilitySavedataInitStart(u32 paramAddr) {
if (currentDialogActive && currentDialogType != UtilityDialogType::SAVEDATA) {
if (PSP_CoreParameter().compat.flags().YugiohSaveFix) {
WARN_LOG(SCEUTILITY, "Yugioh Savedata Correction");
if (accessThread) {
accessThread->Terminate();
// Try to unlock in case other dialog was shutting down.
KernelVolatileMemUnlock(0);
}
} else {
return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type");
}