summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/acc.cpp27
-rw-r--r--src/core/hle/service/acc/errors.h2
2 files changed, 12 insertions, 17 deletions
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
237 237
238 LOG_WARNING(Service_ACC, "(Partial implementation) called, process_id={}", pid); 238 LOG_WARNING(Service_ACC, "(Partial implementation) called, process_id={}", pid);
239 239
240 const auto res = InitializeApplicationInfoBase(pid);
241
242 // TODO(ogniK): We require checking if the user actually owns the title and what not. As of 240 // TODO(ogniK): We require checking if the user actually owns the title and what not. As of
243 // currently, we assume the user owns the title. 241 // currently, we assume the user owns the title. InitializeApplicationInfoBase SHOULD be called
242 // first then we do extra checks if the game is a digital copy.
244 243
245 IPC::ResponseBuilder rb{ctx, 2}; 244 IPC::ResponseBuilder rb{ctx, 2};
246 rb.Push(res); 245 rb.Push(InitializeApplicationInfoBase(pid));
247} 246}
248 247
249ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) { 248ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) {
250 if (application_info) { 249 if (application_info) {
250 LOG_ERROR(Service_ACC, "Application already initialized");
251 return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; 251 return ERR_ACCOUNTINFO_ALREADY_INITIALIZED;
252 } 252 }
253 253
254 Service::SM::ServiceManager& sm = system.ServiceManager();
255 std::shared_ptr<Service::Glue::ARP_R> arp_r = sm.GetService<Service::Glue::ARP_R>("arp:r");
256 if (arp_r == nullptr) {
257 LOG_ERROR(Service_ACC, "Failed to get arp:r service");
258 application_info.application_type = ApplicationType::Unknown;
259
260 return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION);
261 }
262
263 const auto& list = system.Kernel().GetProcessList(); 254 const auto& list = system.Kernel().GetProcessList();
264 const auto iter = std::find_if(list.begin(), list.end(), [&process_id](const auto& process) { 255 const auto iter = std::find_if(list.begin(), list.end(), [&process_id](const auto& process) {
265 return process->GetProcessID() == process_id; 256 return process->GetProcessID() == process_id;
266 }); 257 });
267 258
268 if (iter == list.end()) { 259 if (iter == list.end()) {
269 // Failed to find process ID 260 LOG_ERROR(Service_ACC, "Failed to find process ID");
270 application_info.application_type = ApplicationType::Unknown; 261 application_info.application_type = ApplicationType::Unknown;
271 262
272 return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); 263 return ERR_ACCOUNTINFO_BAD_APPLICATION;
273 } 264 }
274 265
275 const auto launch_property = system.GetARPManager().GetLaunchProperty((*iter)->GetTitleID()); 266 const auto launch_property = system.GetARPManager().GetLaunchProperty((*iter)->GetTitleID());
276 267
277 if (launch_property.Failed()) { 268 if (launch_property.Failed()) {
278 return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); 269 LOG_ERROR(Service_ACC, "Failed to get launch property");
270 return ERR_ACCOUNTINFO_BAD_APPLICATION;
279 } 271 }
280 272
281 switch (launch_property->base_game_storage_id) { 273 switch (launch_property->base_game_storage_id) {
@@ -288,7 +280,8 @@ ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) {
288 application_info.application_type = ApplicationType::Digital; 280 application_info.application_type = ApplicationType::Digital;
289 break; 281 break;
290 default: 282 default:
291 return ResultCode(ERR_ACCOUNTINFO_BAD_APPLICATION); 283 LOG_ERROR(Service_ACC, "Invalid game storage ID");
284 return ERR_ACCOUNTINFO_BAD_APPLICATION;
292 } 285 }
293 286
294 LOG_WARNING(Service_ACC, "ApplicationInfo init required"); 287 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 @@
7#include "core/hle/result.h" 7#include "core/hle/result.h"
8 8
9namespace Service::Account { 9namespace Service::Account {
10
10constexpr ResultCode ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22}; 11constexpr ResultCode ERR_ACCOUNTINFO_BAD_APPLICATION{ErrorModule::Account, 22};
11constexpr ResultCode ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41}; 12constexpr ResultCode ERR_ACCOUNTINFO_ALREADY_INITIALIZED{ErrorModule::Account, 41};
13
12} // namespace Service::Account 14} // namespace Service::Account