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/PSPMsgDialog.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 <string>
21
22
#include "Common/Swap.h"
23
#include "Core/Dialog/PSPDialog.h"
24
25
#define SCE_UTILITY_MSGDIALOG_OPTION_ERRORSOUND 0x00000000
26
#define SCE_UTILITY_MSGDIALOG_OPTION_TEXTSOUND 0x00000001
27
#define SCE_UTILITY_MSGDIALOG_OPTION_NOSOUND 0x00000002
28
#define SCE_UTILITY_MSGDIALOG_OPTION_YESNO 0x00000010
29
#define SCE_UTILITY_MSGDIALOG_OPTION_OK 0x00000020
30
#define SCE_UTILITY_MSGDIALOG_OPTION_NOCANCEL 0x00000080
31
#define SCE_UTILITY_MSGDIALOG_OPTION_DEFAULT_NO 0x00000100
32
33
#define SCE_UTILITY_MSGDIALOG_SIZE_V1 572
34
#define SCE_UTILITY_MSGDIALOG_SIZE_V2 580
35
#define SCE_UTILITY_MSGDIALOG_SIZE_V3 708
36
37
#define SCE_UTILITY_MSGDIALOG_OPTION_SUPPORTED 0x000001B3 // OR of all options coded to display warning
38
39
#define SCE_UTILITY_MSGDIALOG_ERROR_BADOPTION 0x80110501
40
#define SCE_UTILITY_MSGDIALOG_ERROR_ERRORCODEINVALID 0x80110502
41
42
struct pspMessageDialog
43
{
44
pspUtilityDialogCommon common;
45
s32_le result;
46
s32_le type;
47
u32_le errorNum;
48
char string[512];
49
// End of request V1 (Size 572)
50
u32_le options;
51
u32_le buttonPressed;
52
// End of request V2 (Size 580)
53
char okayButton[64];
54
char cancelButton[64];
55
// End of request V3 (Size 708)
56
};
57
58
59
class PSPMsgDialog: public PSPDialog {
60
public:
61
PSPMsgDialog(UtilityDialogType type);
62
~PSPMsgDialog();
63
64
int Init(unsigned int paramAddr);
65
int Update(int animSpeed) override;
66
int Shutdown(bool force = false) override;
67
void DoState(PointerWrap &p) override;
68
pspUtilityDialogCommon *GetCommonParam() override;
69
70
int Abort();
71
72
protected:
73
bool UseAutoStatus() override {
74
return false;
75
}
76
77
private:
78
void FormatErrorCode(uint32_t code);
79
void DisplayMessage(const std::string &text, bool hasYesNo = false, bool hasOK = false);
80
81
enum Flags
82
{
83
DS_MSG = 0x1,
84
DS_ERRORMSG = 0x2,
85
DS_YESNO = 0x4,
86
DS_DEFNO = 0x8,
87
DS_OK = 0x10,
88
DS_VALIDBUTTON = 0x20,
89
DS_CANCELBUTTON = 0x40,
90
DS_NOSOUND = 0x80,
91
DS_ERROR = 0x100,
92
DS_ABORT = 0x200,
93
};
94
95
u32 flag = 0;
96
97
pspMessageDialog messageDialog{};
98
int messageDialogAddr = 0;
99
100
char msgText[512];
101
int yesnoChoice = 0;
102
float scrollPos_ = 0.0f;
103
int framesUpHeld_ = 0;
104
int framesDownHeld_ = 0;
105
};
106
107
108