mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-09-07 15:54:26 +00:00
8 lines
16 KiB
Plaintext
8 lines
16 KiB
Plaintext
|
{
|
||
|
"version": 3,
|
||
|
"sources": ["../src/common/mameplatform.ts"],
|
||
|
"sourcesContent": ["\n/// MAME SUPPORT\n\nimport { EmuState, DisasmLine, cpuStateToLongString_6502, cpuStateToLongString_Z80 } from \"./baseplatform\";\nimport { disassemble6502 } from \"./cpu/disasm6502\";\nimport { disassembleZ80 } from \"./cpu/disasmz80\";\nimport { AnimationTimer, RAM, RasterVideo } from \"./emu\";\n\ndeclare var FS, ENV, Module; // mame emscripten\n\nexport abstract class BaseMAMEPlatform {\n\n loaded : boolean = false;\n preinitted : boolean = false;\n started : boolean = false;\n romfn : string;\n romdata : Uint8Array;\n romtype : string = 'cart';\n video;\n running = false;\n initluavars : boolean = false;\n luadebugscript : string;\n js_lua_string;\n onBreakpointHit;\n mainElement : HTMLElement;\n timer : AnimationTimer;\n\n constructor(mainElement) {\n this.mainElement = mainElement;\n this.timer = new AnimationTimer(20, this.poll.bind(this));\n }\n\n // http://docs.mamedev.org/techspecs/luaengine.html\n luacall(s:string) : string {\n if (!this.js_lua_string) this.js_lua_string = Module.cwrap('_Z13js_lua_stringPKc', 'string', ['string']);\n return this.js_lua_string(s || \"\");\n }\n\n _pause() {\n this.running = false;\n this.timer.stop();\n }\n pause() {\n if (this.loaded && this.running) {\n this.luacall('emu.pause()');\n this._pause();\n }\n }\n\n _resume() {\n this.luacall('emu.unpause()');\n this.running = true;\n this.timer.start();\n }\n resume() {\n if (this.loaded && !this.running) { // TODO\n this._resume();\n }\n }\n\n reset() {\n if (this.loaded) {\n this.luacall('manager:machine():soft_reset()');\n this.running = true;\n this.initluavars = false;\n }\n }\n\n isRunning() {\n return this.running;\n }\n\n bufferConsoleOutput(s) {\n if (typeof s !== 'string') return;\n console.log(s);\n }\n\n startModule(mainElement, opts) {\n this.started = true;\n var romfn = this.romfn = this.romfn || opts.romfn;\n var romdata = this.romdata = this.romdata || opts.romdata || new RAM(opts.romsize).mem;\n var romtype = this.romtype = this.romtype || opts.romtype;\n // create canvas\n var video = this.video = new RasterVideo(this.mainElement, opts.width, opts.height);\n video.create();\n $(video.canvas).attr('id','canvas');\n // load asm.js module\n console.log(\"loading\", opts.jsfile);\n var modargs = [opts.driver,\n '-debug',\n '-debugger', 'none',\n '-verbose', '-window', '-nokeepaspect',\n '-resolution', video.canvas.width+'x'+video.canvas.height\n ];\n if (romfn) {\n modargs.push('-'+romtype, romfn);\n }\n if (opts.extraargs) {\n modargs = modargs.concat(opts.extraargs);\n }\n console.log(modargs);\n window['JSMESS'] = {};\n window['Module'] = {\n arguments: modargs,\n screenIsReadOnly: true,\n print: this.bufferConsoleOutput,\n canvas:video.canvas,\n doNotCaptureKeyboard:true,\n keyboardListeningElement:video.canvas,\n preInit: () => {\n console.log(\"loading FS\");\n ENV.SDL_EMSCRIPTEN_KEYBOARD_ELEMENT = 'canvas';\n if (opts.cfgfile) {\n FS.mkdir('/cfg');\n FS.writeFile('/cfg/' + opts.cfgfile, opts.cfgdata, {encoding:'utf8'});\n }\n if (opts.biosfile) {\n FS.mkdir('/roms');\n FS.mkdir('/roms/' + opts.driver);\n FS.writeFile('/roms/' + opts.biosfile, opts.biosdata, {encoding:'binary'});\n }\n FS.mkdir('/emulator');\n if (romfn) {\n FS.writeFile(romfn, romdata, {encoding:'binary'});\n }\n //FS.writeFile('/debug.ini', 'debugger none\\n', {encoding:'utf8'});\n if (opts.preInit) {\n opts.preInit(self);\n }\n this.preinitted = true;\n },\n preRun: [\n () => {\n $(video.canvas).click((e) =>{\n video.canvas.focus();\n });\n this.loaded = true;\n console.log(\"about to run...\");\n }\n ]\n };\n // preload files\n // TODO: ensure
|
||
|
"mappings": "8GAUO,WAAgC,CAiBrC,YAAY,EAAa,CAfzB,YAAmB,GACnB,gBAAuB,GACvB,aAAoB,GAGpB,aAAmB,OAEnB,aAAU,GACV,iBAAwB,GAQtB,KAAK,YA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