示例#1
0
                    void SaveConfigFile(EmuCores.BytePusher.ConfigsBytePusher aConfigs)
                    {
                        try
                        {
                            string confFile = JsonUtility.ToJson(aConfigs, prettyPrint: true);

                            System.IO.File.WriteAllText(Application.dataPath + "/../core_BytePusher.cfg", confFile);
                        }
                        catch (System.Exception e)
                        {
                            EmuEnvironment.ShowErrorBox("BytePusher Emu Error", e.Message);
                        }
                    }
示例#2
0
                    EmuCores.BytePusher.ConfigsBytePusher LoadConfigFile()
                    {
                        try
                        {
                            string confFile = System.IO.File.ReadAllText(Application.dataPath + "/../core_BytePusher.cfg");

                            EmuCores.BytePusher.ConfigsBytePusher confData = JsonUtility.FromJson <EmuCores.BytePusher.ConfigsBytePusher>(confFile);

                            return(confData);
                        }
                        catch (System.Exception e)
                        {
                            return(new EmuCores.BytePusher.ConfigsBytePusher());
                        }
                    }
示例#3
0
                    void Start()
                    {
                        EmuCores.BytePusher.ConfigsBytePusher configsBytePusher = LoadConfigFile();

                        // Running direct from scene
                        if (EmuEnvironment.EmuCore == EmuEnvironment.Cores._Unknown)
                        {
                            EmuEnvironment.RomFilePath = frontendConfigs.romsPath[frontendConfigs.selectedRomIndex];

                            OverrideConfigsWithFrontend(configsBytePusher);
                        }


                        emuDisplay.displayWidth      = 256;
                        emuDisplay.displayHeight     = 256;
                        emuDisplay.displayZoomFactor = configsBytePusher.graphics.displayZoom;
                        emuDisplay.SetScreenStandard();

                        m_emuBytePusher                 = new EmuCores.BytePusher.EmuBytePusher(configsBytePusher);
                        m_emuBytePusher.DrawDisplay     = DisplayRenderer;
                        m_emuBytePusher.PlayAudio       = PlayAudio;
                        m_emuBytePusher.UpdateInputKeys = UpdateKeys;

                        try
                        {
                            byte[] romData = System.IO.File.ReadAllBytes(EmuEnvironment.RomFilePath);

                            if (!m_emuBytePusher.LoadRom(romData))
                            {
                                throw new System.ArgumentException("Invalid ROM format");
                            }
                        }
                        catch (System.Exception e)
                        {
                            EmuEnvironment.ShowErrorBox("BytePusher Emu Error", "Failed loading rom:\n" + e.Message);
                            Application.Quit();
                        }

                        SaveConfigFile(configsBytePusher);
                    }
示例#4
0
 void OverrideConfigsWithFrontend(EmuCores.BytePusher.ConfigsBytePusher aConf)
 {
     aConf.graphics.displayZoom = frontendConfigs.zoomFactor;
 }