Skip to content

Commit

Permalink
deprecate Emulator.setScale in favor of BaseLoader.setScale
Browse files Browse the repository at this point in the history
  • Loading branch information
db48x committed Jul 15, 2019
1 parent e4388d1 commit 8ad749e
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 19 deletions.
8 changes: 5 additions & 3 deletions TECHNICAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ copy of the rom (which it loads from examples/1943.zip).
null,
new MAMELoader(MAMELoader.driver("1943"),
MAMELoader.nativeResolution(224, 256),
MAMELoader.scale(3),
MAMELoader.emulatorJS("emulators/mess1943.js"),
MAMELoader.mountFile("1943.zip",
MAMELoader.fetchFile("Game File",
"examples/1943.zip"))))
emulator.setScale(3);
emulator.start({ waitAfterDownloading: true });

### Console game for Atari 2600 ###
Expand All @@ -58,6 +58,7 @@ keybindings needed to use the 2600.
null,
new MAMELoader(MAMELoader.driver("a2600"),
MAMELoader.nativeResolution(352, 223),
MAMELoader.scale(3),
MAMELoader.emulatorJS("emulators/messa2600.js"),
MAMELoader.mountFile("Pitfall_Activision_1982.bin",
MAMELoader.fetchFile("Game File",
Expand All @@ -66,7 +67,7 @@ keybindings needed to use the 2600.
MAMELoader.fetchFile("Config File",
"examples/a2600.cfg")),
MAMELoader.peripheral("cart", "Pitfall_Activision_1982.bin")))
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });

### DOS game ###

Expand Down Expand Up @@ -95,6 +96,7 @@ provide their names in the right order.
new SAELoader(SAELoader.model("A500"),
SAELoader.fastMemory(2),
SAELoader.nativeResolution(720, 568),
SAELoader.scale(2),
SAELoader.emulatorJS("emulators/sae/scriptedamigaemulator.js"),
SAELoader.mountFile("aros-amiga-m68k-rom.bin",
SAELoader.fetchFile("Bios",
Expand All @@ -107,7 +109,7 @@ provide their names in the right order.
SAELoader.fetchFile("Game",
"examples/Cool_Demos_17.2_1989_Razor_1911.adf")),
SAELoader.floppy(0, "Cool_Demos_17.2_1989_Razor_1911")))
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });


## Configuration API ##
Expand Down
3 changes: 2 additions & 1 deletion example_amiga.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
new SAELoader(SAELoader.model("A500"),
SAELoader.fastMemory(2),
SAELoader.nativeResolution(720, 568),
SAELoader.scale(2),
SAELoader.emulatorJS("emulators/sae/scriptedamigaemulator.js"),
SAELoader.mountFile("aros-amiga-m68k-rom.bin",
SAELoader.fetchFile("Bios",
Expand All @@ -26,7 +27,7 @@
SAELoader.fetchFile("Game",
"examples/Cool_Demos_17.2_1989_Razor_1911.adf")),
SAELoader.floppy(0, "Cool_Demos_17.2_1989_Razor_1911")))
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion example_arcade.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
null,
new JSMAMELoader(JSMAMELoader.driver("targ"),
JSMAMELoader.nativeResolution(256, 256),
JSMAMELoader.scale(3),
JSMAMELoader.emulatorJS("emulators/jsmess/mameexidy.js"),
JSMAMELoader.mountFile("targ.zip",
JSMAMELoader.fetchFile("Game File",
"examples/targ.zip"))))
emulator.setScale(2);
emulator.start({ waitAfterDownloading: true });
</script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion example_computer.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
null,
new JSMESSLoader(JSMESSLoader.driver("apple2e"),
JSMESSLoader.nativeResolution(560, 384),
JSMESSLoader.scale(2),
JSMESSLoader.emulatorJS("emulators/jsmess/messnapple2e.js"),
JSMESSLoader.mountFile("apple2e.zip",
JSMESSLoader.fetchFile("Bios",
Expand All @@ -59,7 +60,7 @@
"examples/apple2e.cfg")),
JSMESSLoader.peripheral("flop1", "Beagle_Bag_1982_Beagle_Bros.do"),
JSMESSLoader.extraArgs(["-sl6", "diskii", "-sl4", '""'])))
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>
</html>
3 changes: 2 additions & 1 deletion example_console.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
null,
new JSMESSLoader(JSMESSLoader.driver("a2600"),
JSMESSLoader.nativeResolution(352, 223),
JSMAMELoader.scale(3),
JSMESSLoader.emulatorJS("emulators/jsmess/messa2600.js"),
JSMESSLoader.mountFile("atari_2600_halo_2600.bin",
JSMESSLoader.fetchFile("Game File",
Expand All @@ -38,7 +39,7 @@
JSMESSLoader.fetchFile("Config File",
"examples/a2600.cfg")),
JSMESSLoader.peripheral("cart", "atari_2600_halo_2600.bin")))
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>
</html>
1 change: 0 additions & 1 deletion example_ia.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<script type="text/javascript">
var emulator = new IALoader(document.querySelector("#canvas"),
"Pitfall_Activision_1982");
emulator.setScale(3);
emulator.start({ waitAfterDownloading: true });
// some other items to try are FigurePic_1020, arcade_mrdo, Wolfenstein_3d, and mac_DarkCastle_1_2
</script>
Expand Down
2 changes: 1 addition & 1 deletion example_macplus.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
null,
new PCELoader(PCELoader.model("macclassic"),
PCELoader.nativeResolution(512, 342),
PCELoader.scale(2),
PCELoader.mountFile("pce-mac-classic.rom",
PCELoader.fetchFile("ROM 1/2",
"examples/pce/pce-mac-classic.rom")),
Expand All @@ -29,7 +30,6 @@
PCELoader.fetchFile("PCE Config",
"examples/pce/pce-macclassic.cfg")),
PCELoader.emulatorJS("emulators/pce/pce-macplus.js")))
emulator.setScale(2);
emulator.start({ waitAfterDownloading: true });
</script>
</body>
Expand Down
3 changes: 2 additions & 1 deletion example_minivmac.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new NP2Loader(NP2Loader.nativeResolution(512, 342),
NP2Loader.scale(2),
NP2Loader.emulatorJS("emulators/minivmac.js"),
NP2Loader.emulatorWASM("emulators/minivmac.wasm"),
NP2Loader.mountZip("minivmac",
Expand All @@ -54,7 +55,7 @@
"examples/test7.dsk")),
NP2Loader.extraArgs(["/emulator/test7.dsk"]),
));
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>

Expand Down
3 changes: 2 additions & 1 deletion example_minivmacii.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new NP2Loader(NP2Loader.nativeResolution(640, 480),
NP2Loader.scale(2),
NP2Loader.emulatorJS("emulators/minivmacII.js"),
NP2Loader.emulatorWASM("emulators/minivmacII.wasm"),
NP2Loader.mountZip("minivmac",
Expand All @@ -54,7 +55,7 @@
"examples/test7.dsk")),
NP2Loader.extraArgs(["/emulator/test7.dsk"]),
));
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>

Expand Down
3 changes: 2 additions & 1 deletion example_np2.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new NP2Loader(NP2Loader.nativeResolution(640, 400),
NP2Loader.scale(2),
NP2Loader.emulatorJS("emulators/np2-386.js"),
NP2Loader.emulatorWASM("emulators/np2-386.wasm"),
NP2Loader.mountZip("np2",
Expand All @@ -58,7 +59,7 @@
NP2Loader.fetchFile("Configuration file",
"examples/np2/np2.cfg")),
));
emulator.setScale(3).start({ waitAfterDownloading: true });
emulator.start({ waitAfterDownloading: true });
</script>
</body>

Expand Down
2 changes: 1 addition & 1 deletion example_xmil.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
var emulator = new Emulator(document.querySelector("#canvas"),
null,
new NP2Loader(NP2Loader.nativeResolution(320, 200),
NP2Loader.scale(3),
NP2Loader.emulatorJS("emulators/xmil.js"),
NP2Loader.emulatorWASM("emulators/xmil.wasm"),
NP2Loader.mountZip("xmil-em",
Expand All @@ -53,7 +54,6 @@
"examples/np2/Gradius.2d")),
NP2Loader.extraArgs(["/emulator/Gradius.2d"]),
));
emulator.setScale(3).start({ waitAfterDownloading: true });
</script>
</body>

Expand Down
11 changes: 5 additions & 6 deletions loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ var Module = null;
}());

var metadata, filelist, module, modulecfg, config_args, emulator_logo,
emulator = new Emulator(canvas).setScale(scale)
.setSplashImage(images.ia)
emulator = new Emulator(canvas).setSplashImage(images.ia)
.setLoad(loadFiles)
.setCallbacks(callbacks);

Expand Down Expand Up @@ -199,7 +198,7 @@ var Module = null;
cfgr.fileSystemKey(game),
cfgr.nativeResolution(nr[0], nr[1]),
cfgr.aspectRatio(nr[0] / nr[1]),
cfgr.scale(scale),
cfgr.scale(scale || modulecfg.scale || 2),
cfgr.sampleRate(SAMPLE_RATE)];

if ('keepAspect' in cfgr) {
Expand Down Expand Up @@ -1290,7 +1289,7 @@ var Module = null;
document.getElementById("gofullscreen").addEventListener("click", this.requestFullScreen);
}

var css_resolution, scale, aspectRatio;
var css_resolution, aspectRatio;
// right off the bat we set the canvas's inner dimensions to
// whatever it's current css dimensions are; this isn't likely to be
// the same size that dosbox/jsmame will set it to, but it avoids
Expand All @@ -1302,7 +1301,7 @@ var Module = null;
}

this.setScale = function(_scale) {
scale = _scale;
console.warn("setScale method is deprecated; use the BaseLoader.scale method instead");
return this;
};

Expand Down Expand Up @@ -1568,7 +1567,7 @@ var Module = null;

function setup_runner() {
var runner = new game_data.runner(canvas, game_data);
resizeCanvas(canvas, scale, game_data.nativeResolution, game_data.aspectRatio);
resizeCanvas(canvas, game_data.scale, game_data.nativeResolution, game_data.aspectRatio);
runner.onStarted(function () {
splash.finished_loading = true;
splash.hide();
Expand Down

0 comments on commit 8ad749e

Please sign in to comment.