mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 01:03:41 +01:00
Dialog: Use a thread to init dialogs too.
This commit is contained in:
1 parent
28065c1bc4
commit
429b4594d0
4 files changed
+55
-3
No files matched your search
@@ -270,6 +270,30 @@ void __UtilityShutdown() {
|
||||
delete gamedataInstallDialog;
|
||||
}
|
||||
|
||||
void UtilityDialogInitialize(UtilityDialogType type, int delayUs, int priority) {
|
||||
int partDelay = delayUs / 4;
|
||||
const u32_le insts[] = {
|
||||
// Make sure we don't discard/deadbeef 'em.
|
||||
(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"),
|
||||
|
||||
(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"),
|
||||
};
|
||||
|
||||
CleanupDialogThreads();
|
||||
_assert_(accessThread == nullptr);
|
||||
accessThread = new HLEHelperThread("ScePafJob", insts, (uint32_t)ARRAY_SIZE(insts), priority, 0x200);
|
||||
accessThread->Start(partDelay, 0);
|
||||
}
|
||||
|
||||
void UtilityDialogShutdown(UtilityDialogType type, int delayUs, int priority) {
|
||||
// Break it up so better-priority rescheduling happens.
|
||||
// The windows aren't this regular, but close.
|
||||
@@ -299,11 +323,22 @@ void UtilityDialogShutdown(UtilityDialogType type, int delayUs, int priority) {
|
||||
static int UtilityWorkUs(int us) {
|
||||
// This blocks, but other better priority threads can get time.
|
||||
// Simulate this by allowing a reschedule.
|
||||
if (us > 1000) {
|
||||
hleEatMicro(us - 400);
|
||||
return hleDelayResult(0, "utility work", 400);
|
||||
}
|
||||
hleEatMicro(us);
|
||||
hleReSchedule("utility work");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int UtilityInitDialog(int type) {
|
||||
PSPDialog *dialog = CurrentDialog((UtilityDialogType)type);
|
||||
if (dialog)
|
||||
return hleLogSuccessI(SCEUTILITY, dialog->FinishInit());
|
||||
return hleLogError(SCEUTILITY, 0, "invalid dialog type?");
|
||||
}
|
||||
|
||||
static int UtilityFinishDialog(int type) {
|
||||
PSPDialog *dialog = CurrentDialog((UtilityDialogType)type);
|
||||
if (dialog)
|
||||
@@ -1046,6 +1081,7 @@ const HLEFunction sceUtility[] =
|
||||
// Fake functions for PPSSPP's use.
|
||||
{0xC0DE0001, &WrapI_I<UtilityFinishDialog>, "__UtilityFinishDialog", 'i', "i" },
|
||||
{0xC0DE0002, &WrapI_I<UtilityWorkUs>, "__UtilityWorkUs", 'i', "i" },
|
||||
{0xC0DE0003, &WrapI_I<UtilityInitDialog>, "__UtilityInitDialog", 'i', "i" },
|
||||
};
|
||||
|
||||
void Register_sceUtility()
|
||||
|
||||
Reference in new issue
Block a user