Adding Top and Bottom trophy option for pop window + Trophy improvements (#2566)

* Adding top button option for trophy pop up

* Ui fix

* Clang format

* improvements to trophy pr 

* improvements

* Note: The sound will only work in QT versions

* -.

* Update path_util.cpp

* Update path_util.cpp

* centered text when using top and bottom option

* Clang

* trophy viewer now opens in window not fullscreen

---------

Co-authored-by: DanielSvoboda <daniel.svoboda@hotmail.com>
This commit is contained in:
Dmugetsu 2025-03-02 13:36:12 -06:00 committed by GitHub
parent f4110c43a7
commit d59536a71c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 158 additions and 36 deletions

View file

@ -53,7 +53,7 @@ static bool isShaderDebug = false;
static bool isShowSplash = false;
static bool isAutoUpdate = false;
static bool isAlwaysShowChangelog = false;
static bool isLeftSideTrophy = false;
static std::string isSideTrophy = "right";
static bool isNullGpu = false;
static bool shouldCopyGPUBuffers = false;
static bool shouldDumpShaders = false;
@ -270,8 +270,8 @@ bool alwaysShowChangelog() {
return isAlwaysShowChangelog;
}
bool leftSideTrophy() {
return isLeftSideTrophy;
std::string sideTrophy() {
return isSideTrophy;
}
bool nullGpu() {
@ -381,8 +381,9 @@ void setAutoUpdate(bool enable) {
void setAlwaysShowChangelog(bool enable) {
isAlwaysShowChangelog = enable;
}
void setLeftSideTrophy(bool enable) {
isLeftSideTrophy = enable;
void setSideTrophy(std::string side) {
isSideTrophy = side;
}
void setNullGpu(bool enable) {
@ -737,7 +738,7 @@ void load(const std::filesystem::path& path) {
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false);
isAlwaysShowChangelog = toml::find_or<bool>(general, "alwaysShowChangelog", false);
isLeftSideTrophy = toml::find_or<bool>(general, "leftSideTrophy", false);
isSideTrophy = toml::find_or<std::string>(general, "sideTrophy", "right");
separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false);
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", false);
checkCompatibilityOnStartup =
@ -888,7 +889,7 @@ void save(const std::filesystem::path& path) {
data["General"]["showSplash"] = isShowSplash;
data["General"]["autoUpdate"] = isAutoUpdate;
data["General"]["alwaysShowChangelog"] = isAlwaysShowChangelog;
data["General"]["leftSideTrophy"] = isLeftSideTrophy;
data["General"]["sideTrophy"] = isSideTrophy;
data["General"]["separateUpdateEnabled"] = separateupdatefolder;
data["General"]["compatibilityEnabled"] = compatibilityData;
data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup;
@ -1018,7 +1019,7 @@ void setDefaultValues() {
isShowSplash = false;
isAutoUpdate = false;
isAlwaysShowChangelog = false;
isLeftSideTrophy = false;
isSideTrophy = "right";
isNullGpu = false;
shouldDumpShaders = false;
vblankDivider = 1;

View file

@ -63,7 +63,7 @@ bool collectShadersForDebug();
bool showSplash();
bool autoUpdate();
bool alwaysShowChangelog();
bool leftSideTrophy();
std::string sideTrophy();
bool nullGpu();
bool copyGPUCmdBuffers();
bool dumpShaders();
@ -77,7 +77,7 @@ void setCollectShaderForDebug(bool enable);
void setShowSplash(bool enable);
void setAutoUpdate(bool enable);
void setAlwaysShowChangelog(bool enable);
void setLeftSideTrophy(bool enable);
void setSideTrophy(std::string side);
void setNullGpu(bool enable);
void setAllowHDR(bool enable);
void setCopyGPUCmdBuffers(bool enable);

View file

@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <fstream>
#include <unordered_map>
#include "common/logging/log.h"
#include "common/path_util.h"
@ -130,6 +131,21 @@ static auto UserPaths = [] {
create_path(PathType::MetaDataDir, user_dir / METADATA_DIR);
create_path(PathType::CustomTrophy, user_dir / CUSTOM_TROPHY);
std::ofstream notice_file(user_dir / CUSTOM_TROPHY / "Notice.txt");
if (notice_file.is_open()) {
notice_file
<< "++++++++++++++++++++++++++++++++\n+ Custom Trophy Images / Sound "
"+\n++++++++++++++++++++++++++++++++\n\nYou can add custom images to the "
"trophies.\n*We recommend a square resolution image, for example 200x200, 500x500, "
"the same size as the height and width.\nIn this folder ('user\\custom_trophy'), "
"add the files with the following "
"names:\n\nbronze.png\nsilver.png\ngold.png\nplatinum.png\n\nYou can add a custom "
"sound for trophy notifications.\n*By default, no audio is played unless it is in "
"this folder and you are using the QT version.\nIn this folder "
"('user\\custom_trophy'), add the files with the following names:\n\ntrophy.mp3";
notice_file.close();
}
return paths;
}();
@ -223,4 +239,4 @@ std::filesystem::path PathFromQString(const QString& path) {
}
#endif
} // namespace Common::FS
} // namespace Common::FS