2012-12-10 12:08:54 +00:00
|
|
|
// 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
|
|
|
|
|
2017-02-27 19:51:36 +00:00
|
|
|
#include <thread>
|
2017-02-27 20:57:46 +00:00
|
|
|
#include <mutex>
|
2017-02-27 19:51:36 +00:00
|
|
|
|
2014-03-15 17:48:30 +00:00
|
|
|
#include "Core/Dialog/PSPDialog.h"
|
|
|
|
#include "Core/Dialog/SavedataParam.h"
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_TYPE (0x80110300)
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_MS (0x80110301)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_EJECT_MS (0x80110302)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_ACCESS_ERROR (0x80110305)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN (0x80110306)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA (0x80110307)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_PARAM (0x80110308)
|
2020-10-01 07:41:27 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_FILE_NOT_FOUND (0x80110309)
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_LOAD_INTERNAL (0x8011030b)
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2013-05-31 06:32:13 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_NO_MEMSTICK (0x80110321)
|
2014-11-02 20:47:09 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_MEMSTICK_FULL (0x80110323)
|
2014-10-03 07:16:12 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_DATA_BROKEN (0x80110326)
|
2013-05-31 06:32:13 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA (0x80110327)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS (0x80110328)
|
2014-10-03 07:16:12 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_FILE_NOT_FOUND (0x80110329)
|
2013-05-31 06:32:13 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_STATUS (0x8011032c)
|
2012-12-27 01:33:56 +00:00
|
|
|
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_MS (0x80110381)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_EJECT_MS (0x80110382)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE (0x80110383)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_PROTECTED (0x80110384)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_ACCESS_ERROR (0x80110385)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_PARAM (0x80110388)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_NO_UMD (0x80110389)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_WRONG_UMD (0x8011038a)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SAVE_INTERNAL (0x8011038b)
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_MS (0x80110341)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_EJECT_MS (0x80110342)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_MS_PROTECTED (0x80110344)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_ACCESS_ERROR (0x80110345)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_NO_DATA (0x80110347)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_PARAM (0x80110348)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_DELETE_INTERNAL (0x8011034b)
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-03-03 16:16:53 +00:00
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_MS (0x801103C1)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_EJECT_MS (0x801103C2)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_ACCESS_ERROR (0x801103C5)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_DATA (0x801103C7)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_PARAM (0x801103C8)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_NO_UMD (0x801103C9)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_WRONG_UMD (0x801103Ca)
|
|
|
|
#define SCE_UTILITY_SAVEDATA_ERROR_SIZES_INTERNAL (0x801103Cb)
|
2012-12-10 12:08:54 +00:00
|
|
|
|
|
|
|
class PSPSaveDialog: public PSPDialog {
|
|
|
|
public:
|
2021-02-27 21:43:12 +00:00
|
|
|
PSPSaveDialog(UtilityDialogType type);
|
2012-12-10 12:08:54 +00:00
|
|
|
virtual ~PSPSaveDialog();
|
|
|
|
|
2012-12-25 02:37:28 +00:00
|
|
|
virtual int Init(int paramAddr);
|
2014-12-08 20:14:35 +00:00
|
|
|
virtual int Update(int animSpeed) override;
|
|
|
|
virtual int Shutdown(bool force = false) override;
|
|
|
|
virtual void DoState(PointerWrap &p) override;
|
|
|
|
virtual pspUtilityDialogCommon *GetCommonParam() override;
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-06-30 00:29:02 +00:00
|
|
|
void ExecuteIOAction();
|
|
|
|
|
2014-02-08 17:39:50 +00:00
|
|
|
protected:
|
2015-09-17 18:29:37 +00:00
|
|
|
virtual bool UseAutoStatus() override {
|
2014-02-08 17:39:50 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-01-24 09:21:13 +00:00
|
|
|
private:
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2013-06-10 05:48:35 +00:00
|
|
|
void DisplayBanner(int which);
|
2012-12-10 12:08:54 +00:00
|
|
|
void DisplaySaveList(bool canMove = true);
|
2018-09-01 21:40:44 +00:00
|
|
|
void DisplaySaveIcon(bool checkExists);
|
2012-12-10 12:08:54 +00:00
|
|
|
void DisplaySaveDataInfo1();
|
2017-12-02 16:17:50 +00:00
|
|
|
void DisplaySaveDataInfo2(bool showNewData = false);
|
2013-06-10 12:37:30 +00:00
|
|
|
void DisplayMessage(std::string text, bool hasYesNo = false);
|
2014-01-24 09:21:13 +00:00
|
|
|
const std::string GetSelectedSaveDirName() const;
|
2012-12-10 12:08:54 +00:00
|
|
|
|
2014-06-30 00:29:02 +00:00
|
|
|
void JoinIOThread();
|
|
|
|
void StartIOThread();
|
2014-06-30 00:07:04 +00:00
|
|
|
void ExecuteNotVisibleIOAction();
|
|
|
|
|
2012-12-10 12:08:54 +00:00
|
|
|
enum DisplayState
|
|
|
|
{
|
|
|
|
DS_NONE,
|
|
|
|
|
|
|
|
DS_SAVE_LIST_CHOICE,
|
2013-05-12 02:10:01 +00:00
|
|
|
DS_SAVE_CONFIRM,
|
2012-12-10 12:08:54 +00:00
|
|
|
DS_SAVE_CONFIRM_OVERWRITE,
|
|
|
|
DS_SAVE_SAVING,
|
|
|
|
DS_SAVE_DONE,
|
|
|
|
|
|
|
|
DS_LOAD_LIST_CHOICE,
|
2013-05-12 02:10:01 +00:00
|
|
|
DS_LOAD_CONFIRM,
|
2012-12-10 12:08:54 +00:00
|
|
|
DS_LOAD_LOADING,
|
|
|
|
DS_LOAD_DONE,
|
|
|
|
DS_LOAD_NODATA,
|
|
|
|
|
|
|
|
DS_DELETE_LIST_CHOICE,
|
|
|
|
DS_DELETE_CONFIRM,
|
|
|
|
DS_DELETE_DELETING,
|
|
|
|
DS_DELETE_DONE,
|
2014-06-30 00:42:20 +00:00
|
|
|
DS_DELETE_NODATA,
|
|
|
|
|
|
|
|
DS_SAVE_FAILED,
|
|
|
|
DS_LOAD_FAILED,
|
|
|
|
DS_DELETE_FAILED,
|
2012-12-10 12:08:54 +00:00
|
|
|
};
|
|
|
|
|
2013-06-10 05:48:35 +00:00
|
|
|
enum DialogBanner
|
|
|
|
{
|
|
|
|
DB_NONE,
|
|
|
|
DB_SAVE,
|
|
|
|
DB_LOAD,
|
|
|
|
DB_DELETE
|
|
|
|
};
|
|
|
|
|
2021-02-27 20:01:52 +00:00
|
|
|
DisplayState display = DS_NONE;
|
2012-12-10 12:08:54 +00:00
|
|
|
|
|
|
|
SavedataParam param;
|
2012-12-24 00:22:28 +00:00
|
|
|
SceUtilitySavedataParam request;
|
2013-06-24 14:57:52 +00:00
|
|
|
// For detecting changes made by the game.
|
|
|
|
SceUtilitySavedataParam originalRequest;
|
2021-02-27 20:01:52 +00:00
|
|
|
u32 requestAddr = 0;
|
|
|
|
int currentSelectedSave = 0;
|
2012-12-10 12:08:54 +00:00
|
|
|
|
|
|
|
int yesnoChoice;
|
2014-06-30 00:29:02 +00:00
|
|
|
|
|
|
|
enum SaveIOStatus
|
|
|
|
{
|
|
|
|
SAVEIO_NONE,
|
|
|
|
SAVEIO_PENDING,
|
|
|
|
SAVEIO_DONE,
|
|
|
|
};
|
|
|
|
|
2021-02-27 20:01:52 +00:00
|
|
|
std::thread *ioThread = nullptr;
|
2017-02-27 20:57:46 +00:00
|
|
|
std::mutex paramLock;
|
2014-06-30 00:29:02 +00:00
|
|
|
volatile SaveIOStatus ioThreadStatus;
|
2012-12-10 12:08:54 +00:00
|
|
|
};
|
|
|
|
|