summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/apt/apt.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-05-24 23:19:26 +0200
committerbunnei <bunneidev@gmail.com>2016-05-24 23:19:26 +0200
commit2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8 (patch)
tree1ff05e9db556f8d90ddbbced8224c0287a5bf272 /src/core/hle/service/apt/apt.cpp
parentMerge pull request #1733 from lioncash/vert_loader (diff)
parentImplement CheckNew3DS and CheckNew3DSApp (diff)
downloadyuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar.gz
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar.bz2
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar.lz
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar.xz
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.tar.zst
yuzu-2e5e7d9be0b8caa8ba7ecfde66bde2ca1aac97c8.zip
Diffstat (limited to 'src/core/hle/service/apt/apt.cpp')
-rw-r--r--src/core/hle/service/apt/apt.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 73fce6079..bbf170b71 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -14,6 +14,7 @@
#include "core/hle/service/apt/apt_u.h"
#include "core/hle/service/apt/bcfnt/bcfnt.h"
#include "core/hle/service/fs/archive.h"
+#include "core/hle/service/ptm/ptm.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/mutex.h"
@@ -33,6 +34,9 @@ static Kernel::SharedPtr<Kernel::Event> parameter_event; ///< APT parameter even
static u32 cpu_percent; ///< CPU time available to the running application
+// APT::CheckNew3DSApp will check this unknown_ns_state_field to determine processing mode
+static u8 unknown_ns_state_field;
+
/// Parameter data to be returned in the next call to Glance/ReceiveParameter
static MessageParameter next_parameter;
@@ -258,6 +262,10 @@ void PrepareToStartApplication(Service::Interface* self) {
u32 title_info4 = cmd_buff[4];
u32 flags = cmd_buff[5];
+ if (flags & 0x00000100) {
+ unknown_ns_state_field = 1;
+ }
+
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_APT, "(STUBBED) called title_info1=0x%08X, title_info2=0x%08X, title_info3=0x%08X,"
@@ -373,6 +381,25 @@ void StartLibraryApplet(Service::Interface* self) {
cmd_buff[1] = applet->Start(parameter).raw;
}
+void SetNSStateField(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ unknown_ns_state_field = cmd_buff[1];
+
+ cmd_buff[0] = IPC::MakeHeader(0x55, 1, 0);
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ LOG_WARNING(Service_APT, "(STUBBED) unknown_ns_state_field=%u", unknown_ns_state_field);
+}
+
+void GetNSStateField(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ cmd_buff[0] = IPC::MakeHeader(0x56, 2, 0);
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[8] = unknown_ns_state_field;
+ LOG_WARNING(Service_APT, "(STUBBED) unknown_ns_state_field=%u", unknown_ns_state_field);
+}
+
void GetAppletInfo(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
auto app_id = static_cast<AppletId>(cmd_buff[1]);
@@ -408,6 +435,29 @@ void GetStartupArgument(Service::Interface* self) {
cmd_buff[2] = (parameter_size > 0) ? 1 : 0;
}
+void CheckNew3DSApp(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ if (unknown_ns_state_field) {
+ cmd_buff[1] = RESULT_SUCCESS.raw;
+ cmd_buff[2] = 0;
+ } else {
+ PTM::CheckNew3DS(self);
+ }
+
+ cmd_buff[0] = IPC::MakeHeader(0x101, 2, 0);
+ LOG_WARNING(Service_APT, "(STUBBED) called");
+}
+
+void CheckNew3DS(Service::Interface* self) {
+ u32* cmd_buff = Kernel::GetCommandBuffer();
+
+ PTM::CheckNew3DS(self);
+
+ cmd_buff[0] = IPC::MakeHeader(0x102, 2, 0);
+ LOG_WARNING(Service_APT, "(STUBBED) called");
+}
+
void Init() {
AddService(new APT_A_Interface);
AddService(new APT_S_Interface);
@@ -441,6 +491,7 @@ void Init() {
lock = Kernel::Mutex::Create(false, "APT_U:Lock");
cpu_percent = 0;
+ unknown_ns_state_field = 0;
// TODO(bunnei): Check if these are created in Initialize or on APT process startup.
notification_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Notification");