mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
Adding top button option for trophy pop up
This commit is contained in:
parent
99c7fc4049
commit
ba556cb404
@ -53,6 +53,7 @@ static bool isShaderDebug = false;
|
||||
static bool isShowSplash = false;
|
||||
static bool isAutoUpdate = false;
|
||||
static bool isAlwaysShowChangelog = false;
|
||||
static bool isTopSideTrophy = false;
|
||||
static bool isLeftSideTrophy = false;
|
||||
static bool isNullGpu = false;
|
||||
static bool shouldCopyGPUBuffers = false;
|
||||
@ -270,6 +271,10 @@ bool alwaysShowChangelog() {
|
||||
return isAlwaysShowChangelog;
|
||||
}
|
||||
|
||||
bool TopSideTrophy() {
|
||||
return isTopSideTrophy;
|
||||
}
|
||||
|
||||
bool leftSideTrophy() {
|
||||
return isLeftSideTrophy;
|
||||
}
|
||||
@ -381,6 +386,9 @@ void setAutoUpdate(bool enable) {
|
||||
void setAlwaysShowChangelog(bool enable) {
|
||||
isAlwaysShowChangelog = enable;
|
||||
}
|
||||
void setTopSideTrophy(bool enable) {
|
||||
isTopSideTrophy = enable;
|
||||
}
|
||||
void setLeftSideTrophy(bool enable) {
|
||||
isLeftSideTrophy = enable;
|
||||
}
|
||||
@ -737,6 +745,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);
|
||||
isTopSideTrophy = toml::find_or<bool>(general, "TopSideTrophy", false);
|
||||
isLeftSideTrophy = toml::find_or<bool>(general, "leftSideTrophy", false);
|
||||
separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false);
|
||||
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", false);
|
||||
@ -888,6 +897,7 @@ void save(const std::filesystem::path& path) {
|
||||
data["General"]["showSplash"] = isShowSplash;
|
||||
data["General"]["autoUpdate"] = isAutoUpdate;
|
||||
data["General"]["alwaysShowChangelog"] = isAlwaysShowChangelog;
|
||||
data["General"]["TopSideTrophy"] = isTopSideTrophy;
|
||||
data["General"]["leftSideTrophy"] = isLeftSideTrophy;
|
||||
data["General"]["separateUpdateEnabled"] = separateupdatefolder;
|
||||
data["General"]["compatibilityEnabled"] = compatibilityData;
|
||||
@ -1018,6 +1028,7 @@ void setDefaultValues() {
|
||||
isShowSplash = false;
|
||||
isAutoUpdate = false;
|
||||
isAlwaysShowChangelog = false;
|
||||
isTopSideTrophy = false;
|
||||
isLeftSideTrophy = false;
|
||||
isNullGpu = false;
|
||||
shouldDumpShaders = false;
|
||||
|
@ -63,6 +63,7 @@ bool collectShadersForDebug();
|
||||
bool showSplash();
|
||||
bool autoUpdate();
|
||||
bool alwaysShowChangelog();
|
||||
bool TopSideTrophy();
|
||||
bool leftSideTrophy();
|
||||
bool nullGpu();
|
||||
bool copyGPUCmdBuffers();
|
||||
@ -77,6 +78,7 @@ void setCollectShaderForDebug(bool enable);
|
||||
void setShowSplash(bool enable);
|
||||
void setAutoUpdate(bool enable);
|
||||
void setAlwaysShowChangelog(bool enable);
|
||||
void setTopSideTrophy(bool enable);
|
||||
void setLeftSideTrophy(bool enable);
|
||||
void setNullGpu(bool enable);
|
||||
void setAllowHDR(bool enable);
|
||||
|
@ -27,6 +27,7 @@ namespace Libraries::NpTrophy {
|
||||
std::optional<TrophyUI> current_trophy_ui;
|
||||
std::queue<TrophyInfo> trophy_queue;
|
||||
std::mutex queueMtx;
|
||||
bool isTopSide;
|
||||
bool isLeftSide;
|
||||
double trophy_timer;
|
||||
|
||||
@ -34,6 +35,7 @@ TrophyUI::TrophyUI(const std::filesystem::path& trophyIconPath, const std::strin
|
||||
const std::string_view& rarity)
|
||||
: trophy_name(trophyName), trophy_type(rarity) {
|
||||
|
||||
isTopSide = Config::TopSideTrophy();
|
||||
isLeftSide = Config::leftSideTrophy();
|
||||
trophy_timer = Config::getTrophyNotificationDuration();
|
||||
|
||||
@ -115,8 +117,8 @@ float fade_out_duration = 0.5f; // Final fade duration
|
||||
void TrophyUI::Draw() {
|
||||
const auto& io = GetIO();
|
||||
|
||||
float AdjustWidth = io.DisplaySize.x / 1280;
|
||||
float AdjustHeight = io.DisplaySize.y / 720;
|
||||
float AdjustWidth = io.DisplaySize.x / 1920;
|
||||
float AdjustHeight = io.DisplaySize.y / 1080;
|
||||
const ImVec2 window_size{
|
||||
std::min(io.DisplaySize.x, (350 * AdjustWidth)),
|
||||
std::min(io.DisplaySize.y, (70 * AdjustHeight)),
|
||||
@ -125,21 +127,33 @@ void TrophyUI::Draw() {
|
||||
elapsed_time += io.DeltaTime;
|
||||
float progress = std::min(elapsed_time / animation_duration, 1.0f);
|
||||
|
||||
// left or right position
|
||||
float final_pos_x;
|
||||
if (isLeftSide) {
|
||||
start_pos.x = -window_size.x;
|
||||
float final_pos_x, start_x;
|
||||
float final_pos_y, start_y;
|
||||
|
||||
if (isTopSide) {
|
||||
start_x = (io.DisplaySize.x - window_size.x) * 0.5f;
|
||||
start_y = -window_size.y;
|
||||
final_pos_x = start_x;
|
||||
final_pos_y = 50 * AdjustHeight;
|
||||
} else if (isLeftSide) {
|
||||
start_x = -window_size.x;
|
||||
start_y = 50 * AdjustHeight;
|
||||
final_pos_x = 20 * AdjustWidth;
|
||||
final_pos_y = start_y;
|
||||
} else {
|
||||
start_pos.x = io.DisplaySize.x;
|
||||
start_x = io.DisplaySize.x;
|
||||
start_y = 50 * AdjustHeight;
|
||||
final_pos_x = io.DisplaySize.x - window_size.x - 20 * AdjustWidth;
|
||||
final_pos_y = start_y;
|
||||
}
|
||||
|
||||
ImVec2 current_pos = ImVec2(start_pos.x + (final_pos_x - start_pos.x) * progress,
|
||||
start_pos.y + (target_pos.y - start_pos.y) * progress);
|
||||
ImVec2 current_pos = ImVec2(start_x + (final_pos_x - start_x) * progress,
|
||||
start_y + (final_pos_y - start_y) * progress);
|
||||
|
||||
trophy_timer -= io.DeltaTime;
|
||||
|
||||
ImGui::SetNextWindowPos(current_pos);
|
||||
|
||||
// If the remaining time of the trophy is less than or equal to 1 second, the fade-out begins.
|
||||
if (trophy_timer <= 1.0f) {
|
||||
float fade_out_time = 1.0f - (trophy_timer / 1.0f);
|
||||
|
@ -418,8 +418,9 @@ void SettingsDialog::LoadValuesFromConfig() {
|
||||
ui->disableTrophycheckBox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "isTrophyPopupDisabled", false));
|
||||
ui->popUpDurationSpinBox->setValue(Config::getTrophyNotificationDuration());
|
||||
ui->radioButton_Top->setChecked(Config::TopSideTrophy());
|
||||
ui->radioButton_Left->setChecked(Config::leftSideTrophy());
|
||||
ui->radioButton_Right->setChecked(!ui->radioButton_Left->isChecked());
|
||||
ui->radioButton_Right->setChecked(!(ui->radioButton_Left->isChecked() || ui->radioButton_Top->isChecked()));
|
||||
ui->BGMVolumeSlider->setValue(toml::find_or<int>(data, "General", "BGMvolume", 50));
|
||||
ui->discordRPCCheckbox->setChecked(
|
||||
toml::find_or<bool>(data, "General", "enableDiscordRPC", true));
|
||||
@ -706,6 +707,7 @@ void SettingsDialog::UpdateSettings() {
|
||||
Config::setIsMotionControlsEnabled(ui->motionControlsCheckBox->isChecked());
|
||||
Config::setisTrophyPopupDisabled(ui->disableTrophycheckBox->isChecked());
|
||||
Config::setTrophyNotificationDuration(ui->popUpDurationSpinBox->value());
|
||||
Config::setTopSideTrophy(ui->radioButton_Top->isChecked());
|
||||
Config::setLeftSideTrophy(ui->radioButton_Left->isChecked());
|
||||
Config::setPlayBGM(ui->playBGMCheckBox->isChecked());
|
||||
Config::setAllowHDR(ui->enableHDRCheckBox->isChecked());
|
||||
|
@ -1285,7 +1285,13 @@
|
||||
<string>Trophy Notification Position</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Top">
|
||||
<property name="text">
|
||||
<string>Top</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_Left">
|
||||
<property name="text">
|
||||
|
Loading…
Reference in New Issue
Block a user