Exemple #1
0
        public WonderSwan(CoreComm comm, byte[] rom, bool deterministicEmulation, object Settings, object SyncSettings)
        {
            CoreComm      = comm;
            _Settings     = (Settings)Settings ?? new Settings();
            _SyncSettings = (SyncSettings)SyncSettings ?? new SyncSettings();

            DeterministicEmulation = deterministicEmulation;             // when true, remember to force the RTC flag!
            Core = BizSwan.bizswan_new();
            if (Core == IntPtr.Zero)
            {
                throw new InvalidOperationException("bizswan_new() returned NULL!");
            }
            try
            {
                var ss = _SyncSettings.GetNativeSettings();
                if (deterministicEmulation)
                {
                    ss.userealtime = false;
                }

                bool rotate = false;

                if (!BizSwan.bizswan_load(Core, rom, rom.Length, ref ss, ref rotate))
                {
                    throw new InvalidOperationException("bizswan_load() returned FALSE!");
                }

                // for future uses of ClearSaveRam(), it's important that we save this
                _DONTTOUCHME = ss;

                CoreComm.VsyncNum = 3072000;                 // master CPU clock, also pixel clock
                CoreComm.VsyncDen = (144 + 15) * (224 + 32); // 144 vislines, 15 vblank lines; 224 vispixels, 32 hblank pixels

                saverambuff = new byte[BizSwan.bizswan_saveramsize(Core)];

                InitVideo(rotate);
                PutSettings(_Settings);
                SetMemoryDomains();

                savebuff  = new byte[BizSwan.bizswan_binstatesize(Core)];
                savebuff2 = new byte[savebuff.Length + 13];

                InitDebugCallbacks();
            }
            catch
            {
                Dispose();
                throw;
            }
        }
 void InitISaveRam()
 {
     saverambuff = new byte[BizSwan.bizswan_saveramsize(Core)];
 }
 private void InitISaveRam()
 {
     _saveramBuff = new byte[BizSwan.bizswan_saveramsize(Core)];
 }