From 04828e886b5cc804bd0a6ba5a28fbc8dee5894dd Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 14 Aug 2021 20:55:10 -0700 Subject: [PATCH] Dialog: Lock volatile when the access thread runs. Further tests show that this should be locked first thing before the delays, it just depends on the thread priorities involved. --- Core/HLE/sceUtility.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index f33bbe4a72..4201ea8b20 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -276,22 +276,23 @@ void __UtilityShutdown() { void UtilityDialogInitialize(UtilityDialogType type, int delayUs, int priority) { int partDelay = delayUs / 4; const u32_le insts[] = { - // Make sure we don't discard/deadbeef 'em. + // Make sure we don't discard/deadbeef a0. (u32_le)MIPS_MAKE_ORI(MIPS_REG_S0, MIPS_REG_A0, 0), - (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), - (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), - (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), - (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), - (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), - (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), - (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), - // Now actually lock the volatile memory. Maybe this should be earlier... (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_ZERO, 0), (u32_le)MIPS_MAKE_ORI(MIPS_REG_A1, MIPS_REG_ZERO, 0), (u32_le)MIPS_MAKE_ORI(MIPS_REG_A2, MIPS_REG_ZERO, 0), (u32_le)MIPS_MAKE_SYSCALL("sceSuspendForUser", "sceKernelVolatileMemLock"), + (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), + (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), + (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), + (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), + (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), + (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), + (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_S0, 0), + (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityWorkUs"), + (u32_le)MIPS_MAKE_ORI(MIPS_REG_A0, MIPS_REG_ZERO, (int)type), (u32_le)MIPS_MAKE_JR_RA(), (u32_le)MIPS_MAKE_SYSCALL("sceUtility", "__UtilityInitDialog"),