From ad5d28af4e0fc26718a02907d688664f298bb652 Mon Sep 17 00:00:00 2001 From: Matthew Brennan Jones Date: Sun, 22 Jun 2014 15:43:33 -0700 Subject: [PATCH] Fixed issue with DSP Dump not closing files. When dumping the two DSP ROMs to file, if it failed to open one of them, neither will be closed. It should now close any that were opened. --- Source/DSPSpy/main_spy.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/DSPSpy/main_spy.cpp b/Source/DSPSpy/main_spy.cpp index e3a718e87c..b21493a89e 100644 --- a/Source/DSPSpy/main_spy.cpp +++ b/Source/DSPSpy/main_spy.cpp @@ -224,19 +224,23 @@ void DumpDSP_ROMs(const u16* rom, const u16* coef) FILE *fROM = fopen(filename, "wb"); sprintf(filename, "sd:/dsp_coef.bin"); FILE *fCOEF = fopen(filename, "wb"); + if (fROM && fCOEF) { fwrite(MEM_PHYSICAL_TO_K0(rom), 0x2000, 1, fROM); - fclose(fROM); + fwrite(MEM_PHYSICAL_TO_K0(coef), 0x1000, 1, fCOEF); - fwrite(MEM_PHYSICAL_TO_K0(coef), 0x1000, 1, fCOEF); - fclose(fCOEF); UpdateLastMessage("DSP ROMs dumped to SD"); } else { UpdateLastMessage("SD Write Error"); } + + if (fROM) + fclose(fROM); + if (fCOEF) + fclose(fCOEF); #else // Allow to connect to gdb (dump ram... :s) _break();