From fd6549be73ed45c04eb7bd97036ed668edd1a49c Mon Sep 17 00:00:00 2001 From: David Marcec Date: Fri, 28 Jun 2019 15:19:51 +1000 Subject: Addressed issues --- src/core/hle/service/acc/acc.cpp | 27 ++++++++++----------------- src/core/hle/service/acc/errors.h | 2 ++ 2 files changed, 12 insertions(+), 17 deletions(-) (limited to 'src/core') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6aabe7409..c01ee3eda 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -237,45 +237,37 @@ void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestCo LOG_WARNING(Service_ACC, "(Partial implementation) called, process_id={}", pid); - const auto res = InitializeApplicationInfoBase(pid); - // TODO(ogniK): We require checking if the user actually owns the title and what not. As of - // currently, we assume the user owns the title. + // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called + // first then we do extra checks if the game is a digital copy. IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(res); + rb.Push(InitializeApplicationInfoBase(pid)); } ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) { if (application_info) { + LOG_ERROR(Service_ACC, "Application already initialized"); return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; } - Service::SM::ServiceManager& sm = system.ServiceManager(); - std::shared_ptr arp_r = sm.GetService("arp:r"); - if (arp_r == nullptr) { - LOG_ERROR(Service_ACC, "Failed to get arp:r service"); - application_info.application_type = ApplicationType::Unknown; - - return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); - } - const auto& list = system.Kernel().GetProcessList(); const auto iter = std::find_if(list.begin(), list.end(), [&process_id](const auto& process) { return process->GetProcessID() == process_id; }); if (iter == list.end()) { - // Failed to find process ID + LOG_ERROR(Service_ACC, "Failed to find process ID"); application_info.application_type = ApplicationType::Unknown; - return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); + return ERR_ACCOUNTINFO_BAD_APPLICATION; } const auto launch_property = system.GetARPManager().GetLaunchProperty((*iter)->GetTitleID()); if (launch_property.Failed()) { - return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); + LOG_ERROR(Service_ACC, "Failed to get launch property"); + return ERR_ACCOUNTINFO_BAD_APPLICATION; } switch (launch_property->base_game_storage_id) { @@ -288,7 +280,8 @@ ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) { application_info.application_type = ApplicationType::Digital; break; default: - return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); + LOG_ERROR(Service_ACC, "Invalid game storage ID"); + return ERR_ACCOUNTINFO_BAD_APPLICATION; } LOG_WARNING(Service_ACC, "ApplicationInfo init required"); diff --git a/src/core/hle/service/acc/errors.h b/src/core/hle/service/acc/errors.h index 86876dfd6..1f0577239 100644 --- a/src/core/hle/service/acc/errors.h +++ b/src/core/hle/service/acc/errors.h @@ -7,6 +7,8 @@ #include "core/hle/result.h" namespace Service::Account { + constexpr ResultCode ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22}; constexpr ResultCode ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41}; + } // namespace Service::Account -- cgit v1.2.3