From f32af27f1b3852c78520a28f030dfa1e3943eae1 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 15 Jul 2024 22:29:07 +1000 Subject: [PATCH] PS1: Properly reset GPU --- src/Graphics_PS1.c | 1 - src/Window_PS1.c | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Graphics_PS1.c b/src/Graphics_PS1.c index 315747006..f1f5c3421 100644 --- a/src/Graphics_PS1.c +++ b/src/Graphics_PS1.c @@ -92,7 +92,6 @@ void Gfx_Create(void) { Gfx.Created = true; Gfx_RestoreState(); - ResetGraph(0); SetupContexts(Window_Main.Width, Window_Main.Height, 63, 0, 127); SetDispMask(1); diff --git a/src/Window_PS1.c b/src/Window_PS1.c index f62afbdd8..2b3773968 100644 --- a/src/Window_PS1.c +++ b/src/Window_PS1.c @@ -26,6 +26,7 @@ static cc_bool launcherMode; struct _DisplayData DisplayInfo; struct cc_window WindowInfo; +static DISPENV disp; void Window_PreInit(void) { } void Window_Init(void) { @@ -49,9 +50,16 @@ void Window_Init(void) { void Window_Free(void) { } void Window_Create2D(int width, int height) { + ResetGraph(0); launcherMode = true; + + SetDefDispEnv(&disp, 0, 0, SCREEN_XRES, SCREEN_YRES); + PutDispEnv(&disp); + SetDispMask(1); } + void Window_Create3D(int width, int height) { + ResetGraph(0); launcherMode = false; } @@ -160,15 +168,7 @@ void Gamepads_Process(float delta) { /*########################################################################################################################* *------------------------------------------------------Framebuffer--------------------------------------------------------* *#########################################################################################################################*/ -static DISPENV disp; - void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) { - SetDefDispEnv(&disp, 0, 0, SCREEN_XRES, SCREEN_YRES); - disp.isinter = 1; - - PutDispEnv(&disp); - SetDispMask(1); - bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window pixels"); bmp->width = width; bmp->height = height;