public SDL2InputJoypad(SDL2KeyStateManager sdl2KeyStateManager, int joypadIndex = 0) : base(joypadIndex) { keyStateManager = sdl2KeyStateManager; if (joypadIndex < 0 || joypadIndex > 3) { throw new ArgumentOutOfRangeException(nameof(joypadIndex)); } }
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 } }