提交 073f34fa 编写于 作者: P Pengan Zhou

Add support for IE11

上级 bf813551
...@@ -8,12 +8,17 @@ function getUrlVars() { ...@@ -8,12 +8,17 @@ function getUrlVars() {
} }
function runMAME(cart, device) { function runMAME(cart, device) {
var wantsWASM = 'WebAssembly' in window;
var wasmjs_filename = "http://dnbwg.cdn.bcebos.com/emularity-common/emulators/jsmess/mamenes_wasm.js";
var wasm_filename = "http://dnbwg.cdn.bcebos.com/emularity-common/emulators/jsmess/mamenes_wasm.wasm"
var js_filename = "http://dnbwg.cdn.bcebos.com/emularity-common/emulators/jsmess/mamenes.js"
var emulator = new Emulator(document.querySelector("#emularity-canvas"), var emulator = new Emulator(document.querySelector("#emularity-canvas"),
postRun, postRun,
new JSMESSLoader(JSMESSLoader.driver(device), new JSMESSLoader(JSMESSLoader.driver(device),
JSMESSLoader.nativeResolution(640, 480), JSMESSLoader.nativeResolution(640, 480),
JSMESSLoader.emulatorJS("http://dnbwg.cdn.bcebos.com/emularity-common/emulators/jsmess/mamenes_wasm.js"), JSMESSLoader.emulatorJS(wantsWASM ? wasmjs_filename : js_filename),
JSMESSLoader.emulatorWASM("http://dnbwg.cdn.bcebos.com/emularity-common/emulators/jsmess/mamenes_wasm.wasm"), JSMESSLoader.emulatorWASM(wantsWASM && wasm_filename),
JSMESSLoader.mountFile("game.nes", JSMESSLoader.mountFile("game.nes",
JSMESSLoader.fetchFile("Game File", JSMESSLoader.fetchFile("Game File",
cart)), cart)),
...@@ -42,6 +47,23 @@ function resizeCanvas() { ...@@ -42,6 +47,23 @@ function resizeCanvas() {
} }
} }
//IE 11 string includes ployfill
if (!String.prototype.includes) {
Object.defineProperty(String.prototype, 'includes', {
value: function (search, start) {
if (typeof start !== 'number') {
start = 0
}
if (start + search.length > this.length) {
return false
} else {
return this.indexOf(search, start) !== -1
}
}
})
}
$(document).ready(function () { $(document).ready(function () {
console.log("ready!"); console.log("ready!");
var gameBaseUrl = "http://dnbwg3.cdn.bcebos.com/NES-China/" var gameBaseUrl = "http://dnbwg3.cdn.bcebos.com/NES-China/"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册