From 1cc8014cc48ffc8bb0cfc480681e32facf50e652 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 21 Apr 2010 11:19:01 +0300 Subject: [PATCH] Don't wedge the emulator if filename to dump to can't be opened. RAWVideoDumper proceeded even if it couldn't open the output file, resulting emulator stackdumping on first frame it tried to dump. Fix this. --- Changelog.utf8 | 1 + org/jpc/plugins/RAWAudioDumper.java | 7 ++++++- org/jpc/plugins/RAWVideoDumper.java | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Changelog.utf8 b/Changelog.utf8 index 3594e34..cdae6b1 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -46,6 +46,7 @@ Change since JPC-RR Release 9.1: - If shift is held while selecting vkeyboard key, send two edges. - Sound card (FM and PCM) support. - Actually normalize coefficients in rawtorgb. +- Don't wedge the emulator if filename to dump to can't be opened. Changes from JPC-RR Release 9 to JPC-RR Release 9.1: ==================================================== diff --git a/org/jpc/plugins/RAWAudioDumper.java b/org/jpc/plugins/RAWAudioDumper.java index 9fbe580..85868e7 100644 --- a/org/jpc/plugins/RAWAudioDumper.java +++ b/org/jpc/plugins/RAWAudioDumper.java @@ -64,7 +64,12 @@ public class RAWAudioDumper implements Plugin if(soundName == null) throw new IOException("Sound name (src) required for RAWAudioDumper"); System.err.println("Notice: Filename: " + fileName + " soundtrack: " + soundName + "."); - stream = new FileOutputStream(fileName); + try { + stream = new FileOutputStream(fileName); + } catch(Exception e) { + System.err.println("Error: Failed to open raw output file."); + throw new IOException("Can't open dumpfile '" + fileName + "':" + e.getMessage()); + } shuttingDown = false; shutDown = false; pcRunStatus = false; diff --git a/org/jpc/plugins/RAWVideoDumper.java b/org/jpc/plugins/RAWVideoDumper.java index 34c986d..ed60774 100644 --- a/org/jpc/plugins/RAWVideoDumper.java +++ b/org/jpc/plugins/RAWVideoDumper.java @@ -65,6 +65,7 @@ public class RAWVideoDumper implements Plugin rawOutputStream = new DeflaterOutputStream(new FileOutputStream(rawOutput)); } catch(Exception e) { System.err.println("Error: Failed to open raw output file."); + throw new IOException("Can't open dumpfile '" + rawOutput + "':" + e.getMessage()); } } shuttingDown = false; -- 2.11.4.GIT