public void HandleKeyUp(KeyboardKeyEventArgs e, Nes nes) { if (m_ButtonsByKey.TryGetValue(e.Key, out var button)) { nes.SetControllerButtonPressed(button, false); } }
public static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine($"Nesemuto v{k_Version}"); Console.WriteLine("usage: nesemuto pathToGameFile [pathToCheatFile]"); return; } Nes nes; try { string gamePath = args[0]; string cheatPath = args.Length >= 2 ? args[1] : null; nes = new Nes(gamePath, cheatPath); } catch (Exception ex) { Console.Error.WriteLine($"Error: {ex.Message}"); return; } using (nes) { using (var window = new EmulatorWindow(nes, VSyncMode.On)) { const int nesFramesPerSecond = 60; window.Run(0, nesFramesPerSecond); } } }
public EmulatorWindow(Nes nes, VSyncMode vSyncMode) : base(k_NesScreenWidth * k_DefaultScreenSizeMultiplier, k_NesScreenHeight * k_DefaultScreenSizeMultiplier, GraphicsMode.Default, k_Title) { VSync = vSyncMode; m_Nes = nes; }