From 0ec9153d06bc8824f8d85bc42ec9c0819cc2ecf3 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Thu, 2 Apr 2015 19:29:47 -0700 Subject: [PATCH] handle an unknown native resolution without errors, at least --- loader.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/loader.js b/loader.js index 1a8932c..f35caa7 100644 --- a/loader.js +++ b/loader.js @@ -306,8 +306,8 @@ var Module = null; function JSMESSLoader() { var config = Array.prototype.reduce.call(arguments, extend); config.emulator_arguments = build_mess_arguments(config.muted, config.mess_driver, - [config.nativeResolution.width, config.nativeResolution.height], - config.sample_rate, config.peripheral, config.extra_mess_args); + config.nativeResolution, config.sample_rate, + config.peripheral, config.extra_mess_args); config.needs_jsmess_webaudio = true; return config; } @@ -328,8 +328,8 @@ var Module = null; function JSMAMELoader() { var config = Array.prototype.reduce.call(arguments, extend); config.emulator_arguments = build_mame_arguments(config.muted, config.mess_driver, - [config.nativeResolution.width, config.nativeResolution.height], - config.sample_rate, config.extra_mess_args); + config.nativeResolution, config.sample_rate, + config.extra_mess_args); config.needs_jsmess_webaudio = true; return config; } @@ -348,9 +348,12 @@ var Module = null; '-verbose', '-rompath', 'emulator', '-window', - '-resolution', native_resolution.join('x'), '-nokeepaspect']; + if (native_resolution && "width" in native_resolution && "height" in native_resolution) { + args.push('-resolution', [native_resolution.width, native_resolution.height].join('x')); + } + if (muted) { args.push('-sound', 'none'); } else if (sample_rate) { @@ -374,9 +377,12 @@ var Module = null; '-verbose', '-rompath', 'emulator', '-window', - '-resolution', native_resolution.join('x'), '-nokeepaspect']; + if (native_resolution && "width" in native_resolution && "height" in native_resolution) { + args.push('-resolution', [native_resolution.width, native_resolution.height].join('x')); + } + if (muted) { args.push('-sound', 'none'); } else if (sample_rate) {