From 55c9128ecceee43bfddb8498e08cfcbeaf1d0307 Mon Sep 17 00:00:00 2001 From: Bitl Date: Sun, 14 Mar 2021 10:57:55 -0700 Subject: [PATCH] support for march 2007 (1) --- Novetus/NovetusCore/Classes/RobloxXML.cs | 7 ++- .../StorageAndFunctions/GlobalFuncs.cs | 23 ++++++-- .../StorageAndFunctions/ScriptFuncs.cs | 10 +++- .../Forms/CustomGraphicsOptions.Designer.cs | 29 +++++++++- .../Forms/CustomGraphicsOptions.cs | 53 ++++++++++++++++++- .../Forms/SDK/ClientinfoCreator.Designer.cs | 34 +++++++----- 6 files changed, 133 insertions(+), 23 deletions(-) diff --git a/Novetus/NovetusCore/Classes/RobloxXML.cs b/Novetus/NovetusCore/Classes/RobloxXML.cs index e605eac..38c0434 100644 --- a/Novetus/NovetusCore/Classes/RobloxXML.cs +++ b/Novetus/NovetusCore/Classes/RobloxXML.cs @@ -34,7 +34,8 @@ public enum XMLTypes { Token, Bool, - Float + Float, + String } #endregion @@ -522,8 +523,10 @@ public static class RobloxXML case XMLTypes.Float: return "float"; case XMLTypes.Token: - default: return "token"; + case XMLTypes.String: + default: + return "string"; } } diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index d5e2b48..6c401f5 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -573,6 +573,17 @@ public class GlobalFuncs return info; } + //https://social.msdn.microsoft.com/Forums/vstudio/en-US/b0c31115-f6f0-4de5-a62d-d766a855d4d1/directorygetfiles-with-searchpattern-to-get-all-dll-and-exe-files-in-one-call?forum=netfxbcl + public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption) + { + string[] searchPatterns = searchPattern.Split('|'); + List files = new List(); + foreach (string sp in searchPatterns) + files.AddRange(System.IO.Directory.GetFiles(path, sp, searchOption)); + files.Sort(); + return files.ToArray(); + } + public static void LoadClientValues(string clientpath) { LoadClientValues(GlobalVars.SelectedClientInfo, clientpath); @@ -1020,14 +1031,14 @@ public class GlobalFuncs } ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality, AA, AASamples, Bevels, - Shadows_2008, Shadows_2007, GFXQualityLevel); + Shadows_2008, Shadows_2007, "", GFXQualityLevel); } } //oh god.... //we're using this one for custom graphics quality. Better than the latter. public static void ApplyClientSettings_custom(FileFormat.ClientInfo info, string ClientName, int MeshDetail, int ShadingQuality, int MaterialQuality, - int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, int GFXQualityLevel) + int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, string Style_2007, int GFXQualityLevel) { int GraphicsMode = 0; @@ -1070,12 +1081,12 @@ public class GlobalFuncs } ApplyClientSettings(info, ClientName, GraphicsMode, MeshDetail, ShadingQuality, MaterialQuality, - AA, AASamples, Bevels, Shadows_2008, Shadows_2007, GFXQualityLevel); + AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, GFXQualityLevel); } //it's worse. public static void ApplyClientSettings(FileFormat.ClientInfo info, string ClientName, int GraphicsMode, int MeshDetail, int ShadingQuality, int MaterialQuality, - int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, int GFXQualityLevel) + int AA, int AASamples, int Bevels, int Shadows_2008, bool Shadows_2007, string Style_2007, int GFXQualityLevel) { try { @@ -1128,6 +1139,7 @@ public class GlobalFuncs RobloxXML.EditRenderSettings(doc, "Bevels", Bevels.ToString(), XMLTypes.Token); RobloxXML.EditRenderSettings(doc, "Shadow", Shadows_2008.ToString(), XMLTypes.Token); RobloxXML.EditRenderSettings(doc, "Shadows", Shadows_2007.ToString().ToLower(), XMLTypes.Bool); + RobloxXML.EditRenderSettings(doc, "_skinFile", Style_2007, XMLTypes.String); RobloxXML.EditRenderSettings(doc, "QualityLevel", GFXQualityLevel.ToString(), XMLTypes.Token); } catch (Exception) @@ -1285,6 +1297,9 @@ public class GlobalFuncs rbxexe); } + if (args == "") + return; + try { #if LAUNCHER diff --git a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs index 865e307..666e380 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs @@ -5,6 +5,7 @@ using System.IO; using System.Net.PeerToPeer.Collaboration; using System.Reflection; using System.Text.RegularExpressions; +using System.Windows.Forms; #endregion #region Script Type @@ -368,12 +369,19 @@ public class ScriptFuncs .Replace("%extraws%", WebServer_ExtraDir + GlobalVars.UserCustomization.Extra) .Replace("%hat4ws%", WebServer_HatDir + GlobalVars.UserCustomization.Extra) .Replace("%mapfiled%", GlobalPaths.BaseGameDir + GlobalVars.UserConfiguration.MapPathSnip.Replace(@"\\", @"\").Replace(@"/", @"\")) - .Replace("%mapfilec%", GlobalFuncs.CopyMapToRBXAsset()) + .Replace("%mapfilec%", extractedCode.Contains("%mapfilec%") ? GlobalFuncs.CopyMapToRBXAsset() : "") .Replace("%tripcode%", GlobalVars.UserConfiguration.PlayerTripcode) .Replace("%scripttype%", Generator.GetNameForType(type)) .Replace("%addonscriptpath%", GlobalPaths.AddonScriptPath) .Replace("%loadout%", code.Contains("") ? GlobalVars.soloLoadout : GlobalVars.Loadout) .Replace("%doublequote%", "\""); + + if (compiled.Contains("%disabled%")) + { + MessageBox.Show("This option has been disabled for this client."); + return ""; + } + return compiled; } } diff --git a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs index 7b54cf2..2baded9 100644 --- a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.Designer.cs @@ -48,6 +48,8 @@ this.label9 = new System.Windows.Forms.Label(); this.GraphicsShadows2007 = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.style2007 = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsLevel)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsMeshQuality)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.GraphicsShadingQuality)).BeginInit(); @@ -242,7 +244,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(49, 253); + this.label9.Location = new System.Drawing.Point(50, 281); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(234, 13); this.label9.TabIndex = 17; @@ -270,12 +272,33 @@ this.label10.TabIndex = 19; this.label10.Text = "Shadows (2007)"; // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(12, 255); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(89, 13); + this.label11.TabIndex = 21; + this.label11.Text = "Style (Early 2007)"; + // + // style2007 + // + this.style2007.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.style2007.FormattingEnabled = true; + this.style2007.Location = new System.Drawing.Point(172, 252); + this.style2007.Name = "style2007"; + this.style2007.Size = new System.Drawing.Size(155, 21); + this.style2007.TabIndex = 20; + this.style2007.SelectedIndexChanged += new System.EventHandler(this.style2007_SelectedIndexChanged); + // // 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, 275); + this.ClientSize = new System.Drawing.Size(339, 303); + this.Controls.Add(this.label11); + this.Controls.Add(this.style2007); this.Controls.Add(this.label10); this.Controls.Add(this.GraphicsShadows2007); this.Controls.Add(this.label9); @@ -330,5 +353,7 @@ private System.Windows.Forms.Label label9; private System.Windows.Forms.ComboBox GraphicsShadows2007; private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.ComboBox style2007; } } \ No newline at end of file diff --git a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs index 7750f12..5bdd052 100644 --- a/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs +++ b/Novetus/NovetusLauncher/Forms/CustomGraphicsOptions.cs @@ -20,6 +20,7 @@ namespace NovetusLauncher private int Bevels = 0; private int Shadows_2008 = 0; private bool Shadows_2007 = false; + private string Style_2007 = ""; private static string ClientName = ""; private FileFormat.ClientInfo info; #endregion @@ -154,7 +155,22 @@ namespace NovetusLauncher try { Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "Shadows", XMLTypes.Bool)); + } + catch (Exception) + { + // try doing march 2007. + try + { + Shadows_2007 = Convert.ToBoolean(RobloxXML.GetRenderSettings(doc, "shadows", XMLTypes.Bool)); + } + catch (Exception) + { + GraphicsShadows2007.Enabled = false; + } + } + if (GraphicsShadows2007.Enabled) + { switch (Shadows_2007) { case false: @@ -165,9 +181,32 @@ namespace NovetusLauncher break; } } + + //TODO: fix this + try + { + style2007.Items.Clear(); + string clientpath = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\Styles"; + + DirectoryInfo dinfo = new DirectoryInfo(clientpath); + FileInfo[] Files = dinfo.GetFiles("*.cjstyles"); + foreach (FileInfo file in Files) + { + style2007.Items.Add(file.Replace(clientpath, "Styles")); + } + + FileInfo[] Files2 = dinfo.GetFiles("*.msstyles"); + foreach (FileInfo file in Files2) + { + style2007.Items.Add(file.Replace(clientpath, "Styles")); + } + + Style_2007 = RobloxXML.GetRenderSettings(doc, "_skinFile", XMLTypes.String); + style2007.SelectedText = Style_2007; + } catch (Exception) { - GraphicsShadows2007.Enabled = false; + style2007.Enabled = false; } try @@ -273,6 +312,16 @@ namespace NovetusLauncher Shadows_2008 = GraphicsShadows2008.SelectedIndex; } + private void style2007_SelectedIndexChanged(object sender, EventArgs e) + { + if (!style2007.Enabled) + { + style2007.SelectedIndex = 0; + } + + Style_2007 = style2007.SelectedText; + } + private void GraphicsShadows2007_SelectedIndexChanged(object sender, EventArgs e) { switch (GraphicsShadows2007.SelectedIndex) @@ -290,7 +339,7 @@ namespace NovetusLauncher { GlobalFuncs.ReadClientValues(ClientName, null); GlobalFuncs.ApplyClientSettings_custom(info, ClientName, MeshDetail, ShadingQuality, MaterialQuality, - AA, AASamples, Bevels, Shadows_2008, Shadows_2007, QualityLevel); + AA, AASamples, Bevels, Shadows_2008, Shadows_2007, Style_2007, QualityLevel); } #endregion } diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs index d3f1521..c946a34 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs @@ -139,6 +139,7 @@ partial class ClientinfoEditor this.tripcodeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.debuggingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.donothingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.disabledToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.argsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.documentationToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.textBox4 = new System.Windows.Forms.TextBox(); @@ -330,7 +331,7 @@ partial class ClientinfoEditor this.no3dToolStripMenuItem, this.sharedToolStripMenuItem}); this.tagsToolStripMenuItem.Name = "tagsToolStripMenuItem"; - this.tagsToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.tagsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.tagsToolStripMenuItem.Text = "Add Tags"; // // clientToolStripMenuItem @@ -385,7 +386,7 @@ partial class ClientinfoEditor this.debuggingToolStripMenuItem, this.argsToolStripMenuItem}); this.variablesToolStripMenuItem.Name = "variablesToolStripMenuItem"; - this.variablesToolStripMenuItem.Size = new System.Drawing.Size(157, 22); + this.variablesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.variablesToolStripMenuItem.Text = "Add Variables"; // // generalToolStripMenuItem @@ -402,7 +403,7 @@ partial class ClientinfoEditor this.versionToolStripMenuItem, this.doublequoteToolStripMenuItem}); this.generalToolStripMenuItem.Name = "generalToolStripMenuItem"; - this.generalToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.generalToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.generalToolStripMenuItem.Text = "General"; // // mapfileToolStripMenuItem @@ -480,7 +481,7 @@ partial class ClientinfoEditor this.serverToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.limitToolStripMenuItem}); this.serverToolStripMenuItem1.Name = "serverToolStripMenuItem1"; - this.serverToolStripMenuItem1.Size = new System.Drawing.Size(133, 22); + this.serverToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.serverToolStripMenuItem1.Text = "Server"; // // limitToolStripMenuItem @@ -501,7 +502,7 @@ partial class ClientinfoEditor this.md5sToolStripMenuItem, this.md5sdToolStripMenuItem}); this.securityToolStripMenuItem.Name = "securityToolStripMenuItem"; - this.securityToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.securityToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.securityToolStripMenuItem.Text = "Security"; // // md5launcherToolStripMenuItem @@ -561,7 +562,7 @@ partial class ClientinfoEditor this.idToolStripMenuItem, this.tripcodeToolStripMenuItem}); this.playerToolStripMenuItem.Name = "playerToolStripMenuItem"; - this.playerToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.playerToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.playerToolStripMenuItem.Text = "Player"; // // customizationToolStripMenuItem @@ -979,29 +980,37 @@ partial class ClientinfoEditor // debuggingToolStripMenuItem // this.debuggingToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.donothingToolStripMenuItem}); + this.donothingToolStripMenuItem, + this.disabledToolStripMenuItem}); this.debuggingToolStripMenuItem.Name = "debuggingToolStripMenuItem"; - this.debuggingToolStripMenuItem.Size = new System.Drawing.Size(133, 22); - this.debuggingToolStripMenuItem.Text = "Debugging"; + this.debuggingToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.debuggingToolStripMenuItem.Text = "Debugging/Misc"; // // donothingToolStripMenuItem // this.donothingToolStripMenuItem.Name = "donothingToolStripMenuItem"; - this.donothingToolStripMenuItem.Size = new System.Drawing.Size(150, 22); + this.donothingToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.donothingToolStripMenuItem.Text = "%donothing%"; this.donothingToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // + // disabledToolStripMenuItem + // + this.disabledToolStripMenuItem.Name = "disabledToolStripMenuItem"; + this.disabledToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.disabledToolStripMenuItem.Text = "%disabled%"; + this.disabledToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); + // // argsToolStripMenuItem // this.argsToolStripMenuItem.Name = "argsToolStripMenuItem"; - this.argsToolStripMenuItem.Size = new System.Drawing.Size(133, 22); + this.argsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.argsToolStripMenuItem.Text = "%args%"; this.argsToolStripMenuItem.Click += new System.EventHandler(this.variableToolStripMenuItem_Click); // // documentationToolStripMenuItem1 // this.documentationToolStripMenuItem1.Name = "documentationToolStripMenuItem1"; - this.documentationToolStripMenuItem1.Size = new System.Drawing.Size(157, 22); + this.documentationToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.documentationToolStripMenuItem1.Text = "Documentation"; this.documentationToolStripMenuItem1.Click += new System.EventHandler(this.documentationToolStripMenuItem_Click); // @@ -1259,4 +1268,5 @@ partial class ClientinfoEditor private System.Windows.Forms.ToolStripMenuItem md5sToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem md5sdToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem doublequoteToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem; }