IEnumerator Start( ) { this.enabled = false; while (!m_platform.IsInited) { yield return(null); } this.enabled = true; EmuCores.GB.ConfigsGB configsGB = LoadConfigFile(); // Find preferred input m_gbInput = GBInput.BuildInput(configsGB.inputProfiles[configsGB.inputProfileActiveIndex], m_platform.GetConnectedInputs()); // Running direct from scene if (EmuEnvironment.EmuCore == EmuEnvironment.Cores._Unknown) { EmuEnvironment.RomFilePath = frontendConfigs.romsPath[frontendConfigs.selectedRomIndex]; OverrideConfigsWithFrontend(configsGB); } lcdDisplay.SetConfigs(configsGB); m_emuGB = new EmuCores.GB.EmuGB(configsGB); m_emuGB.DrawDisplay = lcdDisplay.DrawDisplay; m_emuGB.DrawDisplayLine = lcdDisplay.DrawDisplayLine; m_emuGB.PlayAudio = dsp.PlayAudio; dsp.ConfigBuffers(m_emuGB.APU); dsp.channel1Enabled = configsGB.audio.soundChannel_1; dsp.channel2Enabled = configsGB.audio.soundChannel_2; dsp.channel3Enabled = configsGB.audio.soundChannel_3; dsp.channel4Enabled = configsGB.audio.soundChannel_4; m_emuGB.GetKeysState = m_gbInput.GetKeysState; //m_emuGB.PlayAudio = PlayAudio; //m_emuGB.UpdateInputKeys = UpdateKeys; m_emuGB.BindLogger(Debug.Log, Debug.LogWarning, Debug.LogError); LoadBootRom(); if (!string.IsNullOrEmpty(EmuEnvironment.RomFilePath)) { LoadROM(); } SaveConfigFile(configsGB); lastUpdateTick = Time.realtimeSinceStartup; //m_emuGB.CPU.UserCyclesRate = 500; m_emuGB.PowerOn(); }
public void LoadFile(byte[] loadFile) { interruptManager = new InterruptManager(); timer = new GBTimer(interruptManager); serial = new Serial(); audio = new GBAudio(); wram = new WRAM(); hram = new HRAM(); video = new Video(interruptManager, screen); cart = CartLoader.LoadCart(loadFile); input = new GBInput(interruptManager, inputHandler); mmu = new MMU(interruptManager, cart, input, audio, timer, serial, video, wram, hram); cpu = new CPU(interruptManager, mmu.Read, mmu.Write, mmu.UpdateTime); }
public MMU(InterruptManager iM, Cart iCart, GBInput iInput, GBAudio iAudio, GBTimer iTimer, Serial iSerial, Video iVideo, WRAM iWram, HRAM iHram) { interruptManager = iM; cart = iCart; input = iInput; timer = iTimer; LCD = iVideo; serial = iSerial; audio = iAudio; wram = iWram; hram = iHram; }