示例#1
0
        /// <summary>
        /// finds a board class which can handle the provided cart
        /// </summary>
        private static Type FindBoard(CartInfo cart, EDetectionOrigin origin, Dictionary <string, string> properties)
        {
            NES nes = new NES {
                cart = cart
            };
            Type ret = null;

            lock (INESBoardImplementors)
                foreach (var type in INESBoardImplementors)
                {
                    NesBoardBase board = (NesBoardBase)Activator.CreateInstance(type);
                    //unif demands that the boards set themselves up with expected legal values based on the board size
                    //except, i guess, for the rom/chr sizes. go figure.
                    //so, disable the asserts here
                    if (origin == EDetectionOrigin.UNIF)
                    {
                        board.DisableConfigAsserts = true;
                    }

                    board.Create(nes);
                    board.InitialRegisterValues = properties;
                    if (board.Configure(origin))
                    {
#if DEBUG
                        if (ret != null)
                        {
                            throw new Exception($"Boards {ret} and {type} both responded to {nameof(NesBoardBase.Configure)}!");
                        }
                        ret = type;
#else
                        return(type);
#endif
                    }
                }
            return(ret);
        }
 public Mapper197_MMC3(NesBoardBase board, int num_prg_banks) : base(board, num_prg_banks)
 {
 }
示例#3
0
 public Namcot108Chip(NesBoardBase board)
 {
     Sync();
 }
示例#4
0
 public MMC3Variant(NesBoardBase board)
     : base(board, 0)
 {
 }