aoc_u: Obey disabled add-ons list when listing DLC

This commit is contained in:
Zach Hilman 2018-11-28 14:01:29 -05:00
parent 0cea05cdf7
commit 51483d83bb

View File

@ -20,6 +20,7 @@
#include "core/hle/service/aoc/aoc_u.h" #include "core/hle/service/aoc/aoc_u.h"
#include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/settings.h"
namespace Service::AOC { namespace Service::AOC {
@ -76,6 +77,13 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) {
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID(); const auto current = Core::System::GetInstance().CurrentProcess()->GetTitleID();
const auto& disabled = Settings::values.disabled_addons[current];
if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) {
rb.Push<u32>(0);
return;
}
rb.Push<u32>(static_cast<u32>( rb.Push<u32>(static_cast<u32>(
std::count_if(add_on_content.begin(), add_on_content.end(), std::count_if(add_on_content.begin(), add_on_content.end(),
[current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); }))); [current](u64 tid) { return CheckAOCTitleIDMatchesBase(tid, current); })));
@ -96,6 +104,10 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) {
out.push_back(static_cast<u32>(add_on_content[i] & 0x7FF)); out.push_back(static_cast<u32>(add_on_content[i] & 0x7FF));
} }
const auto& disabled = Settings::values.disabled_addons[current];
if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end())
out = {};
if (out.size() < offset) { if (out.size() < offset) {
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
// TODO(DarkLordZach): Find the correct error code. // TODO(DarkLordZach): Find the correct error code.