VERY experimental Nintendo Switch 2 emulator
C++
Added a bunch of services
purpasmart96539b4c883d66
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txtindex 947ccd7884..b1ebd942f1 100644--- a/src/core/CMakeLists.txt+++ b/src/core/CMakeLists.txt@@ -30,13 +30,21 @@ set(SRCShle/kernel/mutex.cpphle/kernel/shared_memory.cpphle/kernel/thread.cpp+ hle/service/ac_u.cpphle/service/apt_u.cpp+ hle/service/cfg_u.cpp+ hle/service/dsp_dsp.cpphle/service/fs_user.cpphle/service/gsp_gpu.cpphle/service/hid_user.cpp+ hle/service/mic_u.cpphle/service/ndm_u.cpp+ hle/service/nwm_uds.cpp+ hle/service/ptm_u.cpphle/service/service.cpp+ hle/service/soc_u.cpphle/service/srv.cpp+ hle/service/ssl_c.cpphle/config_mem.cpphle/hle.cpphle/svc.cpp@@ -91,13 +99,21 @@ set(HEADERShle/kernel/mutex.hhle/kernel/shared_memory.hhle/kernel/thread.h+ hle/service/ac_u.hhle/service/apt_u.h+ hle/service/cfg_u.h+ hle/service/dsp_dsp.hhle/service/fs_user.hhle/service/gsp_gpu.hhle/service/hid_user.h+ hle/service/mic_u.hhle/service/ndm_u.h+ hle/service/nwm_uds.h+ hle/service/ptm_u.hhle/service/service.h+ hle/service/soc_u.hhle/service/srv.h+ hle/service/ssl_c.hhle/config_mem.hhle/function_wrappers.hhle/hle.hdiff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cppnew file mode 100644index 0000000000..b39603bdfd--- /dev/null+++ b/src/core/hle/service/ac_u.cpp@@ -0,0 +1,44 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/ac_u.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace AC_U++namespace AC_U {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010000, nullptr, "CreateDefaultConfig"},+ {0x00040006, nullptr, "ConnectAsync"},+ {0x00050002, nullptr, "GetConnectResult"},+ {0x00080004, nullptr, "CloseAsync"},+ {0x00090002, nullptr, "GetCloseResult"},+ {0x000A0000, nullptr, "GetLastErrorCode"},+ {0x000D0000, nullptr, "GetWifiStatus"},+ {0x000E0042, nullptr, "GetCurrentAPInfo"},+ {0x00100042, nullptr, "GetCurrentNZoneInfo"},+ {0x00110042, nullptr, "GetNZoneApNumService"},+ {0x00240042, nullptr, "AddDenyApType "},+ {0x00270002, nullptr, "GetInfraPriority "},+ {0x002D0082, nullptr, "SetRequestEulaVersion"},+ {0x00300004, nullptr, "RegisterDisconnectEvent"},+ {0x003C0042, nullptr, "GetAPSSIDList"},+ {0x003E0042, nullptr, "IsConnected "},+ {0x00400042, nullptr, "SetClientVersion"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.hnew file mode 100644index 0000000000..3c5958d27d--- /dev/null+++ b/src/core/hle/service/ac_u.h@@ -0,0 +1,29 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace AC_U++// socket service "ac:u"++namespace AC_U {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "ac:u";+ }+};++} // namespacediff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg_u.cppnew file mode 100644index 0000000000..822b0e2b8a--- /dev/null+++ b/src/core/hle/service/cfg_u.cpp@@ -0,0 +1,36 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/cfg_u.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace CFG_U++namespace CFG_U {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010082, nullptr, "GetConfigInfoBlk2"},+ {0x00020000, nullptr, "SecureInfoGetRegion"},+ {0x00030000, nullptr, "GenHashConsoleUnique"},+ {0x00040000, nullptr, "GetRegionCanadaUSA"},+ {0x00050000, nullptr, "GetSystemModel"},+ {0x00060000, nullptr, "GetModelNintendo2DS"},+ {0x00070040, nullptr, "unknown"},+ {0x00080080, nullptr, "unknown"},+ {0x00090080, nullptr, "GetCountryCodeString"},+ {0x000A0040, nullptr, "GetCountryCodeID"},+};+////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/cfg_u.h b/src/core/hle/service/cfg_u.hnew file mode 100644index 0000000000..7525bd7c6e--- /dev/null+++ b/src/core/hle/service/cfg_u.h@@ -0,0 +1,27 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace CFG_U++namespace CFG_U {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "cfg:u";+ }+};++} // namespacediff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cppnew file mode 100644index 0000000000..9e84ac9381--- /dev/null+++ b/src/core/hle/service/dsp_dsp.cpp@@ -0,0 +1,52 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/dsp_dsp.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace DSP_DSP++namespace DSP_DSP {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010040, nullptr, "RecvData"},+ {0x00020040, nullptr, "RecvDataIsReady"},+ {0x00030080, nullptr, "SendData"},+ {0x00040040, nullptr, "SendDataIsEmpty"},+ {0x00070040, nullptr, "WriteReg0x10"},+ {0x00080000, nullptr, "GetSemaphore"},+ {0x00090040, nullptr, "ClearSemaphore"},+ {0x000B0000, nullptr, "CheckSemaphoreRequest"},+ {0x000C0040, nullptr, "ConvertProcessAddressFromDspDram"},+ {0x000D0082, nullptr, "WriteProcessPipe"},+ {0x001000C0, nullptr, "ReadPipeIfPossible"},+ {0x001100C2, nullptr, "LoadComponent"},+ {0x00120000, nullptr, "UnloadComponent"},+ {0x00130082, nullptr, "FlushDataCache"},+ {0x00140082, nullptr, "InvalidateDCache "},+ {0x00150082, nullptr, "RegisterInterruptEvents"},+ {0x00160000, nullptr, "GetSemaphoreEventHandle"},+ {0x00170040, nullptr, "SetSemaphoreMask"},+ {0x00180040, nullptr, "GetPhysicalAddress"},+ {0x00190040, nullptr, "GetVirtualAddress" },+ {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"},+ {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"},+ {0x001C0082, nullptr, "SetIirFilterEQ"},+ {0x001F0000, nullptr, "GetHeadphoneStatus"},+ {0x00210000, nullptr, "GetIsDspOccupied"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.hnew file mode 100644index 0000000000..c439ed266d--- /dev/null+++ b/src/core/hle/service/dsp_dsp.h@@ -0,0 +1,27 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace DSP_DSP++namespace DSP_DSP {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "dsp:DSP";+ }+};++} // namespacediff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cppnew file mode 100644index 0000000000..58051f1334--- /dev/null+++ b/src/core/hle/service/mic_u.cpp@@ -0,0 +1,43 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/mic_u.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace MIC_U++namespace MIC_U {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010042, nullptr, "MapSharedMem"},+ {0x00020000, nullptr, "UnmapSharedMem"},+ {0x00030140, nullptr, "Initialize"},+ {0x00040040, nullptr, "AdjustSampling"},+ {0x00050000, nullptr, "StopSampling"},+ {0x00060000, nullptr, "IsSampling"},+ {0x00070000, nullptr, "GetEventHandle"},+ {0x00080040, nullptr, "SetControl"},+ {0x00090000, nullptr, "GetControl"},+ {0x000A0040, nullptr, "SetBias"},+ {0x000B0000, nullptr, "GetBias"},+ {0x000C0042, nullptr, "size"},+ {0x000D0040, nullptr, "SetClamp"},+ {0x000E0000, nullptr, "GetClamp"},+ {0x000F0040, nullptr, "unknown_input1"},+ {0x00100040, nullptr, "unknown_input2"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/mic_u.h b/src/core/hle/service/mic_u.hnew file mode 100644index 0000000000..72ba048ef0--- /dev/null+++ b/src/core/hle/service/mic_u.h@@ -0,0 +1,29 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace MIC_U++// mic service++namespace MIC_U {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "mic:u";+ }+};++} // namespacediff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cppnew file mode 100644index 0000000000..14df86d858--- /dev/null+++ b/src/core/hle/service/nwm_uds.cpp@@ -0,0 +1,35 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/nwm_uds.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NWM_UDS++namespace NWM_UDS {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00030000, nullptr, "Shutdown"},+ {0x000F0404, nullptr, "RecvBeaconBroadcastData"},+ {0x00100042, nullptr, "SetBeaconAdditionalData"},+ {0x001400C0, nullptr, "RecvBroadcastDataFrame"},+ {0x001B0302, nullptr, "Initialize"},+ {0x001D0044, nullptr, "BeginHostingNetwork"},+ {0x001E0084, nullptr, "ConnectToNetwork"},+ {0x001F0006, nullptr, "DecryptBeaconData"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/nwm_uds.h b/src/core/hle/service/nwm_uds.hnew file mode 100644index 0000000000..a956ca8124--- /dev/null+++ b/src/core/hle/service/nwm_uds.h@@ -0,0 +1,29 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace NWM_UDS++// local-WLAN service++namespace NWM_UDS {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "nwm:UDS";+ }+};++} // namespacediff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cppnew file mode 100644index 0000000000..f6a14d509d--- /dev/null+++ b/src/core/hle/service/ptm_u.cpp@@ -0,0 +1,42 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/ptm_u.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace PTM_U++namespace PTM_U {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010002, nullptr, "RegisterAlarmClient"},+ {0x00020080, nullptr, "SetRtcAlarm"},+ {0x00030000, nullptr, "GetRtcAlarm"},+ {0x00040000, nullptr, "CancelRtcAlarm"},+ {0x00050000, nullptr, "GetAdapterState"},+ {0x00060000, nullptr, "GetShellState "},+ {0x00070000, nullptr, "GetBatteryLevel"},+ {0x00080000, nullptr, "GetBatteryChargeState"},+ {0x00090000, nullptr, "GetPedometerState"},+ {0x000A0042, nullptr, "GetStepHistoryEntry"},+ {0x000B00C2, nullptr, "GetStepHistory "},+ {0x000C0000, nullptr, "GetTotalStepCount "},+ {0x000D0040, nullptr, "SetPedometerRecordingMode"},+ {0x000E0000, nullptr, "GetPedometerRecordingMode"},+ {0x000F0084, nullptr, "GetStepHistoryAll"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/ptm_u.h b/src/core/hle/service/ptm_u.hnew file mode 100644index 0000000000..82749fa398--- /dev/null+++ b/src/core/hle/service/ptm_u.h@@ -0,0 +1,29 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace PTM_U++// ptm service++namespace PTM_U {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "ptm:u";+ }+};++} // namespacediff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex e9af6fdaad..ab1b37ff55 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -6,12 +6,20 @@#include "common/string_util.h"#include "core/hle/service/service.h"+#include "core/hle/service/ac_u.h"#include "core/hle/service/apt_u.h"+#include "core/hle/service/cfg_u.h"+#include "core/hle/service/dsp_dsp.h"#include "core/hle/service/fs_user.h"#include "core/hle/service/gsp_gpu.h"#include "core/hle/service/hid_user.h"+#include "core/hle/service/mic_u.h"#include "core/hle/service/ndm_u.h"+#include "core/hle/service/nwm_uds.h"+#include "core/hle/service/ptm_u.h"+#include "core/hle/service/soc_u.h"#include "core/hle/service/srv.h"+#include "core/hle/service/ssl_c.h"namespace Service {@@ -66,11 +74,19 @@ void Init() {g_manager = new Manager;g_manager->AddService(new SRV::Interface);+ g_manager->AddService(new AC_U::Interface);g_manager->AddService(new APT_U::Interface);+ g_manager->AddService(new CFG_U::Interface);+ g_manager->AddService(new DSP_DSP::Interface);g_manager->AddService(new FS_User::Interface);g_manager->AddService(new GSP_GPU::Interface);g_manager->AddService(new HID_User::Interface);+ g_manager->AddService(new MIC_U::Interface);g_manager->AddService(new NDM_U::Interface);+ g_manager->AddService(new NWM_UDS::Interface);+ g_manager->AddService(new PTM_U::Interface);+ g_manager->AddService(new SOC_U::Interface);+ g_manager->AddService(new SSL_C::Interface);NOTICE_LOG(HLE, "initialized OK");}diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cppnew file mode 100644index 0000000000..2f89104682--- /dev/null+++ b/src/core/hle/service/soc_u.cpp@@ -0,0 +1,58 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/soc_u.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace SOC_U++namespace SOC_U {++const Interface::FunctionInfo FunctionTable[] = {+ {0x00010044, nullptr, "InitializeSockets"},+ {0x000200C2, nullptr, "socket"},+ {0x00030082, nullptr, "listen"},+ {0x00040082, nullptr, "accept"},+ {0x00050084, nullptr, "bind"},+ {0x00060084, nullptr, "connect"},+ {0x00070104, nullptr, "recvfrom_other"},+ {0x00080102, nullptr, "recvfrom"},+ {0x00090106, nullptr, "sendto_other"},+ {0x000A0106, nullptr, "sendto"},+ {0x000B0042, nullptr, "close"},+ {0x000C0082, nullptr, "shutdown"},+ {0x000D0082, nullptr, "gethostbyname"},+ {0x000E00C2, nullptr, "gethostbyaddr"},+ {0x000F0106, nullptr, "unknown_resolve_ip"},+ {0x00110102, nullptr, "getsockopt"},+ {0x00120104, nullptr, "setsockopt"},+ {0x001300C2, nullptr, "fcntl"},+ {0x00140084, nullptr, "poll"},+ {0x00150042, nullptr, "sockatmark"},+ {0x00160000, nullptr, "gethostid"},+ {0x00170082, nullptr, "getsockname"},+ {0x00180082, nullptr, "getpeername"},+ {0x00190000, nullptr, "ShutdownSockets"},+ {0x001A00C0, nullptr, "GetNetworkOpt"},+ {0x001B0040, nullptr, "ICMPSocket"},+ {0x001C0104, nullptr, "ICMPPing"},+ {0x001D0040, nullptr, "ICMPCancel"},+ {0x001E0040, nullptr, "ICMPClose"},+ {0x001F0040, nullptr, "GetResolverInfo"},+ {0x00210002, nullptr, "CloseSockets"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.hnew file mode 100644index 0000000000..e27a2b1fe2--- /dev/null+++ b/src/core/hle/service/soc_u.h@@ -0,0 +1,27 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace SOC_U++namespace SOC_U {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "soc:U";+ }+};++} // namespacediff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cppnew file mode 100644index 0000000000..4aa660ecc5--- /dev/null+++ b/src/core/hle/service/ssl_c.cpp@@ -0,0 +1,31 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#include "common/log.h"+#include "core/hle/hle.h"+#include "core/hle/service/ssl_c.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace SSL_C++namespace SSL_C {++const Interface::FunctionInfo FunctionTable[] = {+ {0x000200C2, nullptr, "CreateContext"},+ {0x00050082, nullptr, "AddTrustedRootCA"},+ {0x00150082, nullptr, "Read"},+ {0x00170082, nullptr, "Write"},+};++////////////////////////////////////////////////////////////////////////////////////////////////////+// Interface class++Interface::Interface() {+ Register(FunctionTable, ARRAY_SIZE(FunctionTable));+}++Interface::~Interface() {+}++} // namespacediff --git a/src/core/hle/service/ssl_c.h b/src/core/hle/service/ssl_c.hnew file mode 100644index 0000000000..7b4e7fd8a8--- /dev/null+++ b/src/core/hle/service/ssl_c.h@@ -0,0 +1,27 @@+// Copyright 2014 Citra Emulator Project+// Licensed under GPLv2+// Refer to the license.txt file included.++#pragma once++#include "core/hle/service/service.h"++////////////////////////////////////////////////////////////////////////////////////////////////////+// Namespace SSL_C++namespace SSL_C {++class Interface : public Service::Interface {+public:+ Interface();+ ~Interface();+ /**+ * Gets the string port name used by CTROS for the service+ * @return Port name of service+ */+ std::string GetPortName() const {+ return "ssl:C";+ }+};++} // namespace