Esempio n. 1
0
		public void PutSettings(Gameboy.GambatteSettings s, Gameboy.GambatteSyncSettings ss)
		{
			this.s = s ?? new Gameboy.GambatteSettings();
			this.ss = ss ?? new Gameboy.GambatteSyncSettings();
			propertyGrid1.SelectedObject = this.ss;
			propertyGrid1.Enabled = !Global.MovieSession.Movie.IsActive;
		}
Esempio n. 2
0
		public static void DoCGBColorChoserFormDialog(IWin32Window parent, Gameboy.GambatteSettings s)
		{
			using (var dlg = new CGBColorChooserForm())
			{
				dlg.LoadType(s);
				var result = dlg.ShowDialog(parent);
				if (result == DialogResult.OK)
					s.CGBColors = dlg.type;
			}
		}
Esempio n. 3
0
		public void PutSettings(Gameboy.GambatteSettings s, Gameboy.GambatteSyncSettings ss)
		{
			this.s = s ?? new Gameboy.GambatteSettings();
			this.ss = ss ?? new Gameboy.GambatteSyncSettings();
			propertyGrid1.SelectedObject = this.ss;
			propertyGrid1.Enabled = !Global.MovieSession.Movie.IsActive;
			checkBoxMuted.Checked = this.s.Muted;
			cbDisplayBG.Checked = this.s.DisplayBG;
			cbDisplayOBJ.Checked = this.s.DisplayOBJ;
		}
Esempio n. 4
0
        public GambattePrinter(Gameboy gb, PrinterCallback callback)
        {
            this.gb       = gb;
            this.callback = callback;

            linkCallback = OnSerial;
            LibGambatte.gambatte_setlinkcallback(gb.GambatteState, linkCallback);

            // connect the cable
            LibGambatte.gambatte_linkstatus(gb.GambatteState, 259);
        }
Esempio n. 5
0
		void LoadType(Gameboy.GambatteSettings s)
		{
			type = s.CGBColors;
			switch (type)
			{
				case GBColors.ColorType.gambatte: radioButton1.Checked = true; break;
				case GBColors.ColorType.vivid: radioButton2.Checked = true; break;
				case GBColors.ColorType.vbavivid: radioButton3.Checked = true; break;
				case GBColors.ColorType.vbagbnew: radioButton4.Checked = true; break;
				case GBColors.ColorType.vbabgbold: radioButton5.Checked = true; break;
				case GBColors.ColorType.gba: radioButton6.Checked = true; break;
			}
		}
Esempio n. 6
0
        public void Dispose()
        {
            if (!disposed)
            {
                L.Dispose();
                L = null;
                R.Dispose();
                R = null;
                blip_left.Dispose();
                blip_left = null;
                blip_right.Dispose();
                blip_right = null;

                disposed = true;
            }
        }
Esempio n. 7
0
        public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object settings, object syncSettings, bool deterministic)
        {
            ServiceProvider = new BasicServiceProvider(this);
            GambatteLinkSettings     linkSettings     = (GambatteLinkSettings)settings ?? new GambatteLinkSettings();
            GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)syncSettings ?? new GambatteLinkSyncSettings();

            CoreComm = comm;
            L        = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                                   leftinfo, leftrom, linkSettings.L, linkSyncSettings.L, deterministic);
            R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify)
            {
                CoreFileProvider = comm.CoreFileProvider
            },
                            rightinfo, rightrom, linkSettings.R, linkSyncSettings.R, deterministic);

            // connect link cable
            LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
            LibGambatte.gambatte_linkstatus(R.GambatteState, 259);

            L.ConnectInputCallbackSystem(_inputCallbacks);
            R.ConnectInputCallbackSystem(_inputCallbacks);
            L.ConnectMemoryCallbackSystem(_memorycallbacks);
            R.ConnectMemoryCallbackSystem(_memorycallbacks);

            comm.RomStatusAnnotation = null;
            comm.RomStatusDetails    = "LEFT:\r\n" + L.CoreComm.RomStatusDetails + "RIGHT:\r\n" + R.CoreComm.RomStatusDetails;
            comm.NominalWidth        = L.CoreComm.NominalWidth + R.CoreComm.NominalWidth;
            comm.NominalHeight       = L.CoreComm.NominalHeight;

            LinkConnected = true;

            Frame      = 0;
            LagCount   = 0;
            IsLagFrame = false;

            _blipLeft  = new BlipBuffer(1024);
            _blipRight = new BlipBuffer(1024);
            _blipLeft.SetRates(2097152 * 2, 44100);
            _blipRight.SetRates(2097152 * 2, 44100);

            SetMemoryDomains();
        }
Esempio n. 8
0
        public GambatteLink(CoreLoadParameters <GambatteLink.GambatteLinkSettings, GambatteLink.GambatteLinkSyncSettings> lp)
        {
            if (lp.Roms.Count != 2)
            {
                throw new InvalidOperationException("Wrong number of roms");
            }

            ServiceProvider = new BasicServiceProvider(this);
            GambatteLinkSettings     linkSettings     = (GambatteLinkSettings)lp.Settings ?? new GambatteLinkSettings();
            GambatteLinkSyncSettings linkSyncSettings = (GambatteLinkSyncSettings)lp.SyncSettings ?? new GambatteLinkSyncSettings();

            L = new Gameboy(lp.Comm, lp.Roms[0].Game, lp.Roms[0].RomData, linkSettings.L, linkSyncSettings.L, lp.DeterministicEmulationRequested);
            R = new Gameboy(lp.Comm, lp.Roms[1].Game, lp.Roms[1].RomData, linkSettings.R, linkSyncSettings.R, lp.DeterministicEmulationRequested);

            // connect link cable
            LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
            LibGambatte.gambatte_linkstatus(R.GambatteState, 259);

            L.ConnectInputCallbackSystem(_inputCallbacks);
            R.ConnectInputCallbackSystem(_inputCallbacks);
            L.ConnectMemoryCallbackSystem(_memorycallbacks);
            R.ConnectMemoryCallbackSystem(_memorycallbacks);

            RomDetails = "LEFT:\r\n" + L.RomDetails + "RIGHT:\r\n" + R.RomDetails;

            LinkConnected = true;

            Frame      = 0;
            LagCount   = 0;
            IsLagFrame = false;

            _blipLeft  = new BlipBuffer(1024);
            _blipRight = new BlipBuffer(1024);
            _blipLeft.SetRates(2097152 * 2, 44100);
            _blipRight.SetRates(2097152 * 2, 44100);

            SetMemoryDomains();
        }
Esempio n. 9
0
        public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic)
        {
            GambatteLinkSettings     _Settings     = (GambatteLinkSettings)Settings ?? new GambatteLinkSettings();
            GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? new GambatteLinkSyncSettings();

            CoreComm = comm;
            L        = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, _Settings.L, _SyncSettings.L, deterministic);
            R        = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, _Settings.R, _SyncSettings.R, deterministic);

            // connect link cable
            LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
            LibGambatte.gambatte_linkstatus(R.GambatteState, 259);

            L.Controller = LCont;
            R.Controller = RCont;

            comm.VsyncNum            = L.CoreComm.VsyncNum;
            comm.VsyncDen            = L.CoreComm.VsyncDen;
            comm.RomStatusAnnotation = null;
            comm.RomStatusDetails    = "LEFT:\r\n" + L.CoreComm.RomStatusDetails + "RIGHT:\r\n" + R.CoreComm.RomStatusDetails;
            comm.CpuTraceAvailable   = false;           // TODO
            comm.NominalWidth        = L.CoreComm.NominalWidth + R.CoreComm.NominalWidth;
            comm.NominalHeight       = L.CoreComm.NominalHeight;

            Frame      = 0;
            LagCount   = 0;
            IsLagFrame = false;

            blip_left  = new BlipBuffer(1024);
            blip_right = new BlipBuffer(1024);
            blip_left.SetRates(2097152 * 2, 44100);
            blip_right.SetRates(2097152 * 2, 44100);

            SetMemoryDomains();

            L.CoreComm.InputCallback = CoreComm.InputCallback;
            R.CoreComm.InputCallback = CoreComm.InputCallback;
        }
Esempio n. 10
0
		public GambatteLink(CoreComm comm, GameInfo leftinfo, byte[] leftrom, GameInfo rightinfo, byte[] rightrom, object Settings, object SyncSettings, bool deterministic)
		{
			GambatteLinkSettings _Settings = (GambatteLinkSettings)Settings ?? new GambatteLinkSettings();
			GambatteLinkSyncSettings _SyncSettings = (GambatteLinkSyncSettings)SyncSettings ?? new GambatteLinkSyncSettings();

			CoreComm = comm;
			L = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), leftinfo, leftrom, _Settings.L, _SyncSettings.L, deterministic);
			R = new Gameboy(new CoreComm(comm.ShowMessage, comm.Notify), rightinfo, rightrom, _Settings.R, _SyncSettings.R, deterministic);

			// connect link cable
			LibGambatte.gambatte_linkstatus(L.GambatteState, 259);
			LibGambatte.gambatte_linkstatus(R.GambatteState, 259);

			L.Controller = LCont;
			R.Controller = RCont;

			comm.VsyncNum = L.CoreComm.VsyncNum;
			comm.VsyncDen = L.CoreComm.VsyncDen;
			comm.RomStatusAnnotation = null;
			comm.RomStatusDetails = "LEFT:\r\n" + L.CoreComm.RomStatusDetails + "RIGHT:\r\n" + R.CoreComm.RomStatusDetails;
			comm.CpuTraceAvailable = false; // TODO
			comm.NominalWidth = L.CoreComm.NominalWidth + R.CoreComm.NominalWidth;
			comm.NominalHeight = L.CoreComm.NominalHeight;

			Frame = 0;
			LagCount = 0;
			IsLagFrame = false;

			blip_left = new BlipBuffer(1024);
			blip_right = new BlipBuffer(1024);
			blip_left.SetRates(2097152 * 2, 44100);
			blip_right.SetRates(2097152 * 2, 44100);

			SetMemoryDomains();

			L.CoreComm.InputCallback = CoreComm.InputCallback;
			R.CoreComm.InputCallback = CoreComm.InputCallback;
		}
Esempio n. 11
0
		public void Restart()
		{
			if (Global.Emulator is Gameboy)
			{
				_gb = Global.Emulator as Gameboy;
				_cgb = _gb.IsCGBMode();
				_lcdc = 0;
				if (!_gb.GetGPUMemoryAreas(out _vram, out _bgpal, out _sppal, out _oam))
				{
					_gb = null;
					if (Visible)
						Close();
				}
				tilespal = _bgpal;

				if (_cgb)
					label4.Enabled = true;
				else
					label4.Enabled = false;
				bmpViewBG.Clear();
				bmpViewWin.Clear();
				bmpViewTiles1.Clear();
				bmpViewTiles2.Clear();
				bmpViewBGPal.Clear();
				bmpViewSPPal.Clear();
				bmpViewOAM.Clear();
				bmpViewDetails.Clear();
				bmpViewMemory.Clear();
				cbscanline_emu = -4; // force refresh
			}
			else
			{
				_gb = null;
				if (Visible)
					Close();
			}
		}
Esempio n. 12
0
		private void GBGPUView_FormClosed(object sender, FormClosedEventArgs e)
		{
			if (_gb != null)
			{
				_gb.SetScanlineCallback(null, 0);
				_gb = null;
			}
			Global.Config.GBGPUSpriteBack = spriteback;
		}
Esempio n. 13
0
 public void GetSettings(out Gameboy.GambatteSettings s, out Gameboy.GambatteSyncSettings ss)
 {
     s = this.s;
     ss = this.ss;
 }
Esempio n. 14
0
        public GambatteLink(CoreLoadParameters <GambatteLinkSettings, GambatteLinkSyncSettings> lp)
        {
            if (lp.Roms.Count < MIN_PLAYERS || lp.Roms.Count > MAX_PLAYERS)
            {
                throw new InvalidOperationException("Wrong number of roms");
            }

            _numCores = lp.Roms.Count;

            _serviceProvider = new BasicServiceProvider(this);
            _settings        = lp.Settings ?? new GambatteLinkSettings();
            _syncSettings    = lp.SyncSettings ?? new GambatteLinkSyncSettings();

            _linkedCores    = new Gameboy[_numCores];
            _linkedConts    = new SaveController[_numCores];
            _linkedBlips    = new BlipBuffer[_numCores];
            _linkedLatches  = new int[_numCores];
            _linkedOverflow = new int[_numCores];

            RomDetails = "";

            var scopes = new string[_numCores * 7];

            for (int i = 0; i < _numCores; i++)
            {
                scopes[i * 7 + 0] = $"P{i + 1} System Bus";
                scopes[i * 7 + 1] = $"P{i + 1} ROM";
                scopes[i * 7 + 2] = $"P{i + 1} VRAM";
                scopes[i * 7 + 3] = $"P{i + 1} SRAM";
                scopes[i * 7 + 4] = $"P{i + 1} WRAM";
                scopes[i * 7 + 5] = $"P{i + 1} OAM";
                scopes[i * 7 + 6] = $"P{i + 1} HRAM";
            }

            _memoryCallbacks = new MemoryCallbackSystem(scopes);

            for (int i = 0; i < _numCores; i++)
            {
                _linkedCores[i] = new Gameboy(lp.Comm, lp.Roms[i].Game, lp.Roms[i].RomData, _settings._linkedSettings[i], _syncSettings._linkedSyncSettings[i], lp.DeterministicEmulationRequested);
                _linkedCores[i].ConnectInputCallbackSystem(_inputCallbacks);
                _linkedCores[i].ConnectMemoryCallbackSystem(_memoryCallbacks, i);
                _linkedConts[i] = new SaveController(Gameboy.CreateControllerDefinition(false, false));
                _linkedBlips[i] = new BlipBuffer(1024);
                _linkedBlips[i].SetRates(2097152 * 2, 44100);
                _linkedOverflow[i] = 0;
                _linkedLatches[i]  = 0;
                RomDetails        += $"P{i + 1}:\r\n" + _linkedCores[i].RomDetails;
            }

            LinkConnected = true;

            Frame      = 0;
            LagCount   = 0;
            IsLagFrame = false;

            SoundBuffer = new short[MaxSampsPerFrame * _numCores];

            FrameBuffer = CreateVideoBuffer();
            VideoBuffer = CreateVideoBuffer();

            GBLinkController = CreateControllerDefinition();

            _linkedSaveRam = new LinkedSaveRam(_linkedCores, _numCores);
            _serviceProvider.Register <ISaveRam>(_linkedSaveRam);

            _linkedMemoryDomains = new LinkedMemoryDomains(_linkedCores, _numCores);
            _serviceProvider.Register <IMemoryDomains>(_linkedMemoryDomains);

            _linkedDebuggable = new LinkedDebuggable(_linkedCores, _numCores, _memoryCallbacks);
            _serviceProvider.Register <IDebuggable>(_linkedDebuggable);
        }
Esempio n. 15
0
			public GambatteLinkSyncSettings(Gameboy.GambatteSyncSettings L, Gameboy.GambatteSyncSettings R)
			{
				this.L = L;
				this.R = R;
			}
Esempio n. 16
0
		static void DoColorChooserFormDialog(IWin32Window parent, Gameboy.GambatteSettings s, bool fromemu)
		{
			using (var dlg = new ColorChooserForm())
			{
				if (fromemu)
					s = (Gameboy.GambatteSettings)Global.Emulator.GetSettings();
				dlg.SetAllColors(s.GBPalette);

				var result = dlg.ShowDialog(parent);
				if (result == DialogResult.OK)
				{
					int[] colorints = new int[12];
					for (int i = 0; i < 12; i++)
						colorints[i] = dlg.colors[i].ToArgb();

					s.GBPalette = colorints;
					if (fromemu)
						Global.Emulator.PutSettings(s);
				}
			}
		}
Esempio n. 17
0
		public static void DoColorChooserFormDialog(IWin32Window parent, Gameboy.GambatteSettings s)
		{
			DoColorChooserFormDialog(parent, s, false);
		}
Esempio n. 18
0
		public void Dispose()
		{
			if (!disposed)
			{
				L.Dispose();
				L = null;
				R.Dispose();
				R = null;
				blip_left.Dispose();
				blip_left = null;
				blip_right.Dispose();
				blip_right = null;

				disposed = true;
			}
		}