示例#1
0
        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;
        }
示例#2
0
        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);
            //}
        }
示例#3
0
        protected override void OnDeactivate(EventArgs e)
        {
            base.OnDeactivate(e);

            MessagePump.Pause();
        }
示例#4
0
        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);

            MessagePump.Resume();
        }