예제 #1
0
        void CleanUp()
        {
            OnEmulatorStarted = null;
            OnEmulatorPaused  = null;
            OnEmulatorResumed = null;

            emulatedGameBoy.Pause();
            UnloadRom();

            emulatedGameBoy.Dispose();
            emulatedGameBoy = null;

            videoRenderer.Dispose();
            videoRenderer = null;

            audioRenderer.Dispose();
            audioRenderer = null;

            inputJoypad.Dispose();
            inputJoypad = null;

            SDL.SDL_DestroyWindow(window);
            window = IntPtr.Zero;

            SDL.SDL_Quit();

            OnEmulatorStop?.Invoke(null, null);
        }
예제 #2
0
        void InitializeEmulator()
        {
            emulatedGameBoy = new EmulatedGameBoy();

            emulatedGameBoy.TryUsingBootRom        = settings.UseBootstrapRom;
            emulatedGameBoy.EnableFramerateLimiter = settings.LimitSpeed;

            emulatedGameBoy.Bus.AudioRenderer = audioRenderer = new SDL2AudioRenderer();;

            emulatedGameBoy.Bus.VideoRenderer = videoRenderer = new SDL2VideoRenderer(window);

            emulatedGameBoy.Bus.SetJoypad(0, inputJoypad = new SDL2InputJoypad(keyStateManager = new SDL2KeyStateManager()));

            try
            {
                emulatedGameBoy.Reset(settings.HardwareType);
            }
            catch
            {
                //Todo: Add something
            }
        }