Ejemplo n.º 1
0
        public void subitem_Stop_CPU()
        {
            if (Critical_failure == false)
            {
                try
                {
                    if (video.Fatal_error)
                    {
                        MessageBox.Show("The Space Invaders encountered an error loading, \nthis option is not available right now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (!time.Enabled && paused == false)
                    {
                        MessageBox.Show("CPU can not be stopped if it has not been started yet, \nthis operation can not continue.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    else
                    {
                        if (time.Enabled)
                        {
                            time.Stop();
                        }

                        if (Paused_state == true)
                        {
                            Paused_state = false;
                        }

                        video.uninit_directx();
                        sound.uninit_directsound();
                        input.Uninitialize_Keyboard();

                        if (cpu != null)
                        {
                            cpu = null;
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("A critical error has been detected in the emulator, This menu has been disabled. Please contact author for assistance.", "Error!", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 2
0
        public void subitem_Restart_CPU()
        {
            if (Critical_failure == false)
            {
                try
                {
                    if (video.Fatal_error)
                    {
                        MessageBox.Show("The Space Invaders encountered an error loading, \nthis option is not available right now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }

                    if (!time.Enabled && paused == false)
                    {
                        MessageBox.Show("CPU can not be restarted if it has not been started yet, \nthis operation can not continue.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    else
                    {
                        if (time.Enabled)
                        {
                            time.Stop();
                        }

                        if (paused == true)
                        {
                            paused = false;
                        }

                        Window_state = FormWindowState.Minimized;
                        Taskbar_visibility = false;
                        Screen_visibility = false;

                        video.reinit_directx();
                        sound.reinit_directsound();
                        input.Reinitialize_Keyboard(video.Directx_Window.Handle);

                        if (cpu != null)
                        {
                            cpu = null;
                        }

                        cpu = new Cpu(this, ref memory, ref video, ref sound, ref input);
                        memory.reinit_memory();

                        video.clear_screen();
                        video.Renderer();

                        time.Start();
                        video.Directx_Window.Activate();
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("A critical error has been detected in the emulator, This menu has been disabled. Please contact author for assistance.", "Error!", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 3
0
        public void subitem_Start_CPU()
        {
            if (Critical_failure == false)
            {
                try
                {
                    if (video != null && time != null)
                    {
                        if (video.Fatal_error)
                        {
                            MessageBox.Show("The Space Invaders encountered an error loading, \nthis option is not available right now.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }

                        if (time.Enabled || Paused_state == true)
                        {
                            MessageBox.Show("CPU is either currently running or is currently paused, \nthis operation can not continue.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                    }

                    Window_state = FormWindowState.Minimized;
                    Taskbar_visibility = false;
                    Screen_visibility = false;

                    if (video == null)
                    {
                        video = new Video(this);
                        memory = new Memory(this, video);
                        input = new Input(this, video.Directx_Window.Handle);
                        sound = new Sound(this, video);
                        cpu = new Cpu(this, ref memory, ref video, ref sound, ref input);
                    }
                    else
                    {
                        video.reinit_directx();
                        sound.reinit_directsound();
                        input.Reinitialize_Keyboard(video.Directx_Window.Handle);
                        if (cpu == null)
                        {
                            cpu = new Cpu(this, ref memory, ref video, ref sound, ref input);
                        }
                    }

                    if (time == null)
                    {
                        time = new Timer();
                        time.Interval = 15;
                        time.Tick += new EventHandler(time_Tick);
                    }

                    time.Start();
                    video.Directx_Window.Activate();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("A critical error has been detected in the emulator, This menu has been disabled. Please contact author for assistance.", "Error!", MessageBoxButtons.OK);
            }
        }