From c36d9cc4a674c9032c06d9f3e475842c610d845f Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Mon, 11 Apr 2022 22:55:53 +0100 Subject: [PATCH] Provide gspGetSessionHandle and gspLcdGetSessionHandle --- libctru/include/3ds/services/gspgpu.h | 6 ++++++ libctru/include/3ds/services/gsplcd.h | 8 +++++++- libctru/source/services/gspgpu.c | 5 +++++ libctru/source/services/gsplcd.c | 7 ++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libctru/include/3ds/services/gspgpu.h b/libctru/include/3ds/services/gspgpu.h index 948c70c..edec309 100644 --- a/libctru/include/3ds/services/gspgpu.h +++ b/libctru/include/3ds/services/gspgpu.h @@ -89,6 +89,12 @@ Result gspInit(void); /// Exits GSPGPU. void gspExit(void); +/** + * @brief Gets a pointer to the current gsp::Gpu session handle. + * @return A pointer to the current gsp::Gpu session handle. + */ +Handle *gspGetSessionHandle(void); + /// Returns true if the application currently has GPU rights. bool gspHasGpuRight(void); diff --git a/libctru/include/3ds/services/gsplcd.h b/libctru/include/3ds/services/gsplcd.h index 8e52d8e..af9c429 100644 --- a/libctru/include/3ds/services/gsplcd.h +++ b/libctru/include/3ds/services/gsplcd.h @@ -20,6 +20,12 @@ Result gspLcdInit(void); /// Exits GSPLCD. void gspLcdExit(void); +/** + * @brief Gets a pointer to the current gsp::Lcd session handle. + * @return A pointer to the current gsp::Lcd session handle. + */ +Handle *gspLcdGetSessionHandle(void); + /// Powers on both backlights. Result GSPLCD_PowerOnAllBacklights(void); @@ -69,4 +75,4 @@ Result GSPLCD_SetBrightness(u32 screen, u32 brightness); * @param screen Screen to set the brightness value of. * @param brightness Brightness value set. */ -Result GSPLCD_SetBrightnessRaw(u32 screen, u32 brightness); \ No newline at end of file +Result GSPLCD_SetBrightnessRaw(u32 screen, u32 brightness); diff --git a/libctru/source/services/gspgpu.c b/libctru/source/services/gspgpu.c index b939d06..27d7cb6 100644 --- a/libctru/source/services/gspgpu.c +++ b/libctru/source/services/gspgpu.c @@ -221,6 +221,11 @@ void gspExit(void) svcCloseHandle(gspGpuHandle); } +Handle *gspGetSessionHandle(void) +{ + return &gspGpuHandle; +} + bool gspHasGpuRight(void) { return gspGpuRight; diff --git a/libctru/source/services/gsplcd.c b/libctru/source/services/gsplcd.c index 89f3fc1..26aed46 100644 --- a/libctru/source/services/gsplcd.c +++ b/libctru/source/services/gsplcd.c @@ -26,6 +26,11 @@ void gspLcdExit(void) svcCloseHandle(gspLcdHandle); } +Handle *gspLcdGetSessionHandle(void) +{ + return &gspLcdHandle; +} + Result GSPLCD_PowerOnAllBacklights(void) { u32 *cmdbuf = getThreadCommandBuffer(); @@ -144,4 +149,4 @@ Result GSPLCD_SetBrightnessRaw(u32 screen, u32 brightness) if (R_FAILED(ret = svcSendSyncRequest(gspLcdHandle))) return ret; return cmdbuf[1]; -} \ No newline at end of file +}