From 41dfea3150a91a9c0578682819a725e9f56c1d30 Mon Sep 17 00:00:00 2001 From: shenweip <1037567878@qq.com> Date: Fri, 13 Sep 2013 23:05:11 +0800 Subject: [PATCH 1/7] Add PSPGamedataInstallDialog --- Core/Core.vcxproj | 2 + Core/Core.vcxproj.filters | 6 +++ Core/Dialog/PSPGamedataInstallDialog.cpp | 61 ++++++++++++++++++++++++ Core/Dialog/PSPGamedataInstallDialog.h | 54 +++++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 Core/Dialog/PSPGamedataInstallDialog.cpp create mode 100644 Core/Dialog/PSPGamedataInstallDialog.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 6cda987ec7..5bfb3b93dd 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -172,6 +172,7 @@ + @@ -409,6 +410,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 395a4174dd..26a7ff1a15 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -493,6 +493,9 @@ HLE\Libraries + + Dialog + @@ -906,6 +909,9 @@ HLE\Libraries + + Dialog + diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp new file mode 100644 index 0000000000..3aee969b85 --- /dev/null +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -0,0 +1,61 @@ +// Copyright (c) 2012- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "PSPGamedataInstallDialog.h" +#include "ChunkFile.h" +#include "../Core/MemMap.h" + +PSPGamedataInstallDialog::PSPGamedataInstallDialog() { +} + +PSPGamedataInstallDialog::~PSPGamedataInstallDialog() { +} + +int PSPGamedataInstallDialog::Init(u32 paramAddr) +{ + // Already running + if (status != SCE_UTILITY_STATUS_NONE && status != SCE_UTILITY_STATUS_SHUTDOWN) + return SCE_ERROR_UTILITY_INVALID_STATUS; + + int size = Memory::Read_U32(paramAddr); + memset(&request, 0, sizeof(request)); + // Only copy the right size to support different request format + Memory::Memcpy(&request, paramAddr, size); + + status = SCE_UTILITY_STATUS_INITIALIZE; + + return 0; +} + +int PSPGamedataInstallDialog::Abort() +{ + return PSPDialog::Shutdown(); +} + +int PSPGamedataInstallDialog::Shutdown(bool force) +{ + if (status != SCE_UTILITY_STATUS_FINISHED && !force) + return SCE_ERROR_UTILITY_INVALID_STATUS; + + return PSPDialog::Shutdown(); +} + +void PSPGamedataInstallDialog::DoState(PointerWrap &p) { + PSPDialog::DoState(p); + p.Do(request); + p.DoMarker("PSPGamedataInstallDialog"); +} \ No newline at end of file diff --git a/Core/Dialog/PSPGamedataInstallDialog.h b/Core/Dialog/PSPGamedataInstallDialog.h new file mode 100644 index 0000000000..d236f1693e --- /dev/null +++ b/Core/Dialog/PSPGamedataInstallDialog.h @@ -0,0 +1,54 @@ +// Copyright (c) 2012- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include "Core/Dialog/PSPDialog.h" + +struct SceUtilityGamedataInstallParam +{ + pspUtilityDialogCommon common; + u32 unknown1; + char gameName[13]; + char ignore1[3]; + char dataName[20]; + char gamedataParamsGameTitle[128]; + char gamedataParamsDataTitle[128]; + char gamedataParamsData[1024]; + u8 unknown2; + char ignore2[7]; + u32 unknownResult1; + u32 unknownResult2; + char ignore[48]; +}; + +class PSPGamedataInstallDialog: public PSPDialog { +public: + PSPGamedataInstallDialog(); + virtual ~PSPGamedataInstallDialog(); + + virtual int Init(u32 paramAddr); + //virtual int Update(); + virtual int Shutdown(bool force = false); + virtual void DoState(PointerWrap &p); + + int Abort(); + + +private: + SceUtilityGamedataInstallParam request; +}; \ No newline at end of file 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 2/7] 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"}, From 82ad9ba853c0c7a67870eb63ecb99f2616cd5526 Mon Sep 17 00:00:00 2001 From: shenweip <1037567878@qq.com> Date: Fri, 13 Sep 2013 23:19:53 +0800 Subject: [PATCH 3/7] Add GamedataInstallDialog to CMakeLists and Android.mk --- CMakeLists.txt | 2 ++ Core/CMakeLists.txt | 1 + android/jni/Android.mk | 1 + 3 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a37a4300b..2a2635039e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,6 +763,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Debugger/SymbolMap.h Core/Dialog/PSPDialog.cpp Core/Dialog/PSPDialog.h + Core/Dialog/PSPGamedataInstallDialog.cpp + Core/Dialog/PSPGamedataInstallDialog.h Core/Dialog/PSPMsgDialog.cpp Core/Dialog/PSPMsgDialog.h Core/Dialog/PSPOskDialog.cpp diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index dad4011183..e43723c313 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -7,6 +7,7 @@ set(SRCS Dialog/PSPSaveDialog.cpp Dialog/SavedataParam.cpp Dialog/PSPOskDialog.cpp + Dialog/PSPGamedataInstallDialog.cpp MIPS/MIPS.cpp MIPS/MIPSAnalyst.cpp MIPS/MIPSCodeUtils.cpp diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 8bbfabf393..0af1927ac3 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -239,6 +239,7 @@ LOCAL_SRC_FILES := \ $(SRC)/Core/Debugger/Breakpoints.cpp \ $(SRC)/Core/Debugger/SymbolMap.cpp \ $(SRC)/Core/Dialog/PSPDialog.cpp \ + $(SRC)/Core/Dialog/PSPGamedataInstallDialog.cpp \ $(SRC)/Core/Dialog/PSPMsgDialog.cpp \ $(SRC)/Core/Dialog/PSPOskDialog.cpp \ $(SRC)/Core/Dialog/PSPPlaceholderDialog.cpp \ From 145a9b4e1d8289cd3340aad927464f0cee63a24a Mon Sep 17 00:00:00 2001 From: shenweip <1037567878@qq.com> Date: Fri, 13 Sep 2013 23:57:31 +0800 Subject: [PATCH 4/7] What a stupid --- Core/HLE/sceUtility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index b38199fd6f..cde3ac9439 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -446,7 +446,7 @@ int sceUtilityGamedataInstallInitStart(u32 paramsAddr) { if (currentDialogActive && currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) { - WARN_LOG(SCEUTILITY, "sceUtilityOskInitStart(%08x): wrong dialog type", paramsAddr); + WARN_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x): wrong dialog type", paramsAddr); return SCE_ERROR_UTILITY_WRONG_TYPE; } DEBUG_LOG(SCEUTILITY, "sceUtilityGamedataInstallInitStart(%08x)", paramsAddr); From c018281509cc8eadfbc4056abaac3b14a9c43aa4 Mon Sep 17 00:00:00 2001 From: shenweip Date: Sat, 14 Sep 2013 00:39:14 +0800 Subject: [PATCH 5/7] fix style --- Core/Dialog/PSPGamedataInstallDialog.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/Dialog/PSPGamedataInstallDialog.h b/Core/Dialog/PSPGamedataInstallDialog.h index d236f1693e..513a7e2745 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.h +++ b/Core/Dialog/PSPGamedataInstallDialog.h @@ -24,16 +24,16 @@ struct SceUtilityGamedataInstallParam pspUtilityDialogCommon common; u32 unknown1; char gameName[13]; - char ignore1[3]; + char ignore1[3]; char dataName[20]; char gamedataParamsGameTitle[128]; char gamedataParamsDataTitle[128]; char gamedataParamsData[1024]; u8 unknown2; - char ignore2[7]; + char ignore2[7]; u32 unknownResult1; u32 unknownResult2; - char ignore[48]; + char ignore[48]; }; class PSPGamedataInstallDialog: public PSPDialog { @@ -51,4 +51,4 @@ public: private: SceUtilityGamedataInstallParam request; -}; \ No newline at end of file +}; From d1cdf7538db5d173ebbf2182dc2b749e07de37e4 Mon Sep 17 00:00:00 2001 From: shenweip Date: Sat, 14 Sep 2013 00:42:41 +0800 Subject: [PATCH 6/7] fix wrong log message --- Core/HLE/sceUtility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index cde3ac9439..f676cc6c72 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -477,7 +477,7 @@ int sceUtilityGamedataInstallGetStatus() { if (currentDialogType != UTILITY_DIALOG_GAMEDATAINSTALL) { - WARN_LOG(SCEUTILITY, "sceUtilitySavedataGetStatus(): wrong dialog type"); + WARN_LOG(SCEUTILITY, "sceUtilityGamedataInstallGetStatus(): wrong dialog type"); return SCE_ERROR_UTILITY_WRONG_TYPE; } From eb91f4a4b6c8a1cc0a8e7aba679ce657fa612954 Mon Sep 17 00:00:00 2001 From: shenweip Date: Sat, 14 Sep 2013 07:50:22 +0800 Subject: [PATCH 7/7] fix style again --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a2635039e..8f12a3260d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -763,7 +763,7 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Debugger/SymbolMap.h Core/Dialog/PSPDialog.cpp Core/Dialog/PSPDialog.h - Core/Dialog/PSPGamedataInstallDialog.cpp + Core/Dialog/PSPGamedataInstallDialog.cpp Core/Dialog/PSPGamedataInstallDialog.h Core/Dialog/PSPMsgDialog.cpp Core/Dialog/PSPMsgDialog.h