示例#1
0
文件: NES.cs 项目: ddugovic/RASuite
		public NES(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)
		{
			byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
			if (fdsbios != null && fdsbios.Length == 40976)
			{
				comm.ShowMessage("Your FDS BIOS is a bad dump.  BizHawk will attempt to use it, but no guarantees!  You should find a new one.");
				var tmp = new byte[8192];
				Buffer.BlockCopy(fdsbios, 16 + 8192 * 3, tmp, 0, 8192);
				fdsbios = tmp;
			}

			this.SyncSettings = (NESSyncSettings)SyncSettings ?? new NESSyncSettings();
			this.ControllerSettings = this.SyncSettings.Controls;
			CoreComm = comm;
			CoreComm.CpuTraceAvailable = true;
			BootGodDB.Initialize();
			videoProvider = new MyVideoProvider(this);
			Init(game, rom, fdsbios);
			if (board is FDS)
			{
				CoreComm.UsesDriveLed = true;
				(board as FDS).SetDriveLightCallback((val) => CoreComm.DriveLED = val);
			}
			PutSettings(Settings ?? new NESSettings());
		}
示例#2
0
        public NES(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
            if (fdsbios != null && fdsbios.Length == 40976)
            {
                comm.ShowMessage("Your FDS BIOS is a bad dump.  BizHawk will attempt to use it, but no guarantees!  You should find a new one.");
                var tmp = new byte[8192];
                Buffer.BlockCopy(fdsbios, 16 + 8192 * 3, tmp, 0, 8192);
                fdsbios = tmp;
            }

            SyncSettings       = (NESSyncSettings)syncSettings ?? new NESSyncSettings();
            ControllerSettings = SyncSettings.Controls;
            CoreComm           = comm;

            MemoryCallbacks = new MemoryCallbackSystem();
            BootGodDB.Initialize();
            videoProvider = new MyVideoProvider(this);
            Init(game, rom, fdsbios);
            if (Board is FDS)
            {
                DriveLightEnabled = true;
                (Board as FDS).SetDriveLightCallback((val) => DriveLightOn = val);
                // bit of a hack: we don't have a private gamedb for FDS, but the frontend
                // expects this to be set.
                RomStatus = game.Status;
            }
            PutSettings((NESSettings)settings ?? new NESSettings());

            // we need to put this here because the line directly above will overwrite palette intialization anywhere else
            // TODO: What if settings are later loaded?
            if (_isVS)
            {
                PickVSPalette(cart);
            }


            ser.Register <IDisassemblable>(cpu);

            Tracer = new TraceBuffer {
                Header = cpu.TraceHeader
            };
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(videoProvider);
            ser.Register <ISoundProvider>(magicSoundProvider);

            if (Board is BANDAI_FCG_1)
            {
                var reader = (Board as BANDAI_FCG_1).reader;
                // not all BANDAI FCG 1 boards have a barcode reader
                if (reader != null)
                {
                    ser.Register <DatachBarcode>(reader);
                }
            }
        }
示例#3
0
文件: NES.cs 项目: stuff2600/RAEmus
        public NES(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)
        {
            byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
            if (fdsbios != null && fdsbios.Length == 40976)
            {
                comm.ShowMessage("Your FDS BIOS is a bad dump.  BizHawk will attempt to use it, but no guarantees!  You should find a new one.");
                var tmp = new byte[8192];
                Buffer.BlockCopy(fdsbios, 16 + 8192 * 3, tmp, 0, 8192);
                fdsbios = tmp;
            }

            this.SyncSettings       = (NESSyncSettings)SyncSettings ?? new NESSyncSettings();
            this.ControllerSettings = this.SyncSettings.Controls;
            CoreComm = comm;
            CoreComm.CpuTraceAvailable = true;
            BootGodDB.Initialize();
            videoProvider = new MyVideoProvider(this);
            Init(game, rom, fdsbios);
            if (board is FDS)
            {
                CoreComm.UsesDriveLed = true;
                (board as FDS).SetDriveLightCallback((val) => CoreComm.DriveLED = val);
            }
            PutSettings(Settings ?? new NESSettings());
        }
示例#4
0
文件: NES.cs 项目: TASeditor/BizHawk
        public NES(CoreComm comm, GameInfo game, byte[] rom, NESSettings settings, NESSyncSettings syncSettings, bool subframe = false)
        {
            var ser = new BasicServiceProvider(this);

            ServiceProvider = ser;

            var fdsBios = comm.CoreFileProvider.GetFirmware(new("NES", "Bios_FDS"));

            if (fdsBios != null && fdsBios.Length == 40976)
            {
                comm.ShowMessage("Your FDS BIOS is a bad dump.  BizHawk will attempt to use it, but no guarantees!  You should find a new one.");
                var tmp = new byte[8192];
                Buffer.BlockCopy(fdsBios, 16 + 8192 * 3, tmp, 0, 8192);
                fdsBios = tmp;
            }

            SyncSettings       = (NESSyncSettings)syncSettings ?? new NESSyncSettings();
            ControllerSettings = SyncSettings.Controls;

            videoProvider = new MyVideoProvider(this);
            Init(game, rom, fdsBios);
            if (Board is FDS fds)
            {
                DriveLightEnabled = true;
                fds.SetDriveLightCallback(val => DriveLightOn = val);
                // bit of a hack: we don't have a private gamedb for FDS, but the frontend
                // expects this to be set.
                RomStatus = game.Status;
            }
            PutSettings((NESSettings)settings ?? new NESSettings());

            // we need to put this here because the line directly above will overwrite palette intialization anywhere else
            // TODO: What if settings are later loaded?
            if (_isVS)
            {
                PickVSPalette(cart);
            }

            ser.Register <IDisassemblable>(cpu);

            Tracer = new TraceBuffer(cpu.TraceHeader);
            ser.Register <ITraceable>(Tracer);
            ser.Register <IVideoProvider>(videoProvider);
            ser.Register <ISoundProvider>(this);
            ser.Register <IStatable>(new StateSerializer(SyncState)
            {
                LoadStateCallback = SetupMemoryDomains
            });

            if (Board is BANDAI_FCG_1 bandai)
            {
                var reader = bandai.reader;
                // not all BANDAI FCG 1 boards have a barcode reader
                if (reader != null)
                {
                    ser.Register(reader);
                }
            }

            ResetControllerDefinition(subframe);
        }