diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index 53ab226e..748a4be4 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -866,6 +866,13 @@ int fceuWrapperClose( void ) return 0; } +int fceuWrapperMemoryCleanup(void) +{ + close_nes_shm(); + + return 0; +} + /** * Update the video, audio, and input subsystems with the provided * video (XBuf) and audio (Buffer) information. diff --git a/src/drivers/Qt/fceuWrapper.h b/src/drivers/Qt/fceuWrapper.h index 315820ea..61c7ec1f 100644 --- a/src/drivers/Qt/fceuWrapper.h +++ b/src/drivers/Qt/fceuWrapper.h @@ -28,6 +28,7 @@ int CloseGame(void); int reloadLastGame(void); int fceuWrapperInit( int argc, char *argv[] ); +int fceuWrapperMemoryCleanup( void ); int fceuWrapperClose( void ); int fceuWrapperUpdate( void ); void fceuWrapperLock(void); diff --git a/src/drivers/Qt/main.cpp b/src/drivers/Qt/main.cpp index 19a57a1c..df6e3ba0 100644 --- a/src/drivers/Qt/main.cpp +++ b/src/drivers/Qt/main.cpp @@ -119,6 +119,8 @@ int main( int argc, char *argv[] ) delete consoleWindow; + fceuWrapperMemoryCleanup(); + return retval; } diff --git a/src/drivers/Qt/nes_shm.cpp b/src/drivers/Qt/nes_shm.cpp index f4b00773..d67b7fea 100644 --- a/src/drivers/Qt/nes_shm.cpp +++ b/src/drivers/Qt/nes_shm.cpp @@ -44,3 +44,12 @@ nes_shm_t *open_nes_shm(void) return vaddr; } //************************************************************************ +void close_nes_shm(void) +{ + if ( nes_shm ) + { + free(nes_shm); nes_shm = NULL; + } + +} +//************************************************************************ diff --git a/src/drivers/Qt/nes_shm.h b/src/drivers/Qt/nes_shm.h index 2e14be81..4ff29cac 100644 --- a/src/drivers/Qt/nes_shm.h +++ b/src/drivers/Qt/nes_shm.h @@ -89,4 +89,6 @@ extern nes_shm_t *nes_shm; nes_shm_t *open_nes_shm(void); +void close_nes_shm(void); + #endif diff --git a/src/video.cpp b/src/video.cpp index 8a3e747d..7167ea0f 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -87,23 +87,23 @@ std::string FCEUI_GetSnapshotAsName() { return AsSnapshotName; } void FCEU_KillVirtualVideo(void) { - //mbg merge TODO 7/17/06 temporarily removed - //if(xbsave) - //{ - // free(xbsave); - // xbsave=0; - //} - //if(XBuf) - //{ - //UnmapViewOfFile(XBuf); - //CloseHandle(mapXBuf); - //mapXBuf=NULL; - //} - //if(XBackBuf) - //{ - // free(XBackBuf); - // XBackBuf=0; - //} + if ( XBuf ) + { + FCEU_free(XBuf); XBuf = NULL; + } + if ( XBackBuf ) + { + FCEU_free(XBackBuf); XBackBuf = NULL; + } + if ( XDBuf ) + { + FCEU_free(XDBuf); XDBuf = NULL; + } + if ( XDBackBuf ) + { + FCEU_free(XDBackBuf); XDBackBuf = NULL; + } + //printf("Video Core Cleanup\n"); } /**