Пример #1
0
 public override void Execute()
 {
     if (NesEmu.EmulationON)
     {
         NesEmu.LoadState();
         Program.PausedShowMenu = false;
         NesEmu.EmulationPaused = false;
     }
     else
     {
         Program.VIDEO.WriteNotification("EMULATION IS OFF !!", 120, System.Drawing.Color.Red);
     }
 }
Пример #2
0
        private static void DoCommandLines(string[] args)
        {
            if (args == null)
            {
                return;
            }
            if (args.Length == 0)
            {
                return;
            }

            // Loop through commands and execute them one by one
            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i].ToLower())
                {
                case "/audio_on": Program.Settings.Audio_SoundEnabled = true; FormMain.InitializeSoundRenderer(); break;

                case "/audio_off": Program.Settings.Audio_SoundEnabled = false; FormMain.InitializeSoundRenderer(); break;

                case "/f_skip_off": Program.Settings.FrameSkip_Enabled = false; break;

                case "/f_skip_1": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 1; break;

                case "/f_skip_2": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 2; break;

                case "/f_skip_3": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 3; break;

                case "/f_skip_4": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 4; break;

                case "/f_skip_5": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 5; break;

                case "/f_skip_6": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 6; break;

                case "/f_skip_7": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 7; break;

                case "/f_skip_8": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 8; break;

                case "/f_skip_9": Program.Settings.FrameSkip_Enabled = true; Program.Settings.FrameSkip_Reload = 9; break;

                case "/pal_use_gen": Program.Settings.Palette_UseGenerators = true; break;

                case "/pal_dontuse_gen": Program.Settings.Palette_UseGenerators = false; break;

                case "/pal_gen_auto": Program.Settings.Palette_GeneratorUsageMode = PaletteGeneratorUsage.AUTO; break;

                case "/pal_gen_ntsc": Program.Settings.Palette_GeneratorUsageMode = PaletteGeneratorUsage.NTSC; break;

                case "/pal_gen_pal": Program.Settings.Palette_GeneratorUsageMode = PaletteGeneratorUsage.PAL; break;

                case "/sram_save_on": Program.Settings.SaveSramOnShutdown = true; break;

                case "/sram_save_off": Program.Settings.SaveSramOnShutdown = false; break;

                case "/show_issues_on": Program.Settings.ShowRomIssuesIfHave = true; break;

                case "/show_issues_off": Program.Settings.ShowRomIssuesIfHave = true; break;

                case "/tv_auto": Program.Settings.TVSystemSetting = Core.TVSystemSetting.AUTO; break;

                case "/tv_ntsc": Program.Settings.TVSystemSetting = Core.TVSystemSetting.NTSC; break;

                case "/tv_pal": Program.Settings.TVSystemSetting = Core.TVSystemSetting.PALB; break;

                case "/tv_dendy": Program.Settings.TVSystemSetting = Core.TVSystemSetting.DENDY; break;

                case "/vid_hide_lines_on": Program.Settings.Video_CutLines = true; break;

                case "/vid_hide_lines_off": Program.Settings.Video_CutLines = false; break;

                case "/vid_filter_point": Program.Settings.Video_Filter = SlimDX.Direct3D9.TextureFilter.Point; break;

                case "/vid_filter_none": Program.Settings.Video_Filter = SlimDX.Direct3D9.TextureFilter.None; break;

                case "/vid_filter_linear": Program.Settings.Video_Filter = SlimDX.Direct3D9.TextureFilter.Linear; break;

                case "/vid_vertex_hardware": Program.Settings.Video_HardwareVertexProcessing = true; break;

                case "/vid_vertex_software": Program.Settings.Video_HardwareVertexProcessing = false; break;

                case "/vid_keep_apsect_on": Program.Settings.Video_KeepAspectRatio = true; break;

                case "/vid_keep_apsect_off": Program.Settings.Video_KeepAspectRatio = false; break;

                case "/vid_fps_on": Program.Settings.Video_ShowFPS = true; break;

                case "/vid_fps_off": Program.Settings.Video_ShowFPS = false; break;

                case "/vid_noti_on": Program.Settings.Video_ShowNotifications = true; break;

                case "/vid_noti_off": Program.Settings.Video_ShowNotifications = false; break;

                case "/vid_fullscreen": Program.Settings.Video_StartFullscreen = true; break;

                case "/vid_wind": Program.Settings.Video_StartFullscreen = false; break;

                case "/vid_stretch_wind_on": Program.Settings.Video_StretchToMulti = true; break;

                case "/vid_stretch_wind_off": Program.Settings.Video_StretchToMulti = false; break;

                case "/state_slot_0": NesEmu.STATESlot = 0; break;

                case "/state_slot_1": NesEmu.STATESlot = 1; break;

                case "/state_slot_2": NesEmu.STATESlot = 2; break;

                case "/state_slot_3": NesEmu.STATESlot = 3; break;

                case "/state_slot_4": NesEmu.STATESlot = 4; break;

                case "/state_slot_5": NesEmu.STATESlot = 5; break;

                case "/state_slot_6": NesEmu.STATESlot = 6; break;

                case "/state_slot_7": NesEmu.STATESlot = 7; break;

                case "/state_slot_8": NesEmu.STATESlot = 8; break;

                case "/state_slot_9": NesEmu.STATESlot = 9; break;

                case "/state_load": NesEmu.LoadState(); break;    // Request a state load on the first rendered frame !
                }
            }

            // First command must be file path, run it here to apply commands first.
            if (File.Exists(args[0]))
            {
                FormMain.OpenRom(args[0]);
            }
        }
Пример #3
0
        private static void CheckJoyShortcuts()
        {
            if (IsJoyButtonPressed(Settings.JoyKey_SwitchFullscreen))
            {
                VIDEO.SwitchFullscreen();
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_HardReset))
            {
                if (NesEmu.EmulationON)
                {
                    NesEmu.EMUHardReset();
                }
                else
                {
                    if (CurrentGameFile != "")
                    {
                        if (File.Exists(CurrentGameFile))
                        {
                            LoadRom(CurrentGameFile);
                        }
                    }
                }
                VIDEO.WriteNotification("HARD RESET", 120, System.Drawing.Color.Red);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_SoftReset))
            {
                NesEmu.EMUSoftReset();
                VIDEO.WriteNotification("SOFT RESET", 120, System.Drawing.Color.LightYellow);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_TakeSnap))
            {
                NesEmu.TakeSnapshot();
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_LoadState))
            {
                NesEmu.LoadState();
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_SaveState))
            {
                NesEmu.SaveState();
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_ShutdownEmu))
            {
                NesEmu.EmulationON = false;
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot0))
            {
                NesEmu.UpdateStateSlot(0);
                VIDEO.WriteNotification("STATE SLOT SET TO 0", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot1))
            {
                NesEmu.UpdateStateSlot(1);
                VIDEO.WriteNotification("STATE SLOT SET TO 1", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot2))
            {
                NesEmu.UpdateStateSlot(2);
                VIDEO.WriteNotification("STATE SLOT SET TO 2", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot3))
            {
                NesEmu.UpdateStateSlot(3);
                VIDEO.WriteNotification("STATE SLOT SET TO 3", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot4))
            {
                NesEmu.UpdateStateSlot(4);
                VIDEO.WriteNotification("STATE SLOT SET TO 4", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot5))
            {
                NesEmu.UpdateStateSlot(5);
                VIDEO.WriteNotification("STATE SLOT SET TO 5", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot6))
            {
                NesEmu.UpdateStateSlot(6);
                VIDEO.WriteNotification("STATE SLOT SET TO 6", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot7))
            {
                NesEmu.UpdateStateSlot(7);
                VIDEO.WriteNotification("STATE SLOT SET TO 7", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot8))
            {
                NesEmu.UpdateStateSlot(8);
                VIDEO.WriteNotification("STATE SLOT SET TO 8", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_StateSlot9))
            {
                NesEmu.UpdateStateSlot(9);
                VIDEO.WriteNotification("STATE SLOT SET TO 9", 120, System.Drawing.Color.Lime);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_TogglePause))
            {
                NesEmu.EmulationPaused = !NesEmu.EmulationPaused;
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_ToggleTurbo))
            {
                NesEmu.SpeedLimitterON = !NesEmu.SpeedLimitterON;
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_RecordSound))
            {
                if (AUDIO.IsRecording)
                {
                    AUDIO.StopRecord();
                }
                else
                {
                    AUDIO.Record();
                }
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_ToggleFrameSkip))
            {
                Settings.FrameSkipEnabled = !Settings.FrameSkipEnabled;
                NesEmu.SetupFrameSkip(Settings.FrameSkipEnabled, (byte)Settings.FrameSkipCount);

                VIDEO.WriteNotification(Settings.FrameSkipEnabled ? "Frame skip enabled." : "Frame skip disabled.", 120, System.Drawing.Color.White);
            }
            else if (IsJoyButtonPressed(Settings.JoyKey_ShowGameStatus))
            {
                VIDEO.ShowGameStatus();
            }
        }
Пример #4
0
        private static void OnKeyDown(object sender, SdlDotNet.Input.KeyboardEventArgs e)
        {
            if (PausedShowMenu)
            {
                Rooms[RoomIndex].DoKeyDown(e);
                if (e.Key == Key.Tab)
                {
                    NesEmu.EmulationPaused = false;
                    PausedShowMenu         = false;
                    Rooms[RoomIndex].OnTabResume();
                }
                return;
            }

            if (e.Key == Key.Escape)
            {
                Quit();
            }
            else if (e.Key == Key.Tab)
            {
                if (!PausedShowMenu)
                {
                    NesEmu.EmulationPaused = true;
                    SelectRoom("main menu");
                    PausedShowMenu = true;
                }
                else
                {
                    NesEmu.EmulationPaused = false;
                    PausedShowMenu         = false;
                }
            }
            else if (e.Key == Key_SwitchFullscreen)
            {
                VIDEO.SwitchFullscreen();
            }
            else if (e.Key == Key_HardReset)
            {
                if (NesEmu.EmulationON)
                {
                    NesEmu.EMUHardReset();
                }
                else
                {
                    if (CurrentGameFile != "")
                    {
                        if (File.Exists(CurrentGameFile))
                        {
                            LoadRom(CurrentGameFile);
                        }
                    }
                }
                VIDEO.WriteNotification("HARD RESET", 120, System.Drawing.Color.Red);
            }
            else if (e.Key == Key_SoftReset)
            {
                NesEmu.EMUSoftReset();
                VIDEO.WriteNotification("SOFT RESET", 120, System.Drawing.Color.LightYellow);
            }
            else if (e.Key == Key_TakeSnap)
            {
                NesEmu.TakeSnapshot();
            }
            else if (e.Key == Key_LoadState)
            {
                NesEmu.LoadState();
            }
            else if (e.Key == Key_SaveState)
            {
                NesEmu.SaveState();
            }
            else if (e.Key == Key_ShutdownEmu)
            {
                NesEmu.EmulationON = false;
            }
            else if (e.Key == Key_StateSlot0)
            {
                NesEmu.UpdateStateSlot(0);
                VIDEO.WriteNotification("STATE SLOT SET TO 0", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot1)
            {
                NesEmu.UpdateStateSlot(1);
                VIDEO.WriteNotification("STATE SLOT SET TO 1", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot2)
            {
                NesEmu.UpdateStateSlot(2);
                VIDEO.WriteNotification("STATE SLOT SET TO 2", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot3)
            {
                NesEmu.UpdateStateSlot(3);
                VIDEO.WriteNotification("STATE SLOT SET TO 3", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot4)
            {
                NesEmu.UpdateStateSlot(4);
                VIDEO.WriteNotification("STATE SLOT SET TO 4", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot5)
            {
                NesEmu.UpdateStateSlot(5);
                VIDEO.WriteNotification("STATE SLOT SET TO 5", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot6)
            {
                NesEmu.UpdateStateSlot(6);
                VIDEO.WriteNotification("STATE SLOT SET TO 6", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot7)
            {
                NesEmu.UpdateStateSlot(7);
                VIDEO.WriteNotification("STATE SLOT SET TO 7", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot8)
            {
                NesEmu.UpdateStateSlot(8);
                VIDEO.WriteNotification("STATE SLOT SET TO 8", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_StateSlot9)
            {
                NesEmu.UpdateStateSlot(9);
                VIDEO.WriteNotification("STATE SLOT SET TO 9", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_TogglePause)
            {
                NesEmu.EmulationPaused = !NesEmu.EmulationPaused;
            }
            else if (e.Key == Key_ToggleTurbo)
            {
                NesEmu.SpeedLimitterON = !NesEmu.SpeedLimitterON;
            }
            else if (e.Key == Key_RecordSound)
            {
                if (AUDIO.IsRecording)
                {
                    AUDIO.StopRecord();
                }
                else
                {
                    AUDIO.Record();
                }
            }
            else if (e.Key == Key_ToggleFrameSkip)
            {
                Settings.FrameSkipEnabled = !Settings.FrameSkipEnabled;
                NesEmu.SetupFrameSkip(Settings.FrameSkipEnabled, (byte)Settings.FrameSkipCount);

                VIDEO.WriteNotification(Settings.FrameSkipEnabled ? "Frame skip enabled." : "Frame skip disabled.", 120, System.Drawing.Color.White);
            }
            else if (e.Key == Key.KeypadPlus || e.Key == Key.Plus)
            {
                if (AUDIO.Volume + 10 < 100)
                {
                    AUDIO.Volume += 10;
                }
                else
                {
                    AUDIO.Volume = 100;
                }
                VIDEO.WriteNotification("VOLUME " + AUDIO.Volume + " %", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key.Minus || e.Key == Key.KeypadMinus)
            {
                if (AUDIO.Volume - 10 > 0)
                {
                    AUDIO.Volume -= 10;
                }
                else
                {
                    AUDIO.Volume = 0;
                }
                VIDEO.WriteNotification("VOLUME " + AUDIO.Volume + " %", 120, System.Drawing.Color.Lime);
            }
            else if (e.Key == Key_ShowGameStatus)
            {
                VIDEO.ShowGameStatus();
            }
        }
Пример #5
0
        private static void ExecuteCommands(string[] commands)
        {
            if (commands == null)
            {
                return;
            }
            if (commands.Length == 0)
            {
                return;
            }
            // Commands that can be ued for emu
            foreach (string command in commands)
            {
                switch (command.ToLower())
                {
                case "record_sound":
                    AUDIO.Record();
                    break;

                case "gamegenie_enable":
                    ActiveGameGenie();
                    break;

                case "state_slot_0":
                    NesEmu.UpdateStateSlot(0);
                    break;

                case "state_slot_1":
                    NesEmu.UpdateStateSlot(1);
                    break;

                case "state_slot_2":
                    NesEmu.UpdateStateSlot(2);
                    break;

                case "state_slot_3":
                    NesEmu.UpdateStateSlot(3);
                    break;

                case "state_slot_4":
                    NesEmu.UpdateStateSlot(4);
                    break;

                case "state_slot_5":
                    NesEmu.UpdateStateSlot(5);
                    break;

                case "state_slot_6":
                    NesEmu.UpdateStateSlot(6);
                    break;

                case "state_slot_7":
                    NesEmu.UpdateStateSlot(7);
                    break;

                case "state_slot_8":
                    NesEmu.UpdateStateSlot(8);
                    break;

                case "state_slot_9":
                    NesEmu.UpdateStateSlot(9);
                    break;

                case "state_load":    // Request a state load on the first rendered frame !
                    NesEmu.LoadState();
                    break;
                }
            }
        }