From e2861636900dacfeaf00d3d592aeffbe54934303 Mon Sep 17 00:00:00 2001 From: shenweip <1037567878@qq.com> Date: Fri, 13 Sep 2013 23:07:43 +0800 Subject: [PATCH] Implemented some HLE functions for GamedataInstallDialog --- Core/HLE/sceUtility.cpp | 68 +++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 50aaf21c3c..b38199fd6f 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -31,6 +31,7 @@ #include "../Dialog/PSPMsgDialog.h" #include "../Dialog/PSPPlaceholderDialog.h" #include "../Dialog/PSPOskDialog.h" +#include "../Dialog/PSPGamedataInstallDialog.h" const int SCE_ERROR_MODULE_BAD_ID = 0x80111101; const int SCE_ERROR_MODULE_ALREADY_LOADED = 0x80111102; @@ -45,6 +46,7 @@ enum UtilityDialogType { UTILITY_DIALOG_NET, UTILITY_DIALOG_SCREENSHOT, UTILITY_DIALOG_GAMESHARING, + UTILITY_DIALOG_GAMEDATAINSTALL, }; // Only a single dialog is allowed at a time. @@ -55,6 +57,7 @@ static PSPMsgDialog msgDialog; static PSPOskDialog oskDialog; static PSPPlaceholderDialog netDialog; static PSPPlaceholderDialog screenshotDialog; +static PSPGamedataInstallDialog gamedataInstallDialog; static std::set currentlyLoadedModules; @@ -75,6 +78,7 @@ void __UtilityDoState(PointerWrap &p) oskDialog.DoState(p); netDialog.DoState(p); screenshotDialog.DoState(p); + gamedataInstallDialog.DoState(p); p.Do(currentlyLoadedModules); p.DoMarker("sceUtility"); } @@ -86,6 +90,7 @@ void __UtilityShutdown() oskDialog.Shutdown(true); netDialog.Shutdown(true); screenshotDialog.Shutdown(true); + gamedataInstallDialog.Shutdown(true); } int __UtilityGetStatus() @@ -437,16 +442,61 @@ int sceUtilityScreenshotGetStatus() return retval; } -void sceUtilityGamedataInstallInitStart(u32 unknown) +int sceUtilityGamedataInstallInitStart(u32 paramsAddr) { - ERROR_LOG_REPORT(SCEUTILITY, "UNIMPL sceUtilityGamedataInstallInitStart(%i)", unknown); + if (currentDialogActive && currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) + { + WARN_LOG(SCEUTILITY, "sceUtilityOskInitStart(%08x): wrong dialog type", paramsAddr); + return SCE_ERROR_UTILITY_WRONG_TYPE; + } + DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x)", paramsAddr); + currentDialogType = UTILITY_DIALOG_GAMEDATAINSTALL; + currentDialogActive = true; + return gamedataInstallDialog.Init(paramsAddr); +} + +int sceUtilityGamedataInstallShutdownStart() { + if (currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) + { + WARN_LOG(SCEUTILITY, "sceUtilityGamedataInstallShutdownStart(): wrong dialog type"); + return SCE_ERROR_UTILITY_WRONG_TYPE; + } + currentDialogActive = false; + + DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallShutdownStart()"); + return gamedataInstallDialog.Shutdown(); +} + +int sceUtilityGamedataInstallUpdate(int speed) { + ERROR_LOG(SCEUTILITY, "UNIMPL sceUtilityGamedataInstallUpdate(%08x)", speed); + gamedataInstallDialog.Abort(); + return 0; } int sceUtilityGamedataInstallGetStatus() { - u32 retval = __UtilityGetStatus(); - ERROR_LOG(SCEUTILITY, "UNIMPL %i=sceUtilityGamedataInstallGetStatus()", retval); - return retval; + if (currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) + { + WARN_LOG(SCEUTILITY, "sceUtilitySavedataGetStatus(): wrong dialog type"); + return SCE_ERROR_UTILITY_WRONG_TYPE; + } + + int status = gamedataInstallDialog.GetStatus(); + DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityGamedataInstallGetStatus()", status); + return status; +} + +int sceUtilityGamedataInstallAbort() +{ + if (currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) + { + WARN_LOG(SCEUTILITY, "sceUtilityMsgDialogShutdownStart(): wrong dialog type"); + return SCE_ERROR_UTILITY_WRONG_TYPE; + } + currentDialogActive = false; + + DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallDialogAbort"); + return gamedataInstallDialog.Abort(); } //TODO: should save to config file @@ -684,11 +734,11 @@ const HLEFunction sceUtility[] = {0x0D5BC6D2, 0, "sceUtilityLoadUsbModule"}, {0xF64910F0, 0, "sceUtilityUnloadUsbModule"}, - {0x24AC31EB, &WrapV_U, "sceUtilityGamedataInstallInitStart"}, - {0x32E32DCB, 0, "sceUtilityGamedataInstallShutdownStart"}, - {0x4AECD179, 0, "sceUtilityGamedataInstallUpdate"}, + {0x24AC31EB, &WrapI_U, "sceUtilityGamedataInstallInitStart"}, + {0x32E32DCB, &WrapI_V, "sceUtilityGamedataInstallShutdownStart"}, + {0x4AECD179, &WrapI_I, "sceUtilityGamedataInstallUpdate"}, {0xB57E95D9, &WrapI_V, "sceUtilityGamedataInstallGetStatus"}, - {0x180F7B62, 0, "sceUtilityGamedataInstallAbort"}, + {0x180F7B62, &WrapI_V, "sceUtilityGamedataInstallAbort"}, {0x16D02AF0, 0, "sceUtilityNpSigninInitStart"}, {0xE19C97D6, 0, "sceUtilityNpSigninShutdownStart"},