More GSPLCD functions

Implemented these using the information from 3D BREW. Did test to make sure they're working.
This commit is contained in:
Joel 2017-08-06 11:43:09 -04:00
parent f132a7a2a9
commit ff540f2ad1
2 changed files with 49 additions and 0 deletions

View File

@ -19,6 +19,12 @@ Result gspLcdInit(void);
/// Exits GSPLCD. /// Exits GSPLCD.
void gspLcdExit(void); void gspLcdExit(void);
/// Powers on both backlights.
Result GSPLCD_PowerOnAllBacklights(void);
/// Powers off both backlights.
Result GSPLCD_PowerOffAllBacklights(void);
/** /**
* @brief Powers on the backlight. * @brief Powers on the backlight.
* @param screen Screen to power on. * @param screen Screen to power on.
@ -31,6 +37,12 @@ Result GSPLCD_PowerOnBacklight(u32 screen);
*/ */
Result GSPLCD_PowerOffBacklight(u32 screen); Result GSPLCD_PowerOffBacklight(u32 screen);
/**
* @brief Sets 3D_LEDSTATE to the input state value.
* @param state 0 = 3D LED enable, 1 = 3D LED disable.
*/
Result GSPLCD_SetLedForceOff(u8 state);
/** /**
* @brief Gets the LCD screens' vendors. Stubbed on old 3ds. * @brief Gets the LCD screens' vendors. Stubbed on old 3ds.
* @param vendor Pointer to output the screen vendors to. * @param vendor Pointer to output the screen vendors to.

View File

@ -26,6 +26,30 @@ void gspLcdExit(void)
svcCloseHandle(gspLcdHandle); svcCloseHandle(gspLcdHandle);
} }
Result GSPLCD_PowerOnAllBacklights(void)
{
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x0F,0,0); // 0x0F0000
Result ret=0;
if (R_FAILED(ret = svcSendSyncRequest(gspLcdHandle))) return ret;
return cmdbuf[1];
}
Result GSPLCD_PowerOffAllBacklights(void)
{
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x10,0,0); // 0x100000
Result ret=0;
if (R_FAILED(ret = svcSendSyncRequest(gspLcdHandle))) return ret;
return cmdbuf[1];
}
Result GSPLCD_PowerOnBacklight(u32 screen) Result GSPLCD_PowerOnBacklight(u32 screen)
{ {
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();
@ -52,6 +76,19 @@ Result GSPLCD_PowerOffBacklight(u32 screen)
return cmdbuf[1]; return cmdbuf[1];
} }
Result GSPLCD_SetLedForceOff(u8 state)
{
u32 *cmdbuf = getThreadCommandBuffer();
cmdbuf[0] = IPC_MakeHeader(0x13,1,0); // 0x130040
cmdbuf[1] = state;
Result ret=0;
if (R_FAILED(ret = svcSendSyncRequest(gspLcdHandle))) return ret;
return cmdbuf[1];
}
Result GSPLCD_GetVendors(u8 *vendors) Result GSPLCD_GetVendors(u8 *vendors)
{ {
u32 *cmdbuf = getThreadCommandBuffer(); u32 *cmdbuf = getThreadCommandBuffer();