protected override void OnLoad(EventArgs e) { base.OnLoad(e); int width = ScreenWidth * 2; int height = ScreenHeight * 2 + mainFormMenuStrip.Height; this.ClientSize = new Size(width, height); BuildPaletteMenu("greyscale"); _renderer = new GdiRenderer(ScreenWidth, ScreenHeight, displayPanel, _palettes["greyscale"]); _gameBoy = new GameBoy(_renderer, this); string romPath = @"roms\Legend of Zelda, The - Link's Awakening (U) (V1.2) [!].gb"; _gameBoy.LoadRom(File.ReadAllBytes(romPath)); //_savePath = Path.ChangeExtension(romPath, "sav"); //if (File.Exists(_savePath)) //{ // using (var stream = File.OpenRead(_savePath)) // { // _gameBoy.Cartridge.LoadExternalRam(stream); // } //} displayPanel.RealTimeUpdate = true; MessagePump.RunWhileIdle(Frame); _limitFrameRate = true; }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); MessagePump.Stop(); //using (var stream = File.Open(_savePath, FileMode.Create, FileAccess.Write)) //{ // _gameBoy.Cartridge.SaveExternalRam(stream); //} }
protected override void OnDeactivate(EventArgs e) { base.OnDeactivate(e); MessagePump.Pause(); }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); MessagePump.Resume(); }