From 9fd0867181b1f43394fd7db8b59fdfee18207706 Mon Sep 17 00:00:00 2001 From: TuxSH <1922548+TuxSH@users.noreply.github.com> Date: Wed, 6 May 2020 20:13:16 +0100 Subject: [PATCH] Add GSPGPU_ResetGpuCore --- libctru/include/3ds/services/gspgpu.h | 7 +++++-- libctru/source/services/gspgpu.c | 13 ++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libctru/include/3ds/services/gspgpu.h b/libctru/include/3ds/services/gspgpu.h index 6636c46..bb59bfc 100644 --- a/libctru/include/3ds/services/gspgpu.h +++ b/libctru/include/3ds/services/gspgpu.h @@ -144,9 +144,12 @@ Result GSPGPU_ReleaseRight(void); */ Result GSPGPU_ImportDisplayCaptureInfo(GSPGPU_CaptureInfo*captureinfo); -/// Sames the VRAM sys area. +/// Saves the VRAM sys area. Result GSPGPU_SaveVramSysArea(void); +/// Resets the GPU +Result GSPGPU_ResetGpuCore(void); + /// Restores the VRAM sys area. Result GSPGPU_RestoreVramSysArea(void); @@ -222,4 +225,4 @@ Result GSPGPU_TriggerCmdReqQueue(void); * @brief Sets 3D_LEDSTATE to the input state value. * @param disable False = 3D LED enable, true = 3D LED disable. */ -Result GSPGPU_SetLedForceOff(bool disable); \ No newline at end of file +Result GSPGPU_SetLedForceOff(bool disable); diff --git a/libctru/source/services/gspgpu.c b/libctru/source/services/gspgpu.c index 1247267..f169ba4 100644 --- a/libctru/source/services/gspgpu.c +++ b/libctru/source/services/gspgpu.c @@ -430,6 +430,17 @@ Result GSPGPU_RestoreVramSysArea(void) return cmdbuf[1]; } +Result GSPGPU_ResetGpuCore(void) +{ + u32* cmdbuf=getThreadCommandBuffer(); + cmdbuf[0]=IPC_MakeHeader(0x1B,0,0); // 0x001B0000 + + Result ret=0; + if(R_FAILED(ret=svcSendSyncRequest(gspGpuHandle)))return ret; + + return cmdbuf[1]; +} + Result GSPGPU_SetLedForceOff(bool disable) { u32 *cmdbuf = getThreadCommandBuffer(); @@ -441,4 +452,4 @@ Result GSPGPU_SetLedForceOff(bool disable) if (R_FAILED(ret = svcSendSyncRequest(gspGpuHandle))) return ret; return cmdbuf[1]; -} \ No newline at end of file +}