diff --git a/source/menu.cpp b/source/menu.cpp index 1681d8f..060d18f 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -60,15 +60,9 @@ static GuiImageData * pointer[4]; #define MEM_ALLOC(A) (u8*)mem2_malloc(A) #define MEM_DEALLOC(A) mem2_free(A) #else -#ifdef USE_VM - #include "vmalloc.h" - #define MEM_ALLOC(A) (u8*)vm_malloc(A) - #define MEM_DEALLOC(A) vm_free(A) - #else #define MEM_ALLOC(A) (u8*)memalign(32, A) #define MEM_DEALLOC(A) free(A) #endif -#endif static GuiTrigger * trigA = NULL; static GuiTrigger * trig2 = NULL; @@ -1562,8 +1556,7 @@ static int MenuGame() delete gameScreenImg; delete gameScreen; gameScreen = NULL; - free(gameScreenPng); - gameScreenPng = NULL; + ClearScreenshot(); if(GCSettings.AutoloadGame) { ExitApp(); } @@ -4400,11 +4393,7 @@ MainMenu (int menu) if(gameScreen) delete gameScreen; - if(gameScreenPng) - { - free(gameScreenPng); - gameScreenPng = NULL; - } + ClearScreenshot(); // wait for keys to be depressed while(MenuRequested()) diff --git a/source/video.cpp b/source/video.cpp index cf565f0..0fbe998 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -907,6 +907,16 @@ void TakeScreenshot() } } +void ClearScreenshot() +{ + if(gameScreenPng) + { + gameScreenPngSize = 0; + free(gameScreenPng); + gameScreenPng = NULL; + } +} + /**************************************************************************** * ResetVideo_Menu * diff --git a/source/video.h b/source/video.h index e183e49..f1a3e2f 100644 --- a/source/video.h +++ b/source/video.h @@ -25,6 +25,7 @@ void setGFX(); void update_video (int width, int height); void ResetVideo_Menu(); void TakeScreenshot(); +void ClearScreenshot(); void Menu_Render(); void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);