mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-24 22:41:12 +01:00
cleanup screenshot memory management. fixes preview image not displaying
on gamecube
This commit is contained in:
parent
8421d23baa
commit
70076aff41
@ -413,12 +413,10 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef USE_VM
|
#ifdef USE_VM
|
||||||
savebuffer = (unsigned char *)vm_malloc(SAVEBUFFERSIZE);
|
savebuffer = (unsigned char *)vm_malloc(SAVEBUFFERSIZE);
|
||||||
browserList = (BROWSERENTRY *)vm_malloc(sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
|
browserList = (BROWSERENTRY *)vm_malloc(sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
|
||||||
gameScreenPng = (u8 *)vm_malloc(512*1024);
|
|
||||||
nesrom = (unsigned char *)vm_malloc(1024*1024*4);
|
nesrom = (unsigned char *)vm_malloc(1024*1024*4);
|
||||||
#else
|
#else
|
||||||
savebuffer = (unsigned char *)memalign(32,SAVEBUFFERSIZE);
|
savebuffer = (unsigned char *)memalign(32,SAVEBUFFERSIZE);
|
||||||
browserList = (BROWSERENTRY *)memalign(32,sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
|
browserList = (BROWSERENTRY *)memalign(32,sizeof(BROWSERENTRY)*MAX_BROWSER_SIZE);
|
||||||
gameScreenPng = (u8 *)memalign(32,512*1024);
|
|
||||||
nesrom = (unsigned char *)memalign(32,1024*1024*4);
|
nesrom = (unsigned char *)memalign(32,1024*1024*4);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -956,6 +956,16 @@ void TakeScreenshot()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearScreenshot()
|
||||||
|
{
|
||||||
|
if(gameScreenPng)
|
||||||
|
{
|
||||||
|
gameScreenPngSize = 0;
|
||||||
|
free(gameScreenPng);
|
||||||
|
gameScreenPng = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ResetVideo_Menu
|
* ResetVideo_Menu
|
||||||
*
|
*
|
||||||
|
@ -30,6 +30,7 @@ void SyncSpeed();
|
|||||||
void SetPalette();
|
void SetPalette();
|
||||||
void ResetVideo_Menu ();
|
void ResetVideo_Menu ();
|
||||||
void TakeScreenshot();
|
void TakeScreenshot();
|
||||||
|
void ClearScreenshot();
|
||||||
void Menu_Render ();
|
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_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);
|
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled);
|
||||||
|
@ -51,14 +51,11 @@ static GuiImageData * pointer[4];
|
|||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include "mem2.h"
|
#include "mem2.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_VM
|
#define MEM_ALLOC(A) (u8*)mem2_malloc(A)
|
||||||
#include "vmalloc.h"
|
#define MEM_DEALLOC(A) mem2_free(A)
|
||||||
#define MEM_ALLOC(A) (u8*)vm_malloc(A)
|
|
||||||
#define MEM_DEALLOC(A) vm_free(A)
|
|
||||||
#else
|
#else
|
||||||
#define MEM_ALLOC(A) (u8*)memalign(32,A)
|
#define MEM_ALLOC(A) (u8*)memalign(32, A)
|
||||||
#define MEM_DEALLOC(A) free(A)
|
#define MEM_DEALLOC(A) free(A)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1571,8 +1568,7 @@ static int MenuGame()
|
|||||||
delete gameScreenImg;
|
delete gameScreenImg;
|
||||||
delete gameScreen;
|
delete gameScreen;
|
||||||
gameScreen = NULL;
|
gameScreen = NULL;
|
||||||
free(gameScreenPng);
|
ClearScreenshot();
|
||||||
gameScreenPng = NULL;
|
|
||||||
if(GCSettings.AutoloadGame) {
|
if(GCSettings.AutoloadGame) {
|
||||||
ExitApp();
|
ExitApp();
|
||||||
}
|
}
|
||||||
@ -4279,16 +4275,8 @@ MainMenu (int menu)
|
|||||||
if(gameScreen)
|
if(gameScreen)
|
||||||
delete gameScreen;
|
delete gameScreen;
|
||||||
|
|
||||||
if(gameScreenPng)
|
ClearScreenshot();
|
||||||
{
|
|
||||||
#ifdef USE_VM
|
|
||||||
vm_free(gameScreenPng);
|
|
||||||
#else
|
|
||||||
free(gameScreenPng);
|
|
||||||
#endif
|
|
||||||
gameScreenPng = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// wait for keys to be depressed
|
// wait for keys to be depressed
|
||||||
while(MenuRequested())
|
while(MenuRequested())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user