yuzu-emu
/
yuzu
Archived
1
0
Fork 0

acc: Fix InitializeApplicationInfo

We're not suppose to pop a u64, should just read the sent pid and check that
This commit is contained in:
David Marcec 2020-04-29 20:38:07 +10:00
parent 8e64fb3225
commit 1fbc341aba
2 changed files with 15 additions and 22 deletions

View File

@ -319,46 +319,37 @@ void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestCon
void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto pid = rp.Pop<u64>();
LOG_DEBUG(Service_ACC, "called, process_id={}", pid); LOG_DEBUG(Service_ACC, "called");
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(InitializeApplicationInfoBase(pid)); rb.Push(InitializeApplicationInfoBase());
} }
void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx) { void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
auto pid = rp.Pop<u64>();
LOG_WARNING(Service_ACC, "(Partial implementation) called, process_id={}", pid); LOG_WARNING(Service_ACC, "(Partial implementation) called");
// TODO(ogniK): We require checking if the user actually owns the title and what not. As of // 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. InitializeApplicationInfoBase SHOULD be called // 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. // first then we do extra checks if the game is a digital copy.
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(InitializeApplicationInfoBase(pid)); rb.Push(InitializeApplicationInfoBase());
} }
ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) { ResultCode Module::Interface::InitializeApplicationInfoBase() {
if (application_info) { if (application_info) {
LOG_ERROR(Service_ACC, "Application already initialized"); LOG_ERROR(Service_ACC, "Application already initialized");
return ERR_ACCOUNTINFO_ALREADY_INITIALIZED; return ERR_ACCOUNTINFO_ALREADY_INITIALIZED;
} }
const auto& list = system.Kernel().GetProcessList(); // TODO(ogniK): This should be changed to reflect the target process for when we have multiple
const auto iter = std::find_if(list.begin(), list.end(), [&process_id](const auto& process) { // processes emulated. As we don't actually have pid support we should assume we're just using
return process->GetProcessID() == process_id; // our own process
}); const auto& current_process = system.Kernel().CurrentProcess();
const auto launch_property =
if (iter == list.end()) { system.GetARPManager().GetLaunchProperty(current_process->GetTitleID());
LOG_ERROR(Service_ACC, "Failed to find process ID");
application_info.application_type = ApplicationType::Unknown;
return ERR_ACCOUNTINFO_BAD_APPLICATION;
}
const auto launch_property = system.GetARPManager().GetLaunchProperty((*iter)->GetTitleID());
if (launch_property.Failed()) { if (launch_property.Failed()) {
LOG_ERROR(Service_ACC, "Failed to get launch property"); LOG_ERROR(Service_ACC, "Failed to get launch property");
@ -372,10 +363,12 @@ ResultCode Module::Interface::InitializeApplicationInfoBase(u64 process_id) {
case FileSys::StorageId::Host: case FileSys::StorageId::Host:
case FileSys::StorageId::NandUser: case FileSys::StorageId::NandUser:
case FileSys::StorageId::SdCard: case FileSys::StorageId::SdCard:
case FileSys::StorageId::None: // Yuzu specific, differs from hardware
application_info.application_type = ApplicationType::Digital; application_info.application_type = ApplicationType::Digital;
break; break;
default: default:
LOG_ERROR(Service_ACC, "Invalid game storage ID"); LOG_ERROR(Service_ACC, "Invalid game storage ID! storage_id={}",
launch_property->base_game_storage_id);
return ERR_ACCOUNTINFO_BAD_APPLICATION; return ERR_ACCOUNTINFO_BAD_APPLICATION;
} }

View File

@ -35,7 +35,7 @@ public:
void GetProfileEditor(Kernel::HLERequestContext& ctx); void GetProfileEditor(Kernel::HLERequestContext& ctx);
private: private:
ResultCode InitializeApplicationInfoBase(u64 process_id); ResultCode InitializeApplicationInfoBase();
enum class ApplicationType : u32_le { enum class ApplicationType : u32_le {
GameCard = 0, GameCard = 0,