diff --git a/ctr/tools/template-cia.rsf b/ctr/tools/template-cia.rsf index e90b50fa17..704bd5c35e 100644 --- a/ctr/tools/template-cia.rsf +++ b/ctr/tools/template-cia.rsf @@ -186,6 +186,7 @@ AccessControlInfo: - frd:u - fs:USER - gsp::Gpu + - gsp::Lcd - hid:USER - http:C - mic:u diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 277d146acc..9e54a08f1c 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -182,6 +182,8 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], static void frontend_ctr_deinit(void *data) { + extern PrintConsole* currentConsole; + Handle lcd_handle; (void)data; #ifndef IS_SALAMANDER global_t *global = global_get_ptr(); @@ -193,7 +195,17 @@ static void frontend_ctr_deinit(void *data) global->log_file = NULL; #endif - wait_for_input(); + if(gfxBottomFramebuffers[0] == (u8*)currentConsole->frameBuffer) + wait_for_input(); + + if(srvGetServiceHandle(&lcd_handle, "gsp::Lcd") >= 0) + { + u32 *cmdbuf = getThreadCommandBuffer(); + cmdbuf[0] = 0x00110040; + cmdbuf[1] = 2; + svcSendSyncRequest(lcd_handle); + svcCloseHandle(lcd_handle); + } csndExit(); gfxExit(); diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index ea6cf1f8a8..c725e2170f 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -85,6 +85,7 @@ typedef struct ctr_video unsigned rotation; bool keep_aspect; bool should_resize; + bool lcd_buttom_on; void* empty_framebuffer; } ctr_video_t; @@ -341,6 +342,7 @@ static void* ctr_init(const video_info_t* video, ctr->keep_aspect = true; ctr->should_resize = true; ctr->smooth = true; + ctr->lcd_buttom_on = true; ctr->empty_framebuffer = linearAlloc(320 * 240 * 2); memset(ctr->empty_framebuffer, 0, 320 * 240 * 2); @@ -390,11 +392,23 @@ static bool ctr_frame(void* data, const void* frame, hidTouchRead(&state_tmp_touch); if((state_tmp & KEY_TOUCH) && (state_tmp_touch.py < 120)) { + Handle lcd_handle; extern PrintConsole* currentConsole; - if ((u8*)currentConsole->frameBuffer == gfxBottomFramebuffers[0]) - gfxBottomFramebuffers[0] = (u8*)ctr->empty_framebuffer; - else - gfxBottomFramebuffers[0] = (u8*)currentConsole->frameBuffer; + + gfxBottomFramebuffers[0] = ctr->lcd_buttom_on ? (u8*)ctr->empty_framebuffer: + (u8*)currentConsole->frameBuffer; + + if(srvGetServiceHandle(&lcd_handle, "gsp::Lcd") >= 0) + { + printf("here !!\n"); + u32 *cmdbuf = getThreadCommandBuffer(); + cmdbuf[0] = ctr->lcd_buttom_on? 0x00120040: 0x00110040; + cmdbuf[1] = 2; + svcSendSyncRequest(lcd_handle); + svcCloseHandle(lcd_handle); + } + + ctr->lcd_buttom_on = !ctr->lcd_buttom_on; } svcWaitSynchronization(gspEvents[GSPEVENT_P3D], 20000000);