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 <functional> 21 22 #include "UI/MiscScreens.h" 23 #include "Common/UI/UIScreen.h" 24 #include "Common/File/Path.h" 25 26 // Game screen: Allows you to start a game, delete saves, delete the game, 27 // set game specific settings, etc. 28 29 // Uses GameInfoCache heavily to implement the functionality. 30 // Should possibly merge this with the PauseScreen. 31 32 class GameScreen : public UIDialogScreenWithGameBackground { 33 public: 34 GameScreen(const Path &gamePath); 35 ~GameScreen(); 36 37 void update() override; 38 39 void render() override; 40 tag()41 std::string tag() const override { return "game"; } 42 43 protected: 44 void CreateViews() override; 45 void CallbackDeleteConfig(bool yes); 46 void CallbackDeleteSaveData(bool yes); 47 void CallbackDeleteGame(bool yes); 48 bool isRecentGame(const Path &gamePath); 49 50 private: 51 UI::Choice *AddOtherChoice(UI::Choice *choice); 52 53 // Event handlers 54 UI::EventReturn OnPlay(UI::EventParams &e); 55 UI::EventReturn OnGameSettings(UI::EventParams &e); 56 UI::EventReturn OnDeleteSaveData(UI::EventParams &e); 57 UI::EventReturn OnDeleteGame(UI::EventParams &e); 58 UI::EventReturn OnSwitchBack(UI::EventParams &e); 59 UI::EventReturn OnCreateShortcut(UI::EventParams &e); 60 UI::EventReturn OnRemoveFromRecent(UI::EventParams &e); 61 UI::EventReturn OnShowInFolder(UI::EventParams &e); 62 UI::EventReturn OnCreateConfig(UI::EventParams &e); 63 UI::EventReturn OnDeleteConfig(UI::EventParams &e); 64 UI::EventReturn OnCwCheat(UI::EventParams &e); 65 UI::EventReturn OnSetBackground(UI::EventParams &e); 66 UI::EventReturn OnDoCRC32(UI::EventParams& e); 67 68 // As we load metadata in the background, we need to be able to update these after the fact. 69 UI::TextView *tvTitle_ = nullptr; 70 UI::TextView *tvGameSize_ = nullptr; 71 UI::TextView *tvSaveDataSize_ = nullptr; 72 UI::TextView *tvInstallDataSize_ = nullptr; 73 UI::TextView *tvRegion_ = nullptr; 74 UI::TextView *tvCRC_ = nullptr; 75 76 UI::Choice *btnGameSettings_ = nullptr; 77 UI::Choice *btnCreateGameConfig_ = nullptr; 78 UI::Choice *btnDeleteGameConfig_ = nullptr; 79 UI::Choice *btnDeleteSaveData_ = nullptr; 80 UI::Choice *btnSetBackground_ = nullptr; 81 82 UI::Choice *btnCalcCRC_ = nullptr; 83 84 std::vector<UI::Choice *> otherChoices_; 85 std::vector<Path> saveDirs; 86 std::string CRC32string; 87 }; 88