From d09ca69df7cd49c0941f3e4cd1052e2898265552 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 2 Apr 2017 21:00:41 -0500 Subject: [PATCH] Implement GSPLCD::GetBrightness --- libctru/include/3ds/services/gsplcd.h | 8 +++++++- libctru/source/services/gsplcd.c | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libctru/include/3ds/services/gsplcd.h b/libctru/include/3ds/services/gsplcd.h index 0ac9a97..3f218a9 100644 --- a/libctru/include/3ds/services/gsplcd.h +++ b/libctru/include/3ds/services/gsplcd.h @@ -35,4 +35,10 @@ Result GSPLCD_PowerOffBacklight(u32 screen); * @brief Gets the LCD screens' vendors. Stubbed on old 3ds. * @param vendor Pointer to output the screen vendors to. */ -Result GSPLCD_GetVendors(u8 *vendors); \ No newline at end of file +Result GSPLCD_GetVendors(u8 *vendors); + +/** + * @brief Gets the LCD screens' brightness. Stubbed on old 3ds. + * @param screen to get the brightness value. + */ +Result GSPLCD_GetBrightness(u32 *screen); \ No newline at end of file diff --git a/libctru/source/services/gsplcd.c b/libctru/source/services/gsplcd.c index d293efe..70b919d 100644 --- a/libctru/source/services/gsplcd.c +++ b/libctru/source/services/gsplcd.c @@ -66,3 +66,17 @@ Result GSPLCD_GetVendors(u8 *vendors) return cmdbuf[1]; } +Result GSPLCD_GetBrightness(u32 *screen) +{ + u32 *cmdbuf = getThreadCommandBuffer(); + + cmdbuf[0] = IPC_MakeHeader(0x15,1,0); // 0x150040 + cmdbuf[1] = *screen; + + Result ret = 0; + if (R_FAILED(ret = svcSendSyncRequest(gspLcdHandle))) return ret; + + *screen = cmdbuf[2]; + + return cmdbuf[1]; +} \ No newline at end of file