Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/UI/CwCheatScreen.h
5672 views
1
// Copyright (c) 2013- 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 <cstdint>
21
#include <functional>
22
23
#include "Common/UI/View.h"
24
#include "Common/UI/UIScreen.h"
25
#include "Common/UI/Context.h"
26
#include "UI/BaseScreens.h"
27
#include "UI/SimpleDialogScreen.h"
28
29
struct CheatFileInfo;
30
class CWCheatEngine;
31
32
class CwCheatScreen : public UITwoPaneBaseDialogScreen {
33
public:
34
CwCheatScreen(const Path &gamePath);
35
~CwCheatScreen();
36
37
bool TryLoadCheatInfo();
38
39
void OnAddCheat(UI::EventParams &params);
40
void OnImportCheat(UI::EventParams &params);
41
void OnImportBrowse(UI::EventParams &params);
42
void OnEditCheatFile(UI::EventParams &params);
43
void OnDisableAll(UI::EventParams &params);
44
45
void update() override;
46
void onFinish(DialogResult result) override;
47
48
const char *tag() const override { return "CwCheat"; }
49
50
protected:
51
void BeforeCreateViews() override;
52
void CreateSettingsViews(UI::ViewGroup *) override;
53
void CreateContentViews(UI::ViewGroup *) override;
54
std::string_view GetTitle() const override;
55
56
private:
57
void OnCheckBox(int index);
58
bool ImportCheats(const Path &cheatFile);
59
60
enum { INDEX_ALL = -1 };
61
bool HasCheatWithName(const std::string &name);
62
bool RebuildCheatFile(int index);
63
64
UI::TextView *errorMessageView_ = nullptr;
65
66
CWCheatEngine *engine_ = nullptr;
67
std::vector<CheatFileInfo> fileInfo_;
68
std::string gameID_;
69
int fileCheckCounter_ = 0;
70
uint64_t fileCheckHash_ = 0;
71
};
72
73