mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 00:13:08 +00:00
Some nits and fixes
This commit is contained in:
parent
e68774d449
commit
bd4e9f1803
@ -966,7 +966,7 @@ int PS4_SYSV_ABI sceNpTrophyUnlockTrophy(OrbisNpTrophyContext context, OrbisNpTr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doc.save_file((trophy_dir.string() + "/trophy00/Xml/TROP.XML").c_str());
|
doc.save_file((trophy_dir / "trophy00" / "Xml" / "TROP.XML").native().c_str());
|
||||||
|
|
||||||
return ORBIS_OK;
|
return ORBIS_OK;
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,13 @@ std::optional<TrophyUI> current_trophy_ui;
|
|||||||
std::queue<TrophyInfo> trophy_queue;
|
std::queue<TrophyInfo> trophy_queue;
|
||||||
std::mutex queueMtx;
|
std::mutex queueMtx;
|
||||||
|
|
||||||
TrophyUI::TrophyUI(std::filesystem::path trophyIconPath, std::string trophyName)
|
TrophyUI::TrophyUI(const std::filesystem::path& trophyIconPath, const std::string& trophyName)
|
||||||
: trophy_name(trophyName) {
|
: trophy_name(trophyName) {
|
||||||
if (std::filesystem::exists(trophyIconPath)) {
|
if (std::filesystem::exists(trophyIconPath)) {
|
||||||
trophy_icon = RefCountedTexture::DecodePngFile(trophyIconPath);
|
trophy_icon = RefCountedTexture::DecodePngFile(trophyIconPath);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR(Lib_NpTrophy, "Couldnt load trophy icon at {}", trophyIconPath.string());
|
LOG_ERROR(Lib_NpTrophy, "Couldnt load trophy icon at {}",
|
||||||
|
fmt::UTF(trophyIconPath.u8string()));
|
||||||
}
|
}
|
||||||
AddLayer(this);
|
AddLayer(this);
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ void TrophyUI::Draw() {
|
|||||||
|
|
||||||
trophy_timer -= io.DeltaTime;
|
trophy_timer -= io.DeltaTime;
|
||||||
if (trophy_timer <= 0) {
|
if (trophy_timer <= 0) {
|
||||||
queueMtx.lock();
|
std::lock_guard<std::mutex> lock(queueMtx);
|
||||||
if (!trophy_queue.empty()) {
|
if (!trophy_queue.empty()) {
|
||||||
TrophyInfo next_trophy = trophy_queue.front();
|
TrophyInfo next_trophy = trophy_queue.front();
|
||||||
trophy_queue.pop();
|
trophy_queue.pop();
|
||||||
@ -74,12 +75,11 @@ void TrophyUI::Draw() {
|
|||||||
} else {
|
} else {
|
||||||
current_trophy_ui.reset();
|
current_trophy_ui.reset();
|
||||||
}
|
}
|
||||||
queueMtx.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddTrophyToQueue(std::filesystem::path trophyIconPath, std::string trophyName) {
|
void AddTrophyToQueue(const std::filesystem::path& trophyIconPath, const std::string& trophyName) {
|
||||||
queueMtx.lock();
|
std::lock_guard<std::mutex> lock(queueMtx);
|
||||||
if (current_trophy_ui.has_value()) {
|
if (current_trophy_ui.has_value()) {
|
||||||
TrophyInfo new_trophy;
|
TrophyInfo new_trophy;
|
||||||
new_trophy.trophy_icon_path = trophyIconPath;
|
new_trophy.trophy_icon_path = trophyIconPath;
|
||||||
@ -88,7 +88,6 @@ void AddTrophyToQueue(std::filesystem::path trophyIconPath, std::string trophyNa
|
|||||||
} else {
|
} else {
|
||||||
current_trophy_ui.emplace(trophyIconPath, trophyName);
|
current_trophy_ui.emplace(trophyIconPath, trophyName);
|
||||||
}
|
}
|
||||||
queueMtx.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Libraries::NpTrophy
|
} // namespace Libraries::NpTrophy
|
@ -17,7 +17,7 @@ namespace Libraries::NpTrophy {
|
|||||||
|
|
||||||
class TrophyUI final : public ImGui::Layer {
|
class TrophyUI final : public ImGui::Layer {
|
||||||
public:
|
public:
|
||||||
TrophyUI(std::filesystem::path trophyIconPath, std::string trophyName);
|
TrophyUI(const std::filesystem::path& trophyIconPath, const std::string& trophyName);
|
||||||
~TrophyUI() override;
|
~TrophyUI() override;
|
||||||
|
|
||||||
void Finish();
|
void Finish();
|
||||||
@ -35,6 +35,6 @@ struct TrophyInfo {
|
|||||||
std::string trophy_name;
|
std::string trophy_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddTrophyToQueue(std::filesystem::path trophyIconPath, std::string trophyName);
|
void AddTrophyToQueue(const std::filesystem::path& trophyIconPath, const std::string& trophyName);
|
||||||
|
|
||||||
}; // namespace Libraries::NpTrophy
|
}; // namespace Libraries::NpTrophy
|
Loading…
Reference in New Issue
Block a user