diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 0c37a561cf..c2dadafd2f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -457,6 +457,7 @@ add_library(core STATIC hle/service/am/service/application_functions.cpp hle/service/am/service/application_functions.h hle/service/am/service/application_proxy.cpp + hle/service/am/service/graphics_scale_controller.h hle/service/am/service/application_proxy.h hle/service/am/service/application_proxy_service.cpp hle/service/am/service/application_proxy_service.h diff --git a/src/core/hle/service/am/service/application_functions.cpp b/src/core/hle/service/am/service/application_functions.cpp index 573a2608de..afa63bbe83 100644 --- a/src/core/hle/service/am/service/application_functions.cpp +++ b/src/core/hle/service/am/service/application_functions.cpp @@ -119,6 +119,7 @@ IApplicationFunctions::IApplicationFunctions(Core::System& system_, std::shared_ {300, nullptr, "CreateMovieWriter"}, // [19.0.0+] {310, nullptr, "Unknown310"}, // [20.0.0+] {320, D<&IApplicationFunctions::Unknown320>, "Unknown320"}, // [20.0.0+] + {321, D<&IApplicationFunctions::Unknown321>, "Unknown321"}, // Switch 2 {330, D<&IApplicationFunctions::Unknown330>, "Unknown330"}, // [20.0.0+] {500, nullptr, "StartContinuousRecordingFlushForDebug"}, {1000, nullptr, "CreateMovieMaker"}, @@ -550,6 +551,12 @@ Result IApplicationFunctions::Unknown320() { R_SUCCEED(); } +Result IApplicationFunctions::Unknown321() { + // Called by Switch 2 titles right after 320; arguments unknown. + LOG_WARNING(Service_AM, "(STUBBED) called"); + R_SUCCEED(); +} + Result IApplicationFunctions::Unknown330(Out out) { LOG_DEBUG(Service_AM, "called"); *out = 0; diff --git a/src/core/hle/service/am/service/application_functions.h b/src/core/hle/service/am/service/application_functions.h index 18442000ce..72bf8998b1 100644 --- a/src/core/hle/service/am/service/application_functions.h +++ b/src/core/hle/service/am/service/application_functions.h @@ -83,6 +83,7 @@ private: Result CreateApplicationAndRequestToStart(u64 application_id); Result GetUnknownEvent210(OutCopyHandle out_event); Result Unknown320(); + Result Unknown321(); Result Unknown330(Out out); Result PrepareForJit(); diff --git a/src/core/hle/service/am/service/application_proxy.cpp b/src/core/hle/service/am/service/application_proxy.cpp index 80a21c0d05..430f3c6888 100644 --- a/src/core/hle/service/am/service/application_proxy.cpp +++ b/src/core/hle/service/am/service/application_proxy.cpp @@ -11,6 +11,7 @@ #include "core/hle/service/am/service/common_state_getter.h" #include "core/hle/service/am/service/debug_functions.h" #include "core/hle/service/am/service/display_controller.h" +#include "core/hle/service/am/service/graphics_scale_controller.h" #include "core/hle/service/am/service/library_applet_creator.h" #include "core/hle/service/am/service/process_winding_controller.h" #include "core/hle/service/am/service/self_controller.h" @@ -37,7 +38,7 @@ IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr, "GetGraphicsScaleController (Switch 2)"}, {70, &IApplicationProxy::GetNx2Interface, "Nx2Getter70"}, {80, &IApplicationProxy::GetNx2Interface, "Nx2Getter80"}, {90, &IApplicationProxy::GetNx2Interface, "Nx2Getter90"}, @@ -50,6 +51,13 @@ IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr> out_controller) { + LOG_DEBUG(Service_AM, "called"); + *out_controller = std::make_shared(system); + R_SUCCEED(); +} + void IApplicationProxy::GetNx2Interface(HLERequestContext& ctx) { ReturnNx2StubInterface(system, ctx, "IApplicationProxy"); } diff --git a/src/core/hle/service/am/service/application_proxy.h b/src/core/hle/service/am/service/application_proxy.h index 04f4b4e175..0a706be4fd 100644 --- a/src/core/hle/service/am/service/application_proxy.h +++ b/src/core/hle/service/am/service/application_proxy.h @@ -17,6 +17,7 @@ class IApplicationFunctions; class ICommonStateGetter; class IDebugFunctions; class IDisplayController; +class IGraphicsScaleController; class ILibraryAppletCreator; class IProcessWindingController; class ISelfController; @@ -31,6 +32,7 @@ public: private: void GetNx2Interface(HLERequestContext& ctx); + Result GetGraphicsScaleController(Out> out_controller); Result GetAudioController(Out> out_audio_controller); Result GetDisplayController(Out> out_display_controller); Result GetProcessWindingController( diff --git a/src/core/hle/service/am/service/graphics_scale_controller.h b/src/core/hle/service/am/service/graphics_scale_controller.h new file mode 100644 index 0000000000..07e38c6ac8 --- /dev/null +++ b/src/core/hle/service/am/service/graphics_scale_controller.h @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "core/hle/service/cmif_types.h" +#include "core/hle/service/nx2_stub_interface.h" +#include "core/hle/service/service.h" + +namespace Service::AM { + +// Switch 2 interface returned by IApplicationProxy command 60 (name is a guess). nn::oe's +// GetCurrentGraphicsScale reads command 10 and accepts 10, 20 or 30 (scale enum 0, 1, 2). +// Commands without a handler are auto-stubbed because the name carries the nx2: prefix. +class IGraphicsScaleController final : public ServiceFramework { +public: + explicit IGraphicsScaleController(Core::System& system_) + : ServiceFramework{system_, "nx2:IGraphicsScaleController"} { + // clang-format off + static const FunctionInfo functions[] = { + {10, D<&IGraphicsScaleController::GetCurrentGraphicsScale>, "GetCurrentGraphicsScale"}, + }; + // clang-format on + RegisterHandlers(functions); + } + +private: + Result GetCurrentGraphicsScale(Out out_scale) { + LOG_WARNING(Service_AM, "(STUBBED) called, returning 10"); + *out_scale = 10; + R_SUCCEED(); + } +}; + +} // namespace Service::AM