From e0819913f06922bba5f1a3a2466c1acab2a30055 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 18:52:10 +0100 Subject: [PATCH 1/9] Add files via upload --- nx/include/switch/services/omm.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nx/include/switch/services/omm.h diff --git a/nx/include/switch/services/omm.h b/nx/include/switch/services/omm.h new file mode 100644 index 0000000000..861757031c --- /dev/null +++ b/nx/include/switch/services/omm.h @@ -0,0 +1,32 @@ +/** + * @file omm.h + * @author MasaGratoR + * @copyright libnx Authors + */ + +#pragma once + +#include "../types.h" +#include "../sf/service.h" + +///OperationModePolicy +typedef enum { + ommOperationModePolicy_Auto = 0, + ommOperationModePolicy_Handheld = 1, + ommOperationModePolicy_Console = 2 +} ommOperationModePolicy; + +/// Initialize pwm. +Result ommInitialize(void); + +/// Exit omm. +void ommExit(void); + +/// Gets the Service for omm. +Service* ommGetServiceSession(void); + +/// Returns a DefaultDisplayResolution. Only available on [3.0.0+]. +Result ommGetDefaultDisplayResolution(s32* width, s32* height); + +/// Takes an ommOperationModePolicy. Only available on [3.0.0+]. +Result ommSetOperationModePolicy(ommOperationModePolicy value); \ No newline at end of file From 01e67e4ea598563de6a09f8c8241a340ff7fd8ac Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 18:53:00 +0100 Subject: [PATCH 2/9] Add files via upload --- nx/source/services/omm.c | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 nx/source/services/omm.c diff --git a/nx/source/services/omm.c b/nx/source/services/omm.c new file mode 100644 index 0000000000..f27b84a6fd --- /dev/null +++ b/nx/source/services/omm.c @@ -0,0 +1,47 @@ +#define NX_SERVICE_ASSUME_NON_DOMAIN +#include "service_guard.h" +#include "services/omm.h" +#include "runtime/hosversion.h" + +static Service g_ommSrv; + +NX_GENERATE_SERVICE_GUARD(omm); + +Result _ommInitialize(void) { + return smGetService(&g_ommSrv, "omm"); +} + +void _ommCleanup(void) { + serviceClose(&g_ommSrv); +} + +Service* ommGetServiceSession(void) { + return &g_ommSrv; +} + +Result ommGetDefaultDisplayResolution(s32* width, s32* height) { + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + struct { + s32 width; + s32 height; + } out; + + Result rc = serviceDispatchOut(&g_ommSrv, 11, out); + + if (R_SUCCEEDED(rc)) { + *width = out.width; + *height = out.height; + } + + return rc; +} + +Result ommSetOperationModePolicy(ommOperationModePolicy value) { + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u8 tmp = value; + return serviceDispatchIn(&g_ommSrv, 10, tmp); +} \ No newline at end of file From c6aa5daa7f5240a1f2275f2c55bee2e7d1fdceb3 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 19:21:50 +0100 Subject: [PATCH 3/9] Add files via upload --- nx/source/services/omm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nx/source/services/omm.c b/nx/source/services/omm.c index f27b84a6fd..2333d32edd 100644 --- a/nx/source/services/omm.c +++ b/nx/source/services/omm.c @@ -38,6 +38,17 @@ Result ommGetDefaultDisplayResolution(s32* width, s32* height) { return rc; } +Result ommGetOperationMode(ommOperationMode* s) { + u8 out; + Result rc = serviceDispatchOut(&g_ommSrv, 0, out); + + if (R_SUCCEEDED(rc)) { + *s = out; + } + + return rc; +} + Result ommSetOperationModePolicy(ommOperationModePolicy value) { if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); From 0f3b10f1b96e48e8dcfa7913ade0545f938f653e Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 19:22:22 +0100 Subject: [PATCH 4/9] Add files via upload --- nx/include/switch/services/omm.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nx/include/switch/services/omm.h b/nx/include/switch/services/omm.h index 861757031c..fd1ca7645a 100644 --- a/nx/include/switch/services/omm.h +++ b/nx/include/switch/services/omm.h @@ -9,6 +9,12 @@ #include "../types.h" #include "../sf/service.h" +///OperationModePolicy +typedef enum { + ommOperationMode_Handheld = 0, + ommOperationMode_Console = 1 +} ommOperationMode; + ///OperationModePolicy typedef enum { ommOperationModePolicy_Auto = 0, @@ -16,7 +22,7 @@ typedef enum { ommOperationModePolicy_Console = 2 } ommOperationModePolicy; -/// Initialize pwm. +/// Initialize omm. Result ommInitialize(void); /// Exit omm. @@ -28,5 +34,8 @@ Service* ommGetServiceSession(void); /// Returns a DefaultDisplayResolution. Only available on [3.0.0+]. Result ommGetDefaultDisplayResolution(s32* width, s32* height); +/// Returns an ommOperationModePolicy. +Result ommGetOperationMode(ommOperationMode* s); + /// Takes an ommOperationModePolicy. Only available on [3.0.0+]. Result ommSetOperationModePolicy(ommOperationModePolicy value); \ No newline at end of file From 7ecc8aac760a803f1b597213ea1c571087e6512a Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 19:22:51 +0100 Subject: [PATCH 5/9] Update switch.h --- nx/include/switch.h | 1 + 1 file changed, 1 insertion(+) diff --git a/nx/include/switch.h b/nx/include/switch.h index 6ba918e697..127993db83 100644 --- a/nx/include/switch.h +++ b/nx/include/switch.h @@ -132,6 +132,7 @@ extern "C" { #include "switch/services/ectx.h" #include "switch/services/avm.h" #include "switch/services/mm.h" +#include "switch/services/omm.h" #include "switch/display/binder.h" #include "switch/display/parcel.h" From aaa497cca1d1a22f33e1a0d3eb4c8e65b8d141bb Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 19:25:58 +0100 Subject: [PATCH 6/9] Update omm.h --- nx/include/switch/services/omm.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/services/omm.h b/nx/include/switch/services/omm.h index fd1ca7645a..d16d233603 100644 --- a/nx/include/switch/services/omm.h +++ b/nx/include/switch/services/omm.h @@ -9,7 +9,7 @@ #include "../types.h" #include "../sf/service.h" -///OperationModePolicy +///OperationMode typedef enum { ommOperationMode_Handheld = 0, ommOperationMode_Console = 1 @@ -38,4 +38,5 @@ Result ommGetDefaultDisplayResolution(s32* width, s32* height); Result ommGetOperationMode(ommOperationMode* s); /// Takes an ommOperationModePolicy. Only available on [3.0.0+]. -Result ommSetOperationModePolicy(ommOperationModePolicy value); \ No newline at end of file + +Result ommSetOperationModePolicy(ommOperationModePolicy value); From 7e2ff673ab330675983a0f11fe7495b99757e585 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 19:26:26 +0100 Subject: [PATCH 7/9] Update omm.h --- nx/include/switch/services/omm.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nx/include/switch/services/omm.h b/nx/include/switch/services/omm.h index d16d233603..cb26327c86 100644 --- a/nx/include/switch/services/omm.h +++ b/nx/include/switch/services/omm.h @@ -34,9 +34,8 @@ Service* ommGetServiceSession(void); /// Returns a DefaultDisplayResolution. Only available on [3.0.0+]. Result ommGetDefaultDisplayResolution(s32* width, s32* height); -/// Returns an ommOperationModePolicy. +/// Returns an ommOperationMode. Result ommGetOperationMode(ommOperationMode* s); /// Takes an ommOperationModePolicy. Only available on [3.0.0+]. - Result ommSetOperationModePolicy(ommOperationModePolicy value); From d343345676444bf8720425e61ff2fb26ebdcf75f Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 20:39:16 +0100 Subject: [PATCH 8/9] Update omm.h --- nx/include/switch/services/omm.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/nx/include/switch/services/omm.h b/nx/include/switch/services/omm.h index cb26327c86..083828f427 100644 --- a/nx/include/switch/services/omm.h +++ b/nx/include/switch/services/omm.h @@ -11,16 +11,16 @@ ///OperationMode typedef enum { - ommOperationMode_Handheld = 0, - ommOperationMode_Console = 1 -} ommOperationMode; + OmmOperationMode_Handheld = 0, + OmmOperationMode_Console = 1 +} OmmOperationMode; ///OperationModePolicy typedef enum { - ommOperationModePolicy_Auto = 0, - ommOperationModePolicy_Handheld = 1, - ommOperationModePolicy_Console = 2 -} ommOperationModePolicy; + OmmOperationModePolicy_Auto = 0, + OmmOperationModePolicy_Handheld = 1, + OmmOperationModePolicy_Console = 2 +} OmmOperationModePolicy; /// Initialize omm. Result ommInitialize(void); @@ -34,8 +34,8 @@ Service* ommGetServiceSession(void); /// Returns a DefaultDisplayResolution. Only available on [3.0.0+]. Result ommGetDefaultDisplayResolution(s32* width, s32* height); -/// Returns an ommOperationMode. -Result ommGetOperationMode(ommOperationMode* s); +/// Returns an OmmOperationMode. +Result ommGetOperationMode(OmmOperationMode* s); -/// Takes an ommOperationModePolicy. Only available on [3.0.0+]. -Result ommSetOperationModePolicy(ommOperationModePolicy value); +/// Takes an OmmOperationModePolicy. Only available on [3.0.0+]. +Result ommSetOperationModePolicy(OmmOperationModePolicy value); From 5187548aed6b0d98327d0dcd27f4d482256d496b Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Sun, 15 Feb 2026 20:39:36 +0100 Subject: [PATCH 9/9] Update omm.c --- nx/source/services/omm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx/source/services/omm.c b/nx/source/services/omm.c index 2333d32edd..6da7c7024d 100644 --- a/nx/source/services/omm.c +++ b/nx/source/services/omm.c @@ -38,7 +38,7 @@ Result ommGetDefaultDisplayResolution(s32* width, s32* height) { return rc; } -Result ommGetOperationMode(ommOperationMode* s) { +Result ommGetOperationMode(OmmOperationMode* s) { u8 out; Result rc = serviceDispatchOut(&g_ommSrv, 0, out); @@ -49,10 +49,10 @@ Result ommGetOperationMode(ommOperationMode* s) { return rc; } -Result ommSetOperationModePolicy(ommOperationModePolicy value) { +Result ommSetOperationModePolicy(OmmOperationModePolicy value) { if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); u8 tmp = value; return serviceDispatchIn(&g_ommSrv, 10, tmp); -} \ No newline at end of file +}