Пример #1
0
        public Pizza(byte[] rom, CoreComm comm, bool sgb)
            : base(comm, new Configuration
        {
            DefaultWidth          = 160,
            DefaultHeight         = 144,
            MaxWidth              = 256,
            MaxHeight             = 224,
            MaxSamples            = 1024,
            DefaultFpsNumerator   = TICKSPERSECOND,
            DefaultFpsDenominator = TICKSPERFRAME
        })
        {
            if (sgb && (rom[0x143] & 0xc0) == 0xc0)
            {
                throw new CGBNotSupportedException();
            }

            _pizza = PreInit <LibPizza>(new PeRunnerOptions
            {
                Filename            = "pizza.wbx",
                SbrkHeapSizeKB      = 128,
                InvisibleHeapSizeKB = 16,
                SealedHeapSizeKB    = 5 * 1024,
                PlainHeapSizeKB     = 16,
                MmapHeapSizeKB      = 0
            });

            var spc = sgb
                                ? Util.DecompressGzipFile(new MemoryStream(Properties.Resources.SgbCartPresent_SPC))
                                : new byte[0];

            _sgb = sgb;
            if (!_pizza.Init(rom, rom.Length, _sgb, spc, spc.Length))
            {
                throw new InvalidOperationException("Core rejected the rom!");
            }

            PostInit();

            if (_sgb)
            {
                VsyncNumerator = TICKSPERSECOND_SGB;
                BufferWidth    = 256;
                BufferHeight   = 224;
            }
            InitializeRtc(new DateTime(2010, 1, 1));             // TODO: connect to syncsettings
            Console.WriteLine("Pizza Initialized: CGB {0} SGB {1}", IsCGBMode(), IsSGBMode());
        }
Пример #2
0
        public Pizza(byte[] rom, CoreComm comm)
            : base(comm, new Configuration
        {
            DefaultWidth          = 160,
            DefaultHeight         = 144,
            MaxWidth              = 256,
            MaxHeight             = 224,
            MaxSamples            = 1024,
            SystemId              = "SGB",
            DefaultFpsNumerator   = TICKSPERSECOND,
            DefaultFpsDenominator = TICKSPERFRAME
        })
        {
            _pizza = PreInit <LibPizza>(new PeRunnerOptions
            {
                Filename            = "pizza.wbx",
                SbrkHeapSizeKB      = 128,
                InvisibleHeapSizeKB = 16,
                SealedHeapSizeKB    = 5 * 1024,
                PlainHeapSizeKB     = 16,
                MmapHeapSizeKB      = 0
            });

            var spc = comm.CoreFileProvider.GetFirmware("SGB", "SPC", true);

            _sgb = true;
            if (!_pizza.Init(rom, rom.Length, _sgb, spc, spc.Length))
            {
                throw new InvalidOperationException("Core rejected the rom!");
            }

            PostInit();

            if (_sgb)
            {
                VsyncNumerator = TICKSPERSECOND_SGB;
                BufferWidth    = 256;
                BufferHeight   = 224;
            }
            InitializeRtc(new DateTime(2010, 1, 1));             // TODO: connect to syncsettings
            Console.WriteLine("Pizza Initialized: CGB {0} SGB {1}", IsCGBMode(), IsSGBMode());
        }