CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/Dialog/PSPGamedataInstallDialog.h
Views: 1401
1
// Copyright (c) 2012- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0 or later versions.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include "Core/Dialog/PSPDialog.h"
21
#include "Core/Dialog/SavedataParam.h"
22
23
struct SceUtilityGamedataInstallParam {
24
pspUtilityDialogCommon common;
25
s32_le mode;
26
char gameName[13];
27
char ignore1[3];
28
char dataName[20];
29
PspUtilitySavedataSFOParam sfoParam;
30
int progress;
31
u32_le unknownResult1;
32
u32_le unknownResult2;
33
char ignore3[48];
34
};
35
36
class PSPGamedataInstallDialog: public PSPDialog {
37
public:
38
PSPGamedataInstallDialog(UtilityDialogType type);
39
~PSPGamedataInstallDialog();
40
41
int Init(u32 paramAddr);
42
int Update(int animSpeed) override;
43
int Shutdown(bool force = false) override;
44
void DoState(PointerWrap &p) override;
45
46
int Abort();
47
std::string GetGameDataInstallFileName(const SceUtilityGamedataInstallParam *param, const std::string &filename);
48
49
protected:
50
// TODO: Manage status correctly.
51
bool UseAutoStatus() override {
52
return true;
53
}
54
55
private:
56
void UpdateProgress();
57
void RenderProgress(int percentage);
58
void OpenNextFile();
59
void CopyCurrentFileData();
60
void CloseCurrentFile();
61
void WriteSfoFile();
62
63
SceUtilityGamedataInstallParam request{};
64
PSPPointer<SceUtilityGamedataInstallParam> param;
65
std::vector<std::string> inFileNames;
66
int numFiles = 0;
67
int readFiles = 0;
68
u64 allFilesSize = 0; // use this to calculate progress value.
69
u64 allReadSize = 0; // use this to calculate progress value.
70
int progressValue = 0;
71
72
int currentInputFile = 0;
73
u32 currentInputBytesLeft = 0;
74
int currentOutputFile = 0;
75
};
76
77