mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-26 07:10:05 +00:00
Merge pull request #4243 from CrazyMax/display_version
AM: fix GetDisplayVersion
This commit is contained in:
commit
4e2464a713
@ -10,6 +10,7 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/file_sys/control_metadata.h"
|
#include "core/file_sys/control_metadata.h"
|
||||||
#include "core/file_sys/patch_manager.h"
|
#include "core/file_sys/patch_manager.h"
|
||||||
|
#include "core/file_sys/registered_cache.h"
|
||||||
#include "core/file_sys/savedata_factory.h"
|
#include "core/file_sys/savedata_factory.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/kernel/kernel.h"
|
#include "core/hle/kernel/kernel.h"
|
||||||
@ -1353,14 +1354,25 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
std::array<u8, 0x10> version_string{};
|
std::array<u8, 0x10> version_string{};
|
||||||
|
|
||||||
FileSys::PatchManager pm{system.CurrentProcess()->GetTitleID()};
|
const auto res = [this] {
|
||||||
const auto res = pm.GetControlMetadata();
|
const auto title_id = system.CurrentProcess()->GetTitleID();
|
||||||
|
|
||||||
|
FileSys::PatchManager pm{title_id};
|
||||||
|
auto res = pm.GetControlMetadata();
|
||||||
|
if (res.first != nullptr) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(title_id)};
|
||||||
|
return pm_update.GetControlMetadata();
|
||||||
|
}();
|
||||||
|
|
||||||
if (res.first != nullptr) {
|
if (res.first != nullptr) {
|
||||||
const auto& version = res.first->GetVersionString();
|
const auto& version = res.first->GetVersionString();
|
||||||
std::copy(version.begin(), version.end(), version_string.begin());
|
std::copy(version.begin(), version.end(), version_string.begin());
|
||||||
} else {
|
} else {
|
||||||
constexpr u128 default_version = {1, 0};
|
constexpr char default_version[]{"1.0.0"};
|
||||||
std::memcpy(version_string.data(), default_version.data(), sizeof(u128));
|
std::memcpy(version_string.data(), default_version, sizeof(default_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 6};
|
IPC::ResponseBuilder rb{ctx, 6};
|
||||||
|
Loading…
Reference in New Issue
Block a user