Beispiel #1
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);
                }
            }
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
 public static void Initialize()
 {
     lock (staticsyncroot)
     {
         if (_Instance == null)
         {
             _Instance = new BootGodDB();
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// looks up from the bootgod DB
 /// </summary>
 CartInfo IdentifyFromBootGodDB(IEnumerable <string> hash_sha1)
 {
     BootGodDB.Initialize();
     foreach (var hash in hash_sha1)
     {
         List <CartInfo> choices = BootGodDB.Instance.Identify(hash);
         //pick the first board for this hash arbitrarily. it probably doesn't make a difference
         if (choices.Count != 0)
         {
             return(choices[0]);
         }
     }
     return(null);
 }
Beispiel #5
0
 public static void Initialize()
 {
     lock (staticsyncroot)
     {
         if (_Instance == null)
             _Instance = new BootGodDB();
     }
 }
Beispiel #6
0
 private NES()
 {
     BootGodDB.Initialize();
 }