public void SetResolution(ScreenResolution resolution) { switch (resolution) { case ScreenResolution.w800h600: this.ScreenWidth = 800; this.ScreenHeight = 600; break; case ScreenResolution.w1024h768: this.ScreenWidth = 1024; this.ScreenHeight = 768; break; case ScreenResolution.w1280h1024: this.ScreenWidth = 1280; this.ScreenHeight = 1024; break; case ScreenResolution.w1920h1080: this.ScreenWidth = 1920; this.ScreenHeight = 1080; break; default: throw new GameSettingsException("Unsupported screen resolution"); } this.CurrentResolution = resolution; this.OnVideoSettingsChanged(); }
private static ScreenResolution GetScreenResolution() { if (screenResolution == ScreenResolution.Unknown) { var bounds = GetBounds(); if (bounds.Height < 768) screenResolution = ScreenResolution.Small; else if (bounds.Height < 1080) screenResolution = ScreenResolution.Medium; else screenResolution = ScreenResolution.Large; } return screenResolution; }
static int get_defaultWidth(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ScreenResolution obj = (ScreenResolution)o; int ret = obj.defaultWidth; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index defaultWidth on a nil value")); } }
//Changes the screen resolution based on the enum given public void ToggleScreenResolution(ScreenResolution screenRes_) { //Setting the screen resolution enum for our global reference globalReference.ScreenResDropdownEnum = screenRes_; //Sets the screen resolution based on the enum given switch (screenRes_) { case ScreenResolution.r1024x768: Screen.SetResolution(1024, 768, Screen.fullScreen); break; case ScreenResolution.r1280x800: Screen.SetResolution(1280, 800, Screen.fullScreen); break; case ScreenResolution.r1280x1024: Screen.SetResolution(1280, 1024, Screen.fullScreen); break; case ScreenResolution.r1366x768: Screen.SetResolution(1366, 768, Screen.fullScreen); break; case ScreenResolution.r1440x900: Screen.SetResolution(1440, 900, Screen.fullScreen); break; case ScreenResolution.r1600x900: Screen.SetResolution(1600, 900, Screen.fullScreen); break; case ScreenResolution.r1680x1050: Screen.SetResolution(1680, 1050, Screen.fullScreen); break; case ScreenResolution.r1920x1080: Screen.SetResolution(1920, 1080, Screen.fullScreen); break; case ScreenResolution.r1920x1200: Screen.SetResolution(1920, 1200, Screen.fullScreen); break; } }
static void DrawRound(ScreenResolution userScreen) // Отрисовка круга { Console.Write("Введите координаты центра круга: \nX = "); double.TryParse(Console.ReadLine(), out double X); Console.Write("Y = "); double.TryParse(Console.ReadLine(), out double Y); Console.Write("Введите радиус: \nR = "); double.TryParse(Console.ReadLine(), out double R); IDraw f = new Round(X, Y, userScreen) { Radius = R }; f.Draw(); }
void OrthSizeSetting() { Manager mg = GameObject.Find("Manager").GetComponent <Manager> (); ScreenResolution resolution = (ScreenResolution)mg.sy_Map.resolution; if (resolution.Equals(ScreenResolution.High)) { baseOrthSize = 4; } else if (resolution.Equals(ScreenResolution.Low)) { baseOrthSize = 2.6f; } if (mg.sy_OtherOption.ScreenSetting.platform == Variables.OtherOptionGroup.Platform.Mobile && (int)mg.sy_Map.orientation == 1) { baseOrthSize = 2.6f; } }
private void WriteKSPSettings() { string settingsPath = Path.Combine(KSPPathHelper.GetPath(KSPPaths.KSPRoot), PARAM_SETTINGS_CFG); if (File.Exists(settingsPath)) { if (ScreenResolution == null) { return; } int index1 = -1; int index2 = -1; string temp = string.Empty; string allText = File.ReadAllText(settingsPath); string[] size = ScreenResolution.Split("x"); if (size.Length == 2) { index1 = allText.IndexOf(Constants.SCREEN_WIDTH); index2 = allText.IndexOf(Environment.NewLine, index1); temp = allText.Substring(index1, index2 - index1); allText = allText.Replace(temp, string.Format(PARAM_0_EQUALS_1, Constants.SCREEN_WIDTH, size[0])); index1 = allText.IndexOf(Constants.SCREEN_HEIGHT); index2 = allText.IndexOf(Environment.NewLine, index1); temp = allText.Substring(index1, index2 - index1); allText = allText.Replace(temp, string.Format(PARAM_0_EQUALS_1, Constants.SCREEN_HEIGHT, size[1])); } index1 = allText.IndexOf(Constants.FULLSCREEN); index2 = allText.IndexOf(Environment.NewLine, index1); temp = allText.Substring(index1, index2 - index1); allText = allText.Replace(temp, string.Format(PARAM_0_EQUALS_1, Constants.FULLSCREEN, rbFullscreen.Checked)); File.WriteAllText(settingsPath, allText); Messenger.AddInfo(Messages.MSG_UPDATE_KSP_SETTINGS); settingsFileFound = true; } else { Messenger.AddInfo(Messages.MSG_CANT_FIND_KSP_SETTINGS); settingsFileFound = false; } }
private JsonContainers.MugshotLocations _GetMugshotLocations( ScreenResolution screenResolution = ScreenResolution.FullHD) { if (!File.Exists(_mugshotLocationConfigPath)) { throw new FileNotFoundException(_mugshotLocationConfigPath); } var readAllText = File.ReadAllText(_mugshotLocationConfigPath); var mugshotLocationsConfig = JsonConvert.DeserializeObject <JsonContainers.MugshotLocationsConfig>(readAllText); switch (screenResolution) { case ScreenResolution.FullHD: return(mugshotLocationsConfig.FullHD); } throw new NotImplementedException(nameof(screenResolution)); }
private static ScreenResolution GetScreenResolution() { if (screenResolution == ScreenResolution.Unknown) { var bounds = GetBounds(); if (bounds.Height < 768) { screenResolution = ScreenResolution.Small; } else if (bounds.Height < 1080) { screenResolution = ScreenResolution.Medium; } else { screenResolution = ScreenResolution.Large; } } return(screenResolution); }
public Point(double userX, double userY, ScreenResolution userScreen) { if ((int)Math.Abs(userX) > userScreen.Width) { throw new ArgumentException("Вышли за пределы экрана по оси OX"); } else { _x = userX; } if ((int)Math.Abs(userY) > userScreen.Height) { throw new ArgumentException("Вышли за пределы экрана по оси OY"); } else { _y = userY; } }
public Smartphone(string name, Manufacturer manufacturer, int size, decimal weight, ScreenResolution screenResolution, int ram, string processor, string operatingSystem, decimal price) { Name = name; Manufacturer = manufacturer; Size = size; Weight = weight; ScreenWidth = screenResolution.Width; ScreenHeight = screenResolution.Height; Ram = ram; Processor = processor; OperatingSystem = operatingSystem; Price = price; }
private void ApplyGraphicSettings() { if (!PlatformUtils.IsStandalone) { return; } ScreenResolution res = SettingsManager.Instance.Settings.GraphicSettings.resolution; FullScreenMode fullScreenMode = SettingsManager.Instance.Settings.GraphicSettings.fullScreenMode; if (res.Width > 0 && res.Height > 0 && res.RefreshRate > 0) { Screen.SetResolution(res.Width, res.Height, fullScreenMode, res.RefreshRate); } else { Debug.LogWarning($"Attempt to apply invalid screen resolution: {res}"); } }
static void DrawRectangle(ScreenResolution userScreen) // Отрисовка прямоугольника { Console.Write("Введите координаты начальной точки прямоугольника: \nX = "); double.TryParse(Console.ReadLine(), out double X); Console.Write("Y = "); double.TryParse(Console.ReadLine(), out double Y); Console.Write("Введите сторону A: \nA = "); double.TryParse(Console.ReadLine(), out double userA); Console.Write("Введите сторону B: \nA = "); double.TryParse(Console.ReadLine(), out double userB); IDraw f = new Rectangle(X, Y, userScreen) { A = userA, B = userB }; f.Draw(); }
static void DrawRing(ScreenResolution userScreen) // Отрисовка кольца { Console.Write("Введите координаты центра кольца: \nX = "); double.TryParse(Console.ReadLine(), out double X); Console.Write("Y = "); double.TryParse(Console.ReadLine(), out double Y); Console.Write("Введите внешний радиус: \nOR = "); double.TryParse(Console.ReadLine(), out double OR); Console.Write("Введите внутренний радиус: \nIR = "); double.TryParse(Console.ReadLine(), out double IR); IDraw f = new Ring(X, Y, userScreen) { OutterRadius = OR, InnerRadius = IR }; f.Draw(); }
public Resolutions(string devName) { deviceName = devName; DEVMODE dm = new DEVMODE { dmDeviceName = new string(new char[32]), dmFormName = new string(new char[32]) }; dm.dmSize = Convert.ToInt16(Marshal.SizeOf(dm)); int counter = 0; do { if (EnumDisplaySettings(deviceName, counter, ref dm) != 0) { ScreenResolution sr = new ScreenResolution { Total = dm.dmPelsWidth + " x " + dm.dmPelsHeight, width = dm.dmPelsWidth, height = dm.dmPelsHeight }; sr.Slim = sr.width + "x" + sr.height; if (!ScreenRes.Contains(sr)) { ScreenRes.Add(sr); } sr.Total = null; counter += 1; } else { break; } } while (true); }
public void SetupLevel(int levelNumber) { LevelData level = LevelData.Get(levelNumber, ScreenResolution.GetCurrentViewport()); nodes = new List <Node> (); edges = new List <Edge> (); int count = 0; foreach (Vector2 vector in level.nodes) { GameObject nodeObject = Instantiate(nodePrefab) as GameObject; nodeObject.name = "Node #" + count++; nodeObject.transform.position = new Vector3(vector.x, vector.y, 0); Node node = nodeObject.GetComponent <Node> (); nodes.Add(node); } foreach (V vector in level.edges) { GameObject edgeObject = Instantiate(edgePrefab) as GameObject; edgeObject.name = "Edge " + vector.input + "-" + vector.output; Edge edge = edgeObject.GetComponent <Edge> (); edge.input = nodes [(int)vector.input]; edge.output = nodes [(int)vector.output]; // Add to our global vertices list edges.Add(edge); // And inform nodes they've been connected edge.input.AddEdge(edge); edge.output.AddEdge(edge); } new Solver(this); }
/// <summary>Clear and populate the resolution dropdown</summary> private void PopulateDropdownResolution() { dropdownResolution.ClearOptions(); screenResolutionsCurrent.Clear(); List <string> options = new List <string>(); // Add allowed resolutions to screenResolutionsCurrent foreach (ScreenResolution screenResolution in screenResolutionsTotal) { // Continue if windowed and resolution is too large if (!fullscreen && (screenResolution.Width > nativeResolution.Width * maxWindowedResolutionRatio || screenResolution.Height > nativeResolution.Height * maxWindowedResolutionRatio)) { continue; } screenResolutionsCurrent.Add(screenResolution); } // Clamp resolution to the largest of screenResolutionsCurrent if (!fullscreen && (currentScreenResolution.Width > nativeResolution.Width * maxWindowedResolutionRatio || currentScreenResolution.Height > nativeResolution.Height * maxWindowedResolutionRatio) && screenResolutionsCurrent.Count > 0) { currentScreenResolution = screenResolutionsCurrent[screenResolutionsCurrent.Count - 1]; } // Add current resolution to screenResolutionsCurrent screenResolutionsCurrent.Insert(0, currentScreenResolution); // Add screenResolutions to options foreach (ScreenResolution screenResolution in screenResolutionsCurrent) { options.Add(screenResolution.ToString()); } dropdownResolution.AddOptions(options); dropdownResolution.SetValueWithoutNotify(0); }
// Use this for initialization private void Start() { // add button functions // reset RealGlobals ResetRG.GetComponent <Button>().onClick.AddListener(() => { if (RealGlobalCooldown > 0) { LuaScriptBinder.ClearVariables(); RealGlobalCooldown = 60 * 2; ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Real Globals Erased!" : "REEL GOLBELZ DELEET!!!!!"; } else { RealGlobalCooldown = 60 * 2; ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // reset AlMightyGlobals ResetAG.GetComponent <Button>().onClick.AddListener(() => { if (AlMightyGlobalCooldown > 0) { LuaScriptBinder.ClearAlMighty(); AlMightyGlobalCooldown = 60 * 2; ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "AlMighty Globals Erased!" : "ALMEIGHTIZ DELEET!!!!!"; } else { AlMightyGlobalCooldown = 60 * 2; ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // clear Save ClearSave.GetComponent <Button>().onClick.AddListener(() => { if (SaveCooldown > 0) { File.Delete(Application.persistentDataPath + "/save.gd"); SaveCooldown = 60 * 2; ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Save wiped!" : "RIP"; } else { SaveCooldown = 60 * 2; ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // toggle safe mode Safe.GetComponent <Button>().onClick.AddListener(() => { ControlPanel.instance.Safe = !ControlPanel.instance.Safe; // save Safe Mode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFSafeMode", DynValue.NewBoolean(ControlPanel.instance.Safe), true); Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off")) : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF")); }); Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off")) : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF")); // toggle retrocompatibility mode Retro.GetComponent <Button>().onClick.AddListener(() => { GlobalControls.retroMode = !GlobalControls.retroMode; // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(GlobalControls.retroMode), true); Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off")) : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF")); }); Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off")) : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF")); // toggle pixel-perfect fullscreen Fullscreen.GetComponent <Button>().onClick.AddListener(() => { ScreenResolution.perfectFullscreen = !ScreenResolution.perfectFullscreen; // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFPerfectFullscreen", DynValue.NewBoolean(ScreenResolution.perfectFullscreen), true); Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off")) : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF")); }); Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off")) : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF")); // change window scale Scale.GetComponent <Button>().onClick.AddListener(() => { double maxScale = System.Math.Floor(Screen.currentResolution.height / 480.0); if (ScreenResolution.windowScale < maxScale) { ScreenResolution.windowScale += 1; } else { ScreenResolution.windowScale = 1; } if (Screen.height != ScreenResolution.windowScale * 480 && !Screen.fullScreen) { ScreenResolution.SetFullScreen(false); } // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFWindowScale", DynValue.NewNumber(ScreenResolution.windowScale), true); Scale.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Window Scale: " + ScreenResolution.windowScale.ToString() + "x") : ("WEENDO STRECH: " + ScreenResolution.windowScale.ToString() + "X"); }); ScreenResolution.windowScale--; Scale.GetComponent <Button>().onClick.Invoke(); // Discord Rich Presence // Change Discord Status Visibility Discord.GetComponent <Button>().onClick.AddListener(() => { Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(1); }); Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(0); // exit Exit.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("ModSelect"); }); // Crate Your Frisk if (!GlobalControls.crate) { return; } // labels GameObject.Find("OptionsLabel").GetComponent <Text>().text = "OPSHUNS"; GameObject.Find("DescriptionLabel").GetComponent <Text>().text = "MORE TXET"; // buttons ResetRG.GetComponentInChildren <Text>().text = "RESTE RELA GOLBALZ"; ResetAG.GetComponentInChildren <Text>().text = "RESTE ALMIGTY GOLBALZ"; ClearSave.GetComponentInChildren <Text>().text = "WYPE SAV"; Exit.GetComponentInChildren <Text>().text = "EXIT TOO MAD SELCT"; }
public override ProcessStartInfo Generate(string system, string emulator, string core, string rom, string playersControllers, ScreenResolution resolution) { if (string.IsNullOrEmpty(RetroarchPath)) { return(null); } if (Path.GetExtension(rom).ToLowerInvariant() == ".libretro") { core = Path.GetFileNameWithoutExtension(rom); if (core == "xrick") { rom = Path.Combine(Path.GetDirectoryName(rom), "xrick", "data.zip"); } else if (core == "dinothawr") { rom = Path.Combine(Path.GetDirectoryName(rom), "dinothawr", "dinothawr.game"); } else { rom = null; } } if (core != null && core.IndexOf("dosbox", StringComparison.InvariantCultureIgnoreCase) >= 0) { string bat = Path.Combine(rom, "dosbox.bat"); if (File.Exists(bat)) { rom = bat; } else { string ext = Path.GetExtension(rom).ToLower(); if ((ext == ".dosbox" || ext == ".dos" || ext == ".pc") && File.Exists(rom)) { string tempRom = Path.Combine(Path.GetDirectoryName(rom), "dosbox.conf"); if (File.Exists(tempRom) && !new FileInfo(tempRom).Attributes.HasFlag(FileAttributes.Hidden)) { rom = tempRom; } else { try { if (File.Exists(tempRom)) { File.Delete(tempRom); } } catch { } try { File.Copy(rom, tempRom); new FileInfo(tempRom).Attributes |= FileAttributes.Hidden; rom = tempRom; _dosBoxTempRom = tempRom; } catch { } } } } } Configure(system, core, rom, resolution); ConfigureCoreOptions(system, core); List <string> commandArray = new List <string>(); string subSystem = SubSystem.GetSubSystem(core, system); if (!string.IsNullOrEmpty(subSystem)) { commandArray.Add("--subsystem"); commandArray.Add(subSystem); } if (!string.IsNullOrEmpty(SystemConfig["netplaymode"])) { // Netplay mode if (SystemConfig["netplaymode"] == "host") { commandArray.Add("--host"); } else if (SystemConfig["netplaymode"] == "client") { commandArray.Add("--connect"); commandArray.Add(SystemConfig["netplay.server.address"]); } } // RetroArch 1.7.8 requires the shaders to be passed as command line argument if (AppConfig.isOptSet("shaders") && SystemConfig.isOptSet("shader") && SystemConfig["shader"] != "None") { string shaderFilename = SystemConfig["shader"] + ".glslp"; string videoShader = Path.Combine(AppConfig.GetFullPath("shaders"), shaderFilename).Replace("/", "\\"); if (File.Exists(videoShader)) { commandArray.Add("--set-shader"); commandArray.Add("\"" + videoShader + "\""); } } string args = string.Join(" ", commandArray); return(new ProcessStartInfo() { FileName = Path.Combine(RetroarchPath, "retroarch.exe"), WorkingDirectory = RetroarchPath, Arguments = string.IsNullOrEmpty(rom) ? ("-L \"" + Path.Combine(RetroarchCorePath, core + "_libretro.dll") + "\" " + args).Trim() : ("-L \"" + Path.Combine(RetroarchCorePath, core + "_libretro.dll") + "\" \"" + rom + "\" " + args).Trim() }); }
public Line(Point userStartPoint, Point userEndPoint, ScreenResolution userScreen) { _startPoint = userStartPoint; _endPoint = userEndPoint; _userScreen = userScreen; }
public override void OnInspectorGUI() { mg = (Manager)target; if (GUI.GetNameOfFocusedControl() == null) { GUI.FocusControl(""); } if (mg.sy_Map != null && mg.sy_CurrentStatus != null && mg.sy_Editor != null && mg.sy_Map != null && mg.sy_OtherOption != null) { GUILayout.Space(6f); GUI.backgroundColor = Color.black; GUIStyle myButtonStyle = new GUIStyle(GUI.skin.box); myButtonStyle.normal.textColor = Color.white; GUILayout.Box("Google Maps API licensing", myButtonStyle, GUILayout.ExpandWidth(true)); GUI.backgroundColor = Color.white; GUILayout.Space(6f); //License string str_license = System.Enum.GetName(typeof(License), mg.sy_Editor.license); license = (License)System.Enum.Parse(typeof(License), str_license); mg.sy_Editor.license = (int)(License)EditorGUILayout.EnumPopup("License", license); if (license == License.GoogleMapsAPI) { mg.sy_Map.apikey[0] = EditorGUILayout.TextField(" ▶API Key", mg.sy_Map.apikey[0]); mg.sy_Map.apikey[1] = ""; mg.sy_Map.apikey[2] = ""; } else if (license == License.GoogleMapsAPI_forBusiness) { mg.sy_Map.apikey[0] = ""; mg.sy_Map.apikey[1] = EditorGUILayout.TextField(" ▶Client ID", mg.sy_Map.apikey[1]); mg.sy_Map.apikey[2] = EditorGUILayout.TextField(" ▶Signature", mg.sy_Map.apikey[2]); } if (mg.sy_Map.apikey[0].Length < 5 && (mg.sy_Map.apikey[1].Length < 5 || mg.sy_Map.apikey[2].Length < 5)) { GUI.enabled = false; } GUILayout.Space(6f); GUI.backgroundColor = Color.black; myButtonStyle.normal.textColor = Color.white; GUILayout.Box("Coordinates Setting", myButtonStyle, GUILayout.ExpandWidth(true)); GUI.backgroundColor = Color.white; GUILayout.Space(6f); if (mg.sy_Editor != null) { mg.sy_Editor.longitude_x = EditorGUILayout.TextField("longitudeX", mg.sy_Editor.longitude_x); mg.sy_Editor.latitude_y = EditorGUILayout.TextField("latitudeY", mg.sy_Editor.latitude_y); mg.sy_Editor.zoom = EditorGUILayout.IntField("Zoom", mg.sy_Editor.zoom); } BeginContents(); mg.sy_Map.language = EditorGUILayout.TextField("Language", mg.sy_Map.language); //ScreenResolution string str_resolution = System.Enum.GetName(typeof(ScreenResolution), mg.sy_Editor.resolution); resolution = (ScreenResolution)System.Enum.Parse(typeof(ScreenResolution), str_resolution); mg.sy_Editor.resolution = (int)(ScreenResolution)EditorGUILayout.EnumPopup("Resolution", resolution); //MapQuality string str_quality = System.Enum.GetName(typeof(MapQuality), mg.sy_Editor.quality); quality = (MapQuality)System.Enum.Parse(typeof(MapQuality), str_quality); mg.sy_Editor.quality = (int)(MapQuality)EditorGUILayout.EnumPopup("Quality", quality); //MapType string str_maptype = System.Enum.GetName(typeof(MapType), mg.sy_Editor.maptype); maptype = (MapType)System.Enum.Parse(typeof(MapType), str_maptype); mg.sy_Editor.maptype = (int)(MapType)EditorGUILayout.EnumPopup("Map type", maptype); //WheelSpeed mg.sy_Map.wheelSpeed = EditorGUILayout.Slider("Wheel Speed", mg.sy_Map.wheelSpeed, 2, 10); EndContents(); #if UNITY_ANDROID || UNITY_IPHONE string str_ori = System.Enum.GetName(typeof(Orientation), mg.sy_Editor.ori); ori = (Orientation)System.Enum.Parse(typeof(Orientation), str_ori); mg.sy_Editor.ori = (int)(Orientation)EditorGUILayout.EnumPopup("Default Orientation", ori); GUILayout.Space(6f); #endif #if UNITY_WEBPLAYER mg.sy_Map.phpurl = EditorGUILayout.TextField("PHP URL", mg.sy_Map.phpurl); GUILayout.Space(6f); #endif } }
public static Resolution ToResolution(ScreenResolution sr) { return new Resolution() { width = sr.width, height = sr.height, refreshRate = sr.refreshRate }; }
protected internal Transform TempTile(Vector2 addPos, float tileSize) { Manager mg = GameObject.Find("Manager").GetComponent <Manager> (); ScreenResolution resolution = (ScreenResolution)mg.sy_Map.resolution; tileWidth = tileSize; // Make Tile Group if (GameObject.Find("TileGroup") != null) { contain = GameObject.Find("TileGroup"); } else { contain = new GameObject("TileGroup"); } int tileLength = 0; if (resolution.Equals(ScreenResolution.High)) { tileLength = 0; } else if (resolution.Equals(ScreenResolution.Low)) { tileLength = 10; } string[] baseTileName = { "center", "up1", "dn1", "left1", "left1_up1", "left1_dn1", "right1", "right1_up1", "right1_dn1", "up2", "dn2", "left1_up2", "left1_dn2", "right1_up2", "right1_dn2" }; string[] LandscapeTileName = { "left2", "left2_up1", "left2_up2", "left2_dn1", "left2_dn2", "right2", "right2_up1", "right2_up2", "right2_dn1", "right2_dn2", "right3", "right3_up1", "right3_up2", "right3_dn1", "right3_dn2", "left3", "left3_up1", "left3_up2", "left3_dn1", "left3_dn2" }; string[] portraitTile = { "center", "up1", "dn1", "left1", "left1_up1", "left1_dn1", "right1", "right1_up1", "right1_dn1" }; string[] mo_landscapeTile = { "center", "up1", "dn1", "left1", "left1_up1", "left1_dn1", "right1", "right1_up1", "right1_dn1", "left2", "left2_up1", "left2_dn1", "right2", "right2_up1", "right2_dn1" }; string[] Landscape = new string[baseTileName.Length + LandscapeTileName.Length - tileLength]; System.Array.Copy(baseTileName, Landscape, baseTileName.Length); System.Array.Copy(LandscapeTileName, 0, Landscape, baseTileName.Length, LandscapeTileName.Length - tileLength); Vector2[] tilePosData = { new Vector2(0 + addPos.x, 0 + addPos.y), //center new Vector2(0 + addPos.x, tileWidth + addPos.y), //up new Vector2(0 + addPos.x, -tileWidth + addPos.y), //dn new Vector2(-tileWidth + addPos.x, 0 + addPos.y), //left new Vector2(-tileWidth + addPos.x, tileWidth + addPos.y), //left,up new Vector2(-tileWidth + addPos.x, -tileWidth + addPos.y), //left,dn new Vector2(tileWidth + addPos.x, 0 + addPos.y), //right new Vector2(tileWidth + addPos.x, tileWidth + addPos.y), //right,up new Vector2(tileWidth + addPos.x, -tileWidth + addPos.y), //right,dn new Vector2(0 + addPos.x, tileWidth * 2 + addPos.y), //up2 new Vector2(0 + addPos.x, -tileWidth * 2 + addPos.y), //dn2 new Vector2(-tileWidth + addPos.x, tileWidth * 2 + addPos.y), //left,up2 new Vector2(-tileWidth + addPos.x, -tileWidth * 2 + addPos.y), //left,dn2 new Vector2(tileWidth + addPos.x, tileWidth * 2 + addPos.y), //right,up2 new Vector2(tileWidth + addPos.x, -tileWidth * 2 + addPos.y), //right,dn2 }; Vector2[] Mo_LandsacpeData = { new Vector2(0 + addPos.x, 0 + addPos.y), //center new Vector2(0 + addPos.x, tileWidth + addPos.y), //up new Vector2(0 + addPos.x, -tileWidth + addPos.y), //dn new Vector2(-tileWidth + addPos.x, 0 + addPos.y), //left new Vector2(-tileWidth + addPos.x, tileWidth + addPos.y), //left,up new Vector2(-tileWidth + addPos.x, -tileWidth + addPos.y), //left,dn new Vector2(tileWidth + addPos.x, 0 + addPos.y), //right new Vector2(tileWidth + addPos.x, tileWidth + addPos.y), //right,up new Vector2(tileWidth + addPos.x, -tileWidth + addPos.y), //right,dn new Vector2(-tileWidth * 2 + addPos.x, 0 + addPos.y), //left2 new Vector2(-tileWidth * 2 + addPos.x, tileWidth + addPos.y), //left2 , up new Vector2(-tileWidth * 2 + addPos.x, -tileWidth + addPos.y), //left2 , dn new Vector2(tileWidth * 2 + addPos.x, 0 + addPos.y), //right2 new Vector2(tileWidth * 2 + addPos.x, tileWidth + addPos.y), //right2 , up new Vector2(tileWidth * 2 + addPos.x, -tileWidth + addPos.y) //right2 , dn }; Vector2[] LandscapePosData = { new Vector2(-tileWidth * 2 + addPos.x, 0 + addPos.y), //left2 new Vector2(-tileWidth * 2 + addPos.x, tileWidth + addPos.y), //left2 , up new Vector2(-tileWidth * 2 + addPos.x, tileWidth * 2 + addPos.y), //left2 , up2 new Vector2(-tileWidth * 2 + addPos.x, -tileWidth + addPos.y), //left2 , dn new Vector2(-tileWidth * 2 + addPos.x, -tileWidth * 2 + addPos.y), //left2 , dn2 new Vector2(tileWidth * 2 + addPos.x, 0 + addPos.y), //right2 new Vector2(tileWidth * 2 + addPos.x, tileWidth + addPos.y), //right2 , up new Vector2(tileWidth * 2 + addPos.x, tileWidth * 2 + addPos.y), //right2 , up2 new Vector2(tileWidth * 2 + addPos.x, -tileWidth + addPos.y), //right2 , dn new Vector2(tileWidth * 2 + addPos.x, -tileWidth * 2 + addPos.y), //right2 , dn2 // new Vector2(tileWidth * 3 + addPos.x, 0 + addPos.y), //right3 new Vector2(tileWidth * 3 + addPos.x, tileWidth + addPos.y), //right3 , up new Vector2(tileWidth * 3 + addPos.x, tileWidth * 2 + addPos.y), //right3 , up2 new Vector2(tileWidth * 3 + addPos.x, -tileWidth + addPos.y), //right3 , dn new Vector2(tileWidth * 3 + addPos.x, -tileWidth * 2 + addPos.y), //right3 , dn2 new Vector2(-tileWidth * 3 + addPos.x, 0 + addPos.y), //left3 new Vector2(-tileWidth * 3 + addPos.x, tileWidth + addPos.y), //left3 , up new Vector2(-tileWidth * 3 + addPos.x, tileWidth * 2 + addPos.y), //left3 , up2 new Vector2(-tileWidth * 3 + addPos.x, -tileWidth + addPos.y), //left3 , dn new Vector2(-tileWidth * 3 + addPos.x, -tileWidth * 2 + addPos.y), //left3 , dn2 }; Vector2[] LandscapeCombined = new Vector2[tilePosData.Length + LandscapePosData.Length]; System.Array.Copy(tilePosData, LandscapeCombined, tilePosData.Length); System.Array.Copy(LandscapePosData, 0, LandscapeCombined, tilePosData.Length, LandscapePosData.Length); Vector2[] resultTilePos = new Vector2[0]; string[] resultTileName = new string[0]; resultTilePos = LandscapeCombined; resultTileName = Landscape; int startNum = 0; int endNum = resultTileName.Length; if (!tileWidth.Equals(2)) { startNum = 1; if (resolution.Equals(ScreenResolution.High)) { endNum = resultTileName.Length - 10; } } //-------------------------------------------------------------------- Platform define if (mg.sy_OtherOption.ScreenSetting.platform != Variables.OtherOptionGroup.Platform.Mobile) { for (int i = startNum; i < endNum; i++) { Create(resultTileName [i], resultTilePos [i]); } } else { if ((int)mg.sy_Map.orientation == 0) //Portrait { if (resolution.Equals(ScreenResolution.High)) { for (int i = 0; i < baseTileName.Length; i++) //Resolution : High { Create(baseTileName [i], tilePosData [i]); } } else if (resolution.Equals(ScreenResolution.Low)) //Resolution : Low { for (int i = 0; i < portraitTile.Length; i++) { Create(portraitTile [i], tilePosData [i]); } } } else //Landscape { for (int i = 0; i < mo_landscapeTile.Length; i++) { Create(mo_landscapeTile [i], Mo_LandsacpeData [i]); } } } return(contain.transform); }
/// <summary> /// Run once per frame. /// </summary> private void Update() { // Update Discord RPC DiscordControls.Update(); #if UNITY_STANDALONE_WIN // Reposition the window to the middle of the screen after exiting fullscreen if (fullscreenSwitch == 1) { StartCoroutine(RepositionWindow()); } if (fullscreenSwitch > 0) { fullscreenSwitch--; } #endif // Frame counter used for logging purposes if (isInFight || UnitaleUtil.IsOverworld) { frame++; } string sceneName = SceneManager.GetActiveScene().name; // Activate Debugger if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9) && UserDebugger.instance.canShow) { UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = UserDebugger.instance.gameObject.activeSelf; } // Activate Hitbox Debugger else if (isInFight && Input.GetKeyDown(KeyCode.H) && sceneName != "Error" && UserDebugger.instance.gameObject.activeSelf) { gameObject.GetComponent <ProjectileHitboxRenderer>().enabled = !gameObject.GetComponent <ProjectileHitboxRenderer>().enabled; } // Exit a battle or the Error scene else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(sceneName) || isInFight)) { if (isInFight && EnemyEncounter.script.GetVar("unescape").Boolean&& sceneName != "Error") { return; } // The Error scene can only be exited if we entered the mod through the mod selection screen if (sceneName == "Error" && !modDev) { UnitaleUtil.ExitOverworld(); SceneManager.LoadScene("Disclaimer"); DiscordControls.StartTitle(); Destroy(GameObject.Find("SpritePivot")); return; } if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.activeInHierarchy) { FindObjectOfType <GameOverBehavior>().EndGameOver(); } else { UIController.EndBattle(); } } else { UIController.EndBattle(); } } // Open the Menu in the Overworld else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(sceneName) && !isInFight && !isInShop && (!GameOverBehavior.gameOverContainerOw || !GameOverBehavior.gameOverContainerOw.activeInHierarchy)) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && (GameObject.Find("FadingBlack") == null || GameObject.Find("FadingBlack").GetComponent <Fading>().alpha <= 0)) { StartCoroutine(PlayerOverworld.LaunchMenu()); } } // Wipe save and close CYF in the Error scene if save failed to load else if (sceneName == "Error" && allowWipeSave && Input.GetKeyDown(KeyCode.R)) { System.IO.File.Delete(Application.persistentDataPath + "/save.gd"); Application.Quit(); } // Enter fullscreen using given shortcuts if (!ScreenResolution.hasInitialized) { return; } if (!Input.GetKeyDown(KeyCode.F4) && (!Input.GetKeyDown(KeyCode.Return) || !Input.GetKey(KeyCode.LeftAlt) && !Input.GetKey(KeyCode.RightAlt))) { return; // RAlt + Enter } ScreenResolution.SetFullScreen(!Screen.fullScreen); if (!Screen.fullScreen) { StartCoroutine(UpdateMonitorSize()); } }
protected virtual void OnOptionChange(int index) { this.Index = index; ScreenResolution.Refresh(); }
/// <summary> /// Control checking, and way more. /// </summary> void Update() { #if UNITY_STANDALONE_WIN if (fullscreenSwitch == 1) { StartCoroutine(RepositionWindow()); } if (fullscreenSwitch > 0) { fullscreenSwitch--; } #endif stopScreenShake = false; if (isInFight || UnitaleUtil.IsOverworld) { frame++; } string sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ModSelect") { lastSceneUnitale = true; } else { lastSceneUnitale = false; } // Activate Debugger if (UserDebugger.instance && Input.GetKeyDown(KeyCode.F9)) { if (UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Text").transform.SetParent(UserDebugger.instance.gameObject.transform); } UserDebugger.instance.gameObject.SetActive(!UserDebugger.instance.gameObject.activeSelf); Camera.main.GetComponent <FPSDisplay>().enabled = UserDebugger.instance.gameObject.activeSelf; // Activate Hitbox Debugger } else if (isInFight && Input.GetKeyDown(KeyCode.H) && sceneName != "Error" && UserDebugger.instance.gameObject.activeSelf) { GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled = !GameObject.Find("Main Camera").GetComponent <ProjectileHitboxRenderer>().enabled; } // Exit a battle or the Error scene else if (Input.GetKeyDown(KeyCode.Escape) && (canTransOW.Contains(sceneName) || isInFight)) { if (isInFight && LuaEnemyEncounter.script.GetVar("unescape").Boolean&& sceneName != "Error") { return; } if (sceneName == "Error" && !modDev) { UnitaleUtil.ExitOverworld(); SceneManager.LoadScene("Disclaimer"); GameObject.Destroy(GameObject.Find("SpritePivot")); return; } if (GameOverBehavior.gameOverContainer) { if (GameOverBehavior.gameOverContainer.activeInHierarchy) { GameObject.FindObjectOfType <GameOverBehavior>().EndGameOver(); } else { UIController.EndBattle(); } } else { UIController.EndBattle(); } //StaticInits.Reset(); //Open the Menu in the Overworld } else if (input.Menu == UndertaleInput.ButtonState.PRESSED && !nonOWScenes.Contains(sceneName) && !isInFight && !isInShop && (!GameOverBehavior.gameOverContainerOw || !GameOverBehavior.gameOverContainerOw.activeInHierarchy)) { if (!PlayerOverworld.instance.PlayerNoMove && EventManager.instance.script == null && !PlayerOverworld.instance.menuRunning[2] && !PlayerOverworld.instance.menuRunning[4] && (GameObject.Find("FadingBlack") == null || GameObject.Find("FadingBlack").GetComponent <Fading>().alpha <= 0)) { StartCoroutine(PlayerOverworld.LaunchMenu()); } //Wipe save and close CYF in the Error scene if save failed to load } else if (sceneName == "Error" && allowWipeSave && Input.GetKeyDown(KeyCode.R)) { System.IO.File.Delete(Application.persistentDataPath + "/save.gd"); Application.Quit(); } if (isInFight) { switch (fleeIndex) { case 0: if (Input.GetKeyDown(KeyCode.F)) { fleeIndex++; } break; case 1: if (Input.GetKeyDown(KeyCode.L)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 2: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 3: if (Input.GetKeyDown(KeyCode.E)) { fleeIndex++; } else if (Input.anyKeyDown) { fleeIndex = 0; } break; case 4: if (Input.GetKeyDown(KeyCode.S)) { fleeIndex = -1; UIController.instance.SuperFlee(); } else if (Input.anyKeyDown) { fleeIndex = 0; } break; } } if (ScreenResolution.hasInitialized) { if (Input.GetKeyDown(KeyCode.F4) || // F4 (Input.GetKeyDown(KeyCode.Return) && (Input.GetKey(KeyCode.LeftAlt) || // LAlt + Enter Input.GetKey(KeyCode.RightAlt)))) // RAlt + Enter { ScreenResolution.SetFullScreen(!Screen.fullScreen); if (!Screen.fullScreen) { StartCoroutine(UpdateMonitorSize()); } } } }
private void LoadValues(ValuesToLoad theValuesToLoad) { isInitialising = true; //open the ini files and check the current values IniFiles myFiles = new IniFiles(SWGANHPAth + "swg2uu_opt.cfg"); switch (theValuesToLoad) { case ValuesToLoad.Graphics: #region Graphics Options chkWindowedMode.IsChecked = myFiles.GetInt32("ClientGraphics", "windowed", 0) == 1; chkSafeRenderer.IsChecked = myFiles.GetInt32("ClientGraphics", "rasterMajor", 7) == 5 && myFiles.GetInt32("ClientGraphics", "useSafeRenderer", 0) == 1; chkBorderlessWindow.IsChecked = myFiles.GetInt32("ClientGraphics", "borderlessWindow", 0) == 1; chkDisableFastMouseCursor.IsChecked = myFiles.GetInt32("ClientUserInterface", "alwaysSetMouseCursor", 0) == 1; chkDisableHardwareMouseCursor.IsChecked = myFiles.GetInt32("ClientGraphics", "useHardwareMouseCursor", 0) == 0; chkDisableVSynch.IsChecked = myFiles.GetInt32("Direct3d9", "allowTearing", 0) == 1; chkUseLowDetailNormalMaps.IsChecked = myFiles.GetInt32("ClientGraphics", "discardHighestNormalMipMapLevels", 0) == 1; chkUseLowDetailTextures.IsChecked = myFiles.GetInt32("ClientGraphics", "discardHighestMipMapLevels", 0) == 1; chkConstrainMouseCursor.IsChecked = myFiles.GetInt32("ClientGraphics", "constrainMouseCursorToWindow", 1) == 1; chkShowDebugWindow.IsChecked = myFiles.GetInt32("ClientGame", "debugPrint", 0) == 1; //some keys are special //these use the same key name in the same section List <KeyValuePair <string, string> > lstKeys = myFiles.GetSectionValuesAsList("ClientGraphics"); chkDisableMultiPassRendering.IsChecked = lstKeys.Any(kvp => kvp.Key.Equals("disableOptionTag", StringComparison.InvariantCultureIgnoreCase) && kvp.Value.Equals("HIQL")); chkDisableBumpMapping.IsChecked = lstKeys.Any(kvp => kvp.Key.Equals("disableOptionTag", StringComparison.InvariantCultureIgnoreCase) && kvp.Value.Equals("DOT3")); //load the available screen resolutions ScreenResolution myScreenReses = new ScreenResolution(); List <ScreenResolution.AvailableScreen> lstScreenRes = myScreenReses.GetScreenResolutions(); //what is it currently set to? int nAdapter = myFiles.GetInt32("Direct3d9", "adapter", 0); int nWidth = myFiles.GetInt32("ClientGraphics", "screenWidth", 1024); int nHeight = myFiles.GetInt32("ClientGraphics", "screenHeight", 768); int nFrequency = myFiles.GetInt32("Direct3d9", "fullscreenRefreshRate", 60); ScreenResolution.ScreenRes theCurrentScreenRes = new ScreenResolution.ScreenRes { Frequency = 60, Width = 1024, Height = 768 }; //people can remvoe monitors if (!lstScreenRes.Any(sr => sr.AdapterNumber == nAdapter)) { nAdapter = 0; myFiles.WriteValue("Direct3d9", "adapter", 0); } var currentRes = lstScreenRes.Where(sr => sr.AdapterNumber == nAdapter).First().AvailableResolutions.Where(sr => sr.Width == nWidth && sr.Height == nHeight && sr.Frequency == nFrequency); if (currentRes.Count() > 0) { theCurrentScreenRes = currentRes.First(); } var currentAdapter = lstScreenRes.Where(sr => sr.AdapterNumber == nAdapter).First(); cboResolution.ItemsSource = currentAdapter.AvailableResolutions; cboResolution.SelectedItem = theCurrentScreenRes; cboAdapter.ItemsSource = lstScreenRes; cboAdapter.SelectedItem = currentAdapter; if (lstScreenRes.Count == 1) { //can't change it anyway lblAdapter.IsEnabled = false; cboAdapter.IsEnabled = false; } //and add the shader versions cboShaderVersion.ItemsSource = ShaderVersions; cboShaderVersion.SelectedItem = CurrentShaderVersion; #endregion break; case ValuesToLoad.Sound: #region Sound Options //get the miles version lblMilesVersion.Text = FileVersionInfo.GetVersionInfo(SWGANHPAth + "Mss32.dll").FileVersion; this.Dispatcher.BeginInvoke(new Action(delegate { //Audio Enabled chkDisableAudio.IsChecked = myFiles.GetInt32("ClientAudio", "disableMiles", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); cboSpeakers.ItemsSource = SoundVersions; cboSpeakers.SelectedItem = myFiles.GetString("ClientAudio", "soundProvider", "Windows Speaker Configuration"); #endregion break; case ValuesToLoad.Game: #region Game Options cboLanguage.ItemsSource = Languages; cboLanguage.SelectedItem = CurrentLanguage; this.Dispatcher.BeginInvoke(new Action(delegate { chkSkipIntroSequence.IsChecked = myFiles.GetInt32("ClientGame", "skipIntro", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkDisableCharSLOD.IsChecked = myFiles.GetInt32("ClientSkeletalAnimation", "lodManagerEnable", 1) == 0; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkAllowMultipleInstances.IsChecked = myFiles.GetInt32("SwgClient", "allowMultipleInstances", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); #endregion break; case ValuesToLoad.Advanced: #region Advanced Options this.Dispatcher.BeginInvoke(new Action(delegate { chkDisableWorldPreloading.IsChecked = myFiles.GetInt32("ClientGame", "preloadWorldSnapshot", 1) == 0; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkUseLowDetailCharacters.IsChecked = myFiles.GetInt32("ClientSkeletalAnimation", "skipL0", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkUseLowDetailMeshes.IsChecked = myFiles.GetInt32("ClientObject/DetailAppearanceTemplate", "skipL0", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkDisableTextureBaking.IsChecked = myFiles.GetInt32("ClientTextureRenderer", "disableTextureBaking", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkDisableFileCaching.IsChecked = myFiles.GetInt32("SharedUtility", "disableFileCaching", 0) == 1; }), System.Windows.Threading.DispatcherPriority.ContextIdle); this.Dispatcher.BeginInvoke(new Action(delegate { chkDisableAsynchronousLoader.IsChecked = myFiles.GetInt32("SharedFile", "enableAsynchronousLoader", 1) == 0; }), System.Windows.Threading.DispatcherPriority.ContextIdle); #endregion break; } isInitialising = false; }
private void Change_Display_Settings(object sender, EventArgs e) { Logger.Instance().Log("Yatse2", "Dispay settings changed"); Topmost = _config.Topmost; WindowStartupLocation = WindowStartupLocation.Manual; Activate(); var dx = 1.0; var dy = 1.0; var temp = PresentationSource.FromVisual(this); if (temp != null) { if (temp.CompositionTarget != null) { var m = temp.CompositionTarget.TransformToDevice; dx = m.M11; dy = m.M22; } } var screens = System.Windows.Forms.Screen.AllScreens; if (screens.Length == 1 || !_config.SecondScreen) { if (_config.ForceResolution) { var currentRes = ScreenResolution.GetDevmode(0, -1); Logger.Instance().LogDump("CurrentResolutionMonoScreen", currentRes); if (currentRes.DMPelsHeight != _config.Resolution.DMPelsHeight || currentRes.DMPelsWidth != _config.Resolution.DMPelsWidth || currentRes.DMBitsPerPel != _config.Resolution.DMBitsPerPel) { ScreenResolution.ChangeResolutionMode(0, _config.Resolution); Logger.Instance().LogDump("ChangeResolutionMonoScreen", _config.Resolution); } } Top = 0; Left = 0; } else { if (_config.ForceResolution) { var currentRes = ScreenResolution.GetDevmode(1, -1); Logger.Instance().LogDump("CurrentResolutionMultiScreen", currentRes); if (currentRes.DMPelsHeight != _config.Resolution.DMPelsHeight || currentRes.DMPelsWidth != _config.Resolution.DMPelsWidth || currentRes.DMBitsPerPel != _config.Resolution.DMBitsPerPel) { ScreenResolution.ChangeResolutionMode(1, _config.Resolution); Logger.Instance().LogDump("ChangeResolutionMultiScreen", _config.Resolution); } } screens = System.Windows.Forms.Screen.AllScreens; foreach (var scr in screens.Where(scr => !scr.Primary)) { Top = scr.Bounds.Top / dy; Left = scr.Bounds.Left / dx; break; } } if (_config.Resolution.DMPelsWidth > 0) { Width = _config.Resolution.DMPelsWidth / dx; Height = _config.Resolution.DMPelsHeight / dy; } if (_config.Resolution.DMPelsHeight == 480) { _config.Hack480 = true; brd_Home_Video.Margin = new Thickness(0, 0, 100, 180); brd_Home_Music.Margin = new Thickness(0, 70, 100, 0); brd_Home_Other.Margin = new Thickness(0, 320, 100, 0); } else { brd_Home_Video.Margin = new Thickness(0, 0, 100, 250); brd_Home_Music.Margin = new Thickness(0, 70, 100, 0); brd_Home_Other.Margin = new Thickness(0, 390, 100, 0); } _setPov = false; }
ScreenConfig GetConfigForResolution(ScreenResolution res) { foreach(var config in configs) { if(config.resolution == res) { return config; } } return GetConfigForResolution(GetCorrectDefault()); }
public string GetResolutionInString(ScreenResolution input) { return (input.width.ToString() + "x" + input.height.ToString()); }
/// <summary>Flips to the next option</summary> internal void Flip() { if (CurrentlySelectedOption < Entries.Length - 1) { CurrentlySelectedOption++; } else { CurrentlySelectedOption = 0; } //Apply switch (Type) { case MenuOptionType.ScreenResolution: ScreenResolution res = CurrentOption as ScreenResolution; Program.Renderer.Screen.Width = (int)(res.Width * DisplayDevice.Default.ScaleFactor.X); Program.Renderer.Screen.Height = (int)(res.Height * DisplayDevice.Default.ScaleFactor.Y); Program.currentGameWindow.Width = (int)(res.Width * DisplayDevice.Default.ScaleFactor.X); Program.currentGameWindow.Height = (int)(res.Height * DisplayDevice.Default.ScaleFactor.Y); if (Interface.CurrentOptions.FullscreenMode) { IList <DisplayResolution> resolutions = DisplayDevice.Default.AvailableResolutions; foreach (DisplayResolution currentResolution in resolutions) { //Test resolution if (currentResolution.Width == Program.Renderer.Screen.Width / DisplayDevice.Default.ScaleFactor.X && currentResolution.Height == Program.Renderer.Screen.Height / DisplayDevice.Default.ScaleFactor.Y) { try { //HACK: some resolutions will result in openBVE not appearing on screen in full screen, so restore resolution then change resolution DisplayDevice.Default.RestoreResolution(); DisplayDevice.Default.ChangeResolution(currentResolution); Program.currentGameWindow.WindowState = WindowState.Fullscreen; Program.currentGameWindow.X = 0; Program.currentGameWindow.Y = 0; Program.currentGameWindow.Width = (int)(currentResolution.Width * DisplayDevice.Default.ScaleFactor.X); Program.currentGameWindow.Height = (int)(currentResolution.Height * DisplayDevice.Default.ScaleFactor.Y); Program.Renderer.Screen.Width = Program.currentGameWindow.Width; Program.Renderer.Screen.Height = Program.currentGameWindow.Height; return; } catch { //refresh rate wrong? - Keep trying in case a different refresh rate works OK } } } } break; case MenuOptionType.FullScreen: Interface.CurrentOptions.FullscreenMode = !Interface.CurrentOptions.FullscreenMode; if (Program.currentGameWindow.WindowState == WindowState.Fullscreen) { Program.currentGameWindow.WindowState = WindowState.Normal; DisplayDevice.Default.RestoreResolution(); } else { IList <DisplayResolution> resolutions = DisplayDevice.Default.AvailableResolutions; foreach (DisplayResolution currentResolution in resolutions) { //Test resolution if (currentResolution.Width == Program.Renderer.Screen.Width / DisplayDevice.Default.ScaleFactor.X && currentResolution.Height == Program.Renderer.Screen.Height / DisplayDevice.Default.ScaleFactor.Y) { try { //HACK: some resolutions will result in openBVE not appearing on screen in full screen, so restore resolution then change resolution DisplayDevice.Default.RestoreResolution(); DisplayDevice.Default.ChangeResolution(currentResolution); Program.currentGameWindow.WindowState = WindowState.Fullscreen; Program.currentGameWindow.X = 0; Program.currentGameWindow.Y = 0; Program.currentGameWindow.Width = (int)(currentResolution.Width * DisplayDevice.Default.ScaleFactor.X); Program.currentGameWindow.Height = (int)(currentResolution.Height * DisplayDevice.Default.ScaleFactor.Y); Program.Renderer.Screen.Width = Program.currentGameWindow.Width; Program.Renderer.Screen.Height = Program.currentGameWindow.Height; return; } catch { //refresh rate wrong? - Keep trying in case a different refresh rate works OK } } } } break; case MenuOptionType.Interpolation: Interface.CurrentOptions.Interpolation = (InterpolationMode)CurrentlySelectedOption; break; //HACK: We can't store plain ints due to to boxing, so store strings and parse instead case MenuOptionType.AnisotropicLevel: Interface.CurrentOptions.AnisotropicFilteringLevel = int.Parse((string)CurrentOption, NumberStyles.Integer); break; case MenuOptionType.AntialiasingLevel: Interface.CurrentOptions.AntiAliasingLevel = int.Parse((string)CurrentOption, NumberStyles.Integer); break; case MenuOptionType.ViewingDistance: Interface.CurrentOptions.ViewingDistance = int.Parse((string)CurrentOption, NumberStyles.Integer); break; } }
public void SetResolution(int index, bool fs) { Screen.SetResolution(resolutions[index].width, resolutions[index].height, fs); currentResolution = resolutions[index]; }
public void StartDeath(string[] newDeathText = null, string newDeathMusic = null) { PlayerOverworld.audioCurrTime = 0; if (!UnitaleUtil.IsOverworld) { UIController.instance.encounter.EndWave(true); autolinebreakstate = EnemyEncounter.script.GetVar("autolinebreak").Boolean; EnemyEncounter.script.SetVar("autolinebreak", DynValue.NewBoolean(true)); transform.position = new Vector3(transform.position.x - Misc.cameraX, transform.position.y - Misc.cameraY, transform.position.z); } else { autolinebreakstate = true; } deathText = newDeathText; deathMusic = newDeathMusic; //Reset the camera's position Misc.MoveCameraTo(0, 0); playerZ = 130; if (UnitaleUtil.IsOverworld) { playerParent = transform.parent.parent; playerIndex = transform.parent.GetSiblingIndex(); // transform.parent.SetParent(null); } else { playerParent = transform.parent; playerIndex = transform.GetSiblingIndex(); transform.SetParent(null); } if (UnitaleUtil.IsOverworld) { /* transform.parent.position = new Vector3(transform.parent.position.x - GameObject.Find("Main Camera OW").transform.position.x - 320, * transform.parent.position.y - GameObject.Find("Main Camera OW").transform.position.y - 240, transform.parent.position.z); */ battleCamera = GameObject.Find("Main Camera OW"); battleCamera.SetActive(false); GetComponent <SpriteRenderer>().enabled = true; // stop showing the player } else { UIController.instance.encounter.gameOverStance = true; GetComponent <PlayerController>().invulTimer = 0; GetComponent <Image>().enabled = true; // abort the blink animation if it was playing battleCamera = GameObject.Find("Main Camera"); battleCamera.SetActive(false); battleContainer = GameObject.Find("Canvas"); battleContainer.GetComponent <Canvas>().enabled = false; } // remove all bullets if in retrocompatibility mode if (GlobalControls.retroMode) { foreach (LuaProjectile p in FindObjectsOfType <LuaProjectile>()) { BulletPool.instance.Requeue(p); } } /*battleContainer = new GameObject("BattleContainer"); * foreach (Transform go in UnitaleUtil.GetFirstChildren(null, false)) * if (go.name != battleContainer.name &&!go.GetComponent<LuaEnemyEncounter>() && go.name != Player.name &&!go.name.Contains("AudioChannel")) * go.SetParent(battleContainer.transform); * battleContainer.SetActive(false);*/ if (UnitaleUtil.IsOverworld) { gameOverContainerOw.SetActive(true); } else { gameOverContainer.SetActive(true); } ScreenResolution.BoxCameras(Screen.fullScreen); Camera.main.GetComponent <AudioSource>().clip = AudioClipRegistry.GetMusic("mus_gameover"); GameObject.Find("GameOver").GetComponent <Image>().sprite = SpriteRegistry.Get("UI/spr_gameoverbg_0"); if (UnitaleUtil.IsOverworld) { utHeart = Instantiate(GameObject.Find("utHeart")); heartColor = utHeart.GetComponent <Image>().color; heartColor.a = 1; } else { heartColor = gameObject.GetComponent <Image>().color; gameObject.transform.SetParent(GameObject.Find("Canvas GameOver").transform); } //if (overworld) // gameObject.transform.SetParent(GameObject.Find("Canvas OW").transform); //else PlayerCharacter.instance.HP = PlayerCharacter.instance.MaxHP; if (UnitaleUtil.IsOverworld) { gameObject.transform.GetComponent <SpriteRenderer>().enabled = false;// gameObject.transform.parent.SetParent(GameObject.Find("Canvas GameOver").transform); } else { gameObject.transform.SetParent(GameObject.Find("Canvas GameOver").transform); UIStats.instance.setHP(PlayerCharacter.instance.MaxHP); } brokenHeartPrefab = Resources.Load <GameObject>("Prefabs/heart_broken"); if (SpriteRegistry.GENERIC_SPRITE_PREFAB == null) { SpriteRegistry.GENERIC_SPRITE_PREFAB = Resources.Load <Image>("Prefabs/generic_sprite"); } heartShardPrefab = SpriteRegistry.GENERIC_SPRITE_PREFAB.gameObject; reviveText = GameObject.Find("ReviveText").GetComponent <TextManager>(); reviveText.SetCaller(EnemyEncounter.script); reviveFade = GameObject.Find("ReviveFade").GetComponent <Image>(); reviveFade.transform.SetAsLastSibling(); gameOverTxt = GameObject.Find("TextParent").GetComponent <TextManager>(); gameOverTxt.SetCaller(EnemyEncounter.script); gameOverImage = GameObject.Find("GameOver").GetComponent <Image>(); if (UnitaleUtil.IsOverworld) { /* * heartPos = new Vector3(GetComponent<RectTransform>().position.x - transform.parent.position.x, * GetComponent<RectTransform>().position.y + (GetComponent<RectTransform>().sizeDelta.y / 2) - transform.parent.position.y, * GetComponent<RectTransform>().position.z + 100010); */ heartPos = new Vector3((transform.parent.position.x - GameObject.Find("Canvas OW").transform.position.x) + 320, ((transform.parent.position.y + (GetComponent <RectTransform>().sizeDelta.y / 2)) - GameObject.Find("Canvas OW").transform.position.y) + 240, GetComponent <RectTransform>().position.z + 100010); } else { heartPos = gameObject.GetComponent <RectTransform>().position; } gameOverMusic = Camera.main.GetComponent <AudioSource>(); started = true; }
private void Configure(string system, string core, string rom, ScreenResolution resolution) { var retroarchConfig = ConfigFile.FromFile(Path.Combine(RetroarchPath, "retroarch.cfg")); retroarchConfig["rgui_extended_ascii"] = "true"; retroarchConfig["rgui_show_start_screen"] = "false"; retroarchConfig["quit_press_twice"] = "false"; retroarchConfig["pause_nonactive"] = "false"; retroarchConfig["video_fullscreen"] = "true"; retroarchConfig["menu_driver"] = "ozone"; if (SystemConfig.isOptSet("monitor")) { int monitorId; if (int.TryParse(SystemConfig["monitor"], out monitorId)) { retroarchConfig["video_monitor_index"] = (monitorId + 1).ToString(); } else { retroarchConfig["video_monitor_index"] = "0"; } } else { retroarchConfig["video_monitor_index"] = "0"; } if (resolution == null) { retroarchConfig["video_windowed_fullscreen"] = "true"; } else { retroarchConfig["video_fullscreen_x"] = resolution.Width.ToString(); retroarchConfig["video_fullscreen_y"] = resolution.Height.ToString(); retroarchConfig["video_windowed_fullscreen"] = "false"; } if (!string.IsNullOrEmpty(AppConfig["bios"])) { if (Directory.Exists(AppConfig["bios"])) { retroarchConfig["system_directory"] = AppConfig.GetFullPath("bios"); } else if (retroarchConfig["system_directory"] != @":\system" && !Directory.Exists(retroarchConfig["system_directory"])) { retroarchConfig["system_directory"] = @":\system"; } } if (!string.IsNullOrEmpty(AppConfig["thumbnails"])) { if (Directory.Exists(AppConfig["thumbnails"])) { retroarchConfig["thumbnails_directory"] = AppConfig.GetFullPath("thumbnails"); } else if (retroarchConfig["thumbnails_directory"] != @":\thumbnails" && !Directory.Exists(retroarchConfig["thumbnails_directory"])) { retroarchConfig["thumbnails_directory"] = @":\thumbnails"; } } if (!string.IsNullOrEmpty(AppConfig["screenshots"])) { if (Directory.Exists(AppConfig["screenshots"])) { retroarchConfig["screenshot_directory"] = AppConfig.GetFullPath("screenshots"); } else if (retroarchConfig["screenshot_directory"] != @":\screenshots" && !Directory.Exists(retroarchConfig["screenshot_directory"])) { retroarchConfig["screenshot_directory"] = @":\screenshots"; } } if (!string.IsNullOrEmpty(AppConfig["saves"]) && Directory.Exists(AppConfig["saves"])) { retroarchConfig["savestate_directory"] = Path.Combine(AppConfig.GetFullPath("saves"), system); retroarchConfig["savefile_directory"] = Path.Combine(AppConfig.GetFullPath("saves"), system); } if (SystemConfig.isOptSet("smooth") && SystemConfig.getOptBoolean("smooth")) { retroarchConfig["video_smooth"] = "true"; } else { retroarchConfig["video_smooth"] = "false"; } if (AppConfig.isOptSet("shaders") && SystemConfig.isOptSet("shader") && SystemConfig["shader"] != "None") { retroarchConfig["video_shader_enable"] = "true"; retroarchConfig["video_smooth"] = "false"; // seems to be necessary for weaker SBCs retroarchConfig["video_shader_dir"] = AppConfig.GetFullPath("shaders"); } else { retroarchConfig["video_shader_enable"] = "false"; } if (SystemConfig.isOptSet("ratio")) { if (SystemConfig["ratio"] == "custom") { retroarchConfig["video_aspect_ratio_auto"] = "false"; } else { int idx = ratioIndexes.IndexOf(SystemConfig["ratio"]); if (idx >= 0) { retroarchConfig["aspect_ratio_index"] = idx.ToString(); retroarchConfig["video_aspect_ratio_auto"] = "false"; } else { retroarchConfig["video_aspect_ratio_auto"] = "true"; retroarchConfig["aspect_ratio_index"] = ""; } } } else { if (SystemConfig["core"] == "tgbdual") { retroarchConfig["aspect_ratio_index"] = ratioIndexes.IndexOf("core").ToString(); } if (system == "wii") { retroarchConfig["aspect_ratio_index"] = "22"; } else { retroarchConfig["aspect_ratio_index"] = ""; } } if (SystemConfig["core"] == "cap32") { retroarchConfig["cap32_combokey"] = "y"; } if (!SystemConfig.isOptSet("rewind")) { retroarchConfig["rewind_enable"] = systemNoRewind.Contains(system) ? "false" : "true"; // AUTO } else if (SystemConfig.getOptBoolean("rewind")) { retroarchConfig["rewind_enable"] = "true"; } else { retroarchConfig["rewind_enable"] = "false"; } if (SystemConfig.isOptSet("integerscale") && SystemConfig.getOptBoolean("integerscale")) { retroarchConfig["video_scale_integer"] = "true"; } else { retroarchConfig["video_scale_integer"] = "false"; } if (SystemConfig.isOptSet("video_threaded") && SystemConfig.getOptBoolean("video_threaded")) { retroarchConfig["video_threaded"] = "true"; } else { retroarchConfig["video_threaded"] = "false"; } if (SystemConfig.isOptSet("showFPS") && SystemConfig.getOptBoolean("showFPS")) { retroarchConfig["fps_show"] = "true"; } else { retroarchConfig["fps_show"] = "false"; } if (SystemConfig.isOptSet("runahead") && SystemConfig["runahead"].ToInteger() > 0 && !systemNoRunahead.Contains(system)) { retroarchConfig["run_ahead_enabled"] = "true"; retroarchConfig["run_ahead_frames"] = SystemConfig["runahead"]; if (SystemConfig.isOptSet("secondinstance") && SystemConfig.getOptBoolean("secondinstance")) { retroarchConfig["run_ahead_secondary_instance"] = "true"; } else { retroarchConfig["run_ahead_secondary_instance"] = "false"; } } else { retroarchConfig["run_ahead_enabled"] = "false"; retroarchConfig["run_ahead_frames"] = "0"; retroarchConfig["run_ahead_secondary_instance"] = "false"; } if (SystemConfig.isOptSet("autosave") && SystemConfig.getOptBoolean("autosave")) { retroarchConfig["savestate_auto_save"] = "true"; retroarchConfig["savestate_auto_load"] = "true"; } else { retroarchConfig["savestate_auto_save"] = "false"; retroarchConfig["savestate_auto_load"] = "false"; } retroarchConfig["input_libretro_device_p1"] = "1"; retroarchConfig["input_libretro_device_p2"] = "1"; if (coreToP1Device.ContainsKey(SystemConfig["core"])) { retroarchConfig["input_libretro_device_p1"] = coreToP1Device[SystemConfig["core"]]; } if (coreToP2Device.ContainsKey(SystemConfig["core"])) { retroarchConfig["input_libretro_device_p2"] = coreToP2Device[SystemConfig["core"]]; } if (Controllers.Count > 2 && (SystemConfig["core"] == "snes9x_next" || SystemConfig["core"] == "snes9x")) { retroarchConfig["input_libretro_device_p2"] = "257"; } if (SystemConfig["core"] == "atari800") { retroarchConfig["input_libretro_device_p1"] = "513"; retroarchConfig["input_libretro_device_p2"] = "513"; } if (SystemConfig["core"] == "bluemsx") { if (systemToP1Device.ContainsKey(system)) { retroarchConfig["input_libretro_device_p1"] = systemToP1Device[system]; } if (systemToP2Device.ContainsKey(system)) { retroarchConfig["input_libretro_device_p2"] = systemToP2Device[system]; } } if (SystemConfig["retroachievements"] == "true" && systemToRetroachievements.Contains(system)) { retroarchConfig["cheevos_enable"] = "true"; retroarchConfig["cheevos_username"] = SystemConfig["retroachievements.username"]; retroarchConfig["cheevos_password"] = SystemConfig["retroachievements.password"]; retroarchConfig["cheevos_hardcore_mode_enable"] = SystemConfig["retroachievements.hardcore"] == "true" ? "true" : "false"; retroarchConfig["cheevos_leaderboards_enable"] = SystemConfig["retroachievements.leaderboards"] == "true" ? "true" : "false"; retroarchConfig["cheevos_verbose_enable"] = SystemConfig["retroachievements.verbose"] == "true" ? "true" : "false"; retroarchConfig["cheevos_auto_screenshot"] = SystemConfig["retroachievements.screenshot"] == "true" ? "true" : "false"; } else { retroarchConfig["cheevos_enable"] = "false"; } // Netplay management : netplaymode client -netplayport " + std::to_string(options.port) + " -netplayip if (SystemConfig["netplay"] == "true" && !string.IsNullOrEmpty(SystemConfig["netplaymode"])) { // Security : hardcore mode disables save states, which would kill netplay retroarchConfig["cheevos_hardcore_mode_enable"] = "false"; retroarchConfig["netplay_mode"] = "false"; retroarchConfig["netplay_ip_port"] = SystemConfig["netplay.port"]; // netplayport retroarchConfig["netplay_nickname"] = SystemConfig["netplay.nickname"]; retroarchConfig["netplay_mitm_server"] = SystemConfig["netplay.relay"]; retroarchConfig["netplay_use_mitm_server"] = string.IsNullOrEmpty(SystemConfig["netplay.relay"]) ? "true" : "false"; retroarchConfig["netplay_spectator_mode_enable"] = SystemConfig.getOptBoolean("netplay.spectator") ? "true" : "false"; retroarchConfig["netplay_client_swap_input"] = "false"; if (SystemConfig["netplaymode"] == "client") { retroarchConfig["netplay_mode"] = "true"; retroarchConfig["netplay_ip_address"] = SystemConfig["netplayip"]; retroarchConfig["netplay_ip_port"] = SystemConfig["netplayport"]; retroarchConfig["netplay_client_swap_input"] = "true"; } } // AI service for game translations if (SystemConfig.isOptSet("ai_service_enabled") && SystemConfig.getOptBoolean("ai_service_enabled")) { retroarchConfig["ai_service_enable"] = "true"; retroarchConfig["ai_service_mode"] = "0"; retroarchConfig["ai_service_source_lang"] = "0"; if (!string.IsNullOrEmpty(SystemConfig["ai_service_url"])) { retroarchConfig["ai_service_url"] = SystemConfig["ai_service_url"] + "&mode=Fast&output=png&target_lang=" + SystemConfig["ai_target_lang"]; } else { retroarchConfig["ai_service_url"] = "http://" + "ztranslate.net/service?api_key=BATOCERA&mode=Fast&output=png&target_lang=" + SystemConfig["ai_target_lang"]; } if (SystemConfig.isOptSet("ai_service_pause") && SystemConfig.getOptBoolean("ai_service_pause")) { retroarchConfig["ai_service_pause"] = "true"; } else { retroarchConfig["ai_service_pause"] = "false"; } } else { retroarchConfig["ai_service_enable"] = "false"; } // bezel writeBezelConfig(retroarchConfig, system, rom, resolution); if (LibretroControllers.WriteControllersConfig(retroarchConfig, system)) { UsePadToKey = false; } // custom : allow the user to configure directly retroarch.cfg via batocera.conf via lines like : snes.retroarch.menu_driver=rgui foreach (var user_config in SystemConfig) { if (user_config.Name.StartsWith("retroarch.")) { retroarchConfig[user_config.Name.Substring("retroarch.".Length)] = user_config.Value; } } if (SystemConfig.isOptSet("video_driver")) { _video_driver = retroarchConfig["video_driver"]; retroarchConfig["video_driver"] = SystemConfig["video_driver"]; } else if (core == "dolphin" && retroarchConfig["video_driver"] != "d3d11" && retroarchConfig["video_driver"] != "vulkan") { _video_driver = retroarchConfig["video_driver"]; retroarchConfig["video_driver"] = "d3d11"; } if (retroarchConfig.IsDirty) { retroarchConfig.Save(Path.Combine(RetroarchPath, "retroarch.cfg"), true); } }
private void writeBezelConfig(ConfigFile retroarchConfig, string systemName, string rom, ScreenResolution resolution) { string overlayUser = AppConfig.GetFullPath("decorations"); string overlaySystem = AppConfig.GetFullPath("system.decorations"); if (string.IsNullOrEmpty(overlaySystem) || !Directory.Exists(overlaySystem)) { overlaySystem = Path.Combine(AppConfig.GetFullPath("home"), "decorations"); } string bezel = Directory.Exists(overlayUser) && !string.IsNullOrEmpty(SystemConfig["bezel"]) ? SystemConfig["bezel"] : "default"; if (SystemConfig.isOptSet("forceNoBezel") && SystemConfig.getOptBoolean("forceNoBezel")) { bezel = null; } retroarchConfig["input_overlay_hide_in_menu"] = "false"; retroarchConfig["input_overlay_enable"] = "false"; retroarchConfig["video_message_pos_x"] = "0.05"; retroarchConfig["video_message_pos_y"] = "0.05"; if (string.IsNullOrEmpty(bezel) || bezel == "none") { return; } if (systemName == "wii") { return; } string romBase = Path.GetFileNameWithoutExtension(rom); string overlay_info_file = overlayUser + "/" + bezel + "/games/" + systemName + "/" + romBase + ".info"; string overlay_png_file = overlayUser + "/" + bezel + "/games/" + systemName + "/" + romBase + ".png"; if (!File.Exists(overlay_png_file) && !string.IsNullOrEmpty(overlaySystem)) { overlay_info_file = overlaySystem + "/" + bezel + "/games/" + systemName + "/" + romBase + ".info"; overlay_png_file = overlaySystem + "/" + bezel + "/games/" + systemName + "/" + romBase + ".png"; } if (!File.Exists(overlay_png_file)) { overlay_info_file = overlayUser + "/" + bezel + "/games/" + romBase + ".info"; overlay_png_file = overlayUser + "/" + bezel + "/games/" + romBase + ".png"; } if (!string.IsNullOrEmpty(overlaySystem) && !File.Exists(overlay_png_file)) { overlay_info_file = overlaySystem + "/" + bezel + "/games/" + romBase + ".info"; overlay_png_file = overlaySystem + "/" + bezel + "/games/" + romBase + ".png"; } if (!File.Exists(overlay_png_file)) { overlay_info_file = overlayUser + "/" + bezel + "/systems/" + systemName + ".info"; overlay_png_file = overlayUser + "/" + bezel + "/systems/" + systemName + ".png"; } if (!string.IsNullOrEmpty(overlaySystem) && !File.Exists(overlay_png_file)) { overlay_info_file = overlaySystem + "/" + bezel + "/systems/" + systemName + ".info"; overlay_png_file = overlaySystem + "/" + bezel + "/systems/" + systemName + ".png"; } if (!File.Exists(overlay_png_file)) { overlay_info_file = overlayUser + "/" + bezel + "/default.info"; overlay_png_file = overlayUser + "/" + bezel + "/default.png"; } if (!string.IsNullOrEmpty(overlaySystem) && !File.Exists(overlay_png_file)) { overlay_info_file = overlaySystem + "/" + bezel + "/default.info"; overlay_png_file = overlaySystem + "/" + bezel + "/default.png"; } if (!File.Exists(overlay_png_file)) { overlay_info_file = overlayUser + "/default/systems/" + systemName + ".info"; overlay_png_file = overlayUser + "/default/systems/" + systemName + ".png"; } if (!string.IsNullOrEmpty(overlaySystem) && !File.Exists(overlay_png_file)) { overlay_info_file = overlaySystem + "/default/systems/" + systemName + ".info"; overlay_png_file = overlaySystem + "/default/systems/" + systemName + ".png"; } if (!File.Exists(overlay_png_file)) { return; } string overlay_cfg_file = Path.Combine(RetroarchPath, "custom-overlay.cfg"); retroarchConfig["input_overlay_enable"] = "true"; retroarchConfig["input_overlay_scale"] = "1.0"; retroarchConfig["input_overlay"] = overlay_cfg_file; retroarchConfig["input_overlay_hide_in_menu"] = "true"; retroarchConfig["input_overlay_opacity"] = "1.0"; retroarchConfig["input_overlay_show_mouse_cursor"] = "false"; StringBuilder fd = new StringBuilder(); fd.AppendLine("overlays = 1"); fd.AppendLine("overlay0_overlay = \"" + overlay_png_file + "\""); fd.AppendLine("overlay0_full_screen = true"); fd.AppendLine("overlay0_descs = 0"); File.WriteAllText(overlay_cfg_file, fd.ToString()); }
static void Main(string[] args) { // Запуск приложения начинается с настройки размера поля для рисования #region RES string yes = "дДyY"; string no = "нНnN"; ScreenResolution yourScreen = new ScreenResolution(); Console.WriteLine("Запуск приложения со стандартным разрешением поля: " + yourScreen + "\n Изменить? (y\\n)"); char changeRes = Console.ReadKey().KeyChar; Console.WriteLine(); while (!(yes.Contains(changeRes) || no.Contains(changeRes))) { Console.WriteLine("Введите 'y' или 'n'"); changeRes = Console.ReadKey().KeyChar; Console.WriteLine(); } if (yes.Contains(changeRes)) { Console.Write("Меняем\nВведите ширину: "); int.TryParse(Console.ReadLine(), out int width); Console.Write("Введите высоту: "); int.TryParse(Console.ReadLine(), out int height); yourScreen.Height = height; yourScreen.Width = width; } else { Console.WriteLine("Не меняем"); } Console.WriteLine("Запуск приложения разрешением поля: " + yourScreen); #endregion RES // Основной цикл #region MAIN_LOOP bool exit = false; int choiceAction = 0; while (exit == false) { while (choiceAction < 5) { Console.WriteLine("\nЧто нарисовть? Выберите действие:\n\t1: Круг\n\t2: Кольцо\n\t3: Прямоугольник\n\t4: Линию\n\nЕсли нет желания рисовть, можно выйти. \n\t5: Выход"); int.TryParse(Console.ReadLine(), out choiceAction); switch (choiceAction) { case 1: DrawRound(yourScreen); break; case 2: DrawRing(yourScreen); break; case 3: DrawRectangle(yourScreen); break; case 4: DrawLine(yourScreen); break; case 5: exit = true; break; default: break; } if (choiceAction > 5 || choiceAction < 1) { Console.WriteLine("Введены неверные параметры!"); } } } #endregion MAIN_LOOP }