Ejemplo n.º 1
0
            public CoreInfo(IEmulator emu)
            {
                CoreName = emu.Attributes().CoreName;
                Released = emu.Attributes().Released;
                Services = new Dictionary <string, ServiceInfo>();
                var ser = emu.ServiceProvider;

                foreach (Type t in ser.AvailableServices.Where(type => type != emu.GetType()))
                {
                    var si = new ServiceInfo(t, ser.GetService(t));
                    Services.Add(si.TypeName, si);
                }

                var notApplicableAttribute = ((ServiceNotApplicableAttribute)Attribute
                                              .GetCustomAttribute(emu.GetType(), typeof(ServiceNotApplicableAttribute)));

                if (notApplicableAttribute != null)
                {
                    NotApplicableTypes = notApplicableAttribute.NotApplicableTypes
                                         .Select(x => x.ToString())
                                         .ToList();
                }
                else
                {
                    NotApplicableTypes = new List <string>();
                }
            }
Ejemplo n.º 2
0
			public CoreInfo(IEmulator emu)
			{
				TypeName = emu.GetType().ToString();
				CoreName = emu.Attributes().CoreName;
				Released = emu.Attributes().Released;
				Services = new Dictionary<string, ServiceInfo>();
				var ser = emu.ServiceProvider;
				foreach (Type t in ser.AvailableServices.Where(type => type != emu.GetType()))
				{
					var si = new ServiceInfo(t, ser.GetService(t));
					Services.Add(si.TypeName, si);
				}

				var notapplicableAttr = ((ServiceNotApplicable)Attribute
					.GetCustomAttribute(emu.GetType(), typeof(ServiceNotApplicable)));

				if (notapplicableAttr != null)
				{
					NotApplicableTypes = notapplicableAttr.NotApplicableTypes
					.Select(x => x.ToString())
					.ToList();
				}
				else
				{
					NotApplicableTypes = new List<string>();
				}
			}
Ejemplo n.º 3
0
        public static string DisplayName(this IEmulator core)
        {
            var attributes = core.Attributes();

            var str = (!attributes.Released ? "(Experimental) " : "") +
                      attributes.CoreName;

            return(str);
        }
Ejemplo n.º 4
0
        public static void DoDialog(IEmulator emulator, IDialogParent owner, bool isMovieActive)
        {
            var settable = ((MainForm)owner).GetSettingsAdapterForLoadedCoreUntyped();              //HACK
            var title    = $"{emulator.Attributes().CoreName} Settings";

            _ = emulator switch
            {
                MAME mame => DoMAMEDialog(owner, settable, mame.CurrentDriverSettings, isMovieActive: isMovieActive),
                NymaCore core => DoNymaDialogFor(owner, settable, title, core.SettingsInfo, isMovieActive: isMovieActive),
                _ => DoDialogFor(owner, settable, title, isMovieActive: isMovieActive)
            };
        }
Ejemplo n.º 5
0
        public static Bitmap Icon(this IEmulator core)
        {
            var attributes = core.Attributes();

            if (!attributes.Ported)
            {
                return(Properties.Resources.CorpHawkSmall);
            }

            if (core is QuickNES)
            {
                return(Properties.Resources.QuickNes);
            }

            if (core is LibsnesCore)
            {
                return(Properties.Resources.bsnes);
            }

            if (core is GPGX)
            {
                return(Properties.Resources.genplus);
            }

            if (core is PSP)
            {
                return(Properties.Resources.ppsspp);
            }

            if (core is Gameboy)
            {
                return(Properties.Resources.gambatte);
            }

            if (core is Snes9x)
            {
                return(Properties.Resources.snes9x);
            }

            if (core is MAME)
            {
                return(Properties.Resources.mame);
            }

            if (core is MGBAHawk)
            {
                return(Properties.Resources.mGba);
            }

            return(null);
        }
Ejemplo n.º 6
0
        public static string DisplayName(this IEmulator core)
        {
            var attributes = core.Attributes();

            var str = (!attributes.Released ? "(Experimental) " : "") +
                      attributes.CoreName;

            if (core is LibsnesCore)
            {
                str += " (" + ((LibsnesCore)core).CurrentProfile + ")";
            }

            return(str);
        }
Ejemplo n.º 7
0
        public static Bitmap Icon(this IEmulator core)
        {
            var attributes = core.Attributes();

            if (!attributes.Ported)
            {
                return(Properties.Resources.CorpHawkSmall);
            }

            if (core is QuickNES)
            {
                return(Properties.Resources.QuickNes);
            }
            else if (core is LibsnesCore)
            {
                return(Properties.Resources.bsnes);
            }
            else if (core is Yabause)
            {
                return(Properties.Resources.yabause);
            }
            else if (core is Atari7800)
            {
                return(Properties.Resources.emu7800);
            }
            else if (core is GBA)
            {
                return(Properties.Resources.meteor);
            }
            else if (core is GPGX)
            {
                return(Properties.Resources.genplus);
            }
            else if (core is PSP)
            {
                return(Properties.Resources.ppsspp);
            }
            else if (core is Gameboy)
            {
                return(Properties.Resources.gambatte);
            }
            else if (core is Snes9x)
            {
                return(Properties.Resources.snes9x);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 8
0
        public static Bitmap Icon(this IEmulator core)
        {
            var attributes = core.Attributes();

            if (!attributes.Ported)
            {
                return(Properties.Resources.CorpHawkSmall);
            }

            return(core switch
            {
                QuickNES _ => Properties.Resources.QuickNes,
                LibsnesCore _ => Properties.Resources.bsnes,
                GPGX _ => Properties.Resources.genplus,
                Gameboy _ => Properties.Resources.gambatte,
                Snes9x _ => Properties.Resources.snes9x,
                MAME _ => Properties.Resources.mame,
                MGBAHawk _ => Properties.Resources.mGba,
                _ => null
            });
Ejemplo n.º 9
0
        public static Bitmap Icon(this IEmulator core)
        {
            var attributes = core.Attributes();

            if (attributes is not PortedCoreAttribute)
            {
                return(Properties.Resources.CorpHawkSmall);
            }

            return(core switch
            {
                QuickNES => Properties.Resources.QuickNes,
                LibsnesCore => Properties.Resources.Bsnes,
                GPGX => Properties.Resources.GenPlus,
                Gameboy => Properties.Resources.Gambatte,
                Snes9x => Properties.Resources.Snes9X,
                MAME => Properties.Resources.Mame,
                MGBAHawk => Properties.Resources.Mgba,
                MelonDS => Properties.Resources.MelonDS,
                _ => null
            });
        // TODO: This doesn't really belong here, but not sure where to put it
        public static void PopulateWithDefaultHeaderValues(
            this IMovie movie,
            IEmulator emulator,
            ISettingsAdapter settable,
            IGameInfo game,
            FirmwareManager firmwareManager,
            string author)
        {
            movie.Author                  = author;
            movie.EmulatorVersion         = VersionInfo.GetEmuVersion();
            movie.OriginalEmulatorVersion = VersionInfo.GetEmuVersion();
            movie.SystemID                = emulator.SystemId;

            if (settable.HasSyncSettings)
            {
                movie.SyncSettingsJson = ConfigService.SaveWithType(settable.GetSyncSettings());
            }

            if (game.IsNullInstance())
            {
                movie.GameName = "NULL";
            }
            else
            {
                movie.GameName = game.FilesystemSafeName();
                movie.Hash     = game.Hash;
                if (game.FirmwareHash != null)
                {
                    movie.FirmwareHash = game.FirmwareHash;
                }
            }

            if (emulator.HasBoardInfo())
            {
                movie.BoardName = emulator.AsBoardInfo().BoardName;
            }

            if (emulator.HasRegions())
            {
                var region = emulator.AsRegionable().Region;
                if (region == DisplayType.PAL)
                {
                    movie.HeaderEntries.Add(HeaderKeys.Pal, "1");
                }
            }

            if (firmwareManager.RecentlyServed.Count != 0)
            {
                foreach (var firmware in firmwareManager.RecentlyServed)
                {
                    var key = firmware.ID.MovieHeaderKey;
                    if (!movie.HeaderEntries.ContainsKey(key))
                    {
                        movie.HeaderEntries.Add(key, firmware.Hash);
                    }
                }
            }

            if (emulator is NDS nds && nds.IsDSi)
            {
                movie.HeaderEntries.Add("IsDSi", "1");

                if (nds.IsDSiWare)
                {
                    movie.HeaderEntries.Add("IsDSiWare", "1");
                }
            }

            if ((emulator is NES nes && nes.IsVS) ||
                (emulator is SubNESHawk subnes && subnes.IsVs))
            {
                movie.HeaderEntries.Add("IsVS", "1");
            }

            if (emulator is IGameboyCommon gb)
            {
                if (gb.IsCGBMode())
                {
                    movie.HeaderEntries.Add(gb.IsCGBDMGMode() ? "IsCGBDMGMode" : "IsCGBMode", "1");
                }
            }

            if (emulator is SMS sms)
            {
                if (sms.IsSG1000)
                {
                    movie.HeaderEntries.Add("IsSGMode", "1");
                }

                if (sms.IsGameGear)
                {
                    movie.HeaderEntries.Add("IsGGMode", "1");
                }
            }

            if (emulator is GPGX gpgx && gpgx.IsMegaCD)
            {
                movie.HeaderEntries.Add("IsSegaCDMode", "1");
            }

            if (emulator is PicoDrive pico && pico.Is32XActive)
            {
                movie.HeaderEntries.Add("Is32X", "1");
            }

            if (emulator is ICycleTiming)
            {
                movie.HeaderEntries.Add(HeaderKeys.CycleCount, "0");
                movie.HeaderEntries.Add(HeaderKeys.ClockRate, "0");
            }

            movie.Core = emulator.Attributes().CoreName;
        }