diff --git a/CMakeLists.txt b/CMakeLists.txt index 80ee7ea980..aaea1d6760 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -981,6 +981,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Dialog/PSPPlaceholderDialog.h Core/Dialog/PSPSaveDialog.cpp Core/Dialog/PSPSaveDialog.h + Core/Dialog/PSPScreenshotDialog.cpp + Core/Dialog/PSPScreenshotDialog.h Core/Dialog/SavedataParam.cpp Core/Dialog/SavedataParam.h Core/ELF/ElfReader.cpp diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 3c494c92f1..2ff2e9e02e 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -9,6 +9,7 @@ set(SRCS Dialog/PSPOskDialog.cpp Dialog/PSPGamedataInstallDialog.cpp Dialog/PSPNetconfDialog.cpp + Dialog/PSPScreenshotDialog.cpp MIPS/MIPS.cpp MIPS/MIPSAnalyst.cpp MIPS/MIPSCodeUtils.cpp diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 61d4957453..21275e4fef 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -183,6 +183,7 @@ + @@ -453,6 +454,7 @@ + @@ -636,4 +638,4 @@ - \ No newline at end of file + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index fb49932054..86d942c46c 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -348,6 +348,9 @@ Dialog + + Dialog + HW @@ -810,6 +813,9 @@ Dialog + + Dialog + HW @@ -967,4 +973,4 @@ - \ No newline at end of file + diff --git a/Core/Dialog/PSPPlaceholderDialog.cpp b/Core/Dialog/PSPPlaceholderDialog.cpp index 1800ab53c8..4672d07211 100644 --- a/Core/Dialog/PSPPlaceholderDialog.cpp +++ b/Core/Dialog/PSPPlaceholderDialog.cpp @@ -33,35 +33,13 @@ int PSPPlaceholderDialog::Init() int PSPPlaceholderDialog::Update(int animSpeed) { - //__UtilityUpdate(); - if (status == SCE_UTILITY_STATUS_INITIALIZE) - { + if (status == SCE_UTILITY_STATUS_INITIALIZE) { status = SCE_UTILITY_STATUS_RUNNING; - } - else if (status == SCE_UTILITY_STATUS_RUNNING) - { - //Check with JPCSPTrace log of Dream Club Portable - //But break Project Divx extand and Kenka Banchou Bros when take screenshot - //They are not call sceUtilityScreenshotContStart; - //status = SCE_UTILITY_STATUS_SCREENSHOT_UNKNOWN; + } else if (status == SCE_UTILITY_STATUS_RUNNING) { status = SCE_UTILITY_STATUS_FINISHED; - } - else if (status == SCE_UTILITY_STATUS_FINISHED) - { + } else if (status == SCE_UTILITY_STATUS_FINISHED) { status = SCE_UTILITY_STATUS_SHUTDOWN; } + return 0; } - -int PSPPlaceholderDialog::ContStart() -{ - // base on JPCSP http://code.google.com/p/jpcsp/source/detail?r=3381 - // be initialized with sceUtilityScreenshotInitStart and the startupType - // parameter has to be PSP_UTILITY_SCREENSHOT_TYPE_CONT_AUTO, otherwise, an - // error is returned. - if (status != SCE_UTILITY_STATUS_SCREENSHOT_UNKNOWN) - return SCE_ERROR_UTILITY_INVALID_STATUS; - // Check with JPCSPTrace log of Dream Club Portable - status = SCE_UTILITY_STATUS_FINISHED; - return 0; -} \ No newline at end of file diff --git a/Core/Dialog/PSPPlaceholderDialog.h b/Core/Dialog/PSPPlaceholderDialog.h index 4aab05809c..42fba56520 100644 --- a/Core/Dialog/PSPPlaceholderDialog.h +++ b/Core/Dialog/PSPPlaceholderDialog.h @@ -26,7 +26,5 @@ public: virtual int Init(); virtual int Update(int animSpeed); - - virtual int ContStart(); }; diff --git a/Core/Dialog/PSPScreenshotDialog.cpp b/Core/Dialog/PSPScreenshotDialog.cpp new file mode 100644 index 0000000000..8984aa1f38 --- /dev/null +++ b/Core/Dialog/PSPScreenshotDialog.cpp @@ -0,0 +1,92 @@ +// 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 "PSPScreenshotDialog.h" +#include "Core/MemMap.h" +#include "ChunkFile.h" + +enum SceUtilityScreenshotType +{ + SCE_UTILITY_SCREENSHOT_TYPE_GUI = 0, + SCE_UTILITY_SCREENSHOT_TYPE_AUTO = 1, + SCE_UTILITY_SCREENSHOT_TYPE_SAVE = 2, + SCE_UTILITY_SCREENSHOT_TYPE_VIEW = 3, + SCE_UTILITY_SCREENSHOT_TYPE_CONT_FINISH = 4, + SCE_UTILITY_SCREENSHOT_TYPE_CONT_AUTO = 5, +}; + +PSPScreenshotDialog::PSPScreenshotDialog() : PSPDialog() { + +} + +PSPScreenshotDialog::~PSPScreenshotDialog() { +} + +int PSPScreenshotDialog::Init(int paramAddr) +{ + // Already running + if (status != SCE_UTILITY_STATUS_NONE && status != SCE_UTILITY_STATUS_SHUTDOWN) { + return SCE_ERROR_UTILITY_INVALID_STATUS; + } + + mode = Memory::Read_U32(paramAddr); + status = SCE_UTILITY_STATUS_INITIALIZE; + + return 0; +} + +int PSPScreenshotDialog::Update(int animSpeed) +{ + PSPDialog::DialogStatus retval = status; + if (UseAutoStatus()) { + if (status == SCE_UTILITY_STATUS_INITIALIZE) { + status = SCE_UTILITY_STATUS_RUNNING; + } else if (status == SCE_UTILITY_STATUS_RUNNING) { + if ((mode & 0x7) == SCE_UTILITY_SCREENSHOT_TYPE_CONT_AUTO || (mode & 0x7) == SCE_UTILITY_SCREENSHOT_TYPE_CONT_FINISH) { + // When screenshot cont. mode is specified , sceUtilityScreenshotContStart will be called in next call. + status = SCE_UTILITY_STATUS_SCREENSHOT_UNKNOWN; + } else { + status = SCE_UTILITY_STATUS_FINISHED; + } + } else if (status == SCE_UTILITY_STATUS_FINISHED) { + status = SCE_UTILITY_STATUS_SHUTDOWN; + } + } + return retval; +} + +int PSPScreenshotDialog::ContStart() +{ + // Based on JPCSP http://code.google.com/p/jpcsp/source/detail?r=3381 + if (status != SCE_UTILITY_STATUS_SCREENSHOT_UNKNOWN) + return SCE_ERROR_UTILITY_INVALID_STATUS; + + // Check with JPCSPTrace log of Dream Club Portable + status = SCE_UTILITY_STATUS_FINISHED; + + return 0; +} + +void PSPScreenshotDialog::DoState(PointerWrap &p) { + PSPDialog::DoState(p); + + auto s = p.Section("PSPScreenshotDialog", 0, 1); + if (!s) + return; + + p.Do(mode); +} diff --git a/Core/Dialog/PSPScreenshotDialog.h b/Core/Dialog/PSPScreenshotDialog.h new file mode 100644 index 0000000000..1d7917a5e8 --- /dev/null +++ b/Core/Dialog/PSPScreenshotDialog.h @@ -0,0 +1,35 @@ +// 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" + +class PSPScreenshotDialog : public PSPDialog { +public: + PSPScreenshotDialog(); + virtual ~PSPScreenshotDialog(); + + virtual int Init(int paramAddr); + virtual int Update(int animSpeed); + virtual int ContStart(); + virtual void DoState(PointerWrap &p); + +protected: + int mode; +}; + diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 92a080d4d2..56acc11bf1 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -39,6 +39,7 @@ #include "Core/Dialog/PSPOskDialog.h" #include "Core/Dialog/PSPGamedataInstallDialog.h" #include "Core/Dialog/PSPNetconfDialog.h" +#include "Core/Dialog/PSPScreenshotDialog.h" #define PSP_AV_MODULE_AVCODEC 0 #define PSP_AV_MODULE_SASCORE 1 @@ -74,7 +75,7 @@ static PSPSaveDialog saveDialog; static PSPMsgDialog msgDialog; static PSPOskDialog oskDialog; static PSPNetconfDialog netDialog; -static PSPPlaceholderDialog screenshotDialog; +static PSPScreenshotDialog screenshotDialog; static PSPGamedataInstallDialog gamedataInstallDialog; static std::set currentlyLoadedModules; @@ -444,7 +445,7 @@ u32 sceUtilityScreenshotInitStart(u32 paramAddr) currentDialogType = UTILITY_DIALOG_SCREENSHOT; currentDialogActive = true; - u32 retval = screenshotDialog.Init(); + u32 retval = screenshotDialog.Init(paramAddr); WARN_LOG_REPORT(SCEUTILITY, "%08x=sceUtilityScreenshotInitStart(%08x)", retval, paramAddr); return retval; } diff --git a/android/jni/Android.mk b/android/jni/Android.mk index e491e0c9e5..c554656672 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -191,6 +191,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/Dialog/PSPMsgDialog.cpp \ $(SRC)/Core/Dialog/PSPNetconfDialog.cpp \ $(SRC)/Core/Dialog/PSPOskDialog.cpp \ + $(SRC)/Core/Dialog/PSPScreenshotDialog.cpp \ $(SRC)/Core/Dialog/PSPPlaceholderDialog.cpp \ $(SRC)/Core/Dialog/PSPSaveDialog.cpp \ $(SRC)/Core/Dialog/SavedataParam.cpp \