Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C

Rename to PSBox Cloud Gaming; new icon and in-app logo

Rafael Abud Ferreirad3996f7aa335
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd4c370..9cf31b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,7 @@ add_library(xcloud_ui STATIC
src/ui/font.cpp
src/ui/image_cache.cpp
src/ui/app_ui.cpp
+ src/ui/brand.cpp
src/app/library.cpp
extern/qrcodegen/qrcodegen.c
)
diff --git a/README.md b/README.md
index 049c9bd..fac50d7 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,11 @@
-# xCloud-PS5
+# PSBox Cloud Gaming
Cliente nativo de Xbox Cloud Gaming (xCloud) para PS5 com homebrew.
+O ícone e o logo são arte original (`src/ui/brand.cpp`), inspirada no
+estilo do Xbox, sem usar o logotipo da Microsoft. Para regenerar o ícone da
+home do PS5: `build-host/xcloud-cli render-icon ps5/sce_sys/icon0.png 512`.
+
## Estado
| Parte | PC (`xcloud-cli`) | PS5 |
diff --git a/ps5/sce_sys/icon0.png b/ps5/sce_sys/icon0.png
index d1ed6a3..28e374c 100644
Binary files a/ps5/sce_sys/icon0.png and b/ps5/sce_sys/icon0.png differ
diff --git a/ps5/sce_sys/param.json b/ps5/sce_sys/param.json
index 81ceca1..1530da4 100644
--- a/ps5/sce_sys/param.json
+++ b/ps5/sce_sys/param.json
@@ -22,10 +22,10 @@
"localizedParameters": {
"defaultLanguage": "en-US",
"en-US": {
- "titleName": "Xbox Cloud Gaming"
+ "titleName": "PSBox Cloud Gaming"
},
"pt-BR": {
- "titleName": "Xbox Cloud Gaming"
+ "titleName": "PSBox Cloud Gaming"
}
},
"masterVersion": "00.10",
diff --git a/src/app/cli_main.cpp b/src/app/cli_main.cpp
index 7dc333d..03ce478 100644
--- a/src/app/cli_main.cpp
+++ b/src/app/cli_main.cpp
@@ -11,6 +11,8 @@
// xcloud-cli bench-decode <file.h264> [threads]
// decode speed of a dumped stream
// xcloud-cli ui-preview <dir> render the menus to PNGs with live data
+// xcloud-cli render-icon <out.png> [size]
+// the PS5 home-screen icon (icon0.png: 512)
// xcloud-cli logout
#include "app/library.h"
#include "auth/auth_manager.h"
@@ -20,6 +22,7 @@
#include "platform/platform.h"
#include "util/log.h"
#include "ui/app_ui.h"
+#include "ui/brand.h"
#include "ui/strings.h"
#include "xcloud/gssv.h"
@@ -49,6 +52,7 @@ int usage() {
" bench-decode <file.h264> [threads]\n"
" measure H.264 decode speed\n"
" ui-preview <dir> render every menu screen to <dir>/*.png\n"
+ " render-icon <out.png> [size] draw the app icon (512 for icon0.png)\n"
" logout forget the stored account\n");
return 2;
}
@@ -314,6 +318,22 @@ int main(int argc, char** argv) {
}
if (argi >= argc) return usage();
std::string cmd = argv[argi++];
+ if (cmd == "render-icon" && argi < argc) {
+ int size = argi + 1 < argc ? std::atoi(argv[argi + 1]) : 512;
+ ui::Fonts fonts;
+ if (!fonts.load("assets/fonts")) return 1;
+ ui::Canvas icon(size, size);
+ ui::drawAppIcon(icon, fonts);
+ // icon0.png is RGB: drop the alpha channel.
+ std::vector<uint8_t> rgb(static_cast<size_t>(size) * size * 3);
+ for (size_t i = 0; i < static_cast<size_t>(size) * size; ++i) {
+ uint32_t p = icon.data()[i];
+ rgb[i * 3] = p & 0xFF;
+ rgb[i * 3 + 1] = (p >> 8) & 0xFF;
+ rgb[i * 3 + 2] = (p >> 16) & 0xFF;
+ }
+ return stbi_write_png(argv[argi], size, size, 3, rgb.data(), size * 3) ? 0 : 1;
+ }
if (cmd == "bench-decode" && argi < argc)
return cmdBenchDecode(argv[argi], argi + 1 < argc ? std::atoi(argv[argi + 1]) : 1);
diff --git a/src/app/ps5_main.cpp b/src/app/ps5_main.cpp
index baa81a1..a5c2216 100644
--- a/src/app/ps5_main.cpp
+++ b/src/app/ps5_main.cpp
@@ -371,7 +371,7 @@ int main(int argc, char** argv) {
platform::init();
log::setFile((platform::dataDir() + "/xcloud.log").c_str());
- XC_LOGI("=== xCloud PS5 starting ===");
+ XC_LOGI("=== PSBox Cloud Gaming starting ===");
loadAutoplay();
sceSystemServiceHideSplashScreen();
diff --git a/src/ui/app_ui.cpp b/src/ui/app_ui.cpp
index 397c1a6..6d0f6a7 100644
--- a/src/ui/app_ui.cpp
+++ b/src/ui/app_ui.cpp
@@ -1,5 +1,6 @@
#include "ui/app_ui.h"
+#include "ui/brand.h"
#include "ui/strings.h"
#include "qrcodegen.h"
@@ -245,12 +246,7 @@ void AppUi::drawBackground(Canvas& c) {
c.gradientV({0, 0, kW, kH}, rgba(24, 28, 24), kBg);
}
-void AppUi::drawLogo(Canvas& c, float cx, float cy, float r) {
- c.fillCircle(cx, cy, r, kWhite);
- float k = r * 0.52f;
- c.line(cx - k, cy - k, cx + k, cy + k, r * 0.34f, kBg);
- c.line(cx + k, cy - k, cx - k, cy + k, r * 0.34f, kBg);
-}
+void AppUi::drawLogo(Canvas& c, float cx, float cy, float r) { drawBrandMark(c, cx, cy, r); }
void AppUi::drawTopBar(Canvas& c) {
drawLogo(c, kMargin + 22, 72, 22);
diff --git a/src/ui/brand.cpp b/src/ui/brand.cpp
new file mode 100644
index 0000000..f4b2a9d
--- /dev/null
+++ b/src/ui/brand.cpp
@@ -0,0 +1,61 @@
+#include "ui/brand.h"
+
+#include <cmath>
+#include <vector>
+
+namespace xc::ui {
+
+namespace {
+
+// A quadratic Bezier stroke stamped with discs: thin in the middle, wide at
+// both ends, like a brush swoosh.
+void swoosh(Canvas& c, float x0, float y0, float cx, float cy, float x1, float y1, float thin, float wide,
+ Color color) {
+ constexpr int kSteps = 160;
+ for (int i = 0; i <= kSteps; ++i) {
+ float t = static_cast<float>(i) / kSteps;
+ float u = 1 - t;
+ float x = u * u * x0 + 2 * u * t * cx + t * t * x1;
+ float y = u * u * y0 + 2 * u * t * cy + t * t * y1;
+ float edge = std::pow(std::fabs(2 * t - 1), 1.4f);
+ c.fillCircle(x, y, thin + (wide - thin) * edge, color);
+ }
+}
+
+} // namespace
+
+void drawBrandMark(Canvas& c, float cx, float cy, float r, Color color) {
+ // Render white-on-black into a scratch canvas, then use it as a coverage
+ // mask, so the cut-outs are transparent over any background.
+ int size = static_cast<int>(std::ceil(r * 2)) + 4;
+ Canvas m(size, size);
+ m.clear(rgba(0, 0, 0));
+ float mx = size / 2.0f, my = size / 2.0f;
+ m.fillCircle(mx, my, r, rgba(255, 255, 255));
+ // Two swooshes from beyond the sphere's upper corners to its lower ones,
+ // bowing upwards; they pinch where they cross.
+ constexpr float bow = 0.30f, endX = 0.75f;
+ float thin = r * 0.05f, wide = r * 0.20f;
+ Color cut = rgba(0, 0, 0);
+ swoosh(m, mx - r * 1.05f, my - r * 0.95f, mx + r * bow, my - r * bow, mx + r * endX, my + r * 1.05f, thin, wide,
+ cut);
+ swoosh(m, mx + r * 1.05f, my - r * 0.95f, mx - r * bow, my - r * bow, mx - r * endX, my + r * 1.05f, thin, wide,
+ cut);
+ std::vector<uint8_t> mask(static_cast<size_t>(size) * size);
+ for (size_t i = 0; i < mask.size(); ++i) mask[i] = static_cast<uint8_t>(m.data()[i] & 0xFF);
+ c.drawMask(mask.data(), size, size, size, static_cast<int>(std::lround(cx - mx)),
+ static_cast<int>(std::lround(cy - my)), color);
+}
+
+void drawAppIcon(Canvas& c, const Fonts& fonts) {
+ const int s = c.width();
+ // Xbox-green field, lighter at the top.
+ c.gradientV({0, 0, s, s}, rgba(36, 160, 36), rgba(8, 82, 8));
+ drawBrandMark(c, s * 0.5f, s * 0.40f, s * 0.27f);
+ const char* word = "PSBox";
+ int px = s / 7;
+ int w = fonts.bold.measure(word, px);
+ fonts.bold.draw(c, word, (s - w) / 2, static_cast<int>(s * 0.74f), px, rgba(255, 255, 255));
+}
+
+} // namespace xc::ui
diff --git a/src/ui/brand.h b/src/ui/brand.h
new file mode 100644
index 0000000..624dfae
--- /dev/null
+++ b/src/ui/brand.h
@@ -0,0 +1,21 @@
+// PSBox Cloud Gaming's mark: a white sphere crossed by two curved swooshes
+// that pinch at the centre, on Xbox green. Original artwork (not the Xbox
+// logo); drawn with the Canvas so the in-app logo and the PS5 home-screen
+// icon (ps5/sce_sys/icon0.png, see `xcloud-cli render-icon`) always match.
+#pragma once
+
+#include "ui/canvas.h"
+#include "ui/font.h"
+
+namespace xc::ui {
+
+constexpr Color kBrandGreen = rgba(16, 124, 16);
+
+// The sphere of radius `r` centred at (cx, cy), in `color`; the swooshes are
+// see-through (whatever is behind shows).
+void drawBrandMark(Canvas& c, float cx, float cy, float r, Color color = rgba(255, 255, 255));
+
+// The square app icon (green field, mark, "PSBox" wordmark).
+void drawAppIcon(Canvas& c, const Fonts& fonts);
+
+} // namespace xc::ui
diff --git a/src/ui/strings.cpp b/src/ui/strings.cpp
index 3f15025..e524383 100644
--- a/src/ui/strings.cpp
+++ b/src/ui/strings.cpp
@@ -9,8 +9,8 @@ namespace {
Language g_language = Language::English;
constexpr std::array<const char*, static_cast<size_t>(Str::Count)> kEnglish = {
- "Xbox Cloud Gaming", // AppName
- "CLOUD GAMING", // CloudGaming
+ "PSBox Cloud Gaming", // AppName
+ "PSBOX CLOUD GAMING", // CloudGaming
"Signing in...", // SigningIn
"Getting a sign-in code...", // RequestingCode
"Loading your games...", // LoadingGames