(wasmData, threadData)
| 931 | })(); |
| 932 | } |
| 933 | initModule(wasmData, threadData) { |
| 934 | if (typeof window.EJS_Runtime !== "function") { |
| 935 | console.warn("EJS_Runtime is not defined!"); |
| 936 | this.startGameError(this.localization("Error loading EmulatorJS runtime")); |
| 937 | throw new Error("EJS_Runtime is not defined!"); |
| 938 | } |
| 939 | window.EJS_Runtime({ |
| 940 | noInitialRun: true, |
| 941 | onRuntimeInitialized: null, |
| 942 | arguments: [], |
| 943 | preRun: [], |
| 944 | postRun: [], |
| 945 | canvas: this.canvas, |
| 946 | callbacks: {}, |
| 947 | parent: this.elements.parent, |
| 948 | print: (msg) => { |
| 949 | if (this.debug) { |
| 950 | console.log(msg); |
| 951 | } |
| 952 | }, |
| 953 | printErr: (msg) => { |
| 954 | if (this.debug) { |
| 955 | console.log(msg); |
| 956 | } |
| 957 | }, |
| 958 | totalDependencies: 0, |
| 959 | locateFile: function (fileName) { |
| 960 | if (this.debug) console.log(fileName); |
| 961 | if (fileName.endsWith(".wasm")) { |
| 962 | return URL.createObjectURL(new Blob([wasmData], { type: "application/wasm" })); |
| 963 | } else if (fileName.endsWith(".worker.js")) { |
| 964 | return URL.createObjectURL(new Blob([threadData], { type: "application/javascript" })); |
| 965 | } |
| 966 | }, |
| 967 | getSavExt: () => { |
| 968 | if (this.saveFileExt) { |
| 969 | return "." + this.saveFileExt; |
| 970 | } |
| 971 | return ".srm"; |
| 972 | } |
| 973 | }).then(module => { |
| 974 | this.Module = module; |
| 975 | this.downloadFiles(); |
| 976 | }).catch(e => { |
| 977 | console.warn(e); |
| 978 | this.startGameError(this.localization("Failed to start game")); |
| 979 | }); |
| 980 | } |
| 981 | startGame() { |
| 982 | try { |
| 983 | const args = []; |
no test coverage detected