Пример #1
0
		public Genesis(CoreComm comm, GameInfo game, byte[] rom)
		{
			CoreComm = comm;
			MainCPU = new MC68000();
			SoundCPU = new Z80A();
			YM2612 = new YM2612() { MaxVolume = 23405 };
			PSG = new SN76489() { MaxVolume = 4681 };
			VDP = new GenVDP();
			VDP.DmaReadFrom68000 = ReadWord;
			SoundMixer = new SoundMixer(YM2612, PSG);

			MainCPU.ReadByte = ReadByte;
			MainCPU.ReadWord = ReadWord;
			MainCPU.ReadLong = ReadLong;
			MainCPU.WriteByte = WriteByte;
			MainCPU.WriteWord = WriteWord;
			MainCPU.WriteLong = WriteLong;
			MainCPU.IrqCallback = InterruptCallback;

			// ---------------------- musashi -----------------------
#if MUSASHI
			_vdp = vdpcallback;
			read8 = Read8;
			read16 = Read16;
			read32 = Read32;
			write8 = Write8;
			write16 = Write16;
			write32 = Write32;

			Musashi.RegisterVdpCallback(Marshal.GetFunctionPointerForDelegate(_vdp));
			Musashi.RegisterRead8(Marshal.GetFunctionPointerForDelegate(read8));
			Musashi.RegisterRead16(Marshal.GetFunctionPointerForDelegate(read16));
			Musashi.RegisterRead32(Marshal.GetFunctionPointerForDelegate(read32));
			Musashi.RegisterWrite8(Marshal.GetFunctionPointerForDelegate(write8));
			Musashi.RegisterWrite16(Marshal.GetFunctionPointerForDelegate(write16));
			Musashi.RegisterWrite32(Marshal.GetFunctionPointerForDelegate(write32));
#endif
			// ---------------------- musashi -----------------------

			SoundCPU.ReadMemory = ReadMemoryZ80;
			SoundCPU.WriteMemory = WriteMemoryZ80;
			SoundCPU.WriteHardware = (a, v) => { Console.WriteLine("Z80: Attempt I/O Write {0:X2}:{1:X2}", a, v); };
			SoundCPU.ReadHardware = x => 0xFF;
			SoundCPU.IRQCallback = () => SoundCPU.Interrupt = false;
			Z80Reset = true;
			RomData = new byte[0x400000];
			for (int i = 0; i < rom.Length; i++)
				RomData[i] = rom[i];

			SetupMemoryDomains();
#if MUSASHI
			Musashi.Init();
			Musashi.Reset();
			VDP.GetPC = () => Musashi.PC;
#else
            MainCPU.Reset();
            VDP.GetPC = () => MainCPU.PC;
#endif
			InitializeCartHardware(game);
		}
Пример #2
0
		public Intellivision(CoreComm comm, GameInfo game, byte[] rom)
		{
			CoreComm = comm;

			Rom = rom;
			Game = game;
			Cart = new Intellicart();
			if (Cart.Parse(Rom) == -1)
			{
				Cart = new Cartridge();
				Cart.Parse(Rom);
			}

			Cpu = new CP1610();
			Cpu.ReadMemory = ReadMemory;
			Cpu.WriteMemory = WriteMemory;
			Cpu.Reset();

			Stic = new STIC();
			Stic.ReadMemory = ReadMemory;
			Stic.WriteMemory = WriteMemory;
			Stic.Reset();

			Psg = new PSG();
			Psg.ReadMemory = ReadMemory;
			Psg.WriteMemory = WriteMemory;

			Connect();

			Cpu.LogData();

			LoadExecutiveRom(CoreComm.CoreFileProvider.GetFirmwarePath("INTV", "EROM", true, "Executive ROM is required."));
			LoadGraphicsRom(CoreComm.CoreFileProvider.GetFirmwarePath("INTV", "GROM", true, "Graphics ROM is required."));
		}
Пример #3
0
		public NES(CoreComm comm, GameInfo game, byte[] rom, object Settings, object SyncSettings)
		{
			byte[] fdsbios = comm.CoreFileProvider.GetFirmware("NES", "Bios_FDS", false);
			if (fdsbios != null && fdsbios.Length == 40976)
			{
				comm.ShowMessage("Your FDS BIOS is a bad dump.  BizHawk will attempt to use it, but no guarantees!  You should find a new one.");
				var tmp = new byte[8192];
				Buffer.BlockCopy(fdsbios, 16 + 8192 * 3, tmp, 0, 8192);
				fdsbios = tmp;
			}

			this.SyncSettings = (NESSyncSettings)SyncSettings ?? new NESSyncSettings();
			this.ControllerSettings = this.SyncSettings.Controls;
			CoreComm = comm;
			CoreComm.CpuTraceAvailable = true;
			BootGodDB.Initialize();
			videoProvider = new MyVideoProvider(this);
			Init(game, rom, fdsbios);
			if (board is FDS)
			{
				CoreComm.UsesDriveLed = true;
				(board as FDS).SetDriveLightCallback((val) => CoreComm.DriveLED = val);
			}
			PutSettings(Settings ?? new NESSettings());
		}
Пример #4
0
        public PSP(CoreComm comm, string isopath)
        {
            ServiceProvider = new BasicServiceProvider(this);
            if (attachedcore != null)
            {
                attachedcore.Dispose();
                attachedcore = null;
            }
            CoreComm = comm;

            glcontext = CoreComm.RequestGLContext(3, 0, true);
            CoreComm.ActivateGLContext(glcontext);

            logcallback = new PPSSPPDll.LogCB(LogCallbackFunc);

            bool good = PPSSPPDll.BizInit(isopath, logcallback);
            LogFlush();
            if (!good)
                throw new Exception("PPSSPP Init failed!");

            CoreComm.VsyncDen = 1;
            CoreComm.VsyncNum = 60;
            CoreComm.RomStatusDetails = "It puts the scythe in the chicken or it gets the abyss again!";

            attachedcore = this;
        }
Пример #5
0
        public AppleII(CoreComm comm, GameInfo game, byte[] rom, Settings settings)
        {
            GameInfoSet = new List<GameInfo>();

            var ser = new BasicServiceProvider(this);
            ServiceProvider = ser;
            CoreComm = comm;

            _disk1 = rom;
            RomSet.Add(rom);

            _appleIIRom = comm.CoreFileProvider.GetFirmware(
                SystemId, "AppleIIe", true, "The Apple IIe BIOS firmware is required");
            _diskIIRom = comm.CoreFileProvider.GetFirmware(
                SystemId, "DiskII", true, "The DiskII firmware is required");

            _machine = new Machine(_appleIIRom, _diskIIRom);

            _machine.BizInitialize();

            //make a writeable memory stream cloned from the rom.
            //for junk.dsk the .dsk is important because it determines the format from that
            InitDisk();

            //trace logger stuff
            Tracer = new TraceBuffer();
            ser.Register<ITraceable>(Tracer);

            InitSaveStates();
            SetupMemoryDomains();
            PutSettings(settings ?? new Settings());
        }
Пример #6
0
		public ColecoVision(CoreComm comm, GameInfo game, byte[] rom, object SyncSettings)
		{
			CoreComm = comm;
			this.SyncSettings = (ColecoSyncSettings)SyncSettings ?? new ColecoSyncSettings();
			bool skipbios = this.SyncSettings.SkipBiosIntro;

			Cpu = new Z80A();
			Cpu.ReadMemory = ReadMemory;
			Cpu.WriteMemory = WriteMemory;
			Cpu.ReadHardware = ReadPort;
			Cpu.WriteHardware = WritePort;

			VDP = new TMS9918A(Cpu);
			PSG = new SN76489();

			// TODO: hack to allow bios-less operation would be nice, no idea if its feasible
			string biosPath = CoreComm.CoreFileProvider.GetFirmwarePath("Coleco", "Bios", true, "Coleco BIOS file is required.");
			BiosRom = File.ReadAllBytes(biosPath);

			// gamedb can overwrite the syncsettings; this is ok
			if (game["NoSkip"])
				skipbios = false;
			LoadRom(rom, skipbios);
			this.game = game;
			SetupMemoryDomains();
		}
Пример #7
0
		public GBA(CoreComm comm, byte[] file)
		{
			ServiceProvider = new BasicServiceProvider(this);
			Tracer = new TraceBuffer
			{
				Header = "   -Addr--- -Opcode- -Instruction------------------- -R0----- -R1----- -R2----- -R3----- -R4----- -R5----- -R6----- -R7----- -R8----- -R9----- -R10---- -R11---- -R12---- -R13(SP) -R14(LR) -R15(PC) -CPSR--- -SPSR---"
			};

			(ServiceProvider as BasicServiceProvider).Register<ITraceable>(Tracer);

			CoreComm = comm;

			comm.VsyncNum = 262144;
			comm.VsyncDen = 4389;
			comm.NominalWidth = 240;
			comm.NominalHeight = 160;

			byte[] bios = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory.");

			if (bios.Length != 16384)
				throw new InvalidDataException("GBA bios must be exactly 16384 bytes!");
			if (file.Length > 32 * 1024 * 1024)
				throw new InvalidDataException("Rom file is too big!  No GBA game is larger than 32MB");
			Init();
			LibMeteor.libmeteor_hardreset();
			LibMeteor.libmeteor_loadbios(bios, (uint)bios.Length);
			LibMeteor.libmeteor_loadrom(file, (uint)file.Length);

			SetUpMemoryDomains();
		}
Пример #8
0
		public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, object SyncSettings)
		{
			byte[] bios = CoreComm.CoreFileProvider.GetFirmware("SAT", "J", true, "Saturn BIOS is required.");
			CoreComm.RomStatusDetails = string.Format("Disk partial hash:{0}", CD.GetHash());
			this.CoreComm = CoreComm;
			this.CD = CD;

			this.SyncSettings = (SaturnSyncSettings)SyncSettings ?? new SaturnSyncSettings();

			if (this.SyncSettings.UseGL && glContext == null)
			{
				glContext = CoreComm.RequestGLContext();
			}


			ResetCounters();

			ActivateGL();
			Init(bios);

			InputCallbackH = new LibYabause.InputCallback(() => CoreComm.InputCallback.Call());
			LibYabause.libyabause_setinputcallback(InputCallbackH);
			CoreComm.UsesDriveLed = true;

			DeactivateGL();
		}
Пример #9
0
		public Snes9x(CoreComm NextComm, byte[] rom)
		{
			if (!LibSnes9x.debug_init(rom, rom.Length))
				throw new Exception();

			CoreComm = NextComm;
		}
Пример #10
0
		public PSP(CoreComm comm, string isopath)
		{
			ServiceProvider = new BasicServiceProvider(this);
			if (attachedcore != null)
			{
				attachedcore.Dispose();
				attachedcore = null;
			}
			CoreComm = comm;

			logcallback = new PPSSPPDll.LogCB(LogCallbackFunc);

			bool good = PPSSPPDll.init(isopath, logcallback);
			LogFlush();
			if (!good)
				throw new Exception("PPSSPP Init failed!");
			vidhandle = GCHandle.Alloc(screenbuffer, GCHandleType.Pinned);
			PPSSPPDll.setvidbuff(vidhandle.AddrOfPinnedObject());

			CoreComm.VsyncDen = 1;
			CoreComm.VsyncNum = 60;
			CoreComm.RomStatusDetails = "It puts the scythe in the chicken or it gets the abyss again!";

			attachedcore = this;
		}
Пример #11
0
        public Snes9x(CoreComm comm, byte[] rom)
        {
            if (!LibSnes9x.debug_init(rom, rom.Length))
                throw new Exception();

            ServiceProvider = new BasicServiceProvider(this);
            CoreComm = comm;
        }
Пример #12
0
		CoreComm CreateCoreComm()
		{
			CoreComm ret = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
			ret.RequestGLContext = () => GlobalWin.GLManager.CreateGLContext();
			ret.ActivateGLContext = (gl) => GlobalWin.GLManager.Activate((GLManager.ContextRef)gl);
			ret.DeactivateGLContext = () => GlobalWin.GLManager.Deactivate();
			return ret;
		}
Пример #13
0
		CoreComm CreateCoreComm()
		{
			CoreComm ret = new CoreComm(ShowMessageCoreComm, NotifyCoreComm);
			ret.ReleaseGLContext = (o) => GlobalWin.GLManager.ReleaseGLContext(o);
			ret.RequestGLContext = (major,minor,forward) => GlobalWin.GLManager.CreateGLContext(major,minor,forward);
			ret.ActivateGLContext = (gl) => GlobalWin.GLManager.Activate((GLManager.ContextRef)gl);
			ret.DeactivateGLContext = () => GlobalWin.GLManager.Deactivate();
			return ret;
		}
Пример #14
0
		public Octoshock(CoreComm comm)
		{
			var domains = new List<MemoryDomain>();
			CoreComm = comm;
			VirtualWidth = BufferWidth = 256;
			BufferHeight = 192;

			MemoryDomains = new MemoryDomainList(memoryDomains);
		}
Пример #15
0
        void RefreshLibretroCore(bool bootstrap)
        {
            txtLibretroCore.Text            = "";
            btnLibretroLaunchNoGame.Enabled = false;
            btnLibretroLaunchGame.Enabled   = false;

            var core = Global.Config.LibretroCore;

            if (string.IsNullOrEmpty(core))
            {
                return;
            }

            txtLibretroCore.Text = core;
            CurrentDescription   = null;

            //scan the current libretro core to see if it can be launched with NoGame,and other stuff
            try
            {
                //OLD COMMENTS:
                ////a stub corecomm. to reinforce that this won't touch the frontend at all!
                ////LibRetroEmulator should be able to survive having this stub corecomm
                //NEW COMMENTS:
                //nope, we need to navigate to the dll path. this was a bad idea anyway. so many dlls get loaded, something to resolve them is needed
                var coreComm = new BizHawk.Emulation.Common.CoreComm(null, null);
                CoreFileProvider.SyncCoreCommInputSignals(coreComm);
                using (var retro = new LibretroCore(coreComm, core))
                {
                    btnLibretroLaunchGame.Enabled = true;
                    if (retro.Description.SupportsNoGame)
                    {
                        btnLibretroLaunchNoGame.Enabled = true;
                    }

                    //print descriptive information
                    var descr = retro.Description;
                    CurrentDescription = descr;
                    Console.WriteLine($"core name: {descr.LibraryName} version {descr.LibraryVersion}");
                    Console.WriteLine($"extensions: {descr.ValidExtensions}");
                    Console.WriteLine($"{nameof(descr.NeedsRomAsPath)}: {descr.NeedsRomAsPath}");
                    Console.WriteLine($"{nameof(descr.NeedsArchives)}: {descr.NeedsArchives}");
                    Console.WriteLine($"{nameof(descr.SupportsNoGame)}: {descr.SupportsNoGame}");

                    foreach (var v in descr.Variables.Values)
                    {
                        Console.WriteLine(v);
                    }
                }
            }
            catch (Exception ex)
            {
                if (!bootstrap)
                {
                    MessageBox.Show($"Couldn't load the selected Libretro core for analysis. It won't be available.\n\nError:\n\n{ex}");
                }
            }
        }
Пример #16
0
		public GBA(CoreComm comm)
		{
			CoreComm = comm;
			comm.VsyncNum = 262144;
			comm.VsyncDen = 4389;
			comm.CpuTraceAvailable = true;
			comm.TraceHeader = "   -Addr--- -Opcode- -Instruction------------------- -R0----- -R1----- -R2----- -R3----- -R4----- -R5----- -R6----- -R7----- -R8----- -R9----- -R10---- -R11---- -R12---- -R13(SP) -R14(LR) -R15(PC) -CPSR--- -SPSR---";
			comm.NominalWidth = 240;
			comm.NominalHeight = 160;
		}
Пример #17
0
		public BatchRunner(IEnumerable<string> files, int numframes)
		{
			this.files = new List<string>(files);
			this.numframes = numframes;

			ldr = new RomLoader();
			ldr.OnLoadError += OnLoadError;
			ldr.ChooseArchive = ChooseArchive;
			Comm = new CoreComm(CommMessage, CommMessage);
			CoreFileProvider.SyncCoreCommInputSignals(Comm);
		}
Пример #18
0
		// framework
		public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension)
		{
			inputFileInfo = new InputFileInfo();
			inputFileInfo.Data = rom;
			inputFileInfo.Extension = romextension;
			CoreComm = comm;
			Init(Region.PAL);
			cyclesPerFrame = board.vic.CyclesPerFrame;
			CoreComm.UsesDriveLed = true;
			SetupMemoryDomains();
			HardReset();
		}
Пример #19
0
		public N64Input(mupen64plusApi core, CoreComm comm, N64SyncSettings.N64ControllerSettings[] controllerSettings)
		{
			api = new mupen64plusInputApi(core);
			CoreComm = comm;

			api.SetM64PInputCallback(new mupen64plusInputApi.InputCallback(GetControllerInput));

			core.VInterrupt += ShiftInputPolledBools;
			for (int i = 0; i < controllerSettings.Length; ++i)
			{
				SetControllerConnected(i, controllerSettings[i].IsConnected);
				SetControllerPakType(i, controllerSettings[i].PakType);
			}
		}
Пример #20
0
		public NullEmulator(CoreComm comm)
		{
			CoreComm = comm;
			var domains = new MemoryDomainList(
				new List<MemoryDomain>
				{
					new MemoryDomain("Main RAM", 1, MemoryDomain.Endian.Little, addr => 0, (a, v) => { })
				});
			memoryDomains = new MemoryDomainList(domains);

			var d = DateTime.Now;
			xmas = d.Month == 12 && d.Day >= 17 && d.Day <= 27;
			if (xmas)
				pleg = new Pleg();
		}
Пример #21
0
        // framework
        public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension)
        {
            ServiceProvider = new BasicServiceProvider(this);
            InputCallbacks = new InputCallbackSystem();

            inputFileInfo = new InputFileInfo();
            inputFileInfo.Data = rom;
            inputFileInfo.Extension = romextension;
            CoreComm = comm;
            Init(Region.PAL);
            cyclesPerFrame = board.vic.CyclesPerFrame;
            SetupMemoryDomains();
            HardReset();

            (ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(board.vic);
        }
Пример #22
0
		// 21,477,270  Machine clocks / sec
		//  7,159,090  Cpu cycles / sec

		public PCEngine(CoreComm comm, GameInfo game, byte[] rom, object Settings, object syncSettings)
		{
			CoreComm = comm;
			CoreComm.CpuTraceAvailable = true;

			switch (game.System)
			{
				case "PCE":
					systemid = "PCE";
					Type = NecSystemType.TurboGrafx;
					break;
				case "SGX":
					systemid = "SGX";
					Type = NecSystemType.SuperGrafx;
					break;
			}
			this._settings = (PCESettings)Settings ?? new PCESettings();
			_syncSettings = (PCESyncSettings)syncSettings ?? new PCESyncSettings();
			Init(game, rom);
			SetControllerButtons();
		}
Пример #23
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;
            }
        }
Пример #24
0
        public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string GameDBfn)
        {
            ServiceProvider = new BasicServiceProvider(this);
            (ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(avProvider);
            InputCallbacks = new InputCallbackSystem();
            CoreComm = comm;
            byte[] highscoreBIOS = comm.CoreFileProvider.GetFirmware("A78", "Bios_HSC", false, "Some functions may not work without the high score BIOS.");
            byte[] pal_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_PAL", false, "The game will not run if the correct region BIOS is not available.");
            byte[] ntsc_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_NTSC", false, "The game will not run if the correct region BIOS is not available.");

            if (EMU7800.Win.GameProgramLibrary.EMU7800DB == null)
            {
                EMU7800.Win.GameProgramLibrary.EMU7800DB = new EMU7800.Win.GameProgramLibrary(new StreamReader(GameDBfn));
            }

            if (rom.Length % 1024 == 128)
            {
                Console.WriteLine("Trimming 128 byte .a78 header...");
                byte[] newrom = new byte[rom.Length - 128];
                Buffer.BlockCopy(rom, 128, newrom, 0, newrom.Length);
                rom = newrom;
            }
            GameInfo = EMU7800.Win.GameProgramLibrary.EMU7800DB.TryRecognizeRom(rom);
            CoreComm.RomStatusDetails = GameInfo.ToString();
            Console.WriteLine("Rom Determiniation from 7800DB:");
            Console.WriteLine(GameInfo.ToString());

            this.rom = rom;
            this.game = game;
            this.hsbios = highscoreBIOS;
            this.bios = GameInfo.MachineType == MachineType.A7800PAL ? pal_bios : ntsc_bios;
            _pal = GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A2600PAL;

            if (bios == null)
            {
                throw new MissingFirmwareException("The BIOS corresponding to the region of the game you loaded is required to run Atari 7800 games.");
            }

            HardReset();
        }
Пример #25
0
			/// <summary>
			/// instatiate an emulator core
			/// </summary>
			/// <param name="comm"></param>
			/// <param name="game"></param>
			/// <param name="rom"></param>
			/// <param name="deterministic"></param>
			/// <param name="settings"></param>
			/// <param name="syncsettings"></param>
			/// <returns></returns>
			public IEmulator Create
			(
				CoreComm comm,
				GameInfo game,
				byte[] rom,
				byte[] file,
				bool deterministic,
				object settings,
				object syncsettings
			)
			{
				object[] o = new object[parammap.Count];
				bp(o, "comm", comm);
				bp(o, "game", game);
				bp(o, "rom", rom);
				bp(o, "file", file);
				bp(o, "deterministic", deterministic);
				bp(o, "settings", settings);
				bp(o, "syncsettings", syncsettings);

				return (IEmulator)CTor.Invoke(o);
			}
Пример #26
0
        public LibRetroEmulator(CoreComm nextComm, string modulename)
        {
            ServiceProvider = new BasicServiceProvider(this);

            retro_environment_cb = new LibRetro.retro_environment_t(retro_environment);
            retro_video_refresh_cb = new LibRetro.retro_video_refresh_t(retro_video_refresh);
            retro_audio_sample_cb = new LibRetro.retro_audio_sample_t(retro_audio_sample);
            retro_audio_sample_batch_cb = new LibRetro.retro_audio_sample_batch_t(retro_audio_sample_batch);
            retro_input_poll_cb = new LibRetro.retro_input_poll_t(retro_input_poll);
            retro_input_state_cb = new LibRetro.retro_input_state_t(retro_input_state);

            retro = new LibRetro(modulename);
            try
            {
                CoreComm = nextComm;

                LibRetro.retro_system_info sys = new LibRetro.retro_system_info();
                retro.retro_get_system_info(ref sys);

                if (sys.need_fullpath)
                    throw new ArgumentException("This libretro core needs filepaths");
                if (sys.block_extract)
                    throw new ArgumentException("This libretro needs non-blocked extract");

                retro.retro_set_environment(retro_environment_cb);
                retro.retro_init();
                retro.retro_set_video_refresh(retro_video_refresh_cb);
                retro.retro_set_audio_sample(retro_audio_sample_cb);
                retro.retro_set_audio_sample_batch(retro_audio_sample_batch_cb);
                retro.retro_set_input_poll(retro_input_poll_cb);
                retro.retro_set_input_state(retro_input_state_cb);
            }
            catch
            {
                retro.Dispose();
                throw;
            }
        }
Пример #27
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;
		}
Пример #28
0
        public C64(CoreComm comm, IEnumerable<byte[]> roms, object settings, object syncSettings)
        {
            PutSyncSettings((C64SyncSettings)syncSettings ?? new C64SyncSettings());
            PutSettings((C64Settings)settings ?? new C64Settings());

            ServiceProvider = new BasicServiceProvider(this);
            InputCallbacks = new InputCallbackSystem();

            CoreComm = comm;
            Roms = roms;
            Init(SyncSettings.VicType, Settings.BorderType, SyncSettings.SidType, SyncSettings.TapeDriveType, SyncSettings.DiskDriveType);
            _cyclesPerFrame = _board.Vic.CyclesPerFrame;
            SetupMemoryDomains(_board.DiskDrive != null);
            _memoryCallbacks = new MemoryCallbackSystem();
            HardReset();

            switch (SyncSettings.VicType)
            {
                case VicType.Ntsc:
                case VicType.Drean:
                case VicType.NtscOld:
                    Region = DisplayType.NTSC;
                    break;
                case VicType.Pal:
                    Region = DisplayType.PAL;
                    break;
            }

            if (_board.Sid != null)
            {
                SyncSoundProvider = DCFilter.AsISyncSoundProvider(_board.Sid, 512);
            }
            DeterministicEmulation = true;

            ((BasicServiceProvider) ServiceProvider).Register<IVideoProvider>(_board.Vic);
            ((BasicServiceProvider) ServiceProvider).Register<IDriveLight>(this);
        }
Пример #29
0
		// framework
		public C64(CoreComm comm, GameInfo game, byte[] rom, string romextension, object settings, object syncSettings)
		{
			PutSyncSettings((C64SyncSettings)syncSettings ?? new C64SyncSettings());
			PutSettings((C64Settings)settings ?? new C64Settings());

			ServiceProvider = new BasicServiceProvider(this);
			InputCallbacks = new InputCallbackSystem();

		    _inputFileInfo = new InputFileInfo
		    {
		        Data = rom,
		        Extension = romextension
		    };

		    CoreComm = comm;
			Init(SyncSettings.VicType, Settings.BorderType, SyncSettings.SidType, SyncSettings.TapeDriveType, SyncSettings.DiskDriveType);
			_cyclesPerFrame = _board.Vic.CyclesPerFrame;
			SetupMemoryDomains(_board.DiskDrive != null);
            _memoryCallbacks = new MemoryCallbackSystem();
			HardReset();

		    switch (SyncSettings.VicType)
		    {
		        case VicType.Ntsc:
                case VicType.Drean:
                case VicType.NtscOld:
                    Region = DisplayType.NTSC;
		            break;
                case VicType.Pal:
                    Region = DisplayType.PAL;
		            break;
		    }

			((BasicServiceProvider) ServiceProvider).Register<IVideoProvider>(_board.Vic);
            ((BasicServiceProvider) ServiceProvider).Register<IDriveLight>(_board.Serial);
        }
Пример #30
0
		public VBANext(byte[] romfile, CoreComm nextComm)
		{
			CoreComm = nextComm;
			byte[] biosfile = CoreComm.CoreFileProvider.GetFirmware("GBA", "Bios", true, "GBA bios file is mandatory.");

			if (romfile.Length > 32 * 1024 * 1024)
				throw new ArgumentException("ROM is too big to be a GBA ROM!");
			if (biosfile.Length != 16 * 1024)
				throw new ArgumentException("BIOS file is not exactly 16K!");

			Core = LibVBANext.Create();
			if (Core == IntPtr.Zero)
				throw new InvalidOperationException("Create() returned nullptr!");
			try
			{
				if (!LibVBANext.LoadRom(Core, romfile, (uint)romfile.Length, biosfile, (uint)biosfile.Length))
					throw new InvalidOperationException("LoadRom() returned false!");
			}
			catch
			{
				Dispose();
				throw;
			}
		}
Пример #31
0
		public Intellivision(CoreComm comm, GameInfo game, byte[] rom)
		{
			ServiceProvider = new BasicServiceProvider(this);
			CoreComm = comm;

			_rom = rom;
			_gameInfo = game;
			_cart = new Intellicart();
			if (_cart.Parse(_rom) == -1)
			{
				_cart = new Cartridge();
				_cart.Parse(_rom);
			}

			_cpu = new CP1610();
			_cpu.ReadMemory = ReadMemory;
			_cpu.WriteMemory = WriteMemory;
			_cpu.Reset();

			_stic = new STIC();
			_stic.ReadMemory = ReadMemory;
			_stic.WriteMemory = WriteMemory;
			_stic.Reset();
			(ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(_stic);

			_psg = new PSG();
			_psg.ReadMemory = ReadMemory;
			_psg.WriteMemory = WriteMemory;

			Connect();

			_cpu.LogData();

			LoadExecutiveRom(CoreComm.CoreFileProvider.GetFirmware("INTV", "EROM", true, "Executive ROM is required."));
			LoadGraphicsRom(CoreComm.CoreFileProvider.GetFirmware("INTV", "GROM", true, "Graphics ROM is required."));
		}