예제 #1
0
 /// <summary>
 /// looks up from the bootgod DB
 /// </summary>
 private CartInfo IdentifyFromBootGodDB(IEnumerable <string> hash_sha1)
 {
     foreach (var hash in hash_sha1)
     {
         List <CartInfo> choices = BootGodDb.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);
 }
예제 #2
0
        public static void Initialize(string basePath)
        {
            if (acquire != null)
            {
                throw new InvalidOperationException("Bootgod DB multiply initialized");
            }
            acquire = new EventWaitHandle(false, EventResetMode.ManualReset);

            var stopwatch = Stopwatch.StartNew();

            ThreadPool.QueueUserWorkItem(_ =>
            {
                instance = new BootGodDb(basePath);
                Util.DebugWriteLine("Bootgod DB load: " + stopwatch.Elapsed + " sec");
                acquire.Set();
            });
        }
예제 #3
0
 private NES()
 {
     BootGodDb.Initialize();
 }
예제 #4
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;

            BootGodDb.Initialize();
            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 {
                Header = 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);
                }
            }
        }