Release bsx streams on reset

This commit is contained in:
OV2 2017-04-17 12:46:20 +02:00
parent 51dfeeac9e
commit 4c87a84328
2 changed files with 13 additions and 6 deletions

13
bsx.cpp
View File

@ -899,7 +899,8 @@ void S9xSetBSX (uint8 byte, uint32 address)
void S9xBSXSetStream1 (uint8 count)
{
if (BSX.sat_stream1.is_open()) BSX.sat_stream1.close(); //If Stream1 already opened for one file: Close it.
if (BSX.sat_stream1.is_open())
BSX.sat_stream1.close(); //If Stream1 already opened for one file: Close it.
char path[PATH_MAX + 1], name[PATH_MAX + 1];
@ -930,7 +931,8 @@ void S9xBSXSetStream1 (uint8 count)
void S9xBSXSetStream2 (uint8 count)
{
if (BSX.sat_stream2.is_open()) BSX.sat_stream2.close(); //If Stream1 already opened for one file: Close it.
if (BSX.sat_stream2.is_open())
BSX.sat_stream2.close(); //If Stream1 already opened for one file: Close it.
char path[PATH_MAX + 1], name[PATH_MAX + 1];
@ -1519,6 +1521,13 @@ void S9xResetBSX (void)
BSX.sat_stream1_first, BSX.sat_stream2_first = FALSE;
BSX.sat_stream1_count, BSX.sat_stream2_count = 0;
if (BSX.sat_stream1.is_open())
BSX.sat_stream1.close();
if (BSX.sat_stream2.is_open())
BSX.sat_stream2.close();
if (Settings.BS)
BSX_Map();
}

View File

@ -288,9 +288,7 @@ void S9xReset (void)
memset(Memory.VRAM, 0x00, 0x10000);
memset(Memory.FillRAM, 0, 0x8000);
if (Settings.BS)
S9xResetBSX();
S9xResetCPU();
S9xResetPPU();
S9xResetDMA();