Merge pull request #19471 from hrydgard/ingame-gameinfo-screen

Add button to show the game-info screen from the in-game pause screen
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2024-09-18 14:21:20 +02:00
commit 476c69c675
4 files changed
+36 -13

No files matched your search

+20 -3
View File
@@ -51,7 +51,7 @@
#include "UI/SavedataScreen.h"
#include "Core/Reporting.h"
GameScreen::GameScreen(const Path &gamePath) : UIDialogScreenWithGameBackground(gamePath) {
GameScreen::GameScreen(const Path &gamePath, bool inGame) : UIDialogScreenWithGameBackground(gamePath), inGame_(inGame) {
g_BackgroundAudio.SetGame(gamePath);
System_PostUIMessage(UIMessage::GAME_SELECTED, gamePath.ToString());
}
@@ -209,10 +209,16 @@ void GameScreen::CreateViews() {
btnGameSettings_ = rightColumnItems->Add(new Choice(ga->T("Game Settings")));
btnGameSettings_->OnClick.Handle(this, &GameScreen::OnGameSettings);
btnDeleteGameConfig_ = rightColumnItems->Add(new Choice(ga->T("Delete Game Config")));
btnDeleteGameConfig_->OnClick.Handle(this, &GameScreen::OnDeleteConfig);
if (inGame_)
btnDeleteGameConfig_->SetEnabled(false);
btnCreateGameConfig_ = rightColumnItems->Add(new Choice(ga->T("Create Game Config")));
btnCreateGameConfig_->OnClick.Handle(this, &GameScreen::OnCreateConfig);
if (inGame_)
btnCreateGameConfig_->SetEnabled(false);
btnGameSettings_->SetVisibility(V_GONE);
btnDeleteGameConfig_->SetVisibility(V_GONE);
@@ -224,7 +230,12 @@ void GameScreen::CreateViews() {
otherChoices_.clear();
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Delete Game"))))->OnClick.Handle(this, &GameScreen::OnDeleteGame);
// Don't want to be able to delete the game while it's running.
Choice *deleteChoice = rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Delete Game"))));
deleteChoice->OnClick.Handle(this, &GameScreen::OnDeleteGame);
if (inGame_) {
deleteChoice->SetEnabled(false);
}
if (System_GetPropertyBool(SYSPROP_CAN_CREATE_SHORTCUT)) {
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Create Shortcut"))))->OnClick.Add([=](UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
@@ -235,9 +246,15 @@ void GameScreen::CreateViews() {
return UI::EVENT_DONE;
});
}
if (isRecentGame(gamePath_)) {
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Remove From Recent"))))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
Choice *removeButton = rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Remove From Recent"))));
removeButton->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
if (inGame_) {
removeButton->SetEnabled(false);
}
}
#if (defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)) && !PPSSPP_PLATFORM(UWP)
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Show In Folder"))))->OnClick.Handle(this, &GameScreen::OnShowInFolder);
#endif
+2 -1
View File
@@ -33,7 +33,7 @@ class NoticeView;
class GameScreen : public UIDialogScreenWithGameBackground {
public:
GameScreen(const Path &gamePath);
GameScreen(const Path &gamePath, bool inGame);
~GameScreen();
void update() override;
@@ -91,4 +91,5 @@ private:
std::string CRC32string;
bool isHomebrew_ = false;
bool inGame_ = false;
};
+1 -1
View File
@@ -1511,7 +1511,7 @@ UI::EventReturn MainScreen::OnGameSelected(UI::EventParams &e) {
restoreFocusGamePath_ = highlightedGamePath_;
g_BackgroundAudio.SetGame(path);
lockBackgroundAudio_ = true;
screenManager()->push(new GameScreen(path));
screenManager()->push(new GameScreen(path, false));
return UI::EVENT_DONE;
}
+13 -8
View File
@@ -51,6 +51,7 @@
#include "UI/ReportScreen.h"
#include "UI/CwCheatScreen.h"
#include "UI/MainScreen.h"
#include "UI/GameScreen.h"
#include "UI/OnScreenDisplay.h"
#include "UI/GameInfoCache.h"
#include "UI/DisplayLayoutScreen.h"
@@ -445,14 +446,18 @@ void GamePauseScreen::CreateViews() {
}
if (!Core_MustRunBehind()) {
if (middleColumn) {
playButton_ = middleColumn->Add(new Button("", g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"), new LinearLayoutParams(64, 64)));
playButton_->OnClick.Add([=](UI::EventParams &e) {
g_Config.bRunBehindPauseMenu = !g_Config.bRunBehindPauseMenu;
playButton_->SetImageID(g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"));
return UI::EVENT_DONE;
});
}
playButton_ = middleColumn->Add(new Button("", g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"), new LinearLayoutParams(64, 64)));
playButton_->OnClick.Add([=](UI::EventParams &e) {
g_Config.bRunBehindPauseMenu = !g_Config.bRunBehindPauseMenu;
playButton_->SetImageID(g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"));
return UI::EVENT_DONE;
});
Button *infoButton = middleColumn->Add(new Button("", ImageID("I_INFO"), new LinearLayoutParams(64, 64)));
infoButton->OnClick.Add([=](UI::EventParams &e) {
screenManager()->push(new GameScreen(gamePath_, true));
return UI::EVENT_DONE;
});
} else {
auto nw = GetI18NCategory(I18NCat::NETWORKING);
rightColumnHolder->Add(new TextView(nw->T("Network connected")));