예제 #1
0
        void StartEmulator(string romPath)
        {
            if (emulatorRunning)
            {
                return;
            }

            if (!File.Exists(romPath) || !romPath.EndsWith(".gbc"))
            {
                return;
            }

            emulatorRunning = true;

            Configuration.Settings settings = Program.settings;

            sdl2Manager = new SDL2Manager(settings);

            //Application.Invoke allows methods to be called on the main GUI thread.
            sdl2Manager.OnEmulatorStarted += (o, e) => Application.Invoke(OnEmulatorStart);

            sdl2Manager.OnEmulatorPaused += (o, e) => Application.Invoke(OnEmulatorPause);

            sdl2Manager.OnEmulatorResumed += (o, e) => Application.Invoke(OnEmulatorResume);

            sdl2Manager.OnEmulatorStop += (o, e) => Application.Invoke(OnEmulatorStop);

            sdl2Manager.Start(romPath);
        }
예제 #2
0
        void OnEmulatorStop(object o, EventArgs e)
        {
            emulatorRunning = false;

            playPauseButton.Image = playIcon;

            stopButton.Sensitive = false;

            toolbar.Sensitive = true;

            sdl2Manager = null;
        }