Exemple #1
0
        public Snes9x(CoreComm NextComm, byte[] rom)
        {
            if (!LibSnes9x.debug_init(rom, rom.Length))
            {
                throw new Exception();
            }

            CoreComm = NextComm;
        }
Exemple #2
0
        public Snes9x(CoreComm comm, byte[] rom)
        {
            if (!LibSnes9x.debug_init(rom, rom.Length))
            {
                throw new Exception();
            }

            ServiceProvider = new BasicServiceProvider(this);
            CoreComm        = comm;
        }
Exemple #3
0
        public Snes9x(CoreComm comm, byte[] rom, Settings settings, SyncSettings syncSettings)
            : base(comm, new Configuration
        {
            DefaultWidth  = 256,
            DefaultHeight = 224,
            MaxWidth      = 512,
            MaxHeight     = 480,
            MaxSamples    = 8192,
            SystemId      = VSystemID.Raw.SNES,
        })
        {
            settings ??= new Settings();
            syncSettings ??= new SyncSettings();

            _core = PreInit <LibSnes9x>(new WaterboxOptions
            {
                Filename                   = "snes9x.wbx",
                SbrkHeapSizeKB             = 1024,
                SealedHeapSizeKB           = 12 * 1024,
                InvisibleHeapSizeKB        = 6 * 1024,
                PlainHeapSizeKB            = 12 * 1024,
                SkipCoreConsistencyCheck   = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxCoreConsistencyCheck),
                SkipMemoryConsistencyCheck = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck),
            });

            if (!_core.biz_init())
            {
                throw new InvalidOperationException("Init() failed");
            }
            if (!_core.biz_load_rom(rom, rom.Length))
            {
                throw new InvalidOperationException("LoadRom() failed");
            }

            PostInit();

            if (_core.biz_is_ntsc())
            {
                Console.WriteLine("NTSC rom loaded");
                VsyncNumerator   = 21477272;
                VsyncDenominator = 357366;
                Region           = DisplayType.NTSC;
            }
            else
            {
                Console.WriteLine("PAL rom loaded");
                VsyncNumerator   = 21281370;
                VsyncDenominator = 425568;
                Region           = DisplayType.PAL;
            }

            _syncSettings = syncSettings;
            InitControllers();
            PutSettings(settings);
        }
Exemple #4
0
        public void FrameAdvance(bool render, bool rendersound = true)
        {
            Frame++;

            LibSnes9x.debug_advance(_vbuff);

            if (IsLagFrame)
            {
                LagCount++;
            }
        }
Exemple #5
0
        public void FrameAdvance(bool render, bool rendersound = true)
        {
            Frame++;

            LibSnes9x.debug_advance(_vbuff);
        }