Esempio n. 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;
            }
        }
Esempio n. 2
0
        public WonderSwan(CoreComm comm, byte[] file, bool deterministic, object Settings, object SyncSettings)
        {
            ServiceProvider = new BasicServiceProvider(this);
            CoreComm        = comm;
            _Settings       = (Settings)Settings ?? new Settings();
            _SyncSettings   = (SyncSettings)SyncSettings ?? new SyncSettings();

            DeterministicEmulation = deterministic;             // 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 (deterministic)
                {
                    ss.userealtime = false;
                }

                bool rotate = false;

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

                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

                InitISaveRam();

                InitVideo(rotate);
                PutSettings(_Settings);
                InitIMemoryDomains();

                InitIStatable();
                InitDebugCallbacks();
            }
            catch
            {
                Dispose();
                throw;
            }
        }
Esempio n. 3
0
        public WonderSwan(CoreComm comm, byte[] file, bool deterministic, object settings, object syncSettings)
        {
            ServiceProvider = new BasicServiceProvider(this);
            CoreComm        = comm;
            _settings       = (Settings)settings ?? new Settings();
            _syncSettings   = (SyncSettings)syncSettings ?? new SyncSettings();

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

                bool rotate = false;

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

                InitISaveRam();

                InitVideo(rotate);
                PutSettings(_settings);
                InitIMemoryDomains();

                InitIStatable();
                InitDebugCallbacks();
            }
            catch
            {
                Dispose();
                throw;
            }
        }