VERY experimental Nintendo Switch 2 emulator
C++
[core/hle] implement Unknown330 and stub extra 20/15 missing funcs (#3269)
lizzie4cacf56cecb5
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cppindex bdae3a012c..d2070b0b74 100644--- a/src/core/hle/service/acc/acc.cpp+++ b/src/core/hle/service/acc/acc.cpp@@ -100,6 +100,7 @@ public:{133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+{134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+{135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0++ {136, nullptr, "GetNintendoAccountUserResourceCache"}, // 19.0.0+{140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+{141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+{142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cppindex e70ed2cccd..ab548fdead 100644--- a/src/core/hle/service/am/service/application_functions.cpp+++ b/src/core/hle/service/am/service/application_functions.cpp@@ -90,10 +90,10 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_{200, nullptr, "GetLastApplicationExitReason"},{210, D<&IApplicationFunctions::GetUnknownEvent210>, "Unknown210"},{220, nullptr, "Unknown220"}, // [20.0.0+]- {300, nullptr, "Unknown300"}, // [20.0.0+]+ {300, nullptr, "CreateMovieWriter"}, // [19.0.0+]{310, nullptr, "Unknown310"}, // [20.0.0+]{320, nullptr, "Unknown320"}, // [20.0.0+]- {330, nullptr, "Unknown330"}, // [20.0.0+]+ {330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+]{500, nullptr, "StartContinuousRecordingFlushForDebug"},{1000, nullptr, "CreateMovieMaker"},{1001, D<&IApplicationFunctions::PrepareForJit>, "PrepareForJit"},@@ -503,6 +503,12 @@ Result IApplicationFunctions::GetUnknownEvent210(R_SUCCEED();}+Result IApplicationFunctions::Unknown330(Out<u8> out) {+ LOG_DEBUG(Service_AM, "called");+ *out = 0;+ R_SUCCEED();+}+Result IApplicationFunctions::PrepareForJit() {LOG_WARNING(Service_AM, "(STUBBED) called");diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.hindex 35b3e9505d..459f71496c 100644--- a/src/core/hle/service/am/service/application_functions.h+++ b/src/core/hle/service/am/service/application_functions.h@@ -80,6 +80,7 @@ private:Result GetNotificationStorageChannelEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);Result GetHealthWarningDisappearedSystemEvent(OutCopyHandle<Kernel::KReadableEvent> out_event);Result GetUnknownEvent210(OutCopyHandle<Kernel::KReadableEvent> out_event);+ Result Unknown330(Out<u8> out);Result PrepareForJit();const std::shared_ptr<Applet> m_applet;diff --git a/src/core/hle/service/am/service/common_state_getter.cpp b/src/core/hle/service/am/service/common_state_getter.cppindex dcd42a2447..0af5b31714 100644--- a/src/core/hle/service/am/service/common_state_getter.cpp+++ b/src/core/hle/service/am/service/common_state_getter.cpp@@ -36,19 +36,20 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap{11, D<&ICommonStateGetter::ReleaseSleepLock>, "ReleaseSleepLock"},{12, D<&ICommonStateGetter::ReleaseSleepLockTransiently>, "ReleaseSleepLockTransiently"},{13, D<&ICommonStateGetter::GetAcquiredSleepLockEvent>, "GetAcquiredSleepLockEvent"},- {14, nullptr, "GetWakeupCount"},+ {14, nullptr, "GetWakeupCount"}, //11.0.0++ {15, nullptr, "Unknown15"}, //19.0.0+{20, D<&ICommonStateGetter::PushToGeneralChannel>, "PushToGeneralChannel"},{30, nullptr, "GetHomeButtonReaderLockAccessor"},- {31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"},- {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"},- {40, nullptr, "GetCradleFwVersion"},- {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"},- {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"},- {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"},- {53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"},- {54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"},- {55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"},- {59, nullptr, "SetVrPositionForDebug"},+ {31, D<&ICommonStateGetter::GetReaderLockAccessorEx>, "GetReaderLockAccessorEx"}, //2.0.0++ {32, D<&ICommonStateGetter::GetWriterLockAccessorEx>, "GetWriterLockAccessorEx"}, //7.0.0++ {40, nullptr, "GetCradleFwVersion"}, //2.0.0++ {50, D<&ICommonStateGetter::IsVrModeEnabled>, "IsVrModeEnabled"}, //3.0.0++ {51, D<&ICommonStateGetter::SetVrModeEnabled>, "SetVrModeEnabled"}, //3.0.0++ {52, D<&ICommonStateGetter::SetLcdBacklighOffEnabled>, "SetLcdBacklighOffEnabled"}, //4.0.0++ {53, D<&ICommonStateGetter::BeginVrModeEx>, "BeginVrModeEx"}, //7.0.0++ {54, D<&ICommonStateGetter::EndVrModeEx>, "EndVrModeEx"}, //7.0.0++ {55, D<&ICommonStateGetter::IsInControllerFirmwareUpdateSection>, "IsInControllerFirmwareUpdateSection"}, //3.0.0++ {59, nullptr, "SetVrPositionForDebug"}, //1.0.0+{60, D<&ICommonStateGetter::GetDefaultDisplayResolution>, "GetDefaultDisplayResolution"},{61, D<&ICommonStateGetter::GetDefaultDisplayResolutionChangeEvent>, "GetDefaultDisplayResolutionChangeEvent"},{62, D<&ICommonStateGetter::GetHdcpAuthenticationState>, "GetHdcpAuthenticationState"},@@ -63,7 +64,8 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap{91, nullptr, "GetCurrentPerformanceConfiguration"},{100, D<&ICommonStateGetter::SetHandlingHomeButtonShortPressedEnabled>, "SetHandlingHomeButtonShortPressedEnabled"},{110, nullptr, "OpenMyGpuErrorHandler"},- {120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory"},+ {120, D<&ICommonStateGetter::GetAppletLaunchedHistory>, "GetAppletLaunchedHistory"}, //13.0.0++ {130, nullptr, "Unknown130"}, //21.0.0+{200, D<&ICommonStateGetter::GetOperationModeSystemInfo>, "GetOperationModeSystemInfo"},{300, D<&ICommonStateGetter::GetSettingsPlatformRegion>, "GetSettingsPlatformRegion"},{400, nullptr, "ActivateMigrationService"},@@ -72,7 +74,13 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, std::shared_ptr<Ap{501, nullptr, "SuppressDisablingSleepTemporarily"},{502, nullptr, "IsSleepEnabled"},{503, nullptr, "IsDisablingSleepSuppressed"},- {900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"},+ {600, nullptr, "Unknown600"}, //20.0.0++ {610, nullptr, "Unknown610"}, //21.0.0++ {900, D<&ICommonStateGetter::SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled>, "SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled"}, //11.0.0++ {910, nullptr, "GetLaunchRequiredTick"}, //17.0.0++ {1000, nullptr, "BeginVrMode3d"}, //19.0.0++ {1001, nullptr, "EndVrMode3d"}, //19.0.0++ {1002, nullptr, "IsVrModeEnabled3d"}, //19.0.0+};// clang-format ondiff --git a/src/core/hle/service/am/service/library_applet_accessor.cpp b/src/core/hle/service/am/service/library_applet_accessor.cppindex c1d2943799..6b31fdb73c 100644--- a/src/core/hle/service/am/service/library_applet_accessor.cpp+++ b/src/core/hle/service/am/service/library_applet_accessor.cpp@@ -27,8 +27,10 @@ ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_,{25, D<&ILibraryAppletAccessor::Terminate>, "Terminate"},{30, D<&ILibraryAppletAccessor::GetResult>, "GetResult"},{50, nullptr, "SetOutOfFocusApplicationSuspendingEnabled"},- {60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero"},- {90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"},+ {60, D<&ILibraryAppletAccessor::PresetLibraryAppletGpuTimeSliceZero>, "PresetLibraryAppletGpuTimeSliceZero"}, //10.0.0++ {80, nullptr, "RequestForLibraryAppletToGetForeground"}, //19.0.0++ {81, nullptr, "GetCurrentChildLibraryApplet"}, //19.0.0++ {90, D<&ILibraryAppletAccessor::Unknown90>, "Unknown90"}, //20.0.0+{100, D<&ILibraryAppletAccessor::PushInData>, "PushInData"},{101, D<&ILibraryAppletAccessor::PopOutData>, "PopOutData"},{102, nullptr, "PushExtraStorage"},@@ -39,7 +41,7 @@ ILibraryAppletAccessor::ILibraryAppletAccessor(Core::System& system_,{110, nullptr, "NeedsToExitProcess"},{120, nullptr, "GetLibraryAppletInfo"},{150, nullptr, "RequestForAppletToGetForeground"},- {160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle"},+ {160, D<&ILibraryAppletAccessor::GetIndirectLayerConsumerHandle>, "GetIndirectLayerConsumerHandle"}, //2.0.0+};// clang-format ondiff --git a/src/core/hle/service/audio/audio_renderer.cpp b/src/core/hle/service/audio/audio_renderer.cppindex fc4aad2339..21cc742b69 100644--- a/src/core/hle/service/audio/audio_renderer.cpp+++ b/src/core/hle/service/audio/audio_renderer.cpp@@ -1,3 +1,6 @@+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later+// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later@@ -28,10 +31,10 @@ IAudioRenderer::IAudioRenderer(Core::System& system_, Manager& manager_,{7, D<&IAudioRenderer::QuerySystemEvent>, "QuerySystemEvent"},{8, D<&IAudioRenderer::SetRenderingTimeLimit>, "SetRenderingTimeLimit"},{9, D<&IAudioRenderer::GetRenderingTimeLimit>, "GetRenderingTimeLimit"},- {10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"},- {11, nullptr, "ExecuteAudioRendererRendering"},- {12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"},- {13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"},+ {10, D<&IAudioRenderer::RequestUpdateAuto>, "RequestUpdateAuto"}, //3.0.0++ {11, nullptr, "ExecuteAudioRendererRendering"}, //3.0.0++ {12, D<&IAudioRenderer::SetVoiceDropParameter>, "SetVoiceDropParameter"}, //15.0.0++ {13, D<&IAudioRenderer::GetVoiceDropParameter>, "GetVoiceDropParameter"}, //15.0.0+};// clang-format onRegisterHandlers(functions);diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cppindex 43f8e150d4..b972b83e1a 100644--- a/src/core/hle/service/service.cpp+++ b/src/core/hle/service/service.cpp@@ -19,16 +19,13 @@namespace Service {/// @brief Creates a function string for logging, complete with the name (or header code, depending-/// on what's passed in) the port name, and all the cmd_buff arguments.-[[maybe_unused]] static std::string MakeFunctionString(std::string_view name, std::string_view port_name, const u32* cmd_buff) {+/// on what's passed in) the port name, and all the cmd_buf arguments.+[[maybe_unused]] static std::string MakeFunctionString(std::string_view name, std::string_view port_name, const u32* cmd_buf) {// Number of params == bits 0-5 + bits 6-11- int num_params = (cmd_buff[0] & 0x3F) + ((cmd_buff[0] >> 6) & 0x3F);-- std::string function_string = fmt::format("function '{}': port={}", name, port_name);-+ int num_params = (cmd_buf[0] & 0x3F) + ((cmd_buf[0] >> 6) & 0x3F);+ std::string function_string = fmt::format("fn '{}': port={}", name, port_name);for (int i = 1; i <= num_params; ++i)- function_string += fmt::format(", cmd_buff[{}]={:#X}", i, cmd_buff[i]);-+ function_string += fmt::format(", cmd_buf[{}]={:#X}", i, cmd_buf[i]);return function_string;}diff --git a/src/core/hle/service/sm/sm_controller.cpp b/src/core/hle/service/sm/sm_controller.cppindex d5245e80eb..6b7ea4d83d 100644--- a/src/core/hle/service/sm/sm_controller.cpp+++ b/src/core/hle/service/sm/sm_controller.cpp@@ -119,7 +119,7 @@ Controller::Controller(Core::System& system_) : ServiceFramework{system_, "IpcCo{2, &Controller::CloneCurrentObject, "CloneCurrentObject"},{3, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},{4, &Controller::CloneCurrentObjectEx, "CloneCurrentObjectEx"},- {5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"},+ {5, &Controller::SetPointerBufferSize, "SetPointerBufferSize"}, //TODO: where does this come from};RegisterHandlers(functions);}diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cppindex 80fec3ef94..d4932fc4ee 100644--- a/src/core/hle/service/sockets/bsd.cpp+++ b/src/core/hle/service/sockets/bsd.cpp@@ -1015,11 +1015,23 @@ BSD::BSD(Core::System& system_, const char* name){26, &BSD::Close, "Close"},{27, &BSD::DuplicateSocket, "DuplicateSocket"},{28, nullptr, "GetResourceStatistics"},- {29, nullptr, "RecvMMsg"},- {30, nullptr, "SendMMsg"},- {31, &BSD::EventFd, "EventFd"},- {32, nullptr, "RegisterResourceStatisticsName"},- {33, nullptr, "Initialize2"},+ {29, nullptr, "RecvMMsg"}, //3.0.0++ {30, nullptr, "SendMMsg"}, //3.0.0++ {31, &BSD::EventFd, "EventFd"}, //7.0.0++ {32, nullptr, "RegisterResourceStatisticsName"}, //7.0.0++ {33, nullptr, "RegisterClientShared"}, //10.0.0++ {34, nullptr, "GetSocketStatistics"}, //15.0.0++ {35, nullptr, "NifIoctl"}, //17.0.0++ {36, nullptr, "Unknown36"}, //18.0.0++ {37, nullptr, "Unknown37"}, //18.0.0++ {38, nullptr, "Unknown38"}, //18.0.0++ {39, nullptr, "Unknown39"}, //20.0.0++ {40, nullptr, "Unknown40"}, //20.0.0++ {41, nullptr, "Unknown41"}, //21.0.0++ {42, nullptr, "Unknown42"}, //21.0.0++ {43, nullptr, "Unknown43"}, //21.0.0++ {200, nullptr, "SetThreadCoreMask"}, //15.0.0++ {201, nullptr, "GetThreadCoreMask"}, //15.0.0+};// clang-format ondiff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.hindex f3ea31bde5..0093347eb8 100644--- a/src/core/hle/service/sockets/sockets.h+++ b/src/core/hle/service/sockets/sockets.h@@ -1,3 +1,6 @@+// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project+// SPDX-License-Identifier: GPL-3.0-or-later+// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project// SPDX-License-Identifier: GPL-2.0-or-later@@ -82,6 +85,10 @@ enum class OptName : u32 {RCVTIMEO = 0x1006,ERROR_ = 0x1007, // avoid name collision with Windows macroNOSIGPIPE = 0x800, // at least according to libnx+ ACCEPTFILTER = 0x1000,+ BINTIME = 0x2000,+ NO_OFFLOAD = 0x4000,+ NO_DDP = 0x8000,};enum class ShutdownHow : s32 {