2013-07-15 17:41:24 +02: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 11:32:24 +02:00
|
|
|
#include <functional>
|
2013-07-16 00:29:00 +02:00
|
|
|
#include <map>
|
|
|
|
|
#include <string>
|
2016-10-12 11:32:24 +02:00
|
|
|
#include <vector>
|
2013-07-16 00:29:00 +02:00
|
|
|
|
2020-10-04 20:48:47 +02:00
|
|
|
#include "Common/UI/UIScreen.h"
|
2023-01-11 10:36:00 +01:00
|
|
|
#include "Common/UI/PopupScreens.h"
|
2020-10-04 20:48:47 +02:00
|
|
|
#include "Common/File/DirListing.h"
|
2021-05-06 01:31:38 +02:00
|
|
|
#include "Common/File/Path.h"
|
2016-03-06 13:16:50 -08:00
|
|
|
|
|
|
|
|
struct ShaderInfo;
|
2020-08-01 21:26:41 -07:00
|
|
|
struct TextureShaderInfo;
|
2013-07-15 17:41:24 +02:00
|
|
|
|
2021-05-09 18:38:48 +02:00
|
|
|
extern Path boot_filename;
|
2017-03-25 15:01:33 -07:00
|
|
|
void UIBackgroundInit(UIContext &dc);
|
|
|
|
|
void UIBackgroundShutdown();
|
2013-11-03 13:18:12 +10:00
|
|
|
|
2013-07-15 17:41:24 +02:00
|
|
|
inline void NoOpVoidBool(bool) {}
|
|
|
|
|
|
2013-07-21 13:31:46 +02:00
|
|
|
class UIScreenWithBackground : public UIScreen {
|
|
|
|
|
public:
|
|
|
|
|
UIScreenWithBackground() : UIScreen() {}
|
|
|
|
|
protected:
|
2016-10-01 11:23:24 -07:00
|
|
|
void DrawBackground(UIContext &dc) override;
|
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
2013-07-21 13:31:46 +02:00
|
|
|
};
|
|
|
|
|
|
2014-02-09 13:15:53 -08:00
|
|
|
class UIScreenWithGameBackground : public UIScreenWithBackground {
|
|
|
|
|
public:
|
|
|
|
|
UIScreenWithGameBackground(const std::string &gamePath)
|
|
|
|
|
: UIScreenWithBackground(), gamePath_(gamePath) {}
|
2016-10-01 11:23:24 -07:00
|
|
|
void DrawBackground(UIContext &dc) override;
|
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
2014-02-09 13:15:53 -08:00
|
|
|
protected:
|
2021-05-06 01:31:38 +02:00
|
|
|
Path gamePath_;
|
2022-11-22 12:00:40 +01:00
|
|
|
|
2022-12-16 09:09:21 +01:00
|
|
|
bool forceTransparent_ = false;
|
|
|
|
|
bool darkenGameBackground_ = true;
|
2014-02-09 13:15:53 -08:00
|
|
|
};
|
|
|
|
|
|
2013-08-17 12:09:50 +02:00
|
|
|
class UIDialogScreenWithBackground : public UIDialogScreen {
|
2013-08-13 00:06:48 +02:00
|
|
|
public:
|
2013-08-17 12:09:50 +02:00
|
|
|
UIDialogScreenWithBackground() : UIDialogScreen() {}
|
2013-08-13 00:06:48 +02:00
|
|
|
protected:
|
2016-10-01 11:23:24 -07:00
|
|
|
void DrawBackground(UIContext &dc) override;
|
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
2015-07-04 08:01:32 -07:00
|
|
|
|
|
|
|
|
void AddStandardBack(UI::ViewGroup *parent);
|
2013-08-13 00:06:48 +02:00
|
|
|
};
|
2013-07-21 13:31:46 +02:00
|
|
|
|
2014-02-09 13:15:53 -08:00
|
|
|
class UIDialogScreenWithGameBackground : public UIDialogScreenWithBackground {
|
|
|
|
|
public:
|
2021-05-06 01:31:38 +02:00
|
|
|
UIDialogScreenWithGameBackground(const Path &gamePath)
|
2014-02-09 13:15:53 -08:00
|
|
|
: UIDialogScreenWithBackground(), gamePath_(gamePath) {}
|
2016-10-01 11:23:24 -07:00
|
|
|
void DrawBackground(UIContext &dc) override;
|
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
2014-02-09 13:15:53 -08:00
|
|
|
protected:
|
2021-05-06 01:31:38 +02:00
|
|
|
Path gamePath_;
|
2022-12-16 09:09:21 +01:00
|
|
|
|
|
|
|
|
bool forceTransparent_ = false;
|
2022-11-22 14:16:24 +01:00
|
|
|
bool darkenGameBackground_ = true;
|
2014-02-09 13:15:53 -08:00
|
|
|
};
|
|
|
|
|
|
2022-11-29 16:29:43 +01:00
|
|
|
class PromptScreen : public UIDialogScreenWithGameBackground {
|
2013-07-15 17:41:24 +02:00
|
|
|
public:
|
2022-11-29 16:29:43 +01:00
|
|
|
PromptScreen(const Path& gamePath, std::string message, std::string yesButtonText, std::string noButtonText,
|
2013-09-03 18:42:12 +08:00
|
|
|
std::function<void(bool)> callback = &NoOpVoidBool);
|
2013-07-15 17:41:24 +02:00
|
|
|
|
2016-10-01 11:23:24 -07:00
|
|
|
void CreateViews() override;
|
2013-07-15 17:41:24 +02:00
|
|
|
|
2017-12-02 19:04:33 -08:00
|
|
|
void TriggerFinish(DialogResult result) override;
|
|
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "Prompt"; }
|
|
|
|
|
|
2013-07-15 17:41:24 +02: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-16 00:29:00 +02:00
|
|
|
|
2023-01-11 10:36:00 +01:00
|
|
|
class NewLanguageScreen : public UI::ListPopupScreen {
|
2013-07-16 00:29:00 +02:00
|
|
|
public:
|
2013-08-31 05:26:59 +08:00
|
|
|
NewLanguageScreen(const std::string &title);
|
2013-07-16 00:29:00 +02:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "NewLanguage"; }
|
|
|
|
|
|
2013-07-16 00:29:00 +02:00
|
|
|
private:
|
2016-10-01 11:23:24 -07:00
|
|
|
void OnCompleted(DialogResult result) override;
|
|
|
|
|
bool ShowButtons() const override { return true; }
|
2021-04-25 20:38:22 +02:00
|
|
|
std::vector<File::FileInfo> langs_;
|
2013-07-16 00:29:00 +02:00
|
|
|
};
|
|
|
|
|
|
2023-01-11 10:36:00 +01:00
|
|
|
class TextureShaderScreen : public UI::ListPopupScreen {
|
2020-08-01 21:26:41 -07:00
|
|
|
public:
|
|
|
|
|
TextureShaderScreen(const std::string &title);
|
|
|
|
|
|
2021-09-28 23:35:57 +02:00
|
|
|
void CreateViews() override;
|
|
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "TextureShader"; }
|
|
|
|
|
|
2020-08-01 21:26:41 -07:00
|
|
|
private:
|
|
|
|
|
void OnCompleted(DialogResult result) override;
|
|
|
|
|
bool ShowButtons() const override { return true; }
|
|
|
|
|
std::vector<TextureShaderInfo> shaders_;
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-18 16:06:11 +02:00
|
|
|
enum class AfterLogoScreen {
|
|
|
|
|
TO_GAME_SETTINGS,
|
|
|
|
|
DEFAULT,
|
|
|
|
|
MEMSTICK_SCREEN_INITIAL_SETUP,
|
|
|
|
|
};
|
|
|
|
|
|
2013-08-14 23:05:02 +02:00
|
|
|
class LogoScreen : public UIScreen {
|
|
|
|
|
public:
|
2021-09-18 16:06:11 +02:00
|
|
|
LogoScreen(AfterLogoScreen afterLogoScreen = AfterLogoScreen::DEFAULT);
|
|
|
|
|
|
2014-06-15 13:04:59 +02:00
|
|
|
bool key(const KeyInput &key) override;
|
2022-12-31 21:41:32 +01:00
|
|
|
void touch(const TouchInput &touch) override;
|
2017-03-14 22:01:18 -07:00
|
|
|
void update() override;
|
2016-10-01 11:23:24 -07:00
|
|
|
void render() override;
|
|
|
|
|
void sendMessage(const char *message, const char *value) override;
|
|
|
|
|
void CreateViews() override {}
|
2013-08-14 23:05:02 +02:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "Logo"; }
|
|
|
|
|
|
2013-08-14 23:05:02 +02:00
|
|
|
private:
|
|
|
|
|
void Next();
|
2021-02-07 20:09:57 +01:00
|
|
|
int frames_ = 0;
|
2021-02-11 22:11:50 +01:00
|
|
|
double sinceStart_ = 0.0;
|
2020-05-09 13:52:04 -07:00
|
|
|
bool switched_ = false;
|
2021-09-18 16:06:11 +02:00
|
|
|
AfterLogoScreen afterLogoScreen_;
|
2013-08-14 23:05:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CreditsScreen : public UIDialogScreenWithBackground {
|
|
|
|
|
public:
|
2021-02-04 08:54:32 +01:00
|
|
|
CreditsScreen();
|
2017-03-14 22:01:18 -07:00
|
|
|
void update() override;
|
2016-10-01 11:23:24 -07:00
|
|
|
void render() override;
|
2013-12-11 18:05:57 +01:00
|
|
|
|
2016-10-01 11:23:24 -07:00
|
|
|
void CreateViews() override;
|
2013-08-14 23:05:02 +02:00
|
|
|
|
2022-09-16 10:14:00 +02:00
|
|
|
const char *tag() const override { return "Credits"; }
|
|
|
|
|
|
2013-08-14 23:05:02 +02:00
|
|
|
private:
|
2013-08-20 00:49:25 +02:00
|
|
|
UI::EventReturn OnSupport(UI::EventParams &e);
|
|
|
|
|
UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
|
2017-11-29 14:33:28 +01:00
|
|
|
UI::EventReturn OnPrivacy(UI::EventParams &e);
|
2013-08-20 00:49:25 +02:00
|
|
|
UI::EventReturn OnForums(UI::EventParams &e);
|
2018-09-16 20:04:10 +02:00
|
|
|
UI::EventReturn OnDiscord(UI::EventParams &e);
|
2013-12-11 18:05:57 +01:00
|
|
|
UI::EventReturn OnShare(UI::EventParams &e);
|
2013-12-19 14:28:04 +01:00
|
|
|
UI::EventReturn OnTwitter(UI::EventParams &e);
|
2013-08-20 00:49:25 +02:00
|
|
|
|
2021-02-04 08:54:32 +01:00
|
|
|
double startTime_ = 0.0;
|
2013-08-14 23:05:02 +02:00
|
|
|
};
|
2021-04-24 22:47:57 +02:00
|
|
|
|
|
|
|
|
class SettingInfoMessage : public UI::LinearLayout {
|
|
|
|
|
public:
|
2023-07-08 10:45:22 +02:00
|
|
|
SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp);
|
2021-04-24 22:47:57 +02:00
|
|
|
|
2022-12-10 21:02:44 -08:00
|
|
|
void Show(const std::string &text, const UI::View *refView = nullptr);
|
2021-04-24 22:47:57 +02:00
|
|
|
|
2022-12-10 20:32:12 -08:00
|
|
|
void Draw(UIContext &dc) override;
|
2021-09-12 01:17:24 +02:00
|
|
|
std::string GetText() const;
|
2021-04-24 22:47:57 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
UI::TextView *text_ = nullptr;
|
|
|
|
|
double timeShown_ = 0.0;
|
|
|
|
|
float cutOffY_;
|
2021-09-12 01:17:24 +02:00
|
|
|
bool showing_ = false;
|
2021-04-24 22:47:57 +02:00
|
|
|
};
|
2022-12-07 23:12:09 +01:00
|
|
|
|
2022-12-10 21:02:44 -08:00
|
|
|
uint32_t GetBackgroundColorWithAlpha(const UIContext &dc);
|