2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #1494 from DarkLordZach/aoc-signature-fixes

aoc: Fix various bugs in current AOC implementation
This commit is contained in:
bunnei 2018-10-15 18:34:02 -04:00 committed by GitHub
commit 9b21fbd1eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View file

@ -56,6 +56,10 @@ u64 NACP::GetTitleId() const {
return raw->title_id; return raw->title_id;
} }
u64 NACP::GetDLCBaseTitleId() const {
return raw->dlc_base_title_id;
}
std::string NACP::GetVersionString() const { std::string NACP::GetVersionString() const {
return Common::StringFromFixedZeroTerminatedBuffer(raw->version_string.data(), 0x10); return Common::StringFromFixedZeroTerminatedBuffer(raw->version_string.data(), 0x10);
} }

View file

@ -79,6 +79,7 @@ public:
std::string GetApplicationName(Language language = Language::Default) const; std::string GetApplicationName(Language language = Language::Default) const;
std::string GetDeveloperName(Language language = Language::Default) const; std::string GetDeveloperName(Language language = Language::Default) const;
u64 GetTitleId() const; u64 GetTitleId() const;
u64 GetDLCBaseTitleId() const;
std::string GetVersionString() const; std::string GetVersionString() const;
private: private:

View file

@ -7,8 +7,10 @@
#include <vector> #include <vector>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/file_sys/content_archive.h" #include "core/file_sys/content_archive.h"
#include "core/file_sys/control_metadata.h"
#include "core/file_sys/nca_metadata.h" #include "core/file_sys/nca_metadata.h"
#include "core/file_sys/partition_filesystem.h" #include "core/file_sys/partition_filesystem.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/hle/ipc_helpers.h" #include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
@ -19,7 +21,7 @@
namespace Service::AOC { namespace Service::AOC {
constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000; constexpr u64 DLC_BASE_TITLE_ID_MASK = 0xFFFFFFFFFFFFE000;
constexpr u64 DLC_BASE_TO_AOC_ID_MASK = 0x1000; constexpr u64 DLC_BASE_TO_AOC_ID = 0x1000;
static bool CheckAOCTitleIDMatchesBase(u64 base, u64 aoc) { static bool CheckAOCTitleIDMatchesBase(u64 base, u64 aoc) {
return (aoc & DLC_BASE_TITLE_ID_MASK) == base; return (aoc & DLC_BASE_TITLE_ID_MASK) == base;
@ -97,14 +99,24 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
ctx.WriteBuffer(out); ctx.WriteBuffer(out);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(count);
} }
void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) {
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push(Core::System::GetInstance().CurrentProcess()->GetTitleID() | DLC_BASE_TO_AOC_ID_MASK); const auto title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
FileSys::PatchManager pm{title_id};
const auto res = pm.GetControlMetadata();
if (res.first == nullptr) {
rb.Push(title_id + DLC_BASE_TO_AOC_ID);
return;
}
rb.Push(res.first->GetDLCBaseTitleId());
} }
void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) { void AOC_U::PrepareAddOnContent(Kernel::HLERequestContext& ctx) {