2016-08-08 00:59:35 +00:00
|
|
|
// Copyright (c) 2013- PPSSPP Project.
|
2013-07-15 15:41:24 +00:00
|
|
|
|
|
|
|
// 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/.
|
|
|
|
|
2017-03-05 12:59:33 +00:00
|
|
|
#include "ppsspp_config.h"
|
|
|
|
|
2014-08-23 12:24:24 +00:00
|
|
|
#include <algorithm>
|
2016-10-12 09:32:24 +00:00
|
|
|
#include <functional>
|
2014-08-23 12:24:24 +00:00
|
|
|
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/Render/DrawBuffer.h"
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/UI/Context.h"
|
|
|
|
#include "Common/UI/View.h"
|
|
|
|
#include "Common/UI/ViewGroup.h"
|
|
|
|
#include "Common/UI/UI.h"
|
2020-10-04 08:30:18 +00:00
|
|
|
|
|
|
|
#include "Common/System/Display.h"
|
|
|
|
#include "Common/System/NativeApp.h"
|
|
|
|
#include "Common/System/System.h"
|
|
|
|
#include "Common/Math/curves.h"
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/File/VFS/VFS.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
|
2020-10-01 11:05:04 +00:00
|
|
|
#include "Common/Data/Color/RGBAUtil.h"
|
|
|
|
#include "Common/Data/Text/I18n.h"
|
|
|
|
#include "Common/Data/Random/Rng.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
#include "Common/TimeUtil.h"
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/File/FileUtil.h"
|
2013-07-15 22:29:00 +00:00
|
|
|
#include "Core/Config.h"
|
2013-12-29 22:44:35 +00:00
|
|
|
#include "Core/Host.h"
|
2013-08-14 21:05:02 +00:00
|
|
|
#include "Core/System.h"
|
2016-05-01 08:35:37 +00:00
|
|
|
#include "Core/MIPS/JitCommon/JitCommon.h"
|
2013-07-15 22:29:00 +00:00
|
|
|
#include "Core/HLE/sceUtility.h"
|
2014-06-29 22:06:47 +00:00
|
|
|
#include "GPU/GPUState.h"
|
2016-03-06 21:16:50 +00:00
|
|
|
#include "GPU/Common/PostShader.h"
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2020-08-15 18:53:08 +00:00
|
|
|
#include "UI/ControlMappingScreen.h"
|
|
|
|
#include "UI/DisplayLayoutScreen.h"
|
|
|
|
#include "UI/EmuScreen.h"
|
|
|
|
#include "UI/GameInfoCache.h"
|
|
|
|
#include "UI/GameSettingsScreen.h"
|
|
|
|
#include "UI/MainScreen.h"
|
|
|
|
#include "UI/MiscScreens.h"
|
2021-09-18 14:06:11 +00:00
|
|
|
#include "UI/MemStickScreen.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
|
2013-08-18 18:22:30 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma execution_character_set("utf-8")
|
|
|
|
#endif
|
|
|
|
|
2020-02-29 20:51:14 +00:00
|
|
|
static const ImageID symbols[4] = {
|
|
|
|
ImageID("I_CROSS"),
|
|
|
|
ImageID("I_CIRCLE"),
|
|
|
|
ImageID("I_SQUARE"),
|
|
|
|
ImageID("I_TRIANGLE"),
|
2013-08-18 18:25:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const uint32_t colors[4] = {
|
|
|
|
0xC0FFFFFF,
|
|
|
|
0xC0FFFFFF,
|
|
|
|
0xC0FFFFFF,
|
|
|
|
0xC0FFFFFF,
|
|
|
|
};
|
|
|
|
|
2017-05-18 10:52:03 +00:00
|
|
|
static std::unique_ptr<ManagedTexture> bgTexture;
|
2017-03-25 22:01:33 +00:00
|
|
|
|
2021-03-23 22:41:16 +00:00
|
|
|
class Animation {
|
|
|
|
public:
|
|
|
|
virtual ~Animation() {}
|
2021-09-09 14:31:14 +00:00
|
|
|
virtual void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) = 0;
|
2021-03-23 22:41:16 +00:00
|
|
|
};
|
|
|
|
|
2021-09-11 19:17:01 +00:00
|
|
|
static constexpr float XFAC = 0.3f;
|
|
|
|
static constexpr float YFAC = 0.3f;
|
|
|
|
static constexpr float ZFAC = 0.12f;
|
|
|
|
static constexpr float XSPEED = 0.05f;
|
|
|
|
static constexpr float YSPEED = 0.05f;
|
|
|
|
static constexpr float ZSPEED = 0.1f;
|
|
|
|
|
2021-09-09 23:55:23 +00:00
|
|
|
class MovingBackground : public Animation {
|
|
|
|
public:
|
|
|
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
|
|
|
if (!bgTexture)
|
|
|
|
return;
|
|
|
|
|
|
|
|
dc.Flush();
|
|
|
|
dc.GetDrawContext()->BindTexture(0, bgTexture->GetTexture());
|
|
|
|
Bounds bounds = dc.GetBounds();
|
|
|
|
|
|
|
|
x = std::min(std::max(x/bounds.w, 0.0f), 1.0f) * XFAC;
|
|
|
|
y = std::min(std::max(y/bounds.h, 0.0f), 1.0f) * YFAC;
|
|
|
|
z = 1.0f + std::max(XFAC, YFAC) + (z-1.0f) * ZFAC;
|
|
|
|
|
|
|
|
lastX_ = abs(x-lastX_) > 0.001f ? x*XSPEED+lastX_*(1.0f-XSPEED) : x;
|
|
|
|
lastY_ = abs(y-lastY_) > 0.001f ? y*YSPEED+lastY_*(1.0f-YSPEED) : y;
|
|
|
|
lastZ_ = abs(z-lastZ_) > 0.001f ? z*ZSPEED+lastZ_*(1.0f-ZSPEED) : z;
|
|
|
|
|
|
|
|
float u1 = lastX_/lastZ_;
|
|
|
|
float v1 = lastY_/lastZ_;
|
|
|
|
float u2 = (1.0f+lastX_)/lastZ_;
|
|
|
|
float v2 = (1.0f+lastY_)/lastZ_;
|
|
|
|
|
|
|
|
dc.Draw()->DrawTexRect(bounds, u1, v1, u2, v2, whiteAlpha(alpha));
|
|
|
|
|
|
|
|
dc.Flush();
|
|
|
|
dc.RebindTexture();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2021-09-11 19:17:01 +00:00
|
|
|
float lastX_ = 0.0f;
|
|
|
|
float lastY_ = 0.0f;
|
|
|
|
float lastZ_ = 1.0f + std::max(XFAC, YFAC);
|
2021-03-23 22:41:16 +00:00
|
|
|
};
|
|
|
|
|
2021-09-08 13:03:32 +00:00
|
|
|
class WaveAnimation : public Animation {
|
|
|
|
public:
|
2021-09-09 14:31:14 +00:00
|
|
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
2021-09-08 14:36:57 +00:00
|
|
|
const uint32_t color = colorAlpha(0xFFFFFFFF, alpha * 0.2f);
|
2021-09-08 13:03:32 +00:00
|
|
|
const float speed = 1.0;
|
|
|
|
|
|
|
|
Bounds bounds = dc.GetBounds();
|
|
|
|
dc.Flush();
|
|
|
|
dc.BeginNoTex();
|
|
|
|
|
2021-09-09 09:58:02 +00:00
|
|
|
// Be sure to not overflow our vertex buffer
|
|
|
|
const float step = ceil(24*bounds.w/pixel_in_dps_x) > MAX_VERTS ? 24*bounds.w/(MAX_VERTS-48) : pixel_in_dps_x;
|
|
|
|
|
2021-09-08 13:03:32 +00:00
|
|
|
t *= speed;
|
2021-09-09 09:58:02 +00:00
|
|
|
for (float x = 0; x < bounds.w; x += step) {
|
2021-09-08 13:03:32 +00:00
|
|
|
float i = x * 1280/bounds.w;
|
|
|
|
|
|
|
|
float wave0 = sin(i*0.005+t*0.8)*0.05 + sin(i*0.002+t*0.25)*0.02 + sin(i*0.001+t*0.3)*0.03 + 0.625;
|
|
|
|
float wave1 = sin(i*0.0044+t*0.4)*0.07 + sin(i*0.003+t*0.1)*0.02 + sin(i*0.001+t*0.3)*0.01 + 0.625;
|
2021-09-09 09:58:02 +00:00
|
|
|
dc.Draw()->RectVGradient(x, wave0*bounds.h, step, (1.0-wave0)*bounds.h, color, 0x00000000);
|
|
|
|
dc.Draw()->RectVGradient(x, wave1*bounds.h, step, (1.0-wave1)*bounds.h, color, 0x00000000);
|
2021-09-08 14:36:57 +00:00
|
|
|
|
|
|
|
// Add some "antialiasing"
|
2021-09-09 09:58:02 +00:00
|
|
|
dc.Draw()->RectVGradient(x, wave0*bounds.h-3*pixel_in_dps_y, step, 3*pixel_in_dps_y, 0x00000000, color);
|
|
|
|
dc.Draw()->RectVGradient(x, wave1*bounds.h-3*pixel_in_dps_y, step, 3*pixel_in_dps_y, 0x00000000, color);
|
2021-09-08 13:03:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dc.Flush();
|
|
|
|
dc.Begin();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-23 22:41:16 +00:00
|
|
|
class FloatingSymbolsAnimation : public Animation {
|
|
|
|
public:
|
|
|
|
~FloatingSymbolsAnimation() override {}
|
2021-09-09 14:31:14 +00:00
|
|
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
2021-03-23 22:41:16 +00:00
|
|
|
float xres = dc.GetBounds().w;
|
|
|
|
float yres = dc.GetBounds().h;
|
2021-04-04 17:48:42 +00:00
|
|
|
if (last_xres != xres || last_yres != yres) {
|
|
|
|
Regenerate(xres, yres);
|
2021-03-23 22:41:16 +00:00
|
|
|
}
|
|
|
|
|
2021-04-04 17:48:42 +00:00
|
|
|
for (int i = 0; i < COUNT; i++) {
|
2021-03-23 22:41:16 +00:00
|
|
|
float x = xbase[i] + dc.GetBounds().x;
|
|
|
|
float y = ybase[i] + dc.GetBounds().y + 40 * cosf(i * 7.2f + t * 1.3f);
|
|
|
|
float angle = (float)sin(i + t);
|
|
|
|
int n = i & 3;
|
|
|
|
ui_draw2d.DrawImageRotated(symbols[n], x, y, 1.0f, angle, colorAlpha(colors[n], alpha * 0.1f));
|
|
|
|
}
|
|
|
|
}
|
2021-04-04 17:48:42 +00:00
|
|
|
|
2021-03-23 22:41:16 +00:00
|
|
|
private:
|
2021-04-04 17:48:42 +00:00
|
|
|
static constexpr int COUNT = 100;
|
|
|
|
|
|
|
|
float xbase[COUNT]{};
|
|
|
|
float ybase[COUNT]{};
|
2021-03-23 22:41:16 +00:00
|
|
|
float last_xres = 0;
|
|
|
|
float last_yres = 0;
|
2021-04-04 17:48:42 +00:00
|
|
|
|
|
|
|
void Regenerate(int xres, int yres) {
|
|
|
|
GMRng rng;
|
|
|
|
for (int i = 0; i < COUNT; i++) {
|
|
|
|
xbase[i] = rng.F() * xres;
|
|
|
|
ybase[i] = rng.F() * yres;
|
|
|
|
}
|
|
|
|
|
|
|
|
last_xres = xres;
|
|
|
|
last_yres = yres;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-04-04 17:57:40 +00:00
|
|
|
class RecentGamesAnimation : public Animation {
|
2021-04-04 17:48:42 +00:00
|
|
|
public:
|
|
|
|
~RecentGamesAnimation() override {}
|
2021-09-09 14:31:14 +00:00
|
|
|
void Draw(UIContext &dc, double t, float alpha, float x, float y, float z) override {
|
2021-04-04 17:48:42 +00:00
|
|
|
if (lastIndex_ == nextIndex_) {
|
|
|
|
CheckNext(dc, t);
|
|
|
|
} else if (t > nextT_) {
|
|
|
|
lastIndex_ = nextIndex_;
|
|
|
|
}
|
|
|
|
|
2022-07-12 03:44:13 +00:00
|
|
|
if (g_Config.HasRecentIsos()) {
|
2021-04-04 17:48:42 +00:00
|
|
|
std::shared_ptr<GameInfo> lastInfo = GetInfo(dc, lastIndex_);
|
|
|
|
std::shared_ptr<GameInfo> nextInfo = GetInfo(dc, nextIndex_);
|
|
|
|
dc.Flush();
|
|
|
|
|
|
|
|
float lastAmount = Clamp((float)(nextT_ - t) * 1.0f / TRANSITION, 0.0f, 1.0f);
|
|
|
|
DrawTex(dc, lastInfo, lastAmount * alpha * 0.2f);
|
|
|
|
|
|
|
|
float nextAmount = lastAmount <= 0.0f ? 1.0f : 1.0f - lastAmount;
|
|
|
|
DrawTex(dc, nextInfo, nextAmount * alpha * 0.2f);
|
|
|
|
|
|
|
|
dc.RebindTexture();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void CheckNext(UIContext &dc, double t) {
|
2022-07-12 03:44:13 +00:00
|
|
|
if (!g_Config.HasRecentIsos()) {
|
2021-04-04 17:48:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int index = lastIndex_ + 1; index != lastIndex_; ++index) {
|
2022-07-12 03:44:13 +00:00
|
|
|
if (index < 0 || index >= (int)g_Config.RecentIsos().size()) {
|
2021-04-04 17:48:42 +00:00
|
|
|
if (lastIndex_ == -1)
|
|
|
|
break;
|
|
|
|
index = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<GameInfo> ginfo = GetInfo(dc, index);
|
|
|
|
if (ginfo && ginfo->pending) {
|
|
|
|
// Wait for it to load. It might be the next one.
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ginfo && (ginfo->pic1.texture || ginfo->pic0.texture)) {
|
|
|
|
nextIndex_ = index;
|
|
|
|
nextT_ = t + INTERVAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, keep going. This skips games with no BG.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<GameInfo> GetInfo(UIContext &dc, int index) {
|
|
|
|
if (index < 0) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
2022-07-12 03:44:13 +00:00
|
|
|
const auto recentIsos = g_Config.RecentIsos();
|
2022-09-13 05:14:48 +00:00
|
|
|
if (index >= (int)recentIsos.size())
|
2022-07-12 03:44:13 +00:00
|
|
|
return nullptr;
|
|
|
|
return g_gameInfoCache->GetInfo(dc.GetDrawContext(), Path(recentIsos[index]), GAMEINFO_WANTBG);
|
2021-04-04 17:48:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrawTex(UIContext &dc, std::shared_ptr<GameInfo> &ginfo, float amount) {
|
|
|
|
if (!ginfo || amount <= 0.0f)
|
|
|
|
return;
|
2021-04-04 17:57:40 +00:00
|
|
|
GameInfoTex *pic = ginfo->GetBGPic();
|
|
|
|
if (!pic)
|
2021-04-04 17:48:42 +00:00
|
|
|
return;
|
|
|
|
|
2021-04-04 17:57:40 +00:00
|
|
|
dc.GetDrawContext()->BindTexture(0, pic->texture->GetTexture());
|
2021-04-04 17:48:42 +00:00
|
|
|
uint32_t color = whiteAlpha(amount) & 0xFFc0c0c0;
|
|
|
|
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, color);
|
|
|
|
dc.Flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
static constexpr double INTERVAL = 8.0;
|
|
|
|
static constexpr float TRANSITION = 3.0f;
|
|
|
|
|
|
|
|
int lastIndex_ = -1;
|
|
|
|
int nextIndex_ = -1;
|
|
|
|
double nextT_ = -INTERVAL;
|
2021-03-23 22:41:16 +00:00
|
|
|
};
|
|
|
|
|
2022-02-11 18:30:25 +00:00
|
|
|
// TODO: Add more styles. Remember to add to the enum in ConfigValues.h and the selector in GameSettings too.
|
2021-03-23 22:41:16 +00:00
|
|
|
|
|
|
|
static BackgroundAnimation g_CurBackgroundAnimation = BackgroundAnimation::OFF;
|
|
|
|
static std::unique_ptr<Animation> g_Animation;
|
2021-04-17 03:49:46 +00:00
|
|
|
static bool bgTextureInited = false;
|
2018-03-01 15:08:23 +00:00
|
|
|
|
2017-03-25 22:01:33 +00:00
|
|
|
void UIBackgroundInit(UIContext &dc) {
|
2021-05-05 23:31:38 +00:00
|
|
|
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
|
|
|
|
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
|
2017-03-25 22:01:33 +00:00
|
|
|
if (File::Exists(bgPng) || File::Exists(bgJpg)) {
|
2021-05-05 23:31:38 +00:00
|
|
|
const Path &bgFile = File::Exists(bgPng) ? bgPng : bgJpg;
|
2017-03-25 22:01:33 +00:00
|
|
|
bgTexture = CreateTextureFromFile(dc.GetDrawContext(), bgFile.c_str(), DETECT, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UIBackgroundShutdown() {
|
2017-05-18 10:52:03 +00:00
|
|
|
bgTexture.reset(nullptr);
|
2021-03-23 22:41:16 +00:00
|
|
|
g_Animation.reset(nullptr);
|
2021-04-17 03:49:46 +00:00
|
|
|
g_CurBackgroundAnimation = BackgroundAnimation::OFF;
|
|
|
|
bgTextureInited = false;
|
2017-03-25 22:01:33 +00:00
|
|
|
}
|
|
|
|
|
2021-09-09 14:31:14 +00:00
|
|
|
void DrawBackground(UIContext &dc, float alpha, float x, float y, float z) {
|
2021-04-17 03:49:46 +00:00
|
|
|
if (!bgTextureInited) {
|
|
|
|
UIBackgroundInit(dc);
|
|
|
|
bgTextureInited = true;
|
|
|
|
}
|
2021-03-23 22:41:16 +00:00
|
|
|
if (g_CurBackgroundAnimation != (BackgroundAnimation)g_Config.iBackgroundAnimation) {
|
|
|
|
g_CurBackgroundAnimation = (BackgroundAnimation)g_Config.iBackgroundAnimation;
|
|
|
|
|
|
|
|
switch (g_CurBackgroundAnimation) {
|
|
|
|
case BackgroundAnimation::FLOATING_SYMBOLS:
|
|
|
|
g_Animation.reset(new FloatingSymbolsAnimation());
|
|
|
|
break;
|
2021-04-04 17:48:42 +00:00
|
|
|
case BackgroundAnimation::RECENT_GAMES:
|
|
|
|
g_Animation.reset(new RecentGamesAnimation());
|
|
|
|
break;
|
2021-09-08 13:03:32 +00:00
|
|
|
case BackgroundAnimation::WAVE:
|
|
|
|
g_Animation.reset(new WaveAnimation());
|
|
|
|
break;
|
2021-09-09 23:55:23 +00:00
|
|
|
case BackgroundAnimation::MOVING_BACKGROUND:
|
|
|
|
g_Animation.reset(new MovingBackground());
|
|
|
|
break;
|
2021-03-23 22:41:16 +00:00
|
|
|
default:
|
|
|
|
g_Animation.reset(nullptr);
|
2013-08-18 18:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-23 22:41:16 +00:00
|
|
|
|
2017-03-06 10:03:56 +00:00
|
|
|
uint32_t bgColor = whiteAlpha(alpha);
|
2017-03-25 22:01:33 +00:00
|
|
|
|
|
|
|
if (bgTexture != nullptr) {
|
|
|
|
dc.Flush();
|
|
|
|
dc.GetDrawContext()->BindTexture(0, bgTexture->GetTexture());
|
|
|
|
dc.Draw()->DrawTexRect(dc.GetBounds(), 0, 0, 1, 1, bgColor);
|
|
|
|
|
|
|
|
dc.Flush();
|
|
|
|
dc.RebindTexture();
|
|
|
|
} else {
|
2022-02-11 14:12:52 +00:00
|
|
|
// I_BG original color: 0xFF754D24
|
2020-02-29 20:51:14 +00:00
|
|
|
ImageID img = ImageID("I_BG");
|
2022-02-18 20:02:07 +00:00
|
|
|
ui_draw2d.DrawImageStretch(img, dc.GetBounds(), bgColor & dc.theme->backgroundColor);
|
2017-03-25 22:01:33 +00:00
|
|
|
}
|
|
|
|
|
2020-12-13 23:38:02 +00:00
|
|
|
#if PPSSPP_PLATFORM(IOS)
|
|
|
|
// iOS uses an old screenshot when restoring the task, so to avoid an ugly
|
|
|
|
// jitter we accumulate time instead.
|
|
|
|
static int frameCount = 0.0;
|
|
|
|
frameCount++;
|
2021-02-04 07:54:32 +00:00
|
|
|
double t = (double)frameCount / System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE);
|
2020-12-13 23:38:02 +00:00
|
|
|
#else
|
2020-08-15 22:13:19 +00:00
|
|
|
double t = time_now_d();
|
2020-12-13 23:38:02 +00:00
|
|
|
#endif
|
2021-03-23 22:41:16 +00:00
|
|
|
|
|
|
|
if (g_Animation) {
|
2021-09-09 14:31:14 +00:00
|
|
|
g_Animation->Draw(dc, t, alpha, x, y, z);
|
2013-08-18 18:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-09 14:31:14 +00:00
|
|
|
void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, float z) {
|
2017-05-18 10:52:03 +00:00
|
|
|
std::shared_ptr<GameInfo> ginfo;
|
2021-05-05 23:31:38 +00:00
|
|
|
if (!gamePath.empty())
|
2017-03-25 05:02:22 +00:00
|
|
|
ginfo = g_gameInfoCache->GetInfo(dc.GetDrawContext(), gamePath, GAMEINFO_WANTBG);
|
2014-02-09 21:15:53 +00:00
|
|
|
dc.Flush();
|
|
|
|
|
2021-04-04 17:57:40 +00:00
|
|
|
GameInfoTex *pic = ginfo ? ginfo->GetBGPic() : nullptr;
|
|
|
|
if (pic) {
|
|
|
|
dc.GetDrawContext()->BindTexture(0, pic->texture->GetTexture());
|
2017-03-25 05:02:22 +00:00
|
|
|
}
|
2021-04-04 17:57:40 +00:00
|
|
|
if (pic) {
|
|
|
|
uint32_t color = whiteAlpha(ease((time_now_d() - pic->timeLoaded) * 3)) & 0xFFc0c0c0;
|
2017-03-25 05:02:22 +00:00
|
|
|
dc.Draw()->DrawTexRect(dc.GetBounds(), 0,0,1,1, color);
|
|
|
|
dc.Flush();
|
|
|
|
dc.RebindTexture();
|
|
|
|
} else {
|
2021-09-09 14:31:14 +00:00
|
|
|
::DrawBackground(dc, 1.0f, x, y, z);
|
2017-03-25 05:02:22 +00:00
|
|
|
dc.RebindTexture();
|
|
|
|
dc.Flush();
|
2014-02-09 21:15:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-02 19:22:16 +00:00
|
|
|
void HandleCommonMessages(const char *message, const char *value, ScreenManager *manager, Screen *activeScreen) {
|
2017-12-02 19:39:33 +00:00
|
|
|
bool isActiveScreen = manager->topScreen() == activeScreen;
|
|
|
|
|
2021-11-28 00:11:51 +00:00
|
|
|
if (!strcmp(message, "clear jit") && PSP_IsInited()) {
|
|
|
|
if (MIPSComp::jit) {
|
|
|
|
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
|
|
|
if (MIPSComp::jit)
|
|
|
|
MIPSComp::jit->ClearCache();
|
2014-05-28 06:02:28 +00:00
|
|
|
}
|
2021-11-28 00:11:51 +00:00
|
|
|
currentMIPS->UpdateCore((CPUCore)g_Config.iCpuCore);
|
2022-09-17 20:29:33 +00:00
|
|
|
} else if (!strcmp(message, "control mapping") && isActiveScreen && std::string(activeScreen->tag()) != "ControlMapping") {
|
2017-12-02 19:22:16 +00:00
|
|
|
UpdateUIState(UISTATE_MENU);
|
2016-09-29 05:37:36 +00:00
|
|
|
manager->push(new ControlMappingScreen());
|
2022-09-17 20:29:33 +00:00
|
|
|
} else if (!strcmp(message, "display layout editor") && isActiveScreen && std::string(activeScreen->tag()) != "DisplayLayout") {
|
2017-12-02 19:22:16 +00:00
|
|
|
UpdateUIState(UISTATE_MENU);
|
2016-09-29 05:37:36 +00:00
|
|
|
manager->push(new DisplayLayoutScreen());
|
2022-09-17 20:29:33 +00:00
|
|
|
} else if (!strcmp(message, "settings") && isActiveScreen && std::string(activeScreen->tag()) != "GameSettings") {
|
2017-12-02 19:39:33 +00:00
|
|
|
UpdateUIState(UISTATE_MENU);
|
2021-05-05 23:31:38 +00:00
|
|
|
manager->push(new GameSettingsScreen(Path()));
|
2017-12-02 19:39:33 +00:00
|
|
|
} else if (!strcmp(message, "language screen") && isActiveScreen) {
|
2020-01-26 18:43:18 +00:00
|
|
|
auto dev = GetI18NCategory("Developer");
|
2017-12-02 19:39:33 +00:00
|
|
|
auto langScreen = new NewLanguageScreen(dev->T("Language"));
|
|
|
|
langScreen->OnChoice.Add([](UI::EventParams &) {
|
|
|
|
NativeMessageReceived("recreateviews", "");
|
|
|
|
if (host) {
|
|
|
|
host->UpdateUI();
|
|
|
|
}
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
});
|
|
|
|
manager->push(langScreen);
|
2016-09-29 05:37:36 +00:00
|
|
|
} else if (!strcmp(message, "window minimized")) {
|
|
|
|
if (!strcmp(value, "true")) {
|
|
|
|
gstate_c.skipDrawReason |= SKIPDRAW_WINDOW_MINIMIZED;
|
|
|
|
} else {
|
|
|
|
gstate_c.skipDrawReason &= ~SKIPDRAW_WINDOW_MINIMIZED;
|
|
|
|
}
|
2013-11-02 20:33:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-21 11:31:46 +00:00
|
|
|
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
|
2021-09-09 14:31:14 +00:00
|
|
|
float x, y, z;
|
|
|
|
screenManager()->getFocusPosition(x, y, z);
|
|
|
|
::DrawBackground(dc, 1.0f, x, y, z);
|
2013-07-21 11:31:46 +00:00
|
|
|
dc.Flush();
|
2013-07-15 15:41:24 +00:00
|
|
|
}
|
|
|
|
|
2014-02-09 21:15:53 +00:00
|
|
|
void UIScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
2021-09-09 14:31:14 +00:00
|
|
|
float x, y, z;
|
|
|
|
screenManager()->getFocusPosition(x, y, z);
|
2015-06-11 18:22:16 +00:00
|
|
|
if (!gamePath_.empty()) {
|
2021-09-09 14:31:14 +00:00
|
|
|
DrawGameBackground(dc, gamePath_, x, y, z);
|
2015-06-11 18:22:16 +00:00
|
|
|
} else {
|
2021-09-09 14:31:14 +00:00
|
|
|
::DrawBackground(dc, 1.0f, x, y, z);
|
2015-06-11 18:22:16 +00:00
|
|
|
dc.Flush();
|
|
|
|
}
|
2014-02-09 21:15:53 +00:00
|
|
|
}
|
|
|
|
|
2016-09-29 05:37:36 +00:00
|
|
|
void UIScreenWithGameBackground::sendMessage(const char *message, const char *value) {
|
2017-12-02 19:22:16 +00:00
|
|
|
if (!strcmp(message, "settings") && screenManager()->topScreen() == this) {
|
2016-09-29 05:37:36 +00:00
|
|
|
screenManager()->push(new GameSettingsScreen(gamePath_));
|
|
|
|
} else {
|
|
|
|
UIScreenWithBackground::sendMessage(message, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-09 21:15:53 +00:00
|
|
|
void UIDialogScreenWithGameBackground::DrawBackground(UIContext &dc) {
|
2021-09-09 14:31:14 +00:00
|
|
|
float x, y, z;
|
|
|
|
screenManager()->getFocusPosition(x, y, z);
|
|
|
|
DrawGameBackground(dc, gamePath_, x, y, z);
|
2014-02-09 21:15:53 +00:00
|
|
|
}
|
|
|
|
|
2016-09-29 05:37:36 +00:00
|
|
|
void UIDialogScreenWithGameBackground::sendMessage(const char *message, const char *value) {
|
2017-12-02 19:22:16 +00:00
|
|
|
if (!strcmp(message, "settings") && screenManager()->topScreen() == this) {
|
2016-09-29 05:37:36 +00:00
|
|
|
screenManager()->push(new GameSettingsScreen(gamePath_));
|
|
|
|
} else {
|
|
|
|
UIDialogScreenWithBackground::sendMessage(message, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-21 20:52:44 +00:00
|
|
|
void UIScreenWithBackground::sendMessage(const char *message, const char *value) {
|
2017-12-02 19:22:16 +00:00
|
|
|
HandleCommonMessages(message, value, screenManager(), this);
|
2013-10-21 20:52:44 +00:00
|
|
|
}
|
|
|
|
|
2013-08-12 22:06:48 +00:00
|
|
|
void UIDialogScreenWithBackground::DrawBackground(UIContext &dc) {
|
2021-09-09 14:31:14 +00:00
|
|
|
float x, y, z;
|
|
|
|
screenManager()->getFocusPosition(x, y, z);
|
|
|
|
::DrawBackground(dc, 1.0f, x, y, z);
|
2013-08-12 22:06:48 +00:00
|
|
|
dc.Flush();
|
|
|
|
}
|
|
|
|
|
2015-07-04 15:01:32 +00:00
|
|
|
void UIDialogScreenWithBackground::AddStandardBack(UI::ViewGroup *parent) {
|
|
|
|
using namespace UI;
|
2020-01-26 18:43:18 +00:00
|
|
|
auto di = GetI18NCategory("Dialog");
|
2015-07-04 15:01:32 +00:00
|
|
|
parent->Add(new Choice(di->T("Back"), "", false, new AnchorLayoutParams(150, 64, 10, NONE, NONE, 10)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
|
|
|
}
|
|
|
|
|
2013-10-21 20:52:44 +00:00
|
|
|
void UIDialogScreenWithBackground::sendMessage(const char *message, const char *value) {
|
2017-12-02 19:22:16 +00:00
|
|
|
HandleCommonMessages(message, value, screenManager(), this);
|
2013-10-21 20:52:44 +00:00
|
|
|
}
|
|
|
|
|
2013-09-03 10:42:12 +00:00
|
|
|
PromptScreen::PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText, std::function<void(bool)> callback)
|
2015-09-27 11:51:16 +00:00
|
|
|
: message_(message), callback_(callback) {
|
2020-01-26 18:43:18 +00:00
|
|
|
auto di = GetI18NCategory("Dialog");
|
2015-09-27 11:51:16 +00:00
|
|
|
yesButtonText_ = di->T(yesButtonText.c_str());
|
|
|
|
noButtonText_ = di->T(noButtonText.c_str());
|
2013-09-03 10:42:12 +00:00
|
|
|
}
|
|
|
|
|
2013-07-15 15:41:24 +00:00
|
|
|
void PromptScreen::CreateViews() {
|
|
|
|
// Information in the top left.
|
|
|
|
// Back button to the bottom left.
|
|
|
|
// Scrolling action menu to the right.
|
|
|
|
using namespace UI;
|
|
|
|
|
|
|
|
Margins actionMenuMargins(0, 100, 15, 0);
|
|
|
|
|
2021-12-13 21:42:03 +00:00
|
|
|
root_ = new AnchorLayout();
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2021-12-13 21:42:03 +00:00
|
|
|
root_->Add(new TextView(message_, ALIGN_LEFT | FLAG_WRAP_TEXT, false, new AnchorLayoutParams(WRAP_CONTENT, WRAP_CONTENT, 15, 15, 330, 10)))->SetClip(false);
|
2013-07-15 15:41:24 +00:00
|
|
|
|
2021-12-13 21:42:03 +00:00
|
|
|
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL, new AnchorLayoutParams(300, WRAP_CONTENT, NONE, 15, 15, NONE));
|
2013-07-15 15:41:24 +00:00
|
|
|
root_->Add(rightColumnItems);
|
2021-12-13 21:42:03 +00:00
|
|
|
|
2014-03-03 11:56:01 +00:00
|
|
|
Choice *yesButton = rightColumnItems->Add(new Choice(yesButtonText_));
|
|
|
|
yesButton->OnClick.Handle(this, &PromptScreen::OnYes);
|
|
|
|
root_->SetDefaultFocusView(yesButton);
|
2017-12-03 03:04:33 +00:00
|
|
|
if (!noButtonText_.empty())
|
2013-07-15 15:41:24 +00:00
|
|
|
rightColumnItems->Add(new Choice(noButtonText_))->OnClick.Handle(this, &PromptScreen::OnNo);
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn PromptScreen::OnYes(UI::EventParams &e) {
|
2017-03-20 00:43:03 +00:00
|
|
|
TriggerFinish(DR_OK);
|
2013-07-15 15:41:24 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn PromptScreen::OnNo(UI::EventParams &e) {
|
2017-03-20 00:43:03 +00:00
|
|
|
TriggerFinish(DR_CANCEL);
|
2013-07-15 15:41:24 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2017-12-03 03:04:33 +00:00
|
|
|
void PromptScreen::TriggerFinish(DialogResult result) {
|
|
|
|
callback_(result == DR_OK || result == DR_YES);
|
|
|
|
UIDialogScreenWithBackground::TriggerFinish(result);
|
|
|
|
}
|
|
|
|
|
2021-09-28 21:35:57 +00:00
|
|
|
PostProcScreen::PostProcScreen(const std::string &title, int id) : ListPopupScreen(title), id_(id) { }
|
|
|
|
|
|
|
|
void PostProcScreen::CreateViews() {
|
2020-01-26 18:43:18 +00:00
|
|
|
auto ps = GetI18NCategory("PostShaders");
|
2021-09-28 21:35:57 +00:00
|
|
|
ReloadAllPostShaderInfo(screenManager()->getDrawContext());
|
2013-10-12 00:05:55 +00:00
|
|
|
shaders_ = GetAllPostShaderInfo();
|
|
|
|
std::vector<std::string> items;
|
|
|
|
int selected = -1;
|
2022-01-07 04:40:29 +00:00
|
|
|
const std::string selectedName = id_ >= (int)g_Config.vPostShaderNames.size() ? "Off" : g_Config.vPostShaderNames[id_];
|
2013-10-12 23:49:22 +00:00
|
|
|
for (int i = 0; i < (int)shaders_.size(); i++) {
|
2020-05-16 07:03:39 +00:00
|
|
|
if (!shaders_[i].visible)
|
|
|
|
continue;
|
2021-04-11 01:35:23 +00:00
|
|
|
if (shaders_[i].section == selectedName)
|
2013-10-12 00:05:55 +00:00
|
|
|
selected = i;
|
2018-03-25 09:53:11 +00:00
|
|
|
items.push_back(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()));
|
2013-10-12 00:05:55 +00:00
|
|
|
}
|
|
|
|
adaptor_ = UI::StringVectorListAdaptor(items, selected);
|
2021-09-28 21:35:57 +00:00
|
|
|
ListPopupScreen::CreateViews();
|
2013-10-12 00:05:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void PostProcScreen::OnCompleted(DialogResult result) {
|
|
|
|
if (result != DR_OK)
|
|
|
|
return;
|
2021-04-11 01:35:23 +00:00
|
|
|
const std::string &value = shaders_[listView_->GetSelected()].section;
|
2022-01-07 04:40:29 +00:00
|
|
|
if (id_ < (int)g_Config.vPostShaderNames.size())
|
2021-04-11 01:35:23 +00:00
|
|
|
g_Config.vPostShaderNames[id_] = value;
|
|
|
|
else
|
|
|
|
g_Config.vPostShaderNames.push_back(value);
|
2013-10-12 00:05:55 +00:00
|
|
|
}
|
|
|
|
|
2021-09-28 21:35:57 +00:00
|
|
|
TextureShaderScreen::TextureShaderScreen(const std::string &title) : ListPopupScreen(title) {}
|
|
|
|
|
|
|
|
void TextureShaderScreen::CreateViews() {
|
2020-08-02 04:26:41 +00:00
|
|
|
auto ps = GetI18NCategory("TextureShaders");
|
2021-09-28 21:35:57 +00:00
|
|
|
ReloadAllPostShaderInfo(screenManager()->getDrawContext());
|
2020-08-02 04:26:41 +00:00
|
|
|
shaders_ = GetAllTextureShaderInfo();
|
|
|
|
std::vector<std::string> items;
|
|
|
|
int selected = -1;
|
|
|
|
for (int i = 0; i < (int)shaders_.size(); i++) {
|
|
|
|
if (shaders_[i].section == g_Config.sTextureShaderName)
|
|
|
|
selected = i;
|
|
|
|
items.push_back(ps->T(shaders_[i].section.c_str(), shaders_[i].name.c_str()));
|
|
|
|
}
|
|
|
|
adaptor_ = UI::StringVectorListAdaptor(items, selected);
|
2021-09-28 21:35:57 +00:00
|
|
|
|
|
|
|
ListPopupScreen::CreateViews();
|
2020-08-02 04:26:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextureShaderScreen::OnCompleted(DialogResult result) {
|
|
|
|
if (result != DR_OK)
|
|
|
|
return;
|
|
|
|
g_Config.sTextureShaderName = shaders_[listView_->GetSelected()].section;
|
|
|
|
}
|
|
|
|
|
2013-08-30 21:26:59 +00:00
|
|
|
NewLanguageScreen::NewLanguageScreen(const std::string &title) : ListPopupScreen(title) {
|
2013-07-22 17:22:21 +00:00
|
|
|
// Disable annoying encoding warning
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable:4566)
|
|
|
|
#endif
|
2013-08-18 18:08:28 +00:00
|
|
|
langValuesMapping = GetLangValuesMapping();
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2021-04-25 18:38:22 +00:00
|
|
|
std::vector<File::FileInfo> tempLangs;
|
2013-08-20 18:12:58 +00:00
|
|
|
VFSGetFileListing("lang", &tempLangs, "ini");
|
2013-07-15 22:29:00 +00:00
|
|
|
std::vector<std::string> listing;
|
2013-08-10 21:04:23 +00:00
|
|
|
int selected = -1;
|
2013-08-20 18:12:58 +00:00
|
|
|
int counter = 0;
|
|
|
|
for (size_t i = 0; i < tempLangs.size(); i++) {
|
2013-07-15 22:29:00 +00:00
|
|
|
// Skip README
|
2013-08-20 18:12:58 +00:00
|
|
|
if (tempLangs[i].name.find("README") != std::string::npos) {
|
2013-07-15 22:29:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
2013-12-02 14:15:19 +00:00
|
|
|
|
2017-06-06 09:30:20 +00:00
|
|
|
// We only support Arabic on platforms where we have support for the native text rendering
|
|
|
|
// APIs, as proper Arabic support is way too difficult to implement ourselves.
|
2017-06-05 15:32:49 +00:00
|
|
|
#if !(defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(ANDROID))
|
2013-08-22 03:01:37 +00:00
|
|
|
if (tempLangs[i].name.find("ar_AE") != std::string::npos) {
|
|
|
|
continue;
|
|
|
|
}
|
2017-06-05 15:32:49 +00:00
|
|
|
|
2015-01-31 14:27:13 +00:00
|
|
|
if (tempLangs[i].name.find("fa_IR") != std::string::npos) {
|
|
|
|
continue;
|
|
|
|
}
|
2013-09-04 12:46:21 +00:00
|
|
|
#endif
|
2017-06-05 15:32:49 +00:00
|
|
|
|
2021-04-25 18:38:22 +00:00
|
|
|
File::FileInfo lang = tempLangs[i];
|
2013-08-20 18:12:58 +00:00
|
|
|
langs_.push_back(lang);
|
|
|
|
|
2013-07-15 22:29:00 +00:00
|
|
|
std::string code;
|
2013-08-20 18:12:58 +00:00
|
|
|
size_t dot = lang.name.find('.');
|
2013-07-15 22:29:00 +00:00
|
|
|
if (dot != std::string::npos)
|
2013-08-20 18:12:58 +00:00
|
|
|
code = lang.name.substr(0, dot);
|
2013-07-15 22:29:00 +00:00
|
|
|
|
2013-08-20 18:12:58 +00:00
|
|
|
std::string buttonTitle = lang.name;
|
2013-07-15 22:29:00 +00:00
|
|
|
|
|
|
|
if (!code.empty()) {
|
|
|
|
if (langValuesMapping.find(code) == langValuesMapping.end()) {
|
|
|
|
// No title found, show locale code
|
|
|
|
buttonTitle = code;
|
|
|
|
} else {
|
|
|
|
buttonTitle = langValuesMapping[code].first;
|
|
|
|
}
|
|
|
|
}
|
2013-09-16 23:47:25 +00:00
|
|
|
if (g_Config.sLanguageIni == code)
|
2013-08-20 18:12:58 +00:00
|
|
|
selected = counter;
|
2013-07-15 22:29:00 +00:00
|
|
|
listing.push_back(buttonTitle);
|
2013-08-20 18:12:58 +00:00
|
|
|
counter++;
|
2013-07-15 22:29:00 +00:00
|
|
|
}
|
|
|
|
|
2013-08-10 21:04:23 +00:00
|
|
|
adaptor_ = UI::StringVectorListAdaptor(listing, selected);
|
2013-07-15 22:29:00 +00:00
|
|
|
}
|
|
|
|
|
2013-08-18 17:51:40 +00:00
|
|
|
void NewLanguageScreen::OnCompleted(DialogResult result) {
|
|
|
|
if (result != DR_OK)
|
|
|
|
return;
|
2013-09-16 23:47:25 +00:00
|
|
|
std::string oldLang = g_Config.sLanguageIni;
|
2013-07-15 22:29:00 +00:00
|
|
|
std::string iniFile = langs_[listView_->GetSelected()].name;
|
|
|
|
|
|
|
|
size_t dot = iniFile.find('.');
|
|
|
|
std::string code;
|
|
|
|
if (dot != std::string::npos)
|
|
|
|
code = iniFile.substr(0, dot);
|
|
|
|
|
|
|
|
if (code.empty())
|
|
|
|
return;
|
|
|
|
|
2013-09-16 23:47:25 +00:00
|
|
|
g_Config.sLanguageIni = code;
|
2013-12-05 13:14:15 +00:00
|
|
|
|
2014-02-12 23:31:54 +00:00
|
|
|
bool iniLoadedSuccessfully = false;
|
|
|
|
// Allow the lang directory to be overridden for testing purposes (e.g. Android, where it's hard to
|
|
|
|
// test new languages without recompiling the entire app, which is a hassle).
|
2021-05-05 23:31:38 +00:00
|
|
|
const Path langOverridePath = GetSysDirectory(DIRECTORY_SYSTEM) / "lang";
|
2014-02-12 23:31:54 +00:00
|
|
|
|
|
|
|
// If we run into the unlikely case that "lang" is actually a file, just use the built-in translations.
|
|
|
|
if (!File::Exists(langOverridePath) || !File::IsDirectory(langOverridePath))
|
|
|
|
iniLoadedSuccessfully = i18nrepo.LoadIni(g_Config.sLanguageIni);
|
|
|
|
else
|
|
|
|
iniLoadedSuccessfully = i18nrepo.LoadIni(g_Config.sLanguageIni, langOverridePath);
|
|
|
|
|
|
|
|
if (iniLoadedSuccessfully) {
|
2013-07-15 22:29:00 +00:00
|
|
|
// Dunno what else to do here.
|
|
|
|
if (langValuesMapping.find(code) == langValuesMapping.end()) {
|
|
|
|
// Fallback to English
|
2013-09-16 22:08:09 +00:00
|
|
|
g_Config.iLanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
2013-07-15 22:29:00 +00:00
|
|
|
} else {
|
2013-09-16 22:08:09 +00:00
|
|
|
g_Config.iLanguage = langValuesMapping[code].second;
|
2013-07-15 22:29:00 +00:00
|
|
|
}
|
2013-09-01 20:29:23 +00:00
|
|
|
RecreateViews();
|
2013-07-15 22:29:00 +00:00
|
|
|
} else {
|
2013-09-16 23:47:25 +00:00
|
|
|
g_Config.sLanguageIni = oldLang;
|
2013-07-15 22:29:00 +00:00
|
|
|
}
|
2013-07-20 15:27:03 +00:00
|
|
|
}
|
2013-08-14 21:05:02 +00:00
|
|
|
|
|
|
|
void LogoScreen::Next() {
|
2013-10-20 15:33:18 +00:00
|
|
|
if (!switched_) {
|
|
|
|
switched_ = true;
|
2021-05-11 21:58:54 +00:00
|
|
|
Path gamePath = boot_filename;
|
2021-09-18 14:06:11 +00:00
|
|
|
|
|
|
|
switch (afterLogoScreen_) {
|
|
|
|
case AfterLogoScreen::TO_GAME_SETTINGS:
|
2021-05-11 21:58:54 +00:00
|
|
|
if (!gamePath.empty()) {
|
2021-05-05 23:31:38 +00:00
|
|
|
screenManager()->switchScreen(new EmuScreen(gamePath));
|
2020-05-09 20:52:04 +00:00
|
|
|
} else {
|
|
|
|
screenManager()->switchScreen(new MainScreen());
|
|
|
|
}
|
2021-05-05 23:31:38 +00:00
|
|
|
screenManager()->push(new GameSettingsScreen(gamePath));
|
2021-09-18 14:06:11 +00:00
|
|
|
break;
|
|
|
|
case AfterLogoScreen::MEMSTICK_SCREEN_INITIAL_SETUP:
|
|
|
|
screenManager()->switchScreen(new MemStickScreen(true));
|
|
|
|
break;
|
|
|
|
case AfterLogoScreen::DEFAULT:
|
|
|
|
default:
|
|
|
|
if (boot_filename.size()) {
|
|
|
|
screenManager()->switchScreen(new EmuScreen(gamePath));
|
|
|
|
} else {
|
|
|
|
screenManager()->switchScreen(new MainScreen());
|
|
|
|
}
|
|
|
|
break;
|
2013-10-20 15:33:18 +00:00
|
|
|
}
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-06 10:03:56 +00:00
|
|
|
const float logoScreenSeconds = 2.5f;
|
|
|
|
|
2021-09-18 14:06:11 +00:00
|
|
|
LogoScreen::LogoScreen(AfterLogoScreen afterLogoScreen)
|
|
|
|
: afterLogoScreen_(afterLogoScreen) {
|
2021-02-04 07:54:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-15 05:01:18 +00:00
|
|
|
void LogoScreen::update() {
|
|
|
|
UIScreen::update();
|
2021-02-07 19:09:57 +00:00
|
|
|
double rate = std::max(30.0, (double)System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE));
|
|
|
|
|
|
|
|
if ((double)frames_ / rate > logoScreenSeconds) {
|
2013-08-14 21:05:02 +00:00
|
|
|
Next();
|
|
|
|
}
|
2021-02-07 19:09:57 +00:00
|
|
|
frames_++;
|
2021-02-11 21:11:50 +00:00
|
|
|
sinceStart_ = (double)frames_ / rate;
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LogoScreen::sendMessage(const char *message, const char *value) {
|
2017-12-02 19:22:16 +00:00
|
|
|
if (!strcmp(message, "boot") && screenManager()->topScreen() == this) {
|
2021-05-05 23:31:38 +00:00
|
|
|
screenManager()->switchScreen(new EmuScreen(Path(value)));
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-15 11:04:59 +00:00
|
|
|
bool LogoScreen::key(const KeyInput &key) {
|
2021-09-16 20:31:24 +00:00
|
|
|
if (key.deviceId != DEVICE_ID_MOUSE && (key.flags & KEY_DOWN)) {
|
2013-08-14 21:05:02 +00:00
|
|
|
Next();
|
2014-06-15 11:04:59 +00:00
|
|
|
return true;
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
2014-06-15 11:04:59 +00:00
|
|
|
return false;
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
|
2017-03-15 04:03:57 +00:00
|
|
|
bool LogoScreen::touch(const TouchInput &touch) {
|
|
|
|
if (touch.flags & TOUCH_DOWN) {
|
|
|
|
Next();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
void LogoScreen::render() {
|
2016-12-25 17:18:19 +00:00
|
|
|
using namespace Draw;
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
UIScreen::render();
|
|
|
|
UIContext &dc = *screenManager()->getUIContext();
|
|
|
|
|
2014-02-10 15:08:19 +00:00
|
|
|
const Bounds &bounds = dc.GetBounds();
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
dc.Begin();
|
2021-02-04 07:54:32 +00:00
|
|
|
|
2021-02-11 21:11:50 +00:00
|
|
|
float t = (float)sinceStart_ / (logoScreenSeconds / 3.0f);
|
2013-08-14 21:05:02 +00:00
|
|
|
|
|
|
|
float alpha = t;
|
2014-02-10 11:38:23 +00:00
|
|
|
if (t > 1.0f)
|
|
|
|
alpha = 1.0f;
|
2013-08-14 21:05:02 +00:00
|
|
|
float alphaText = alpha;
|
2014-02-10 11:38:23 +00:00
|
|
|
if (t > 2.0f)
|
|
|
|
alphaText = 3.0f - t;
|
2017-03-26 15:57:04 +00:00
|
|
|
uint32_t textColor = colorAlpha(dc.theme->infoStyle.fgColor, alphaText);
|
2013-08-14 21:05:02 +00:00
|
|
|
|
2021-09-09 14:31:14 +00:00
|
|
|
float x, y, z;
|
|
|
|
screenManager()->getFocusPosition(x, y, z);
|
|
|
|
::DrawBackground(dc, alpha, x, y, z);
|
2013-08-14 21:05:02 +00:00
|
|
|
|
2020-01-26 18:43:18 +00:00
|
|
|
auto cr = GetI18NCategory("PSPCredits");
|
|
|
|
auto gr = GetI18NCategory("Graphics");
|
2013-08-14 21:05:02 +00:00
|
|
|
char temp[256];
|
2017-04-05 14:21:08 +00:00
|
|
|
// Manually formatting UTF-8 is fun. \xXX doesn't work everywhere.
|
2015-07-01 22:19:38 +00:00
|
|
|
snprintf(temp, sizeof(temp), "%s Henrik Rydg%c%crd", cr->T("created", "Created by"), 0xC3, 0xA5);
|
2017-04-30 00:35:12 +00:00
|
|
|
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
2022-02-14 12:57:22 +00:00
|
|
|
dc.Draw()->DrawImage(ImageID("I_ICONGOLD"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, 0xFFFFFFFF, ALIGN_CENTER);
|
2017-04-05 14:21:08 +00:00
|
|
|
} else {
|
2022-02-14 12:57:22 +00:00
|
|
|
dc.Draw()->DrawImage(ImageID("I_ICON"), bounds.centerX() - 120, bounds.centerY() - 30, 1.2f, 0xFFFFFFFF, ALIGN_CENTER);
|
2017-04-05 14:21:08 +00:00
|
|
|
}
|
2022-02-14 12:57:22 +00:00
|
|
|
dc.Draw()->DrawImage(ImageID("I_LOGO"), bounds.centerX() + 40, bounds.centerY() - 30, 1.5f, 0xFFFFFFFF, ALIGN_CENTER);
|
2021-02-15 17:28:07 +00:00
|
|
|
//dc.Draw()->DrawTextShadow(UBUNTU48, "PPSSPP", bounds.w / 2, bounds.h / 2 - 30, textColor, ALIGN_CENTER);
|
2015-05-07 03:14:04 +00:00
|
|
|
dc.SetFontScale(1.0f, 1.0f);
|
2013-08-30 12:47:28 +00:00
|
|
|
dc.SetFontStyle(dc.theme->uiFont);
|
2017-03-26 15:57:04 +00:00
|
|
|
dc.DrawText(temp, bounds.centerX(), bounds.centerY() + 40, textColor, ALIGN_CENTER);
|
|
|
|
dc.DrawText(cr->T("license", "Free Software under GPL 2.0+"), bounds.centerX(), bounds.centerY() + 70, textColor, ALIGN_CENTER);
|
2017-11-26 20:02:59 +00:00
|
|
|
|
2021-02-15 17:28:07 +00:00
|
|
|
int ppsspp_org_y = bounds.h / 2 + 130;
|
2017-11-26 20:02:59 +00:00
|
|
|
dc.DrawText("www.ppsspp.org", bounds.centerX(), ppsspp_org_y, textColor, ALIGN_CENTER);
|
2013-10-21 10:21:22 +00:00
|
|
|
|
2021-11-30 09:11:18 +00:00
|
|
|
#if !PPSSPP_PLATFORM(UWP)
|
2017-03-05 12:59:33 +00:00
|
|
|
// Draw the graphics API, except on UWP where it's always D3D11
|
2017-12-25 02:04:18 +00:00
|
|
|
std::string apiName = screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME);
|
2020-05-18 21:16:00 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
apiName += ", debug build";
|
|
|
|
#endif
|
2017-12-25 02:04:18 +00:00
|
|
|
dc.DrawText(gr->T(apiName), bounds.centerX(), ppsspp_org_y + 50, textColor, ALIGN_CENTER);
|
2014-09-13 18:55:51 +00:00
|
|
|
#endif
|
2014-08-22 18:48:35 +00:00
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
dc.Flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreditsScreen::CreateViews() {
|
|
|
|
using namespace UI;
|
2020-01-26 18:43:18 +00:00
|
|
|
auto di = GetI18NCategory("Dialog");
|
|
|
|
auto cr = GetI18NCategory("PSPCredits");
|
2013-08-19 22:49:25 +00:00
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
|
2015-07-01 21:26:55 +00:00
|
|
|
Button *back = root_->Add(new Button(di->T("Back"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 10, false)));
|
2014-03-03 11:56:01 +00:00
|
|
|
back->OnClick.Handle(this, &CreditsScreen::OnOK);
|
|
|
|
root_->SetDefaultFocusView(back);
|
2018-09-24 21:23:51 +00:00
|
|
|
|
|
|
|
// Really need to redo this whole layout with some linear layouts...
|
|
|
|
|
|
|
|
int rightYOffset = 0;
|
2017-11-14 11:50:27 +00:00
|
|
|
if (!System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
2018-09-16 18:04:10 +00:00
|
|
|
root_->Add(new Button(cr->T("Buy Gold"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnSupport);
|
2018-09-24 21:23:51 +00:00
|
|
|
rightYOffset = 74;
|
2017-11-14 11:50:27 +00:00
|
|
|
}
|
2018-09-16 18:04:10 +00:00
|
|
|
root_->Add(new Button(cr->T("PPSSPP Forums"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 158, false)))->OnClick.Handle(this, &CreditsScreen::OnForums);
|
|
|
|
root_->Add(new Button(cr->T("Discord"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 232, false)))->OnClick.Handle(this, &CreditsScreen::OnDiscord);
|
|
|
|
root_->Add(new Button("www.ppsspp.org", new AnchorLayoutParams(260, 64, 10, NONE, NONE, 10, false)))->OnClick.Handle(this, &CreditsScreen::OnPPSSPPOrg);
|
|
|
|
root_->Add(new Button(cr->T("Privacy Policy"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnPrivacy);
|
2020-04-20 22:20:58 +00:00
|
|
|
root_->Add(new Button(cr->T("Twitter @PPSSPP_emu"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 84, false)))->OnClick.Handle(this, &CreditsScreen::OnTwitter);
|
2020-04-25 07:07:35 +00:00
|
|
|
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
|
2020-04-20 22:20:58 +00:00
|
|
|
root_->Add(new Button(cr->T("Share PPSSPP"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 158, false)))->OnClick.Handle(this, &CreditsScreen::OnShare);
|
2013-12-11 17:05:57 +00:00
|
|
|
#endif
|
2017-04-30 00:35:12 +00:00
|
|
|
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
2021-02-22 00:38:02 +00:00
|
|
|
root_->Add(new ImageView(ImageID("I_ICONGOLD"), "", IS_DEFAULT, new AnchorLayoutParams(100, 64, 10, 10, NONE, NONE, false)));
|
2017-04-05 14:21:08 +00:00
|
|
|
} else {
|
2021-02-22 00:38:02 +00:00
|
|
|
root_->Add(new ImageView(ImageID("I_ICON"), "", IS_DEFAULT, new AnchorLayoutParams(100, 64, 10, 10, NONE, NONE, false)));
|
2017-04-05 14:21:08 +00:00
|
|
|
}
|
2013-08-19 22:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UI::EventReturn CreditsScreen::OnSupport(UI::EventParams &e) {
|
2016-10-12 09:13:16 +00:00
|
|
|
#ifdef __ANDROID__
|
2013-08-19 22:49:25 +00:00
|
|
|
LaunchBrowser("market://details?id=org.ppsspp.ppssppgold");
|
|
|
|
#else
|
2017-11-14 11:50:27 +00:00
|
|
|
LaunchBrowser("https://central.ppsspp.org/buygold");
|
2013-08-19 22:49:25 +00:00
|
|
|
#endif
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2013-12-19 13:28:04 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnTwitter(UI::EventParams &e) {
|
2016-10-12 09:13:16 +00:00
|
|
|
#ifdef __ANDROID__
|
2013-12-19 13:28:04 +00:00
|
|
|
System_SendMessage("showTwitter", "PPSSPP_emu");
|
2013-12-19 13:34:33 +00:00
|
|
|
#else
|
|
|
|
LaunchBrowser("https://twitter.com/#!/PPSSPP_emu");
|
2013-12-19 13:28:04 +00:00
|
|
|
#endif
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2013-08-19 22:49:25 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnPPSSPPOrg(UI::EventParams &e) {
|
2017-11-14 11:50:27 +00:00
|
|
|
LaunchBrowser("https://www.ppsspp.org");
|
2013-08-19 22:49:25 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2017-11-29 13:33:28 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnPrivacy(UI::EventParams &e) {
|
|
|
|
LaunchBrowser("https://www.ppsspp.org/privacy.html");
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2013-08-19 22:49:25 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnForums(UI::EventParams &e) {
|
2017-11-14 11:50:27 +00:00
|
|
|
LaunchBrowser("https://forums.ppsspp.org");
|
2013-08-19 22:49:25 +00:00
|
|
|
return UI::EVENT_DONE;
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
|
2018-09-16 18:04:10 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnDiscord(UI::EventParams &e) {
|
|
|
|
LaunchBrowser("https://discord.gg/5NJB6dD");
|
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2013-12-11 17:05:57 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnShare(UI::EventParams &e) {
|
2020-01-26 18:43:18 +00:00
|
|
|
auto cr = GetI18NCategory("PSPCredits");
|
2020-04-24 21:37:15 +00:00
|
|
|
System_SendMessage("sharetext", cr->T("CheckOutPPSSPP", "Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/"));
|
2013-12-11 17:05:57 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
UI::EventReturn CreditsScreen::OnOK(UI::EventParams &e) {
|
2017-03-20 00:43:03 +00:00
|
|
|
TriggerFinish(DR_OK);
|
2013-08-14 21:05:02 +00:00
|
|
|
return UI::EVENT_DONE;
|
|
|
|
}
|
|
|
|
|
2021-02-04 07:54:32 +00:00
|
|
|
CreditsScreen::CreditsScreen() {
|
|
|
|
startTime_ = time_now_d();
|
|
|
|
}
|
|
|
|
|
2017-03-15 05:01:18 +00:00
|
|
|
void CreditsScreen::update() {
|
|
|
|
UIScreen::update();
|
2013-09-15 16:35:58 +00:00
|
|
|
UpdateUIState(UISTATE_MENU);
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CreditsScreen::render() {
|
|
|
|
UIScreen::render();
|
|
|
|
|
2020-01-26 18:43:18 +00:00
|
|
|
auto cr = GetI18NCategory("PSPCredits");
|
2013-08-14 21:05:02 +00:00
|
|
|
|
2018-10-28 14:58:13 +00:00
|
|
|
std::string specialthanksMaxim = "Maxim ";
|
|
|
|
specialthanksMaxim += cr->T("specialthanksMaxim", "for his amazing Atrac3+ decoder work");
|
|
|
|
|
|
|
|
std::string specialthanksKeithGalocy = "Keith Galocy ";
|
|
|
|
specialthanksKeithGalocy += cr->T("specialthanksKeithGalocy", "at NVIDIA (hardware, advice)");
|
|
|
|
|
|
|
|
std::string specialthanksOrphis = "Orphis (";
|
|
|
|
specialthanksOrphis += cr->T("build server");
|
|
|
|
specialthanksOrphis += ')';
|
|
|
|
|
|
|
|
std::string specialthanksangelxwind = "angelxwind (";
|
|
|
|
specialthanksangelxwind += cr->T("iOS builds");
|
|
|
|
specialthanksangelxwind += ')';
|
|
|
|
|
|
|
|
std::string specialthanksW_MS = "W.MS (";
|
|
|
|
specialthanksW_MS += cr->T("iOS builds");
|
|
|
|
specialthanksW_MS += ')';
|
|
|
|
|
|
|
|
std::string specialthankssolarmystic = "solarmystic (";
|
|
|
|
specialthankssolarmystic += cr->T("testing");
|
|
|
|
specialthankssolarmystic += ')';
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
const char * credits[] = {
|
|
|
|
"PPSSPP",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("title", "A fast and portable PSP emulator"),
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
2013-08-16 14:48:43 +00:00
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("created", "Created by"),
|
2013-09-04 11:25:35 +00:00
|
|
|
"Henrik Rydg\xc3\xa5rd",
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("contributors", "Contributors:"),
|
2013-08-14 21:05:02 +00:00
|
|
|
"unknownbrackets",
|
|
|
|
"oioitff",
|
|
|
|
"xsacha",
|
|
|
|
"raven02",
|
|
|
|
"tpunix",
|
|
|
|
"orphis",
|
|
|
|
"sum2012",
|
|
|
|
"mikusp",
|
|
|
|
"aquanull",
|
|
|
|
"The Dax",
|
2013-10-15 05:02:15 +00:00
|
|
|
"bollu",
|
2013-08-14 21:05:02 +00:00
|
|
|
"tmaul",
|
|
|
|
"artart78",
|
|
|
|
"ced2911",
|
|
|
|
"soywiz",
|
|
|
|
"kovensky",
|
|
|
|
"xele",
|
|
|
|
"chaserhjk",
|
|
|
|
"evilcorn",
|
|
|
|
"daniel dressler",
|
|
|
|
"makotech222",
|
|
|
|
"CPkmn",
|
|
|
|
"mgaver",
|
|
|
|
"jeid3",
|
|
|
|
"cinaera/BeaR",
|
|
|
|
"jtraynham",
|
|
|
|
"Kingcom",
|
|
|
|
"arnastia",
|
|
|
|
"lioncash",
|
|
|
|
"JulianoAmaralChaves",
|
2013-09-15 13:28:23 +00:00
|
|
|
"vnctdj",
|
2013-09-16 06:09:27 +00:00
|
|
|
"kaienfr",
|
2013-10-28 10:01:22 +00:00
|
|
|
"shenweip",
|
2013-10-28 15:06:14 +00:00
|
|
|
"Danyal Zia",
|
2013-12-14 10:08:04 +00:00
|
|
|
"Igor Calabria",
|
2013-12-14 10:57:36 +00:00
|
|
|
"Coldbird",
|
|
|
|
"Kyhel",
|
2017-01-08 19:57:21 +00:00
|
|
|
"xebra",
|
2017-04-30 06:54:34 +00:00
|
|
|
"LunaMoo",
|
2017-06-11 13:44:41 +00:00
|
|
|
"zminhquanz",
|
2020-10-05 20:54:50 +00:00
|
|
|
"ANR2ME",
|
|
|
|
"adenovan",
|
|
|
|
"iota97",
|
2022-09-06 09:50:01 +00:00
|
|
|
"Lubos",
|
2013-08-16 14:48:43 +00:00
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("specialthanks", "Special thanks to:"),
|
2018-10-28 14:58:13 +00:00
|
|
|
specialthanksMaxim.c_str(),
|
|
|
|
specialthanksKeithGalocy.c_str(),
|
|
|
|
specialthanksOrphis.c_str(),
|
|
|
|
specialthanksangelxwind.c_str(),
|
|
|
|
specialthanksW_MS.c_str(),
|
|
|
|
specialthankssolarmystic.c_str(),
|
|
|
|
cr->T("all the forum mods"),
|
2013-08-16 14:48:43 +00:00
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("this translation by", ""), // Empty string as this is the original :)
|
|
|
|
cr->T("translators1", ""),
|
|
|
|
cr->T("translators2", ""),
|
|
|
|
cr->T("translators3", ""),
|
|
|
|
cr->T("translators4", ""),
|
|
|
|
cr->T("translators5", ""),
|
|
|
|
cr->T("translators6", ""),
|
2013-08-16 14:48:43 +00:00
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("written", "Written in C++ for speed and portability"),
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("tools", "Free tools used:"),
|
2016-10-12 09:13:16 +00:00
|
|
|
#ifdef __ANDROID__
|
2013-08-14 21:05:02 +00:00
|
|
|
"Android SDK + NDK",
|
|
|
|
#endif
|
|
|
|
#if defined(USING_QT_UI)
|
|
|
|
"Qt",
|
2022-01-09 23:36:20 +00:00
|
|
|
#endif
|
|
|
|
#if defined(SDL)
|
2013-08-14 21:05:02 +00:00
|
|
|
"SDL",
|
|
|
|
#endif
|
|
|
|
"CMake",
|
|
|
|
"freetype2",
|
|
|
|
"zlib",
|
|
|
|
"PSP SDK",
|
|
|
|
"",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("website", "Check out the website:"),
|
2013-08-14 21:05:02 +00:00
|
|
|
"www.ppsspp.org",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("list", "compatibility lists, forums, and development info"),
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("check", "Also check out Dolphin, the best Wii/GC emu around:"),
|
2017-11-14 11:50:27 +00:00
|
|
|
"https://www.dolphin-emu.org",
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("info1", "PPSSPP is only intended to play games you own."),
|
|
|
|
cr->T("info2", "Please make sure that you own the rights to any games"),
|
|
|
|
cr->T("info3", "you play by owning the UMD or by buying the digital"),
|
|
|
|
cr->T("info4", "download from the PSN store on your real PSP."),
|
2013-10-21 10:21:22 +00:00
|
|
|
"",
|
2013-08-14 21:05:02 +00:00
|
|
|
"",
|
2015-07-01 22:19:38 +00:00
|
|
|
cr->T("info5", "PSP is a trademark by Sony, Inc."),
|
2013-08-14 21:05:02 +00:00
|
|
|
};
|
|
|
|
|
2014-02-10 11:38:23 +00:00
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
// TODO: This is kinda ugly, done on every frame...
|
|
|
|
char temp[256];
|
2017-04-30 00:35:12 +00:00
|
|
|
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {
|
2017-04-05 14:21:08 +00:00
|
|
|
snprintf(temp, sizeof(temp), "PPSSPP Gold %s", PPSSPP_GIT_VERSION);
|
|
|
|
} else {
|
|
|
|
snprintf(temp, sizeof(temp), "PPSSPP %s", PPSSPP_GIT_VERSION);
|
|
|
|
}
|
2013-08-14 21:05:02 +00:00
|
|
|
credits[0] = (const char *)temp;
|
|
|
|
|
|
|
|
UIContext &dc = *screenManager()->getUIContext();
|
|
|
|
dc.Begin();
|
2020-03-31 14:46:14 +00:00
|
|
|
const Bounds &bounds = dc.GetLayoutBounds();
|
2013-08-14 21:05:02 +00:00
|
|
|
|
|
|
|
const int numItems = ARRAY_SIZE(credits);
|
|
|
|
int itemHeight = 36;
|
2014-02-10 11:38:23 +00:00
|
|
|
int totalHeight = numItems * itemHeight + bounds.h + 200;
|
2021-02-04 07:54:32 +00:00
|
|
|
|
|
|
|
float t = (float)(time_now_d() - startTime_) * 60.0;
|
|
|
|
|
|
|
|
float y = bounds.y2() - fmodf(t, (float)totalHeight);
|
2013-08-14 21:05:02 +00:00
|
|
|
for (int i = 0; i < numItems; i++) {
|
2014-02-10 11:38:23 +00:00
|
|
|
float alpha = linearInOut(y+32, 64, bounds.y2() - 192, 64);
|
2017-03-26 15:57:04 +00:00
|
|
|
uint32_t textColor = colorAlpha(dc.theme->infoStyle.fgColor, alpha);
|
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
if (alpha > 0.0f) {
|
2013-09-04 10:38:52 +00:00
|
|
|
dc.SetFontScale(ease(alpha), ease(alpha));
|
2020-03-31 14:46:14 +00:00
|
|
|
dc.DrawText(credits[i], bounds.centerX(), y, textColor, ALIGN_HCENTER);
|
2013-09-04 10:38:52 +00:00
|
|
|
dc.SetFontScale(1.0f, 1.0f);
|
2013-08-14 21:05:02 +00:00
|
|
|
}
|
|
|
|
y += itemHeight;
|
|
|
|
}
|
2013-08-18 18:25:33 +00:00
|
|
|
|
2013-08-14 21:05:02 +00:00
|
|
|
dc.Flush();
|
|
|
|
}
|
2021-04-24 20:47:57 +00:00
|
|
|
|
|
|
|
SettingInfoMessage::SettingInfoMessage(int align, UI::AnchorLayoutParams *lp)
|
|
|
|
: UI::LinearLayout(UI::ORIENT_HORIZONTAL, lp) {
|
|
|
|
using namespace UI;
|
|
|
|
SetSpacing(0.0f);
|
|
|
|
Add(new UI::Spacer(10.0f));
|
|
|
|
text_ = Add(new UI::TextView("", align, false, new LinearLayoutParams(1.0, Margins(0, 10))));
|
|
|
|
Add(new UI::Spacer(10.0f));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingInfoMessage::Show(const std::string &text, UI::View *refView) {
|
|
|
|
if (refView) {
|
|
|
|
Bounds b = refView->GetBounds();
|
|
|
|
const UI::AnchorLayoutParams *lp = GetLayoutParams()->As<UI::AnchorLayoutParams>();
|
|
|
|
if (b.y >= cutOffY_) {
|
|
|
|
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, 80.0f, lp->right, lp->bottom, lp->center));
|
|
|
|
} else {
|
|
|
|
ReplaceLayoutParams(new UI::AnchorLayoutParams(lp->width, lp->height, lp->left, dp_yres - 80.0f - 40.0f, lp->right, lp->bottom, lp->center));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
text_->SetText(text);
|
|
|
|
timeShown_ = time_now_d();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SettingInfoMessage::Draw(UIContext &dc) {
|
|
|
|
static const double FADE_TIME = 1.0;
|
|
|
|
static const float MAX_ALPHA = 0.9f;
|
|
|
|
|
|
|
|
// Let's show longer messages for more time (guesstimate at reading speed.)
|
|
|
|
// Note: this will give multibyte characters more time, but they often have shorter words anyway.
|
|
|
|
double timeToShow = std::max(1.5, text_->GetText().size() * 0.05);
|
|
|
|
|
|
|
|
double sinceShow = time_now_d() - timeShown_;
|
|
|
|
float alpha = MAX_ALPHA;
|
|
|
|
if (timeShown_ == 0.0 || sinceShow > timeToShow + FADE_TIME) {
|
|
|
|
alpha = 0.0f;
|
|
|
|
} else if (sinceShow > timeToShow) {
|
|
|
|
alpha = MAX_ALPHA - MAX_ALPHA * (float)((sinceShow - timeToShow) / FADE_TIME);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alpha >= 0.1f) {
|
|
|
|
UI::Style style = dc.theme->popupTitle;
|
|
|
|
style.background.color = colorAlpha(style.background.color, alpha - 0.1f);
|
|
|
|
dc.FillRect(style.background, bounds_);
|
|
|
|
}
|
|
|
|
|
|
|
|
text_->SetTextColor(whiteAlpha(alpha));
|
|
|
|
ViewGroup::Draw(dc);
|
2021-09-11 23:17:24 +00:00
|
|
|
showing_ = sinceShow <= timeToShow; // Don't consider fade time
|
2021-04-24 20:47:57 +00:00
|
|
|
}
|
2021-09-11 23:17:24 +00:00
|
|
|
|
|
|
|
std::string SettingInfoMessage::GetText() const {
|
|
|
|
return showing_ && text_ ? text_->GetText() : "";
|
2021-09-18 14:06:11 +00:00
|
|
|
}
|