MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / startGame

Method startGame

data/src/emulator.js:981–1037  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

979 });
980 }
981 startGame() {
982 try {
983 const args = [];
984 if (this.debug) args.push("-v");
985 args.push("/" + this.fileName);
986 if (this.debug) console.log(args);
987 this.Module.callMain(args);
988 if (typeof this.config.softLoad === "number" && this.config.softLoad > 0) {
989 this.resetTimeout = setTimeout(() => {
990 this.gameManager.restart();
991 }, this.config.softLoad * 1000);
992 }
993 this.Module.resumeMainLoop();
994 this.checkSupportedOpts();
995 this.setupDisksMenu();
996 // hide the disks menu if the disk count is not greater than 1
997 if (!(this.gameManager.getDiskCount() > 1)) {
998 this.diskParent.style.display = "none";
999 }
1000 this.setupSettingsMenu();
1001 this.loadSettings();
1002 this.updateCheatUI();
1003 this.updateGamepadLabels();
1004 if (!this.muted) this.setVolume(this.volume);
1005 if (this.config.noAutoFocus !== true) this.elements.parent.focus();
1006 this.textElem.remove();
1007 this.textElem = null;
1008 this.game.classList.remove("ejs_game");
1009 this.game.classList.add("ejs_canvas_parent");
1010 this.game.appendChild(this.canvas);
1011 this.handleResize();
1012 this.started = true;
1013 this.paused = false;
1014 if (this.touch) {
1015 this.virtualGamepad.style.display = "";
1016 }
1017 this.handleResize();
1018 if (this.config.fullscreenOnLoad) {
1019 try {
1020 this.toggleFullscreen(true);
1021 } catch(e) {
1022 if (this.debug) console.warn("Could not fullscreen on load");
1023 }
1024 }
1025 this.menu.open();
1026 if (this.isSafari && this.isMobile) {
1027 //Safari is --- funny
1028 this.checkStarted();
1029 }
1030 } catch(e) {
1031 console.warn("Failed to start game", e);
1032 this.startGameError(this.localization("Failed to start game"));
1033 this.callEvent("exit");
1034 return;
1035 }
1036 this.callEvent("start");
1037 }
1038 checkStarted() {

Callers 1

downloadFilesMethod · 0.95

Calls 14

checkSupportedOptsMethod · 0.95
setupDisksMenuMethod · 0.95
setupSettingsMenuMethod · 0.95
loadSettingsMethod · 0.95
updateCheatUIMethod · 0.95
updateGamepadLabelsMethod · 0.95
handleResizeMethod · 0.95
checkStartedMethod · 0.95
startGameErrorMethod · 0.95
localizationMethod · 0.95
callEventMethod · 0.95
restartMethod · 0.80

Tested by

no test coverage detected