Пример #1
0
        /**
         * Initialize the WPC-EMU
         * @function
         * @param {Object} romObject, rom data (sound and main game). NOTE: DCS sound roms are not implemented yet
         * @param {Object} metaData, meta data about the current game
         * @return {promise} promise contains a new Emulator instance.
         * @example
         *
         * const romObject = {
         *   u06: Uint8Array(524288),
         * };
         * const metaData = {
         *   features: ['securityPic'], // needed for WPC-S games
         *   fileName: 'harr_lx2.rom',
         *   skipWpcRomCheck: true,     // speedup bootup for WPC games
         *   memoryPosition: [          // information about the game ram state (optional)
         *    { offset: 0x3B2, description: 'current player', type: 'uint8' }
         *   ]
         * };
         * wpcEmu.initVMwithRom(romObject, metaData)
         *   .then((emu) => {
         *     ...
         *   }
         */

        public static Emulator initVMwithRom(RomBinary romObject, RomMetaData?metaData = null)
        {
            Debug.Print("initVMwithRom {0} {1}", romObject, metaData);

            RomData romData = RomHelper.parse(romObject, metaData);

            var _romObject = new RomObject
            {
                romSizeMBit          = romData.romSizeMBit,
                systemRom            = romData.systemRom,
                fileName             = romData.fileName,
                gameRom              = romData.gameRom,
                gameIdMemoryLocation = romData.gameIdMemoryLocation,
                wpc95                  = romData.wpc95,
                hasSecurityPic         = romData.hasSecurityPic,
                skipWpcRomCheck        = romData.skipWpcRomCheck,
                hasAlphanumericDisplay = romData.hasAlphanumericDisplay,
                preDcsSoundboard       = romData.preDcsSoundboard
            };

            return(new Emulator(_romObject));
        }
Пример #2
0
 public Emulator(RomObject romObject)
 {
     cpuBoard = WpcCpuBoard.getInstance(romObject);
     uiFacade = UiState.getInstance(null);
 }