Re-added code to free allocated video memory at application close. Free Qt NES wrapper memory at application close.

This commit is contained in:
mjbudd77 2021-02-21 10:39:21 -05:00
parent b8e647fbc6
commit 2a2e1b7bca
6 changed files with 38 additions and 17 deletions

View File

@ -866,6 +866,13 @@ int fceuWrapperClose( void )
return 0; return 0;
} }
int fceuWrapperMemoryCleanup(void)
{
close_nes_shm();
return 0;
}
/** /**
* Update the video, audio, and input subsystems with the provided * Update the video, audio, and input subsystems with the provided
* video (XBuf) and audio (Buffer) information. * video (XBuf) and audio (Buffer) information.

View File

@ -28,6 +28,7 @@ int CloseGame(void);
int reloadLastGame(void); int reloadLastGame(void);
int fceuWrapperInit( int argc, char *argv[] ); int fceuWrapperInit( int argc, char *argv[] );
int fceuWrapperMemoryCleanup( void );
int fceuWrapperClose( void ); int fceuWrapperClose( void );
int fceuWrapperUpdate( void ); int fceuWrapperUpdate( void );
void fceuWrapperLock(void); void fceuWrapperLock(void);

View File

@ -119,6 +119,8 @@ int main( int argc, char *argv[] )
delete consoleWindow; delete consoleWindow;
fceuWrapperMemoryCleanup();
return retval; return retval;
} }

View File

@ -44,3 +44,12 @@ nes_shm_t *open_nes_shm(void)
return vaddr; return vaddr;
} }
//************************************************************************ //************************************************************************
void close_nes_shm(void)
{
if ( nes_shm )
{
free(nes_shm); nes_shm = NULL;
}
}
//************************************************************************

View File

@ -89,4 +89,6 @@ extern nes_shm_t *nes_shm;
nes_shm_t *open_nes_shm(void); nes_shm_t *open_nes_shm(void);
void close_nes_shm(void);
#endif #endif

View File

@ -87,23 +87,23 @@ std::string FCEUI_GetSnapshotAsName() { return AsSnapshotName; }
void FCEU_KillVirtualVideo(void) void FCEU_KillVirtualVideo(void)
{ {
//mbg merge TODO 7/17/06 temporarily removed if ( XBuf )
//if(xbsave) {
//{ FCEU_free(XBuf); XBuf = NULL;
// free(xbsave); }
// xbsave=0; if ( XBackBuf )
//} {
//if(XBuf) FCEU_free(XBackBuf); XBackBuf = NULL;
//{ }
//UnmapViewOfFile(XBuf); if ( XDBuf )
//CloseHandle(mapXBuf); {
//mapXBuf=NULL; FCEU_free(XDBuf); XDBuf = NULL;
//} }
//if(XBackBuf) if ( XDBackBuf )
//{ {
// free(XBackBuf); FCEU_free(XDBackBuf); XDBackBuf = NULL;
// XBackBuf=0; }
//} //printf("Video Core Cleanup\n");
} }
/** /**