Пример #1
0
 public InstructionItem(GameBoy.GameBoy gameBoy, Z80Instruction instruction)
 {
     if (gameBoy == null)
     {
         throw new ArgumentNullException(nameof(gameBoy));
     }
     if (instruction == null)
     {
         throw new ArgumentNullException(nameof(instruction));
     }
     _gameBoy     = gameBoy;
     _instruction = instruction;
 }
Пример #2
0
        private void DeviceManagerOnDeviceChanged(object sender, EventArgs e)
        {
            _currentDevice                 = App.Current.DeviceManager.CurrentDevice;
            _currentDevice.Cpu.Paused     += GameBoyOnPaused;
            _currentDevice.Gpu.VideoOutput = _videoWindow;

            _videoWindow.Device = _currentDevice;
            _videoWindow.Show();
            _keypadWindow.Device = _currentDevice;

            RefreshView();

            if (EnableSoundsMenuItem.IsChecked)
            {
                _currentDevice.Spu.ActivateAllChannels();
            }
            else
            {
                _currentDevice.Spu.DeactivateAllChannels();
            }
        }
Пример #3
0
        private void OnDeviceChanged(object sender, EventArgs e)
        {
            if (_currentDevice != null)
            {
                _currentDevice.Cpu.Paused  -= GameBoyOnPaused;
                _currentDevice.Cpu.Resumed -= GameBoyOnResumed;
                RunningOverlay.DisableOverlay();
            }

            _currentDevice                 = DeviceManager.CurrentDevice;
            _currentDevice.Cpu.Paused     += GameBoyOnPaused;
            _currentDevice.Cpu.Resumed    += GameBoyOnResumed;
            _currentDevice.Gpu.VideoOutput = _videoWindow;

            _videoWindow.Device  = _currentDevice;
            _keypadWindow.Device = _currentDevice;
            _ioWindow.Device     = _currentDevice;
            _mixerWindow.Mixer   = DeviceManager.AudioMixer;

            _videoWindow.Show();

            RefreshView();
        }
Пример #4
0
        private static void Main(string[] args)
        {
            PrintAbout();
            (string romFile, string saveFile) = ParseArguments(args);
            var settings = ReadSettings();

            using (var host = new EmuxHost(settings))
                using (var mbc = new BufferedExternalMemory(saveFile))
                {
                    var cartridge = new EmulatedCartridge(File.ReadAllBytes(romFile), mbc);
                    var device    = new GameBoy.GameBoy(cartridge, host, true);
                    host.GameBoy = device;

                    device.Gpu.VideoOutput = host;

                    var mixer = new GameBoyNAudioMixer();
                    mixer.Connect(device.Spu);
                    var player = new DirectSoundOut();
                    player.Init(mixer);
                    player.Play();

                    host.Run();
                }
        }