mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-10 14:07:25 +00:00
Merge remote-tracking branch 'origin/feat/qlaunch-ovl-fixes' into feat/qlaunch-ovl-fixes
This commit is contained in:
@@ -20,132 +20,96 @@ struct RomMetadata {
|
|||||||
std::vector<u8> icon;
|
std::vector<u8> icon;
|
||||||
bool isHomebrew;
|
bool isHomebrew;
|
||||||
};
|
};
|
||||||
|
static ankerl::unordered_dense::map<std::string, RomMetadata> m_rom_metadata_cache;
|
||||||
|
|
||||||
ankerl::unordered_dense::map<std::string, RomMetadata> m_rom_metadata_cache;
|
static RomMetadata CacheRomMetadata(const std::string& path) {
|
||||||
|
auto& instance = EmulationSession::GetInstance();
|
||||||
|
const auto file = Core::GetGameFileFromPath(instance.System().GetFilesystem(), path);
|
||||||
|
if (auto loader = Loader::GetLoader(instance.System(), file, 0, 0); loader) {
|
||||||
|
RomMetadata entry;
|
||||||
|
loader->ReadTitle(entry.title);
|
||||||
|
loader->ReadProgramId(entry.programId);
|
||||||
|
loader->ReadIcon(entry.icon);
|
||||||
|
|
||||||
RomMetadata CacheRomMetadata(const std::string& path) {
|
const FileSys::PatchManager pm{
|
||||||
const auto file =
|
entry.programId,
|
||||||
Core::GetGameFileFromPath(EmulationSession::GetInstance().System().GetFilesystem(), path);
|
instance.System().GetFileSystemController(),
|
||||||
auto loader = Loader::GetLoader(EmulationSession::GetInstance().System(), file, 0, 0);
|
instance.System().GetContentProvider()
|
||||||
|
};
|
||||||
|
const auto control = pm.GetControlMetadata();
|
||||||
|
|
||||||
RomMetadata entry;
|
if (control.first != nullptr) {
|
||||||
loader->ReadTitle(entry.title);
|
entry.developer = control.first->GetDeveloperName();
|
||||||
loader->ReadProgramId(entry.programId);
|
entry.version = control.first->GetVersionString();
|
||||||
loader->ReadIcon(entry.icon);
|
|
||||||
|
|
||||||
const FileSys::PatchManager pm{
|
|
||||||
entry.programId, EmulationSession::GetInstance().System().GetFileSystemController(),
|
|
||||||
EmulationSession::GetInstance().System().GetContentProvider()};
|
|
||||||
const auto control = pm.GetControlMetadata();
|
|
||||||
|
|
||||||
if (control.first != nullptr) {
|
|
||||||
entry.developer = control.first->GetDeveloperName();
|
|
||||||
entry.version = control.first->GetVersionString();
|
|
||||||
} else {
|
|
||||||
FileSys::NACP nacp;
|
|
||||||
if (loader->ReadControlData(nacp) == Loader::ResultStatus::Success) {
|
|
||||||
entry.developer = nacp.GetDeveloperName();
|
|
||||||
} else {
|
} else {
|
||||||
entry.developer = "";
|
FileSys::NACP nacp{};
|
||||||
|
entry.developer = loader->ReadControlData(nacp) == Loader::ResultStatus::Success
|
||||||
|
? nacp.GetDeveloperName()
|
||||||
|
: "";
|
||||||
|
entry.version = "1.0.0";
|
||||||
}
|
}
|
||||||
|
if (loader->GetFileType() == Loader::FileType::NRO) {
|
||||||
entry.version = "1.0.0";
|
auto loader_nro = reinterpret_cast<Loader::AppLoader_NRO*>(loader.get());
|
||||||
|
entry.isHomebrew = loader_nro->IsHomebrew();
|
||||||
|
} else {
|
||||||
|
entry.isHomebrew = false;
|
||||||
|
}
|
||||||
|
m_rom_metadata_cache[path] = entry;
|
||||||
|
return entry;
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
if (loader->GetFileType() == Loader::FileType::NRO) {
|
|
||||||
auto loader_nro = reinterpret_cast<Loader::AppLoader_NRO*>(loader.get());
|
|
||||||
entry.isHomebrew = loader_nro->IsHomebrew();
|
|
||||||
} else {
|
|
||||||
entry.isHomebrew = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_rom_metadata_cache[path] = entry;
|
|
||||||
|
|
||||||
return entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RomMetadata GetRomMetadata(const std::string& path, bool reload = false) {
|
static RomMetadata GetRomMetadata(const std::string& path, bool reload = false) {
|
||||||
if (reload) {
|
if (reload)
|
||||||
return CacheRomMetadata(path);
|
return CacheRomMetadata(path);
|
||||||
}
|
if (auto it = m_rom_metadata_cache.find(path); it != m_rom_metadata_cache.end())
|
||||||
|
return it->second;
|
||||||
if (auto search = m_rom_metadata_cache.find(path); search != m_rom_metadata_cache.end()) {
|
|
||||||
return search->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CacheRomMetadata(path);
|
return CacheRomMetadata(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsValid(JNIEnv* env, jobject obj,
|
jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsValid(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
if (auto const file = EmulationSession::GetInstance().System().GetFilesystem()->OpenFile(Common::Android::GetJString(env, jpath), FileSys::OpenMode::Read); file) {
|
||||||
const auto file = EmulationSession::GetInstance().System().GetFilesystem()->OpenFile(
|
if (auto loader = Loader::GetLoader(EmulationSession::GetInstance().System(), file); loader) {
|
||||||
Common::Android::GetJString(env, jpath), FileSys::OpenMode::Read);
|
auto const file_type = loader->GetFileType();
|
||||||
if (!file) {
|
if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error)
|
||||||
return false;
|
return false;
|
||||||
|
if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI) && !Loader::IsBootableGameContainer(file, file_type))
|
||||||
|
return false;
|
||||||
|
u64 program_id = 0;
|
||||||
|
return loader->ReadProgramId(program_id) == Loader::ResultStatus::Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
auto loader = Loader::GetLoader(EmulationSession::GetInstance().System(), file);
|
|
||||||
if (!loader) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto file_type = loader->GetFileType();
|
|
||||||
if (file_type == Loader::FileType::Unknown || file_type == Loader::FileType::Error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((file_type == Loader::FileType::NSP || file_type == Loader::FileType::XCI) &&
|
|
||||||
!Loader::IsBootableGameContainer(file, file_type)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 program_id = 0;
|
|
||||||
Loader::ResultStatus res = loader->ReadProgramId(program_id);
|
|
||||||
if (res != Loader::ResultStatus::Success) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getTitle(JNIEnv* env, jobject obj,
|
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getTitle(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
return Common::Android::ToJString(env, GetRomMetadata(Common::Android::GetJString(env, jpath)).title);
|
||||||
return Common::Android::ToJString(
|
|
||||||
env, GetRomMetadata(Common::Android::GetJString(env, jpath)).title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getProgramId(JNIEnv* env, jobject obj,
|
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getProgramId(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
return Common::Android::ToJString(env, std::to_string(GetRomMetadata(Common::Android::GetJString(env, jpath)).programId));
|
||||||
return Common::Android::ToJString(
|
|
||||||
env, std::to_string(GetRomMetadata(Common::Android::GetJString(env, jpath)).programId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getDeveloper(JNIEnv* env, jobject obj,
|
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getDeveloper(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
return Common::Android::ToJString(env, GetRomMetadata(Common::Android::GetJString(env, jpath)).developer);
|
||||||
return Common::Android::ToJString(
|
|
||||||
env, GetRomMetadata(Common::Android::GetJString(env, jpath)).developer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getVersion(JNIEnv* env, jobject obj,
|
jstring Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getVersion(JNIEnv* env, jobject obj, jstring jpath, jboolean jreload) {
|
||||||
jstring jpath, jboolean jreload) {
|
return Common::Android::ToJString(env, GetRomMetadata(Common::Android::GetJString(env, jpath), jreload).version);
|
||||||
return Common::Android::ToJString(
|
|
||||||
env, GetRomMetadata(Common::Android::GetJString(env, jpath), jreload).version);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jbyteArray Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIcon(JNIEnv* env, jobject obj,
|
jbyteArray Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIcon(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
|
||||||
auto icon_data = GetRomMetadata(Common::Android::GetJString(env, jpath)).icon;
|
auto icon_data = GetRomMetadata(Common::Android::GetJString(env, jpath)).icon;
|
||||||
jbyteArray icon = env->NewByteArray(static_cast<jsize>(icon_data.size()));
|
jbyteArray icon = env->NewByteArray(jsize(icon_data.size()));
|
||||||
env->SetByteArrayRegion(icon, 0, env->GetArrayLength(icon),
|
env->SetByteArrayRegion(icon, 0, env->GetArrayLength(icon), reinterpret_cast<jbyte*>(icon_data.data()));
|
||||||
reinterpret_cast<jbyte*>(icon_data.data()));
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsHomebrew(JNIEnv* env, jobject obj,
|
jboolean Java_org_yuzu_yuzu_1emu_utils_GameMetadata_getIsHomebrew(JNIEnv* env, jobject obj, jstring jpath) {
|
||||||
jstring jpath) {
|
return jboolean(GetRomMetadata(Common::Android::GetJString(env, jpath)).isHomebrew);
|
||||||
return static_cast<jboolean>(
|
|
||||||
GetRomMetadata(Common::Android::GetJString(env, jpath)).isHomebrew);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Java_org_yuzu_yuzu_1emu_utils_GameMetadata_resetMetadata(JNIEnv* env, jobject obj) {
|
void Java_org_yuzu_yuzu_1emu_utils_GameMetadata_resetMetadata(JNIEnv* env, jobject obj) {
|
||||||
|
|||||||
@@ -208,4 +208,12 @@ UUID UUID::MakeRandomRFC4122V4() {
|
|||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UUID UUID::MakeRFC4122V5(std::span<u8, 20> sha1) {
|
||||||
|
UUID uuid{};
|
||||||
|
std::memcpy(&uuid.uuid, sha1.data(), sizeof(UUID));
|
||||||
|
uuid.uuid[8] = 0x80 | (uuid.uuid[8] & 0x3F);
|
||||||
|
uuid.uuid[6] = 0x50 | (uuid.uuid[6] & 0xF);
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|||||||
+16
-20
@@ -1,3 +1,6 @@
|
|||||||
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
@@ -5,6 +8,7 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
@@ -86,28 +90,20 @@ struct UUID {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/// @brief Creates a random UUID.
|
||||||
* Creates a random UUID.
|
/// @returns A random UUID.
|
||||||
*
|
[[nodiscard]] static UUID MakeRandom();
|
||||||
* @returns A random UUID.
|
|
||||||
*/
|
|
||||||
static UUID MakeRandom();
|
|
||||||
|
|
||||||
/**
|
/// @brief Creates a random UUID with a seed.
|
||||||
* Creates a random UUID with a seed.
|
/// @param seed A seed to initialize the Mersenne-Twister RNG
|
||||||
*
|
/// @returns A random UUID.
|
||||||
* @param seed A seed to initialize the Mersenne-Twister RNG
|
[[nodiscard]] static UUID MakeRandomWithSeed(u32 seed);
|
||||||
*
|
|
||||||
* @returns A random UUID.
|
|
||||||
*/
|
|
||||||
static UUID MakeRandomWithSeed(u32 seed);
|
|
||||||
|
|
||||||
/**
|
/// @brief Creates a random UUID. The generated UUID is RFC 4122 Version 4 compliant.
|
||||||
* Creates a random UUID. The generated UUID is RFC 4122 Version 4 compliant.
|
/// @returns A random UUID that is RFC 4122 Version 4 compliant.
|
||||||
*
|
[[nodiscard]] static UUID MakeRandomRFC4122V4();
|
||||||
* @returns A random UUID that is RFC 4122 Version 4 compliant.
|
|
||||||
*/
|
[[nodiscard]] static UUID MakeRFC4122V5(std::span<u8, 20> sha1);
|
||||||
static UUID MakeRandomRFC4122V4();
|
|
||||||
|
|
||||||
friend constexpr bool operator==(const UUID& lhs, const UUID& rhs) = default;
|
friend constexpr bool operator==(const UUID& lhs, const UUID& rhs) = default;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -274,23 +274,22 @@ public:
|
|||||||
explicit NACP(VirtualFile file);
|
explicit NACP(VirtualFile file);
|
||||||
~NACP();
|
~NACP();
|
||||||
|
|
||||||
const LanguageEntry& GetLanguageEntry() const;
|
[[nodiscard]] const LanguageEntry& GetLanguageEntry() const;
|
||||||
std::string GetApplicationName() const;
|
[[nodiscard]] std::string GetApplicationName() const;
|
||||||
std::string GetDeveloperName() const;
|
[[nodiscard]] std::string GetDeveloperName() const;
|
||||||
u64 GetTitleId() const;
|
[[nodiscard]] u64 GetTitleId() const;
|
||||||
u64 GetDLCBaseTitleId() const;
|
[[nodiscard]] u64 GetDLCBaseTitleId() const;
|
||||||
std::string GetVersionString() const;
|
[[nodiscard]] std::string GetVersionString() const;
|
||||||
u64 GetDefaultNormalSaveSize() const;
|
[[nodiscard]] u64 GetDefaultNormalSaveSize() const;
|
||||||
u64 GetDefaultJournalSaveSize() const;
|
[[nodiscard]] u64 GetDefaultJournalSaveSize() const;
|
||||||
u32 GetSupportedLanguages() const;
|
[[nodiscard]] u32 GetSupportedLanguages() const;
|
||||||
std::vector<std::string> GetApplicationNames() const;
|
[[nodiscard]] std::vector<std::string> GetApplicationNames() const;
|
||||||
std::vector<u8> GetRawBytes() const;
|
[[nodiscard]] std::vector<u8> GetRawBytes() const;
|
||||||
bool GetUserAccountSwitchLock() const;
|
[[nodiscard]] bool GetUserAccountSwitchLock() const;
|
||||||
u64 GetDeviceSaveDataSize() const;
|
[[nodiscard]] u64 GetDeviceSaveDataSize() const;
|
||||||
u32 GetParentalControlFlag() const;
|
[[nodiscard]] u32 GetParentalControlFlag() const;
|
||||||
const std::array<u8, 0x20>& GetRatingAge() const;
|
[[nodiscard]] const std::array<u8, 0x20>& GetRatingAge() const;
|
||||||
|
|
||||||
private:
|
|
||||||
RawNACP raw{};
|
RawNACP raw{};
|
||||||
std::vector<LanguageEntry> language_entries;
|
std::vector<LanguageEntry> language_entries;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1156,4 +1156,14 @@ PatchManager::Metadata PatchManager::ParseControlNCA(const NCA& nca) const {
|
|||||||
|
|
||||||
return {std::move(nacp), icon_file};
|
return {std::move(nacp), icon_file};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] PatchManager::Metadata PatchManager::GetMetadataFromBaseOrUpdate(Core::System& system, u64 application_id) noexcept {
|
||||||
|
const FileSys::PatchManager pm{application_id, system.GetFileSystemController(), system.GetContentProvider()};
|
||||||
|
auto metadata = pm.GetControlMetadata();
|
||||||
|
if (metadata.first != nullptr)
|
||||||
|
return metadata;
|
||||||
|
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(application_id), system.GetFileSystemController(), system.GetContentProvider()};
|
||||||
|
return pm_update.GetControlMetadata();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FileSys
|
} // namespace FileSys
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ public:
|
|||||||
// Version of GetControlMetadata that takes an arbitrary NCA
|
// Version of GetControlMetadata that takes an arbitrary NCA
|
||||||
[[nodiscard]] Metadata ParseControlNCA(const NCA& nca) const;
|
[[nodiscard]] Metadata ParseControlNCA(const NCA& nca) const;
|
||||||
|
|
||||||
|
/// @brief Gets NACP metadata (accounting for any patches or updates)
|
||||||
|
[[nodiscard]] static PatchManager::Metadata GetMetadataFromBaseOrUpdate(Core::System& system, u64 application_id) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] std::vector<VirtualFile> CollectPatches(const std::vector<VirtualDir>& patch_dirs,
|
[[nodiscard]] std::vector<VirtualFile> CollectPatches(const std::vector<VirtualDir>& patch_dirs,
|
||||||
const std::string& build_id) const;
|
const std::string& build_id) const;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "common/uuid.h"
|
#include "common/uuid.h"
|
||||||
#include "core/file_sys/control_metadata.h"
|
#include "core/file_sys/control_metadata.h"
|
||||||
@@ -154,20 +156,7 @@ Result IApplicationFunctions::GetDesiredLanguage(Out<u64> out_language_code) {
|
|||||||
// Default to 0 (all languages supported)
|
// Default to 0 (all languages supported)
|
||||||
u32 supported_languages = 0;
|
u32 supported_languages = 0;
|
||||||
|
|
||||||
const auto res = [this] {
|
const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, m_applet->program_id);
|
||||||
const FileSys::PatchManager pm{m_applet->program_id, system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
auto metadata = pm.GetControlMetadata();
|
|
||||||
if (metadata.first != nullptr) {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(m_applet->program_id),
|
|
||||||
system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
return pm_update.GetControlMetadata();
|
|
||||||
}();
|
|
||||||
|
|
||||||
if (res.first != nullptr) {
|
if (res.first != nullptr) {
|
||||||
supported_languages = res.first->GetSupportedLanguages();
|
supported_languages = res.first->GetSupportedLanguages();
|
||||||
}
|
}
|
||||||
@@ -205,20 +194,7 @@ Result IApplicationFunctions::SetTerminateResult(Result terminate_result) {
|
|||||||
Result IApplicationFunctions::GetDisplayVersion(Out<DisplayVersion> out_display_version) {
|
Result IApplicationFunctions::GetDisplayVersion(Out<DisplayVersion> out_display_version) {
|
||||||
LOG_DEBUG(Service_AM, "called");
|
LOG_DEBUG(Service_AM, "called");
|
||||||
|
|
||||||
const auto res = [this] {
|
const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, m_applet->program_id);
|
||||||
const FileSys::PatchManager pm{m_applet->program_id, system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
auto metadata = pm.GetControlMetadata();
|
|
||||||
if (metadata.first != nullptr) {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(m_applet->program_id),
|
|
||||||
system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
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::memcpy(out_display_version->string.data(), version.data(),
|
std::memcpy(out_display_version->string.data(), version.data(),
|
||||||
@@ -347,8 +323,21 @@ Result IApplicationFunctions::NotifyRunning(Out<bool> out_became_running) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result IApplicationFunctions::GetPseudoDeviceId(Out<Common::UUID> out_pseudo_device_id) {
|
Result IApplicationFunctions::GetPseudoDeviceId(Out<Common::UUID> out_pseudo_device_id) {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_WARNING(Service_AM, "(stubbed)");
|
||||||
*out_pseudo_device_id = {};
|
|
||||||
|
// This should be hashed with the device specific hash
|
||||||
|
// for now this will do
|
||||||
|
const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, m_applet->program_id);
|
||||||
|
u8 hash[EVP_MAX_MD_SIZE];
|
||||||
|
unsigned int hash_len = 0;
|
||||||
|
auto const seed = res.first->raw.seed_for_pseudo_device_id;
|
||||||
|
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
||||||
|
auto const algorithm = EVP_sha1();
|
||||||
|
EVP_DigestInit_ex(ctx, algorithm, nullptr);
|
||||||
|
EVP_DigestUpdate(ctx, &seed, sizeof(seed));
|
||||||
|
EVP_DigestFinal_ex(ctx, hash, &hash_len);
|
||||||
|
EVP_MD_CTX_free(ctx);
|
||||||
|
*out_pseudo_device_id = Common::UUID::MakeRFC4122V5(std::span<u8, 20>{hash, std::size(hash)});
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -252,19 +252,7 @@ Result ILibraryAppletSelfAccessor::GetMainAppletApplicationDesiredLanguage(
|
|||||||
// Default to 0 (all languages supported)
|
// Default to 0 (all languages supported)
|
||||||
u32 supported_languages = 0;
|
u32 supported_languages = 0;
|
||||||
|
|
||||||
const auto res = [this, identity] {
|
const auto res = FileSys::PatchManager::GetMetadataFromBaseOrUpdate(system, identity.application_id);
|
||||||
const FileSys::PatchManager pm{identity.application_id, system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
auto metadata = pm.GetControlMetadata();
|
|
||||||
if (metadata.first != nullptr) {
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileSys::PatchManager pm_update{FileSys::GetUpdateTitleID(identity.application_id),
|
|
||||||
system.GetFileSystemController(),
|
|
||||||
system.GetContentProvider()};
|
|
||||||
return pm_update.GetControlMetadata();
|
|
||||||
}();
|
|
||||||
|
|
||||||
if (res.first != nullptr) {
|
if (res.first != nullptr) {
|
||||||
supported_languages = res.first->GetSupportedLanguages();
|
supported_languages = res.first->GetSupportedLanguages();
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ void EmulatedConsole::ReloadInput() {
|
|||||||
motion.gyro = emulated_motion.GetGyroscope();
|
motion.gyro = emulated_motion.GetGyroscope();
|
||||||
motion.rotation = emulated_motion.GetRotations();
|
motion.rotation = emulated_motion.GetRotations();
|
||||||
motion.orientation = emulated_motion.GetOrientation();
|
motion.orientation = emulated_motion.GetOrientation();
|
||||||
|
motion.quaternion = emulated_motion.GetQuaternion();
|
||||||
motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
|
motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity);
|
||||||
|
|
||||||
// Unique index for identifying touch device source
|
// Unique index for identifying touch device source
|
||||||
|
|||||||
Reference in New Issue
Block a user