Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trophy manager improvements #11084

Merged
merged 3 commits into from Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions rpcs3/Emu/RSX/Overlays/overlay_trophy_notification.cpp
Expand Up @@ -71,6 +71,7 @@ namespace rsx
{
// First tick
creation_time = t;
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/trophy.wav");
return;
}

Expand Down Expand Up @@ -176,8 +177,6 @@ namespace rsx

visible = true;

Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/trophy.wav");

return CELL_OK;
}
} // namespace overlays
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Loader/TROPUSR.cpp
Expand Up @@ -204,12 +204,12 @@ bool TROPUSRLoader::Generate(const std::string& filepath, const std::string& con
return Save(filepath);
}

u32 TROPUSRLoader::GetTrophiesCount()
u32 TROPUSRLoader::GetTrophiesCount() const
{
return ::size32(m_table6);
}

u32 TROPUSRLoader::GetUnlockedTrophiesCount()
u32 TROPUSRLoader::GetUnlockedTrophiesCount() const
{
u32 count = 0;
for (const auto& trophy : m_table6)
Expand Down Expand Up @@ -296,7 +296,7 @@ u32 TROPUSRLoader::GetUnlockedPlatinumID(u32 trophy_id, const std::string& confi
return pid;
}

u32 TROPUSRLoader::GetTrophyGrade(u32 id)
u32 TROPUSRLoader::GetTrophyGrade(u32 id) const
{
if (id >= m_table4.size())
{
Expand All @@ -307,7 +307,7 @@ u32 TROPUSRLoader::GetTrophyGrade(u32 id)
return m_table4[id].trophy_grade; // Let's assume the trophies are stored ordered
}

u32 TROPUSRLoader::GetTrophyUnlockState(u32 id)
u32 TROPUSRLoader::GetTrophyUnlockState(u32 id) const
{
if (id >= m_table6.size())
{
Expand All @@ -318,7 +318,7 @@ u32 TROPUSRLoader::GetTrophyUnlockState(u32 id)
return m_table6[id].trophy_state; // Let's assume the trophies are stored ordered
}

u64 TROPUSRLoader::GetTrophyTimestamp(u32 id)
u64 TROPUSRLoader::GetTrophyTimestamp(u32 id) const
{
if (id >= m_table6.size())
{
Expand Down
10 changes: 5 additions & 5 deletions rpcs3/Loader/TROPUSR.h
Expand Up @@ -89,14 +89,14 @@ class TROPUSRLoader
virtual load_result Load(const std::string& filepath, const std::string& configpath);
virtual bool Save(const std::string& filepath);

virtual u32 GetTrophiesCount();
virtual u32 GetUnlockedTrophiesCount();
virtual u32 GetTrophiesCount() const;
virtual u32 GetUnlockedTrophiesCount() const;

virtual u32 GetUnlockedPlatinumID(u32 trophy_id, const std::string& config_path);

virtual u32 GetTrophyGrade(u32 id);
virtual u32 GetTrophyUnlockState(u32 id);
virtual u64 GetTrophyTimestamp(u32 id);
virtual u32 GetTrophyGrade(u32 id) const;
virtual u32 GetTrophyUnlockState(u32 id) const;
virtual u64 GetTrophyTimestamp(u32 id) const;

virtual bool UnlockTrophy(u32 id, u64 timestamp1, u64 timestamp2);
};
12 changes: 12 additions & 0 deletions rpcs3/rpcs3qt/screenshot_manager_dialog.cpp
@@ -1,3 +1,4 @@
#include "stdafx.h"
#include "screenshot_manager_dialog.h"
#include "screenshot_preview.h"
#include "qt_utils.h"
Expand All @@ -14,6 +15,8 @@
#include <QVBoxLayout>
#include <QtConcurrent>

LOG_CHANNEL(gui_log, "GUI");

screenshot_manager_dialog::screenshot_manager_dialog(QWidget* parent) : QDialog(parent)
{
setWindowTitle(tr("Screenshots"));
Expand All @@ -28,6 +31,9 @@ screenshot_manager_dialog::screenshot_manager_dialog(QWidget* parent) : QDialog(
m_grid->setIconSize(m_icon_size);
m_grid->setGridSize(m_icon_size + QSize(10, 10));

// Make sure the directory is mounted
vfs::mount("/dev_hdd0", rpcs3::utils::get_hdd0_dir());

const std::string screenshot_path_qt = fs::get_config_dir() + "screenshots/";
const std::string screenshot_path_cell = vfs::get("/dev_hdd0/photo/");
const QStringList filter{ QStringLiteral("*.png") };
Expand All @@ -38,6 +44,12 @@ screenshot_manager_dialog::screenshot_manager_dialog(QWidget* parent) : QDialog(

for (const std::string& path : { screenshot_path_qt, screenshot_path_cell })
{
if (path.empty())
{
gui_log.error("Screenshot manager: Trying to load screenshots from empty path!");
continue;
}

QDirIterator dir_iter(QString::fromStdString(path), filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);

while (dir_iter.hasNext())
Expand Down