Added game title, serial and version to sdl window.
This commit is contained in:
parent
a57ac0656b
commit
2f184cc171
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <vector>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
|
|
18
src/run.h
18
src/run.h
|
@ -36,14 +36,12 @@ public:
|
||||||
s32 width = Config::getScreenWidth();
|
s32 width = Config::getScreenWidth();
|
||||||
s32 height = Config::getScreenHeight();
|
s32 height = Config::getScreenHeight();
|
||||||
|
|
||||||
auto* controller = Common::Singleton<Input::GameController>::Instance();
|
|
||||||
Frontend::WindowSDL window{width, height, controller};
|
|
||||||
g_window = &window;
|
|
||||||
|
|
||||||
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
auto* mnt = Common::Singleton<Core::FileSys::MntPoints>::Instance();
|
||||||
std::filesystem::path p = std::string(ebootPath);
|
std::filesystem::path p = std::string(ebootPath);
|
||||||
mnt->Mount(p.parent_path(), "/app0");
|
mnt->Mount(p.parent_path(), "/app0");
|
||||||
|
std::string id;
|
||||||
|
std::string title;
|
||||||
|
std::string app_version;
|
||||||
// Loading param.sfo file if exists
|
// Loading param.sfo file if exists
|
||||||
std::filesystem::path sce_sys_folder = p.parent_path() / "sce_sys";
|
std::filesystem::path sce_sys_folder = p.parent_path() / "sce_sys";
|
||||||
if (std::filesystem::is_directory(sce_sys_folder)) {
|
if (std::filesystem::is_directory(sce_sys_folder)) {
|
||||||
|
@ -51,11 +49,11 @@ public:
|
||||||
if (entry.path().filename() == "param.sfo") {
|
if (entry.path().filename() == "param.sfo") {
|
||||||
auto* param_sfo = Common::Singleton<PSF>::Instance();
|
auto* param_sfo = Common::Singleton<PSF>::Instance();
|
||||||
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
|
param_sfo->open(sce_sys_folder.string() + "/param.sfo", {});
|
||||||
std::string id(param_sfo->GetString("CONTENT_ID"), 7, 9);
|
id = std::string(param_sfo->GetString("CONTENT_ID"), 7, 9);
|
||||||
std::string title(param_sfo->GetString("TITLE"));
|
title = param_sfo->GetString("TITLE");
|
||||||
LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
|
LOG_INFO(Loader, "Game id: {} Title: {}", id, title);
|
||||||
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");
|
u32 fw_version = param_sfo->GetInteger("SYSTEM_VER");
|
||||||
std::string app_version = param_sfo->GetString("APP_VER");
|
app_version = param_sfo->GetString("APP_VER");
|
||||||
LOG_INFO(Loader, "Fw: {:#x} App Version: {}", fw_version, app_version);
|
LOG_INFO(Loader, "Fw: {:#x} App Version: {}", fw_version, app_version);
|
||||||
} else if (entry.path().filename() == "pic0.png" ||
|
} else if (entry.path().filename() == "pic0.png" ||
|
||||||
entry.path().filename() == "pic1.png") {
|
entry.path().filename() == "pic1.png") {
|
||||||
|
@ -70,6 +68,10 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto* controller = Common::Singleton<Input::GameController>::Instance();
|
||||||
|
Frontend::WindowSDL window{width, height, controller, title, id, app_version};
|
||||||
|
g_window = &window;
|
||||||
|
|
||||||
auto linker = Common::Singleton<Core::Linker>::Instance();
|
auto linker = Common::Singleton<Core::Linker>::Instance();
|
||||||
Libraries::InitHLELibs(&linker->GetHLESymbols());
|
Libraries::InitHLELibs(&linker->GetHLESymbols());
|
||||||
linker->LoadModule(ebootPath);
|
linker->LoadModule(ebootPath);
|
||||||
|
|
|
@ -12,15 +12,19 @@
|
||||||
|
|
||||||
namespace Frontend {
|
namespace Frontend {
|
||||||
|
|
||||||
WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_)
|
WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_,
|
||||||
|
std::string_view game_title_, std::string_view game_serial_,
|
||||||
|
std::string_view game_appver_)
|
||||||
: width{width_}, height{height_}, controller{controller_} {
|
: width{width_}, height{height_}, controller{controller_} {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||||
UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError());
|
UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError());
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string title = "shadPS4 v" + std::string(Common::VERSION);
|
const std::string windowTitle = "shadPS4 v" + std::string(Common::VERSION) + " | " +
|
||||||
|
game_serial_.data() + " - " + game_title_.data() + " (v" +
|
||||||
|
game_appver_.data() + ")";
|
||||||
SDL_PropertiesID props = SDL_CreateProperties();
|
SDL_PropertiesID props = SDL_CreateProperties();
|
||||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, title.c_str());
|
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, windowTitle.c_str());
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_CENTERED);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_CENTERED);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, width);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, width);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
struct SDL_Window;
|
struct SDL_Window;
|
||||||
|
@ -39,7 +40,9 @@ struct WindowSystemInfo {
|
||||||
|
|
||||||
class WindowSDL {
|
class WindowSDL {
|
||||||
public:
|
public:
|
||||||
explicit WindowSDL(s32 width, s32 height, Input::GameController* controller);
|
explicit WindowSDL(s32 width, s32 height, Input::GameController* controller,
|
||||||
|
std::string_view game_title_, std::string_view game_serial_,
|
||||||
|
std::string_view game_appver_);
|
||||||
~WindowSDL();
|
~WindowSDL();
|
||||||
|
|
||||||
s32 getWidth() const {
|
s32 getWidth() const {
|
||||||
|
|
Loading…
Reference in New Issue