VERY experimental Nintendo Switch 2 emulator
C++
Services: Stubbed more services.
Subvc2e9990149fc
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 5578fa6809..3e1578969a 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -37,11 +37,14 @@ set(SRCShle/service/act_u.cpphle/service/am_app.cpphle/service/am_net.cpp+ hle/service/am_sys.cpphle/service/apt_a.cpphle/service/apt_s.cpphle/service/apt_u.cpp+ hle/service/boss_p.cpphle/service/boss_u.cpphle/service/cam_u.cpp+ hle/service/cecd_s.cpphle/service/cecd_u.cpphle/service/cfg/cfg.cpphle/service/cfg/cfg_i.cpp@@ -50,6 +53,7 @@ set(SRCShle/service/csnd_snd.cpphle/service/dsp_dsp.cpphle/service/err_f.cpp+ hle/service/frd_a.cpphle/service/frd_u.cpphle/service/fs/archive.cpphle/service/fs/fs_user.cpp@@ -57,14 +61,17 @@ set(SRCShle/service/hid/hid.cpphle/service/hid/hid_user.cpphle/service/hid/hid_spvr.cpp+ hle/service/gsp_lcd.cpphle/service/http_c.cpphle/service/ir_rst.cpphle/service/ir_u.cpphle/service/ldr_ro.cpphle/service/mic_u.cpphle/service/ndm_u.cpp+ hle/service/news_s.cpphle/service/news_u.cpphle/service/nim_aoc.cpp+ hle/service/ns_s.cpphle/service/nwm_uds.cpphle/service/pm_app.cpphle/service/ptm_play.cpp@@ -138,11 +145,14 @@ set(HEADERShle/service/act_u.hhle/service/am_app.hhle/service/am_net.h+ hle/service/am_sys.hhle/service/apt_a.hhle/service/apt_s.hhle/service/apt_u.h+ hle/service/boss_p.hhle/service/boss_u.hhle/service/cam_u.h+ hle/service/cecd_s.hhle/service/cecd_u.hhle/service/cfg/cfg.hhle/service/cfg/cfg_i.h@@ -151,6 +161,7 @@ set(HEADERShle/service/csnd_snd.hhle/service/dsp_dsp.hhle/service/err_f.h+ hle/service/frd_a.hhle/service/frd_u.hhle/service/fs/archive.hhle/service/fs/fs_user.h@@ -158,14 +169,17 @@ set(HEADERShle/service/hid/hid.hhle/service/hid/hid_spvr.hhle/service/hid/hid_user.h+ hle/service/gsp_lcd.hhle/service/http_c.hhle/service/ir_rst.hhle/service/ir_u.hhle/service/ldr_ro.hhle/service/mic_u.hhle/service/ndm_u.h+ hle/service/news_s.hhle/service/news_u.hhle/service/nim_aoc.h+ hle/service/ns_s.hhle/service/nwm_uds.hhle/service/pm_app.hhle/service/ptm_play.hdiff --git a/src/core/file_sys/archive_extsavedata.cpp b/src/core/file_sys/archive_extsavedata.cppindex 0805f42ae9..33e4e76f88 100644--- a/src/core/file_sys/archive_extsavedata.cpp+++ b/src/core/file_sys/archive_extsavedata.cpp@@ -17,7 +17,7 @@namespace FileSys {-static std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path) {+std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path) {std::vector<u8> vec_data = path.AsBinary();const u32* data = reinterpret_cast<const u32*>(vec_data.data());u32 save_low = data[1];@@ -25,7 +25,7 @@ static std::string GetExtSaveDataPath(const std::string& mount_point, const Pathreturn Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), save_high, save_low);}-static std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {+std::string GetExtDataContainerPath(const std::string& mount_point, bool shared) {if (shared)return Common::StringFromFormat("%sdata/%s/extdata/", mount_point.c_str(), SYSTEM_ID.c_str());diff --git a/src/core/file_sys/archive_extsavedata.h b/src/core/file_sys/archive_extsavedata.hindex fb7f209d2e..802a11b5fa 100644--- a/src/core/file_sys/archive_extsavedata.h+++ b/src/core/file_sys/archive_extsavedata.h@@ -42,4 +42,21 @@ protected:std::string concrete_mount_point;};+/**+ * Constructs a path to the concrete ExtData archive in the host filesystem based on the+ * input Path and base mount point.+ * @param mount_point The base mount point of the ExtSaveData archives.+ * @param path The path that identifies the requested concrete ExtSaveData archive.+ * @returns The complete path to the specified extdata archive in the host filesystem+ */+std::string GetExtSaveDataPath(const std::string& mount_point, const Path& path);++/**+ * Constructs a path to the base folder to hold concrete ExtSaveData archives in the host file system.+ * @param mount_point The base folder where this folder resides, ie. SDMC or NAND.+ * @param shared Whether this ExtSaveData container is for SharedExtSaveDatas or not.+ * @returns The path to the base ExtSaveData archives' folder in the host file system+ */+std::string GetExtDataContainerPath(const std::string& mount_point, bool shared);+} // namespace FileSysdiff --git a/src/core/hle/service/am_sys.cpp b/src/core/hle/service/am_sys.cppnew file mode 100644index 0000000000..b63c8c0879--- /dev/null+++ b/src/core/hle/service/am_sys.cpp@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/am_sys.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace AM_SYS++namespace AM_SYS {++// Empty arrays are illegal -- commented out until an entry is added.+//const Interface::FunctionInfo FunctionTable[] = { };++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ //Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/am_sys.h b/src/core/hle/service/am_sys.hnew file mode 100644index 0000000000..bb6178a43b--- /dev/null+++ b/src/core/hle/service/am_sys.h@@ -0,0 +1,23 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace AM_SYS++namespace AM_SYS {++class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "am:sys";+ }+};++} // namespacediff --git a/src/core/hle/service/boss_p.cpp b/src/core/hle/service/boss_p.cppnew file mode 100644index 0000000000..f245a38e99--- /dev/null+++ b/src/core/hle/service/boss_p.cpp@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/boss_p.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace BOSS_P++namespace BOSS_P {++// Empty arrays are illegal -- commented out until an entry is added.+// const Interface::FunctionInfo FunctionTable[] = { };++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ //Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/boss_p.h b/src/core/hle/service/boss_p.hnew file mode 100644index 0000000000..71f1e74640--- /dev/null+++ b/src/core/hle/service/boss_p.h@@ -0,0 +1,23 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace BOSS_P++namespace BOSS_P {++class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "boss:P";+ }+};++} // namespacediff --git a/src/core/hle/service/cecd_s.cpp b/src/core/hle/service/cecd_s.cppnew file mode 100644index 0000000000..9c4992f134--- /dev/null+++ b/src/core/hle/service/cecd_s.cpp@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/cecd_s.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace CECD_S++namespace CECD_S {++// Empty arrays are illegal -- commented out until an entry is added.+//const Interface::FunctionInfo FunctionTable[] = { };++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ //Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/cecd_s.h b/src/core/hle/service/cecd_s.hnew file mode 100644index 0000000000..d880d03910--- /dev/null+++ b/src/core/hle/service/cecd_s.h@@ -0,0 +1,23 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace CECD_S++namespace CECD_S {++class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "cecd:s";+ }+};++} // namespacediff --git a/src/core/hle/service/frd_a.cpp b/src/core/hle/service/frd_a.cppnew file mode 100644index 0000000000..53edc2cd8e--- /dev/null+++ b/src/core/hle/service/frd_a.cpp@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/frd_a.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace FRD_A++namespace FRD_A {++// Empty arrays are illegal -- commented out until an entry is added.+// const Interface::FunctionInfo FunctionTable[] = { };++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ //Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/frd_a.h b/src/core/hle/service/frd_a.hnew file mode 100644index 0000000000..f068c6108e--- /dev/null+++ b/src/core/hle/service/frd_a.h@@ -0,0 +1,23 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace FRD_A++namespace FRD_A {++class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "frd:a";+ }+};++} // namespacediff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cppindex 958dd9344f..1bb4e4b230 100644--- a/src/core/hle/service/fs/archive.cpp+++ b/src/core/hle/service/fs/archive.cpp@@ -432,6 +432,28 @@ ResultCode FormatSaveData() {return archive_itr->second->backend->Format(FileSys::Path());}+ResultCode CreateExtSaveData(u32 high, u32 low) {+ // Construct the binary path to the archive first+ std::vector<u8> binary_path;+ binary_path.reserve(12);+ // The first word is all zero to specify a NAND archive+ for (unsigned i = 0; i < 4; ++i)+ binary_path.push_back(0);+ // Next is the low word+ for (unsigned i = 0; i < 4; ++i)+ binary_path.push_back((low >> (8 * i)) & 0xFF);+ // Next is the high word+ for (unsigned i = 0; i < 4; ++i)+ binary_path.push_back((high >> i) & 0xFF);+ FileSys::Path path(binary_path);+ std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);+ std::string base_path = FileSys::GetExtDataContainerPath(nand_directory, true);+ std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path);+ if (!FileUtil::CreateFullPath(extsavedata_path))+ return ResultCode(-1); // TODO(Subv): Find the right error code+ return RESULT_SUCCESS;+}+/// Initialize archivesvoid ArchiveInit() {next_handle = 1;diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.hindex 2cdfaa7e9b..ba674d7f6e 100644--- a/src/core/hle/service/fs/archive.h+++ b/src/core/hle/service/fs/archive.h@@ -131,6 +131,14 @@ ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F*/ResultCode FormatSaveData();+/**+ * Creates a blank SharedExtSaveData archive for the specified extdata ID+ * @param high The high word of the extdata id to create+ * @param low The low word of the extdata id to create+ * @return ResultCode 0 on success or the corresponding code on error+ */+ResultCode CreateExtSaveData(u32 high, u32 low);+/// Initialize archivesvoid ArchiveInit();diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cppindex 56f3117f49..c495b6f3ce 100644--- a/src/core/hle/service/fs/fs_user.cpp+++ b/src/core/hle/service/fs/fs_user.cpp@@ -484,6 +484,15 @@ static void FormatThisUserSaveData(Service::Interface* self) {cmd_buff[1] = FormatSaveData().raw;}+static void CreateExtSaveData(Service::Interface* self) {+ // TODO(Subv): Figure out the other parameters.+ u32* cmd_buff = Kernel::GetCommandBuffer();+ u32 save_high = cmd_buff[1];+ u32 save_low = cmd_buff[2];+ // TODO(Subv): For now it is assumed that only SharedExtSaveData can be created like this+ cmd_buff[1] = CreateExtSaveData(save_high, save_low).raw;+}+const FSUserInterface::FunctionInfo FunctionTable[] = {{0x000100C6, nullptr, "Dummy1"},{0x040100C4, nullptr, "Control"},@@ -567,6 +576,8 @@ const FSUserInterface::FunctionInfo FunctionTable[] = {{0x084E0342, nullptr, "UpdateSha256Context"},{0x084F0102, nullptr, "ReadSpecialFile"},{0x08500040, nullptr, "GetSpecialFileSize"},+ {0x08510242, CreateExtSaveData, "CreateExtSaveData"},+ {0x08520100, nullptr, "DeleteExtSaveData"},{0x08580000, nullptr, "GetMovableSedHashedKeyYRandomData"},{0x08610042, nullptr, "InitializeWithSdkVersion"},{0x08620040, nullptr, "SetPriority"},diff --git a/src/core/hle/service/gsp_lcd.cpp b/src/core/hle/service/gsp_lcd.cppnew file mode 100644index 0000000000..6213472ffd--- /dev/null+++ b/src/core/hle/service/gsp_lcd.cpp@@ -0,0 +1,26 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.+++#include "common/log.h"+#include "common/bit_field.h"++#include "core/hle/service/gsp_lcd.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace GSP_LCD++namespace GSP_LCD {++/*const Interface::FunctionInfo FunctionTable[] = {+};*/++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ //Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/gsp_lcd.h b/src/core/hle/service/gsp_lcd.hnew file mode 100644index 0000000000..56b3cfe86b--- /dev/null+++ b/src/core/hle/service/gsp_lcd.h@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace GSP_LCD++namespace GSP_LCD {++/// Interface to "gsp::Lcd" service+class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "gsp::Lcd";+ }+};++} // namespacediff --git a/src/core/hle/service/hid_spvr.cpp b/src/core/hle/service/hid_spvr.cppnew file mode 100644index 0000000000..e14e93f4bd--- /dev/null+++ b/src/core/hle/service/hid_spvr.cpp@@ -0,0 +1,41 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"++#include "core/arm/arm_interface.h"+#include "core/hle/hle.h"+#include "core/hle/service/hid_user.h"+#include "core/hle/service/hid_spvr.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace HID_SPVR++namespace HID_User {+ extern void GetIPCHandles(Service::Interface* self);+}++namespace HID_SPVR {++const Interface::FunctionInfo FunctionTable[] = {+ {0x000A0000, HID_User::GetIPCHandles, "GetIPCHandles"},+ {0x000B0000, nullptr, "StartAnalogStickCalibration"},+ {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},+ {0x00110000, nullptr, "EnableAccelerometer"},+ {0x00120000, nullptr, "DisableAccelerometer"},+ {0x00130000, nullptr, "EnableGyroscopeLow"},+ {0x00140000, nullptr, "DisableGyroscopeLow"},+ {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},+ {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},+ {0x00170000, nullptr, "GetSoundVolume"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/hid_spvr.h b/src/core/hle/service/hid_spvr.hnew file mode 100644index 0000000000..be506358be--- /dev/null+++ b/src/core/hle/service/hid_spvr.h@@ -0,0 +1,29 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace HID_SPVR++// This service is used for interfacing to physical user controls.+// Uses include game pad controls, touchscreen, accelerometers, gyroscopes, and debug pad.++namespace HID_SPVR {++/**+ * HID service interface.+ */+class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "hid:SPVR";+ }+};++} // namespacediff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cppnew file mode 100644index 0000000000..1fa12ddc9c--- /dev/null+++ b/src/core/hle/service/hid_user.cpp@@ -0,0 +1,197 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"++#include "core/arm/arm_interface.h"+#include "core/hle/hle.h"+#include "core/hle/kernel/event.h"+#include "core/hle/kernel/shared_memory.h"+#include "hid_user.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace HID_User++namespace HID_User {++// Handle to shared memory region designated to HID_User service+static Handle shared_mem = 0;++// Event handles+static Handle event_pad_or_touch_1 = 0;+static Handle event_pad_or_touch_2 = 0;+static Handle event_accelerometer = 0;+static Handle event_gyroscope = 0;+static Handle event_debug_pad = 0;++// Next Pad state update information+static PadState next_state = {{0}};+static u32 next_index = 0;+static s16 next_circle_x = 0;+static s16 next_circle_y = 0;++/**+ * Gets a pointer to the PadData structure inside HID shared memory+ */+static inline PadData* GetPadData() {+ return reinterpret_cast<PadData*>(Kernel::GetSharedMemoryPointer(shared_mem, 0).ValueOr(nullptr));+}++/**+ * Circle Pad from keys.+ *+ * This is implemented as "pushed all the way to an edge (max) or centered (0)".+ *+ * Indicate the circle pad is pushed completely to the edge in 1 of 8 directions.+ */+static void UpdateNextCirclePadState() {+ static const s16 max_value = 0x9C;+ next_circle_x = next_state.circle_left ? -max_value : 0x0;+ next_circle_x += next_state.circle_right ? max_value : 0x0;+ next_circle_y = next_state.circle_down ? -max_value : 0x0;+ next_circle_y += next_state.circle_up ? max_value : 0x0;+}++/**+ * Sets a Pad state (button or button combo) as pressed+ */+void PadButtonPress(const PadState& pad_state) {+ next_state.hex |= pad_state.hex;+ UpdateNextCirclePadState();+}++/**+ * Sets a Pad state (button or button combo) as released+ */+void PadButtonRelease(const PadState& pad_state) {+ next_state.hex &= ~pad_state.hex;+ UpdateNextCirclePadState();+}++/**+ * Called after all Pad changes to be included in this update have been made,+ * including both Pad key changes and analog circle Pad changes.+ */+void PadUpdateComplete() {+ PadData* pad_data = GetPadData();++ if (pad_data == nullptr) {+ return;+ }++ // Update PadData struct+ pad_data->current_state.hex = next_state.hex;+ pad_data->index = next_index;+ next_index = (next_index + 1) % pad_data->entries.size();++ // Get the previous Pad state+ u32 last_entry_index = (pad_data->index - 1) % pad_data->entries.size();+ PadState old_state = pad_data->entries[last_entry_index].current_state;++ // Compute bitmask with 1s for bits different from the old state+ PadState changed;+ changed.hex = (next_state.hex ^ old_state.hex);++ // Compute what was added+ PadState additions;+ additions.hex = changed.hex & next_state.hex;++ // Compute what was removed+ PadState removals;+ removals.hex = changed.hex & old_state.hex;++ // Get the current Pad entry+ PadDataEntry* current_pad_entry = &pad_data->entries[pad_data->index];++ // Update entry properties+ current_pad_entry->current_state.hex = next_state.hex;+ current_pad_entry->delta_additions.hex = additions.hex;+ current_pad_entry->delta_removals.hex = removals.hex;++ // Set circle Pad+ current_pad_entry->circle_pad_x = next_circle_x;+ current_pad_entry->circle_pad_y = next_circle_y;++ // If we just updated index 0, provide a new timestamp+ if (pad_data->index == 0) {+ pad_data->index_reset_ticks_previous = pad_data->index_reset_ticks;+ pad_data->index_reset_ticks = (s64)Core::g_app_core->GetTicks();+ }++ // Signal both handles when there's an update to Pad or touch+ Kernel::SignalEvent(event_pad_or_touch_1);+ Kernel::SignalEvent(event_pad_or_touch_2);+}+++// TODO(peachum):+// Add a method for setting analog input from joystick device for the circle Pad.+//+// This method should:+// * Be called after both PadButton<Press, Release>().+// * Be called before PadUpdateComplete()+// * Set current PadEntry.circle_pad_<axis> using analog data+// * Set PadData.raw_circle_pad_data+// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_x >= 41+// * Set PadData.current_state.circle_up = 1 if current PadEntry.circle_pad_y >= 41+// * Set PadData.current_state.circle_left = 1 if current PadEntry.circle_pad_x <= -41+// * Set PadData.current_state.circle_right = 1 if current PadEntry.circle_pad_y <= -41+++/**+ * HID_User::GetIPCHandles service function+ * Inputs:+ * None+ * Outputs:+ * 1 : Result of function, 0 on success, otherwise error code+ * 2 : Unused+ * 3 : Handle to HID_User shared memory+ * 4 : Event signaled by HID_User+ * 5 : Event signaled by HID_User+ * 6 : Event signaled by HID_User+ * 7 : Gyroscope event+ * 8 : Event signaled by HID_User+ */+void GetIPCHandles(Service::Interface* self) {+ u32* cmd_buff = Kernel::GetCommandBuffer();++ cmd_buff[1] = 0; // No error+ cmd_buff[3] = shared_mem;+ cmd_buff[4] = event_pad_or_touch_1;+ cmd_buff[5] = event_pad_or_touch_2;+ cmd_buff[6] = event_accelerometer;+ cmd_buff[7] = event_gyroscope;+ cmd_buff[8] = event_debug_pad;+}++const Interface::FunctionInfo FunctionTable[] = {+ {0x000A0000, GetIPCHandles, "GetIPCHandles"},+ {0x000B0000, nullptr, "StartAnalogStickCalibration"},+ {0x000E0000, nullptr, "GetAnalogStickCalibrateParam"},+ {0x00110000, nullptr, "EnableAccelerometer"},+ {0x00120000, nullptr, "DisableAccelerometer"},+ {0x00130000, nullptr, "EnableGyroscopeLow"},+ {0x00140000, nullptr, "DisableGyroscopeLow"},+ {0x00150000, nullptr, "GetGyroscopeLowRawToDpsCoefficient"},+ {0x00160000, nullptr, "GetGyroscopeLowCalibrateParam"},+ {0x00170000, nullptr, "GetSoundVolume"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ shared_mem = Kernel::CreateSharedMemory("HID_User:SharedMem"); // Create shared memory object++ // Create event handles+ event_pad_or_touch_1 = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventPadOrTouch1");+ event_pad_or_touch_2 = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventPadOrTouch2");+ event_accelerometer = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventAccelerometer");+ event_gyroscope = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventGyroscope");+ event_debug_pad = Kernel::CreateEvent(RESETTYPE_ONESHOT, "HID_User:EventDebugPad");++ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/news_s.cpp b/src/core/hle/service/news_s.cppnew file mode 100644index 0000000000..1850f59bdd--- /dev/null+++ b/src/core/hle/service/news_s.cpp@@ -0,0 +1,25 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/news_s.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NEWS_S++namespace NEWS_S {++const Interface::FunctionInfo FunctionTable[] = {+ {0x000100C6, nullptr, "AddNotification"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/news_s.h b/src/core/hle/service/news_s.hnew file mode 100644index 0000000000..f8b4636d54--- /dev/null+++ b/src/core/hle/service/news_s.h@@ -0,0 +1,23 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NEWS_S++namespace NEWS_S {++class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "news:s";+ }+};++} // namespacediff --git a/src/core/hle/service/ns_s.cpp b/src/core/hle/service/ns_s.cppnew file mode 100644index 0000000000..b9aca42578--- /dev/null+++ b/src/core/hle/service/ns_s.cpp@@ -0,0 +1,27 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.+++#include "common/common.h"++#include "core/hle/hle.h"+#include "core/hle/service/ns_s.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NS_S++namespace NS_S {++const Interface::FunctionInfo FunctionTable[] = {+ {0x000200C0, nullptr, "LaunchTitle"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++} // namespacediff --git a/src/core/hle/service/ns_s.h b/src/core/hle/service/ns_s.hnew file mode 100644index 0000000000..8d8e849b82--- /dev/null+++ b/src/core/hle/service/ns_s.h@@ -0,0 +1,24 @@+// Copyright 2015 Citra Emulator Project+// Licensed under GPLv2 or any later version+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NS_S++namespace NS_S {++/// Interface to "NS:S" service+class Interface : public Service::Interface {+public:+ Interface();++ std::string GetPortName() const override {+ return "ns:s";+ }+};++} // namespacediff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex 444a4eab1b..355196fd33 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -10,12 +10,15 @@#include "core/hle/service/act_u.h"#include "core/hle/service/am_app.h"#include "core/hle/service/am_net.h"+#include "core/hle/service/am_sys.h"#include "core/hle/service/apt_a.h"#include "core/hle/service/apt_s.h"#include "core/hle/service/apt_u.h"+#include "core/hle/service/boss_p.h"#include "core/hle/service/boss_u.h"#include "core/hle/service/cam_u.h"#include "core/hle/service/cecd_u.h"+#include "core/hle/service/cecd_s.h"#include "core/hle/service/cfg/cfg_i.h"#include "core/hle/service/cfg/cfg_s.h"#include "core/hle/service/cfg/cfg_u.h"@@ -23,18 +26,22 @@#include "core/hle/service/dsp_dsp.h"#include "core/hle/service/err_f.h"#include "core/hle/service/fs/fs_user.h"+#include "core/hle/service/frd_a.h"#include "core/hle/service/frd_u.h"#include "core/hle/service/gsp_gpu.h"#include "core/hle/service/hid/hid_spvr.h"#include "core/hle/service/hid/hid_user.h"+#include "core/hle/service/gsp_lcd.h"#include "core/hle/service/http_c.h"#include "core/hle/service/ir_rst.h"#include "core/hle/service/ir_u.h"#include "core/hle/service/ldr_ro.h"#include "core/hle/service/mic_u.h"#include "core/hle/service/ndm_u.h"+#include "core/hle/service/news_s.h"#include "core/hle/service/news_u.h"#include "core/hle/service/nim_aoc.h"+#include "core/hle/service/ns_s.h"#include "core/hle/service/nwm_uds.h"#include "core/hle/service/pm_app.h"#include "core/hle/service/ptm_play.h"@@ -90,11 +97,14 @@ void Init() {g_manager->AddService(new ACT_U::Interface);g_manager->AddService(new AM_APP::Interface);g_manager->AddService(new AM_NET::Interface);+ g_manager->AddService(new AM_SYS::Interface);g_manager->AddService(new APT_A::Interface);g_manager->AddService(new APT_S::Interface);g_manager->AddService(new APT_U::Interface);+ g_manager->AddService(new BOSS_P::Interface);g_manager->AddService(new BOSS_U::Interface);g_manager->AddService(new CAM_U::Interface);+ g_manager->AddService(new CECD_S::Interface);g_manager->AddService(new CECD_U::Interface);g_manager->AddService(new CFG_I::Interface);g_manager->AddService(new CFG_S::Interface);@@ -102,19 +112,23 @@ void Init() {g_manager->AddService(new CSND_SND::Interface);g_manager->AddService(new DSP_DSP::Interface);g_manager->AddService(new ERR_F::Interface);+ g_manager->AddService(new FRD_A::Interface);g_manager->AddService(new FRD_U::Interface);g_manager->AddService(new FS::FSUserInterface);g_manager->AddService(new GSP_GPU::Interface);- g_manager->AddService(new HID_SPVR::Interface);+ g_manager->AddService(new GSP_LCD::Interface);g_manager->AddService(new HID_User::Interface);+ g_manager->AddService(new HID_SPVR::Interface);g_manager->AddService(new HTTP_C::Interface);g_manager->AddService(new IR_RST::Interface);g_manager->AddService(new IR_U::Interface);g_manager->AddService(new LDR_RO::Interface);g_manager->AddService(new MIC_U::Interface);g_manager->AddService(new NDM_U::Interface);+ g_manager->AddService(new NEWS_S::Interface);g_manager->AddService(new NEWS_U::Interface);g_manager->AddService(new NIM_AOC::Interface);+ g_manager->AddService(new NS_S::Interface);g_manager->AddService(new NWM_UDS::Interface);g_manager->AddService(new PM_APP::Interface);g_manager->AddService(new PTM_PLAY::Interface);