2013-07-15 15:41:24 +00:00
|
|
|
// Copyright (c) 2013- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-10-12 09:32:24 +00:00
|
|
|
#include <functional>
|
2013-07-15 22:29:00 +00:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2016-10-12 09:32:24 +00:00
|
|
|
#include <vector>
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/UI/UIScreen.h"
|
2023-01-11 09:36:00 +00:00
|
|
|
#include "Common/UI/PopupScreens.h"
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/File/DirListing.h"
|
2021-05-05 23:31:38 +00:00
|
|
|
#include "Common/File/Path.h"
|
2016-03-06 21:16:50 +00:00
|
|
|
|
|
|
|
struct ShaderInfo;
|
2020-08-02 04:26:41 +00:00
|
|
|
struct TextureShaderInfo;
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2021-05-09 16:38:48 +00:00
|
|
|
extern Path boot_filename;
|
2017-03-25 22:01:33 +00:00
|
|
|
void UIBackgroundInit(UIContext &dc);
|
|
|
|
void UIBackgroundShutdown();
|
2013-11-03 03:18:12 +00:00
|
|
|
|
2013-07-15 15:41:24 +00:00
|
|
|
inline void NoOpVoidBool(bool) {}
|
|
|
|
|
2023-12-10 20:57:05 +00:00
|
|
|
class BackgroundScreen : public UIScreen {
|
|
|
|
public:
|
2023-12-11 11:41:44 +00:00
|
|
|
ScreenRenderFlags render(ScreenRenderMode mode) override;
|
2023-12-10 20:57:05 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void CreateViews() override {}
|
|
|
|
const char *tag() const override { return "bg"; }
|
|
|
|
|
|
|
|
Path gamePath_;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This doesn't have anything to do with the background anymore. It's just a PPSSPP UIScreen
|
|
|
|
// that knows how handle sendMessage properly. Same for all the below.
|
2013-07-21 11:31:46 +00:00
|
|
|
class UIScreenWithBackground : public UIScreen {
|
|
|
|
public:
|
|
|
|
UIScreenWithBackground() : UIScreen() {}
|
|
|
|
protected:
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2013-07-21 11:31:46 +00:00
|
|
|
};
|
|
|
|
|
2014-02-09 21:15:53 +00:00
|
|
|
class UIScreenWithGameBackground : public UIScreenWithBackground {
|
|
|
|
public:
|
2023-12-10 20:57:05 +00:00
|
|
|
UIScreenWithGameBackground(const Path &gamePath) : UIScreenWithBackground(), gamePath_(gamePath) {}
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2014-02-09 21:15:53 +00:00
|
|
|
protected:
|
2021-05-05 23:31:38 +00:00
|
|
|
Path gamePath_;
|
2022-11-22 11:00:40 +00:00
|
|
|
|
2022-12-16 08:09:21 +00:00
|
|
|
bool forceTransparent_ = false;
|
|
|
|
bool darkenGameBackground_ = true;
|
2014-02-09 21:15:53 +00:00
|
|
|
};
|
|
|
|
|
2013-08-17 10:09:50 +00:00
|
|
|
class UIDialogScreenWithBackground : public UIDialogScreen {
|
2013-08-12 22:06:48 +00:00
|
|
|
public:
|
2013-08-17 10:09:50 +00:00
|
|
|
UIDialogScreenWithBackground() : UIDialogScreen() {}
|
2013-08-12 22:06:48 +00:00
|
|
|
protected:
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2015-07-04 15:01:32 +00:00
|
|
|
void AddStandardBack(UI::ViewGroup *parent);
|
2013-08-12 22:06:48 +00:00
|
|
|
};
|
2013-07-21 11:31:46 +00:00
|
|
|
|
2014-02-09 21:15:53 +00:00
|
|
|
class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground {
|
|
|
|
public:
|
2021-05-05 23:31:38 +00:00
|
|
|
UIDialogScreenWithGameBackground(const Path &gamePath)
|
2014-02-09 21:15:53 +00:00
|
|
|
: UIDialogScreenWithBackground(), gamePath_(gamePath) {}
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2014-02-09 21:15:53 +00:00
|
|
|
protected:
|
2021-05-05 23:31:38 +00:00
|
|
|
Path gamePath_;
|
2014-02-09 21:15:53 +00:00
|
|
|
};
|
|
|
|
|
2022-11-29 15:29:43 +00:00
|
|
|
class PromptScreen : public UIDialogScreenWithGameBackground {
|
2013-07-15 15:41:24 +00:00
|
|
|
public:
|
2024-01-19 12:44:49 +00:00
|
|
|
PromptScreen(const Path& gamePath, std::string_view message, std::string_view yesButtonText, std::string_view noButtonText,
|
2013-09-03 10:42:12 +00:00
|
|
|
std::function<void(bool)> callback = &NoOpVoidBool);
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2016-10-01 18:23:24 +00:00
|
|
|
void CreateViews() override;
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2017-12-03 03:04:33 +00:00
|
|
|
void TriggerFinish(DialogResult result) override;
|
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "Prompt"; }
|
|
|
|
|
2013-07-15 15:41:24 +00:00
|
|
|
private:
|
|
|
|
UI::EventReturn OnYes(UI::EventParams &e);
|
|
|
|
UI::EventReturn OnNo(UI::EventParams &e);
|
|
|
|
|
|
|
|
std::string message_;
|
|
|
|
std::string yesButtonText_;
|
|
|
|
std::string noButtonText_;
|
|
|
|
std::function<void(bool)> callback_;
|
|
|
|
};
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2023-01-11 09:36:00 +00:00
|
|
|
class NewLanguageScreen : public UI::ListPopupScreen {
|
2013-07-15 22:29:00 +00:00
|
|
|
public:
|
2024-01-19 12:44:49 +00:00
|
|
|
NewLanguageScreen(std::string_view title);
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "NewLanguage"; }
|
|
|
|
|
2013-07-15 22:29:00 +00:00
|
|
|
private:
|
2016-10-01 18:23:24 +00:00
|
|
|
void OnCompleted(DialogResult result) override;
|
|
|
|
bool ShowButtons() const override { return true; }
|
2021-04-25 18:38:22 +00:00
|
|
|
std::vector<File::FileInfo> langs_;
|
2013-07-15 22:29:00 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 09:36:00 +00:00
|
|
|
class TextureShaderScreen : public UI::ListPopupScreen {
|
2020-08-02 04:26:41 +00:00
|
|
|
public:
|
2024-01-19 12:44:49 +00:00
|
|
|
TextureShaderScreen(std::string_view title);
|
2020-08-02 04:26:41 +00:00
|
|
|
|
2021-09-28 21:35:57 +00:00
|
|
|
void CreateViews() override;
|
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "TextureShader"; }
|
|
|
|
|
2020-08-02 04:26:41 +00:00
|
|
|
private:
|
|
|
|
void OnCompleted(DialogResult result) override;
|
|
|
|
bool ShowButtons() const override { return true; }
|
|
|
|
std::vector<TextureShaderInfo> shaders_;
|
|
|
|
};
|
|
|
|
|
2021-09-18 14:06:11 +00:00
|
|
|
enum class AfterLogoScreen {
|
|
|
|
TO_GAME_SETTINGS,
|
|
|
|
DEFAULT,
|
|
|
|
MEMSTICK_SCREEN_INITIAL_SETUP,
|
|
|
|
};
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
class LogoScreen : public UIScreen {
|
|
|
|
public:
|
2021-09-18 14:06:11 +00:00
|
|
|
LogoScreen(AfterLogoScreen afterLogoScreen = AfterLogoScreen::DEFAULT);
|
|
|
|
|
2014-06-15 11:04:59 +00:00
|
|
|
bool key(const KeyInput &key) override;
|
2022-12-31 20:41:32 +00:00
|
|
|
void touch(const TouchInput &touch) override;
|
2017-03-15 05:01:18 +00:00
|
|
|
void update() override;
|
2023-12-11 11:41:44 +00:00
|
|
|
void DrawForeground(UIContext &ui) override;
|
2023-09-30 09:21:22 +00:00
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
2016-10-01 18:23:24 +00:00
|
|
|
void CreateViews() override {}
|
2013-08-14 21:05:02 +00:00
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "Logo"; }
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
private:
|
|
|
|
void Next();
|
2021-02-07 19:09:57 +00:00
|
|
|
int frames_ = 0;
|
2021-02-11 21:11:50 +00:00
|
|
|
double sinceStart_ = 0.0;
|
2020-05-09 20:52:04 +00:00
|
|
|
bool switched_ = false;
|
2021-09-18 14:06:11 +00:00
|
|
|
AfterLogoScreen afterLogoScreen_;
|
2013-08-14 21:05:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CreditsScreen : public UIDialogScreenWithBackground {
|
|
|
|
public:
|
2021-02-04 07:54:32 +00:00
|
|
|
CreditsScreen();
|
2017-03-15 05:01:18 +00:00
|
|
|
void update() override;
|
2023-12-11 11:41:44 +00:00
|
|
|
void DrawForeground(UIContext &ui) override;
|
2013-12-11 17:05:57 +00:00
|
|
|
|
2016-10-01 18:23:24 +00:00
|
|
|
void CreateViews() override;
|
2013-08-14 21:05:02 +00:00
|
|
|
|
2022-09-16 08:14:00 +00:00
|
|
|
const char *tag() const override { return "Credits"; }
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
private:
|
2013-08-19 22:49:25 +00:00
|
|
|
UI::EventReturn OnSupport(UI::EventParams &e);
|
|
|
|
UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
|
2017-11-29 13:33:28 +00:00
|
|
|
UI::EventReturn OnPrivacy(UI::EventParams &e);
|
2013-08-19 22:49:25 +00:00
|
|
|
UI::EventReturn OnForums(UI::EventParams &e);
|
2018-09-16 18:04:10 +00:00
|
|
|
UI::EventReturn OnDiscord(UI::EventParams &e);
|
2013-12-11 17:05:57 +00:00
|
|
|
UI::EventReturn OnShare(UI::EventParams &e);
|
2013-12-19 13:28:04 +00:00
|
|
|
UI::EventReturn OnTwitter(UI::EventParams &e);
|
2013-08-19 22:49:25 +00:00
|
|
|
|
2021-02-04 07:54:32 +00:00
|
|
|
double startTime_ = 0.0;
|
2013-08-14 21:05:02 +00:00
|
|
|
};
|
2021-04-24 20:47:57 +00:00
|
|
|
|
|
|
|
class SettingInfoMessage : public UI::LinearLayout {
|
|
|
|
public:
|
2023-07-08 08:45:22 +00:00
|
|
|
SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp);
|
2021-04-24 20:47:57 +00:00
|
|
|
|
2024-01-19 12:44:49 +00:00
|
|
|
void Show(std::string_view text, const UI::View *refView = nullptr);
|
2021-04-24 20:47:57 +00:00
|
|
|
|
2022-12-11 04:32:12 +00:00
|
|
|
void Draw(UIContext &dc) override;
|
2021-09-11 23:17:24 +00:00
|
|
|
std::string GetText() const;
|
2021-04-24 20:47:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
UI::TextView *text_ = nullptr;
|
|
|
|
double timeShown_ = 0.0;
|
|
|
|
float cutOffY_;
|
2021-09-11 23:17:24 +00:00
|
|
|
bool showing_ = false;
|
2021-04-24 20:47:57 +00:00
|
|
|
};
|
2022-12-07 22:12:09 +00:00
|
|
|
|
2022-12-11 05:02:44 +00:00
|
|
|
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc);
|