示例#1
0
文件: FrontendGB.cs 项目: fattard/xFF
                    EmuCores.GB.ConfigsGB LoadConfigFile( )
                    {
                        try
                        {
                            if (!System.IO.File.Exists(Application.dataPath + "/../core_GB.cfg"))
                            {
                                return(new EmuCores.GB.ConfigsGB());
                            }

                            string confFile = System.IO.File.ReadAllText(Application.dataPath + "/../core_GB.cfg");

                            EmuCores.GB.ConfigsGB confData = JsonUtility.FromJson <EmuCores.GB.ConfigsGB>(confFile);

                            return(confData);
                        }
                        catch (System.Exception e)
                        {
                            EmuEnvironment.ShowErrorBox("GB Emu Error", "Invalid data in config file \"core_gb.cfg\"\n\n" + e.Message);
                            if (!Application.isEditor)
                            {
                                Application.Quit();
                                return(null);
                            }

                            return(new EmuCores.GB.ConfigsGB());
                        }
                    }
示例#2
0
文件: LCDDisplay.cs 项目: fattard/xFF
                    public void SetLCDColors(EmuCores.GB.ConfigsGB aConfigs)
                    {
                        m_LCDColor[0] = new Color(aConfigs.dmgColors.color0.r / 255.0f, aConfigs.dmgColors.color0.g / 255.0f, aConfigs.dmgColors.color0.b / 255.0f);
                        m_LCDColor[1] = new Color(aConfigs.dmgColors.color1.r / 255.0f, aConfigs.dmgColors.color1.g / 255.0f, aConfigs.dmgColors.color1.b / 255.0f);
                        m_LCDColor[2] = new Color(aConfigs.dmgColors.color2.r / 255.0f, aConfigs.dmgColors.color2.g / 255.0f, aConfigs.dmgColors.color2.b / 255.0f);
                        m_LCDColor[3] = new Color(aConfigs.dmgColors.color3.r / 255.0f, aConfigs.dmgColors.color3.g / 255.0f, aConfigs.dmgColors.color3.b / 255.0f);

                        m_disabledLCDColor = new Color(aConfigs.dmgColors.colorDisabledLCD.r / 255.0f, aConfigs.dmgColors.colorDisabledLCD.g / 255.0f, aConfigs.dmgColors.colorDisabledLCD.b / 255.0f);
                    }
示例#3
0
文件: LCDDisplay.cs 项目: fattard/xFF
                    public void SetConfigs(EmuCores.GB.ConfigsGB aConfigs)
                    {
                        gbDisplay.displayWidth      = 160;
                        gbDisplay.displayHeight     = 144;
                        gbDisplay.displayZoomFactor = aConfigs.graphics.displayZoom;
                        gbDisplay.SetScreenStandard();

                        SetLCDColors(aConfigs);
                    }
示例#4
0
文件: FrontendGB.cs 项目: fattard/xFF
 void OverrideConfigsColors(EmuCores.GB.ConfigsGB aConf)
 {
     // DMG Colors
     aConf.dmgColors.color0.Set((int)(255 * frontendConfigs.color0.r), (int)(255 * frontendConfigs.color0.g), (int)(255 * frontendConfigs.color0.b));
     aConf.dmgColors.color1.Set((int)(255 * frontendConfigs.color1.r), (int)(255 * frontendConfigs.color1.g), (int)(255 * frontendConfigs.color1.b));
     aConf.dmgColors.color2.Set((int)(255 * frontendConfigs.color2.r), (int)(255 * frontendConfigs.color2.g), (int)(255 * frontendConfigs.color2.b));
     aConf.dmgColors.color3.Set((int)(255 * frontendConfigs.color3.r), (int)(255 * frontendConfigs.color3.g), (int)(255 * frontendConfigs.color3.b));
     aConf.dmgColors.colorDisabledLCD.Set((int)(255 * frontendConfigs.color0.r), (int)(255 * frontendConfigs.color0.g), (int)(255 * frontendConfigs.color0.b));
 }
示例#5
0
文件: FrontendGB.cs 项目: fattard/xFF
                    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();
                    }
示例#6
0
文件: FrontendGB.cs 项目: fattard/xFF
                    void SaveConfigFile(EmuCores.GB.ConfigsGB aConfigs)
                    {
                        try
                        {
                            string confFile = JsonUtility.ToJson(aConfigs, prettyPrint: true);

                            System.IO.File.WriteAllText(Application.dataPath + "/../core_GB.cfg", confFile);
                        }
                        catch (System.Exception e)
                        {
                            EmuEnvironment.ShowErrorBox("GB Emu Error", e.Message);
                        }
                    }
示例#7
0
文件: FrontendGB.cs 项目: fattard/xFF
                    void OverrideConfigsWithFrontend(EmuCores.GB.ConfigsGB aConf)
                    {
                        // Graphics
                        aConf.graphics.displayZoom = frontendConfigs.zoomFactor;

                        // Bootrom
                        aConf.bootRomDMG.customEnabled    = (frontendConfigs.bootRomMode == ConfigsGB.BootRomMode.ExternalFile);
                        aConf.bootRomDMG.path             = frontendConfigs.bootRomPath;
                        aConf.bootRomDMG.internalAnimType = (int)frontendConfigs.bootRomMode;

                        // DMG Colors
                        OverrideConfigsColors(aConf);

                        // Audio
                        aConf.audio.soundChannel_1 = dsp.channel1Enabled;
                        aConf.audio.soundChannel_2 = dsp.channel2Enabled;
                        aConf.audio.soundChannel_3 = dsp.channel3Enabled;
                        aConf.audio.soundChannel_4 = dsp.channel4Enabled;
                    }