mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 05:38:49 +00:00
print git info in windows title
This commit is contained in:
17
src/common/scm_rev.cpp.in
Normal file
17
src/common/scm_rev.cpp.in
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/scm_rev.h"
|
||||
|
||||
#define GIT_REV "@GIT_REV@"
|
||||
#define GIT_BRANCH "@GIT_BRANCH@"
|
||||
#define GIT_DESC "@GIT_DESC@"
|
||||
|
||||
namespace Common {
|
||||
|
||||
const char g_scm_rev[] = GIT_REV;
|
||||
const char g_scm_branch[] = GIT_BRANCH;
|
||||
const char g_scm_desc[] = GIT_DESC;
|
||||
|
||||
} // namespace
|
||||
|
||||
12
src/common/scm_rev.h
Normal file
12
src/common/scm_rev.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Common {
|
||||
|
||||
extern const char g_scm_rev[];
|
||||
extern const char g_scm_branch[];
|
||||
extern const char g_scm_desc[];
|
||||
|
||||
} // namespace Common
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "core/memory.h"
|
||||
#include "emulator.h"
|
||||
#include "video_core/renderdoc.h"
|
||||
#include "src/common/scm_rev.h"
|
||||
|
||||
Frontend::WindowSDL* g_window = nullptr;
|
||||
|
||||
@@ -100,10 +101,11 @@ void Emulator::Run(const std::filesystem::path& file) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string game_title = fmt::format("{} - {} <{}>", id, title, app_version);
|
||||
|
||||
const std::string window_title = fmt::format("shadPS4 v{} {}| {}", Common::VERSION, Common::g_scm_desc,game_title);
|
||||
window =
|
||||
std::make_unique<Frontend::WindowSDL>(WindowWidth, WindowHeight, controller, game_title);
|
||||
std::make_unique<Frontend::WindowSDL>(WindowWidth, WindowHeight, controller, window_title);
|
||||
|
||||
g_window = window.get();
|
||||
|
||||
|
||||
@@ -20,16 +20,15 @@
|
||||
namespace Frontend {
|
||||
|
||||
WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_,
|
||||
std::string_view game_title)
|
||||
std::string_view window_title)
|
||||
: width{width_}, height{height_}, controller{controller_} {
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
UNREACHABLE_MSG("Failed to initialize SDL video subsystem: {}", SDL_GetError());
|
||||
}
|
||||
SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
|
||||
const std::string title = fmt::format("shadPS4 v{} | {}", Common::VERSION, game_title);
|
||||
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, std::string(window_title).c_str());
|
||||
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_WIDTH_NUMBER, width);
|
||||
|
||||
@@ -42,7 +42,7 @@ struct WindowSystemInfo {
|
||||
class WindowSDL {
|
||||
public:
|
||||
explicit WindowSDL(s32 width, s32 height, Input::GameController* controller,
|
||||
std::string_view game_title);
|
||||
std::string_view window_title);
|
||||
~WindowSDL();
|
||||
|
||||
s32 getWidth() const {
|
||||
|
||||
Reference in New Issue
Block a user