diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a37a4300b..8f12a3260d 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/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..513a7e2745 --- /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; +}; diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index e735b8e6a4..55b3ba6b40 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; @@ -79,6 +82,7 @@ void __UtilityDoState(PointerWrap &p) oskDialog.DoState(p); netDialog.DoState(p); screenshotDialog.DoState(p); + gamedataInstallDialog.DoState(p); p.Do(currentlyLoadedModules); } @@ -89,6 +93,7 @@ void __UtilityShutdown() oskDialog.Shutdown(true); netDialog.Shutdown(true); screenshotDialog.Shutdown(true); + gamedataInstallDialog.Shutdown(true); } int __UtilityGetStatus() @@ -440,16 +445,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, "sceUtilityGamedataInstallInitStart(%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, "sceUtilityGamedataInstallGetStatus(): 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 @@ -687,11 +737,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"}, 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 \