1 // Copyright (c) 2013- PPSSPP Project.
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.
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.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official git repository and contact information can be found at
16 // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
20 #include "base/functional.h"
21 #include "file/path.h"
22 #include "ui/ui_screen.h"
23 #include "ui/viewgroup.h"
24 #include "UI/MiscScreens.h"
26 class GameBrowser
: public UI::LinearLayout
{
28 GameBrowser(std::string path
, bool allowBrowsing
, bool *gridStyle_
, std::string lastText
, std::string lastLink
, int flags
= 0, UI::LayoutParams
*layoutParams
= 0);
31 UI::Event OnHoldChoice
;
32 UI::Event OnHighlight
;
34 UI::Choice
*HomebrewStoreButton() { return homebrewStoreButton_
; }
38 bool IsCurrentPathPinned();
39 const std::vector
<std::string
> GetPinnedPaths();
40 const std::string
GetBaseName(const std::string
&path
);
42 UI::EventReturn
GameButtonClick(UI::EventParams
&e
);
43 UI::EventReturn
GameButtonHoldClick(UI::EventParams
&e
);
44 UI::EventReturn
GameButtonHighlight(UI::EventParams
&e
);
45 UI::EventReturn
NavigateClick(UI::EventParams
&e
);
46 UI::EventReturn
LayoutChange(UI::EventParams
&e
);
47 UI::EventReturn
LastClick(UI::EventParams
&e
);
48 UI::EventReturn
HomeClick(UI::EventParams
&e
);
49 UI::EventReturn
PinToggleClick(UI::EventParams
&e
);
51 UI::ViewGroup
*gameList_
;
55 std::string lastText_
;
56 std::string lastLink_
;
58 UI::Choice
*homebrewStoreButton_
;
61 class MainScreen
: public UIScreenWithBackground
{
66 virtual bool isTopLevel() const { return true; }
68 // Horrible hack to show the demos & homebrew tab after having installed a game from a zip file.
69 static bool showHomebrewTab
;
72 virtual void CreateViews();
73 virtual void DrawBackground(UIContext
&dc
);
74 virtual void update(InputState
&input
);
75 virtual void sendMessage(const char *message
, const char *value
);
76 virtual void dialogFinished(const Screen
*dialog
, DialogResult result
);
79 bool DrawBackgroundFor(UIContext
&dc
, const std::string
&gamePath
, float progress
);
81 UI::EventReturn
OnGameSelected(UI::EventParams
&e
);
82 UI::EventReturn
OnGameSelectedInstant(UI::EventParams
&e
);
83 UI::EventReturn
OnGameHighlight(UI::EventParams
&e
);
85 UI::EventReturn
OnLoadFile(UI::EventParams
&e
);
86 UI::EventReturn
OnGameSettings(UI::EventParams
&e
);
87 UI::EventReturn
OnRecentChange(UI::EventParams
&e
);
88 UI::EventReturn
OnCredits(UI::EventParams
&e
);
89 UI::EventReturn
OnSupport(UI::EventParams
&e
);
90 UI::EventReturn
OnPPSSPPOrg(UI::EventParams
&e
);
91 UI::EventReturn
OnForums(UI::EventParams
&e
);
92 UI::EventReturn
OnExit(UI::EventParams
&e
);
93 UI::EventReturn
OnDownloadUpgrade(UI::EventParams
&e
);
94 UI::EventReturn
OnDismissUpgrade(UI::EventParams
&e
);
95 UI::EventReturn
OnHomebrewStore(UI::EventParams
&e
);
97 UI::LinearLayout
*upgradeBar_
;
98 UI::TabHolder
*tabHolder_
;
100 std::string highlightedGamePath_
;
101 std::string prevHighlightedGamePath_
;
102 float highlightProgress_
;
103 float prevHighlightProgress_
;
105 bool lockBackgroundAudio_
;
108 bool UseVerticalLayout() const;
111 class UmdReplaceScreen
: public UIDialogScreenWithBackground
{
113 UmdReplaceScreen() {}
116 virtual void CreateViews();
117 virtual void update(InputState
&input
);
118 //virtual void sendMessage(const char *message, const char *value);
121 UI::EventReturn
OnGameSelected(UI::EventParams
&e
);
122 UI::EventReturn
OnGameSelectedInstant(UI::EventParams
&e
);
124 UI::EventReturn
OnCancel(UI::EventParams
&e
);
125 UI::EventReturn
OnGameSettings(UI::EventParams
&e
);