From 90fc6dabf7ca0b2b8346d1d8f809f58e263ed0b5 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 8 Feb 2017 14:31:23 -0600 Subject: [PATCH] Implemented/stubbed PrepareToCloseApplication I implemented/stubbed this function in hopes of fixing the crash to desktop issue that homebrew causes when it tries to exit back to the homemenu --- src/core/hle/service/apt/apt.cpp | 6 +++++- src/core/hle/service/apt/apt.h | 11 ++++++++++- src/core/hle/service/apt/apt_u.cpp | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 615fe31ea..bd0c49018 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -395,7 +395,11 @@ void StartLibraryApplet(Service::Interface* self) { cmd_buff[1] = applet->Start(parameter).raw; } - +void PrepareToCloseApplication(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + cmd_buff[1] = RESULT_SUCCESS.raw; + LOG_WARNING(Service_APT, "(STUBBED) called"); +} void CancelLibraryApplet(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); u32 exiting = cmd_buff[1] & 0xFF; diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h index 80325361f..9ad1dcdb8 100644 --- a/src/core/hle/service/apt/apt.h +++ b/src/core/hle/service/apt/apt.h @@ -321,7 +321,16 @@ void PrepareToStartApplication(Service::Interface* self); * 1 : Result of function, 0 on success, otherwise error code */ void StartApplication(Service::Interface* self); - +/** + * APT::PrepareToCloseApplication service function + * Inputs: + * 0 : Command header [0x00180040] + * 1 : u8, Cancel Preload (0 = don't cancel, 1 = cancel) + * Outputs: + * 0 : Return header + * 1 : Result of function, 0 on success, otherwise error code + */ +void PrepareToCloseApplication(Service::Interface* self); /** * APT::AppletUtility service function * Inputs: diff --git a/src/core/hle/service/apt/apt_u.cpp b/src/core/hle/service/apt/apt_u.cpp index e06084a1e..79b41ad5f 100644 --- a/src/core/hle/service/apt/apt_u.cpp +++ b/src/core/hle/service/apt/apt_u.cpp @@ -42,7 +42,7 @@ const Interface::FunctionInfo FunctionTable[] = { {0x001F0084, nullptr, "StartSystemApplet"}, {0x00200044, nullptr, "StartNewestHomeMenu"}, {0x00210000, nullptr, "OrderToCloseApplication"}, - {0x00220040, nullptr, "PrepareToCloseApplication"}, + {0x00220040, PrepareToCloseApplication, "PrepareToCloseApplication"}, {0x00230040, nullptr, "PrepareToJumpToApplication"}, {0x00240044, nullptr, "JumpToApplication"}, {0x002500C0, nullptr, "PrepareToCloseLibraryApplet"},