From cada251d693e8dd1129dafeb23ebd1d2bd057f92 Mon Sep 17 00:00:00 2001 From: Bitl Date: Tue, 16 Mar 2021 12:47:28 -0700 Subject: [PATCH] update sources --- Novetus/NovetusCore/Classes/FileFormat.cs | 2 + Novetus/NovetusCore/Classes/RobloxXML.cs | 24 +++++++++ .../StorageAndFunctions/GlobalFuncs.cs | 12 +++-- .../Forms/CustomGraphicsOptions.Designer.cs | 50 ++++++++++++++----- .../Forms/CustomGraphicsOptions.cs | 33 +++++++++++- .../Compact/LauncherFormCompact.cs | 11 ++++ .../Extended/LauncherFormExtended.cs | 11 ++++ 7 files changed, 126 insertions(+), 17 deletions(-) diff --git a/Novetus/NovetusCore/Classes/FileFormat.cs b/Novetus/NovetusCore/Classes/FileFormat.cs index e3bf6c0..b0ff24e 100644 --- a/Novetus/NovetusCore/Classes/FileFormat.cs +++ b/Novetus/NovetusCore/Classes/FileFormat.cs @@ -62,6 +62,7 @@ public class FileFormat AlternateServerIP = ""; WebServerPort = 40735; WebServer = true; + DisableReshadeDelete = false; } public string SelectedClient { get; set; } @@ -87,6 +88,7 @@ public class FileFormat public string AlternateServerIP { get; set; } public int WebServerPort { get; set; } public bool WebServer { get; set; } + public bool DisableReshadeDelete { get; set; } } #endregion diff --git a/Novetus/NovetusCore/Classes/RobloxXML.cs b/Novetus/NovetusCore/Classes/RobloxXML.cs index 38c0434..8468e3e 100644 --- a/Novetus/NovetusCore/Classes/RobloxXML.cs +++ b/Novetus/NovetusCore/Classes/RobloxXML.cs @@ -549,6 +549,30 @@ public static class RobloxXML } } + public static bool IsRenderSettingStringValid(XDocument doc, string setting, XMLTypes type) + { + if (type != XMLTypes.String) + return false; + + var v = from nodes in doc.Descendants("Item") + where nodes.Attribute("class").Value == "RenderSettings" + select nodes; + + foreach (var item in v) + { + var v2 = from nodes in item.Descendants(GetStringForXMLType(type)) + where nodes.Attribute("name").Value == setting + select nodes; + + foreach (var item2 in v2) + { + return true; + } + } + + return false; + } + public static string GetRenderSettings(XDocument doc, string setting, XMLTypes type) { var v = from nodes in doc.Descendants("Item") diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index db49529..e7085a8 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -122,6 +122,7 @@ public class GlobalFuncs ini.IniWriteValue(section, "AlternateServerIP", GlobalVars.UserConfiguration.AlternateServerIP.ToString()); ini.IniWriteValue(section, "WebServerPort", GlobalVars.UserConfiguration.WebServerPort.ToString()); ini.IniWriteValue(section, "WebServer", GlobalVars.UserConfiguration.WebServer.ToString()); + ini.IniWriteValue(section, "DisableReshadeDelete", GlobalVars.UserConfiguration.DisableReshadeDelete.ToString()); } else { @@ -131,7 +132,7 @@ public class GlobalFuncs string closeonlaunch, userid, name, selectedclient, map, port, limit, upnp, disablehelpmessage, tripcode, discord, mappath, mapsnip, - graphics, reshade, qualitylevel, style, savebackups, altIP, WS, WSPort; + graphics, reshade, qualitylevel, style, savebackups, altIP, WS, WSPort, disReshadeDel; INIFile ini = new INIFile(cfgpath); @@ -158,6 +159,7 @@ public class GlobalFuncs altIP = ini.IniReadValue(section, "AlternateServerIP", GlobalVars.UserConfiguration.AlternateServerIP.ToString()); WSPort = ini.IniReadValue(section, "WebServerPort", GlobalVars.UserConfiguration.WebServerPort.ToString()); WS = ini.IniReadValue(section, "WebServer", GlobalVars.UserConfiguration.WebServer.ToString()); + disReshadeDel = ini.IniReadValue(section, "DisableReshadeDelete", GlobalVars.UserConfiguration.DisableReshadeDelete.ToString()); GlobalVars.UserConfiguration.CloseOnLaunch = Convert.ToBoolean(closeonlaunch); @@ -211,6 +213,7 @@ public class GlobalFuncs GlobalVars.UserConfiguration.AlternateServerIP = altIP; GlobalVars.UserConfiguration.WebServerPort = Convert.ToInt32(WSPort); GlobalVars.UserConfiguration.WebServer = Convert.ToBoolean(WS); + GlobalVars.UserConfiguration.DisableReshadeDelete = Convert.ToBoolean(disReshadeDel); } catch (Exception) { @@ -404,9 +407,12 @@ public class GlobalFuncs File.Delete(fulldirpath); } - if (File.Exists(fulldllpath)) + if (!GlobalVars.UserConfiguration.DisableReshadeDelete) { - File.Delete(fulldllpath); + if (File.Exists(fulldllpath)) + { + File.Delete(fulldllpath); + } } } } diff --git a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs index b0cf916..aa39b74 100644 --- a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs @@ -50,6 +50,8 @@ this.label10 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.Style2007 = new System.Windows.Forms.TextBox(); + this.Style2007FolderFinder = new System.Windows.Forms.Button(); + this.Styles2007Info = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsLevel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsMeshQuality)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsShadingQuality)).BeginInit(); @@ -72,7 +74,7 @@ 0, 0}); this.GraphicsLevel.Name = "GraphicsLevel"; - this.GraphicsLevel.Size = new System.Drawing.Size(155, 20); + this.GraphicsLevel.Size = new System.Drawing.Size(246, 20); this.GraphicsLevel.TabIndex = 1; this.GraphicsLevel.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.GraphicsLevel.ValueChanged += new System.EventHandler(this.GraphicsLevel_ValueChanged); @@ -81,7 +83,7 @@ // this.GraphicsMeshQuality.Location = new System.Drawing.Point(172, 38); this.GraphicsMeshQuality.Name = "GraphicsMeshQuality"; - this.GraphicsMeshQuality.Size = new System.Drawing.Size(155, 20); + this.GraphicsMeshQuality.Size = new System.Drawing.Size(246, 20); this.GraphicsMeshQuality.TabIndex = 2; this.GraphicsMeshQuality.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.GraphicsMeshQuality.Value = new decimal(new int[] { @@ -104,7 +106,7 @@ // this.GraphicsShadingQuality.Location = new System.Drawing.Point(172, 64); this.GraphicsShadingQuality.Name = "GraphicsShadingQuality"; - this.GraphicsShadingQuality.Size = new System.Drawing.Size(155, 20); + this.GraphicsShadingQuality.Size = new System.Drawing.Size(246, 20); this.GraphicsShadingQuality.TabIndex = 4; this.GraphicsShadingQuality.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; this.GraphicsShadingQuality.Value = new decimal(new int[] { @@ -134,7 +136,7 @@ "High"}); this.GraphicsMaterialQuality.Location = new System.Drawing.Point(172, 90); this.GraphicsMaterialQuality.Name = "GraphicsMaterialQuality"; - this.GraphicsMaterialQuality.Size = new System.Drawing.Size(155, 21); + this.GraphicsMaterialQuality.Size = new System.Drawing.Size(246, 21); this.GraphicsMaterialQuality.TabIndex = 6; this.GraphicsMaterialQuality.SelectedIndexChanged += new System.EventHandler(this.GraphicsMaterialQuality_SelectedIndexChanged); // @@ -165,7 +167,7 @@ "Off"}); this.GraphicsAntiAliasing.Location = new System.Drawing.Point(172, 117); this.GraphicsAntiAliasing.Name = "GraphicsAntiAliasing"; - this.GraphicsAntiAliasing.Size = new System.Drawing.Size(155, 21); + this.GraphicsAntiAliasing.Size = new System.Drawing.Size(246, 21); this.GraphicsAntiAliasing.TabIndex = 9; this.GraphicsAntiAliasing.SelectedIndexChanged += new System.EventHandler(this.GraphicsAntiAliasing_SelectedIndexChanged); // @@ -188,7 +190,7 @@ "8x"}); this.GraphicsAASamples.Location = new System.Drawing.Point(172, 144); this.GraphicsAASamples.Name = "GraphicsAASamples"; - this.GraphicsAASamples.Size = new System.Drawing.Size(155, 21); + this.GraphicsAASamples.Size = new System.Drawing.Size(246, 21); this.GraphicsAASamples.TabIndex = 11; this.GraphicsAASamples.SelectedIndexChanged += new System.EventHandler(this.GraphicsAASamples_SelectedIndexChanged); // @@ -202,7 +204,7 @@ "Off"}); this.GraphicsBevels.Location = new System.Drawing.Point(172, 171); this.GraphicsBevels.Name = "GraphicsBevels"; - this.GraphicsBevels.Size = new System.Drawing.Size(155, 21); + this.GraphicsBevels.Size = new System.Drawing.Size(246, 21); this.GraphicsBevels.TabIndex = 12; this.GraphicsBevels.SelectedIndexChanged += new System.EventHandler(this.GraphicsBevels_SelectedIndexChanged); // @@ -217,7 +219,7 @@ "Character-Only"}); this.GraphicsShadows2008.Location = new System.Drawing.Point(172, 198); this.GraphicsShadows2008.Name = "GraphicsShadows2008"; - this.GraphicsShadows2008.Size = new System.Drawing.Size(155, 21); + this.GraphicsShadows2008.Size = new System.Drawing.Size(246, 21); this.GraphicsShadows2008.TabIndex = 13; this.GraphicsShadows2008.SelectedIndexChanged += new System.EventHandler(this.GraphicsShadows2008_SelectedIndexChanged); // @@ -244,7 +246,7 @@ this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.ForeColor = System.Drawing.Color.Red; - this.label9.Location = new System.Drawing.Point(50, 281); + this.label9.Location = new System.Drawing.Point(93, 281); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(234, 13); this.label9.TabIndex = 17; @@ -259,7 +261,7 @@ "Off"}); this.GraphicsShadows2007.Location = new System.Drawing.Point(172, 225); this.GraphicsShadows2007.Name = "GraphicsShadows2007"; - this.GraphicsShadows2007.Size = new System.Drawing.Size(155, 21); + this.GraphicsShadows2007.Size = new System.Drawing.Size(246, 21); this.GraphicsShadows2007.TabIndex = 18; this.GraphicsShadows2007.SelectedIndexChanged += new System.EventHandler(this.GraphicsShadows2007_SelectedIndexChanged); // @@ -285,16 +287,38 @@ // this.Style2007.Location = new System.Drawing.Point(172, 252); this.Style2007.Name = "Style2007"; - this.Style2007.Size = new System.Drawing.Size(155, 20); + this.Style2007.Size = new System.Drawing.Size(118, 20); this.Style2007.TabIndex = 22; this.Style2007.TextChanged += new System.EventHandler(this.Style2007_TextChanged); // + // Style2007FolderFinder + // + this.Style2007FolderFinder.Location = new System.Drawing.Point(296, 250); + this.Style2007FolderFinder.Name = "Style2007FolderFinder"; + this.Style2007FolderFinder.Size = new System.Drawing.Size(77, 23); + this.Style2007FolderFinder.TabIndex = 23; + this.Style2007FolderFinder.Text = "Styles Folder"; + this.Style2007FolderFinder.UseVisualStyleBackColor = true; + this.Style2007FolderFinder.Click += new System.EventHandler(this.Style2007FolderFinder_Click); + // + // Styles2007Info + // + this.Styles2007Info.Location = new System.Drawing.Point(379, 250); + this.Styles2007Info.Name = "Styles2007Info"; + this.Styles2007Info.Size = new System.Drawing.Size(39, 23); + this.Styles2007Info.TabIndex = 24; + this.Styles2007Info.Text = "Info"; + this.Styles2007Info.UseVisualStyleBackColor = true; + this.Styles2007Info.Click += new System.EventHandler(this.Styles2007Info_Click); + // // CustomGraphicsOptions // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.ClientSize = new System.Drawing.Size(339, 303); + this.ClientSize = new System.Drawing.Size(430, 303); + this.Controls.Add(this.Styles2007Info); + this.Controls.Add(this.Style2007FolderFinder); this.Controls.Add(this.Style2007); this.Controls.Add(this.label11); this.Controls.Add(this.label10); @@ -353,5 +377,7 @@ private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox Style2007; + private System.Windows.Forms.Button Style2007FolderFinder; + private System.Windows.Forms.Button Styles2007Info; } } \ No newline at end of file diff --git a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs index 18bb1b1..c58b051 100644 --- a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs +++ b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs @@ -1,5 +1,6 @@ #region Usings using System; +using System.Diagnostics; using System.IO; using System.Windows.Forms; using System.Xml.Linq; @@ -39,6 +40,7 @@ namespace NovetusLauncher info = GlobalFuncs.GetClientInfoValues(ClientName); string terms = "_" + ClientName; + bool hasFoundDir = false; string[] dirs = Directory.GetFiles(GlobalPaths.ConfigDirClients); foreach (string dir in dirs) @@ -184,12 +186,22 @@ namespace NovetusLauncher try { - Style_2007 = RobloxXML.GetRenderSettings(doc, "_skinFile", XMLTypes.String).Replace(@"Styles\", ""); - Style2007.Text = Style_2007; + bool checkSkin = RobloxXML.IsRenderSettingStringValid(doc, "_skinFile", XMLTypes.String); + if (checkSkin) + { + Style_2007 = RobloxXML.GetRenderSettings(doc, "_skinFile", XMLTypes.String).Replace(@"Styles\", ""); + Style2007.Text = Style_2007; + } + else + { + Style2007.Enabled = false; + Style2007FolderFinder.Enabled = false; + } } catch (Exception) { Style2007.Enabled = false; + Style2007FolderFinder.Enabled = false; } try @@ -205,8 +217,15 @@ namespace NovetusLauncher doc = null; GC.Collect(); GC.WaitForPendingFinalizers(); + hasFoundDir = true; } } + + if (!hasFoundDir) + { + MessageBox.Show("This client does not support setting adjustment through the Novetus Launcher.\nTry opening this client in ROBLOX Studio and adjust it through the settings in Tools -> Settings."); + Close(); + } } private void GraphicsLevel_ValueChanged(object sender, EventArgs e) @@ -300,6 +319,16 @@ namespace NovetusLauncher Style_2007 = Style2007.Text; } + private void Style2007FolderFinder_Click(object sender, EventArgs e) + { + Process.Start("explorer.exe", GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + ClientName + @"\Styles"); + } + + private void Styles2007Info_Click(object sender, EventArgs e) + { + MessageBox.Show("Make sure you place the styles you want in the Styles folder in " + GlobalPaths.ClientDir.Replace(@"\\", @"\") + @"\" + ClientName + @"\Styles." + Environment.NewLine + "If the files are not placed in this directory, they will not be loaded properly.\nThis client will accept .msstyles and .cjstyles files."); + } + private void GraphicsShadows2007_SelectedIndexChanged(object sender, EventArgs e) { switch (GraphicsShadows2007.SelectedIndex) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs index a205c15..942546c 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Compact/LauncherFormCompact.cs @@ -912,6 +912,14 @@ namespace NovetusLauncher GlobalFuncs.ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2, richTextBox1); } break; + case string dlldeleteon when string.Compare(dlldeleteon, "dlldelete on", true, CultureInfo.InvariantCulture) == 0: + GlobalVars.UserConfiguration.DisableReshadeDelete = false; + GlobalFuncs.ConsolePrint("ReShade DLL deletion enabled.", 4, richTextBox1); + break; + case string dlldeleteoff when string.Compare(dlldeleteoff, "dlldelete off", true, CultureInfo.InvariantCulture) == 0: + GlobalVars.UserConfiguration.DisableReshadeDelete = true; + GlobalFuncs.ConsolePrint("ReShade DLL deletion disabled.", 4, richTextBox1); + break; case string important when string.Compare(important, LocalVars.important, true, CultureInfo.InvariantCulture) == 0: GlobalVars.AdminMode = true; GlobalFuncs.ConsolePrint("ADMIN MODE ENABLED.", 4, richTextBox1); @@ -950,6 +958,9 @@ namespace NovetusLauncher GlobalFuncs.ConsolePrint("= webserver stop | Stops a web server if there is one on.", 4, richTextBox1); GlobalFuncs.ConsolePrint("= webserver start | Starts a web server if there isn't one on yet.", 4, richTextBox1); GlobalFuncs.ConsolePrint("---------", 1, richTextBox1); + GlobalFuncs.ConsolePrint("= dlldelete off | Turn off the deletion of opengl32.dll when ReShade is off.", 4, richTextBox1); + GlobalFuncs.ConsolePrint("= dlldelete on | Turn on the deletion of opengl32.dll when ReShade is off.", 4, richTextBox1); + GlobalFuncs.ConsolePrint("---------", 1, richTextBox1); } void Button21Click(object sender, EventArgs e) diff --git a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs index cbc3299..2fabdb8 100644 --- a/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs +++ b/Novetus/NovetusLauncher/Forms/LauncherForm/Extended/LauncherFormExtended.cs @@ -986,6 +986,14 @@ namespace NovetusLauncher GlobalFuncs.ConsolePrint("WebServer: Cannot restart web server. (" + ex.Message + ")", 2, richTextBox1); } break; + case string dlldeleteon when string.Compare(dlldeleteon, "dlldelete on", true, CultureInfo.InvariantCulture) == 0: + GlobalVars.UserConfiguration.DisableReshadeDelete = false; + GlobalFuncs.ConsolePrint("ReShade DLL deletion enabled.", 4, richTextBox1); + break; + case string dlldeleteoff when string.Compare(dlldeleteoff, "dlldelete off", true, CultureInfo.InvariantCulture) == 0: + GlobalVars.UserConfiguration.DisableReshadeDelete = true; + GlobalFuncs.ConsolePrint("ReShade DLL deletion disabled.", 4, richTextBox1); + break; case string important when string.Compare(important, LocalVars.important, true, CultureInfo.InvariantCulture) == 0: GlobalVars.AdminMode = true; GlobalFuncs.ConsolePrint("ADMIN MODE ENABLED.", 4, richTextBox1); @@ -1024,6 +1032,9 @@ namespace NovetusLauncher GlobalFuncs.ConsolePrint("= webserver stop | Stops a web server if there is one on.", 4, richTextBox1); GlobalFuncs.ConsolePrint("= webserver start | Starts a web server if there isn't one on yet.", 4, richTextBox1); GlobalFuncs.ConsolePrint("---------", 1, richTextBox1); + GlobalFuncs.ConsolePrint("= dlldelete off | Turn off the deletion of opengl32.dll when ReShade is off.", 4, richTextBox1); + GlobalFuncs.ConsolePrint("= dlldelete on | Turn on the deletion of opengl32.dll when ReShade is off.", 4, richTextBox1); + GlobalFuncs.ConsolePrint("---------", 1, richTextBox1); } void Button21Click(object sender, EventArgs e)