Example #1
0
        public static void LoadRom(string fileName)
        {
            CurrentGameFile = fileName;

            NesEmu.EmulationPaused = true;
            // Make sure it's still paused !
            bool   is_supported_mapper = false;
            bool   has_issues          = false;
            string issues = "";

            if (NesEmu.CheckRom(fileName, out is_supported_mapper, out has_issues, out issues))
            {
                if (!is_supported_mapper)
                {
                    Console.WriteLine("** MAPPER IS NOT SUPPORTED !!");
                    Console.WriteLine("** RUNNING WITH DEFAULT MAPPER CONFIGURATION");
                }
                if (has_issues)
                {
                    Console.WriteLine("** " + issues);
                }
                NesEmu.EmulationON     = false;
                NesEmu.EmulationPaused = true;
                // Kill the original thread
                if (NesEmu.EmulationThread != null)
                {
                    if (NesEmu.EmulationThread.IsAlive)
                    {
                        NesEmu.EmulationThread.Abort();
                    }
                }

                // Create new
                TVSystemSetting sett = TVSystemSetting.AUTO;
                switch (Settings.TvSystemSetting.ToLower())
                {
                case "auto":
                    sett = TVSystemSetting.AUTO;
                    break;

                case "ntsc":
                    sett = TVSystemSetting.NTSC;
                    break;

                case "palb":
                    sett = TVSystemSetting.PALB;
                    break;

                case "dendy":
                    sett = TVSystemSetting.DENDY;
                    break;
                }
                NesEmu.CreateNew(fileName, sett, true);

                VIDEO.SetWindowTitle();
                InitializePalette();// Confirm palette selection !
                NesEmu.EmulationPaused = true;
            }
            else
            {
                Console.WriteLine(@"** MY NES CAN'T RUN THIS GAME !!");
                if (!is_supported_mapper)
                {
                    Console.WriteLine("** MAPPER IS NOT SUPPORTED !!");
                    Console.WriteLine("** RUNNING WITH DEFAULT MAPPER CONFIGURATION");
                }
                if (has_issues)
                {
                    Console.WriteLine("** " + issues);
                }
                if (NesEmu.EmulationON)
                {
                    NesEmu.EmulationPaused = false;
                }
            }
        }