From 284944db9dcc9ca4843b343f105d0a985d8fb12d Mon Sep 17 00:00:00 2001 From: Bitl Date: Wed, 27 Oct 2021 12:07:13 -0700 Subject: [PATCH] add seperate folders option --- Novetus/NovetusCore/Classes/FileFormat.cs | 2 + .../StorageAndFunctions/GlobalFuncs.cs | 86 +++++++++++++++++-- .../StorageAndFunctions/ScriptFuncs.cs | 24 +++++- .../StorageAndFunctions/SecurityFuncs.cs | 6 +- .../Forms/SDK/ClientinfoCreator.Designer.cs | 14 +++ .../Forms/SDK/ClientinfoCreator.cs | 41 ++++++++- 6 files changed, 159 insertions(+), 14 deletions(-) diff --git a/Novetus/NovetusCore/Classes/FileFormat.cs b/Novetus/NovetusCore/Classes/FileFormat.cs index 7ff8777..8c27431 100644 --- a/Novetus/NovetusCore/Classes/FileFormat.cs +++ b/Novetus/NovetusCore/Classes/FileFormat.cs @@ -19,6 +19,7 @@ public class FileFormat Fix2007 = false; AlreadyHasSecurity = false; ClientLoadOptions = Settings.ClientLoadOptions.Client_2008AndUp; + SeperateFolders = false; CommandLineArgs = "%args%"; } @@ -31,6 +32,7 @@ public class FileFormat public string ScriptMD5 { get; set; } public bool Fix2007 { get; set; } public bool AlreadyHasSecurity { get; set; } + public bool SeperateFolders { get; set; } public Settings.ClientLoadOptions ClientLoadOptions { get; set; } public string CommandLineArgs { get; set; } } diff --git a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs index d5a718a..6d1b677 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/GlobalFuncs.cs @@ -764,6 +764,11 @@ public class GlobalFuncs { ClientName = "\\RobloxApp_client.exe"; } + else if (File.Exists(path + "\\client\\RobloxApp_client.exe")) + { + ClientName = "\\client\\RobloxApp_client.exe"; + DefaultClientInfo.SeperateFolders = true; + } else if (File.Exists(path + "\\RobloxApp.exe")) { ClientName = "\\RobloxApp.exe"; @@ -817,6 +822,7 @@ public class GlobalFuncs SecurityFuncs.Base64Encode(DefaultClientInfo.Fix2007.ToString()), SecurityFuncs.Base64Encode(DefaultClientInfo.AlreadyHasSecurity.ToString()), SecurityFuncs.Base64Encode(((int)DefaultClientInfo.ClientLoadOptions).ToString()), + SecurityFuncs.Base64Encode(DefaultClientInfo.SeperateFolders.ToString()), SecurityFuncs.Base64Encode(DefaultClientInfo.CommandLineArgs.ToString()) }; @@ -985,7 +991,7 @@ public class GlobalFuncs string file, usesplayername, usesid, warning, legacymode, clientmd5, scriptmd5, desc, fix2007, alreadyhassecurity, - clientloadoptions, commandlineargs; + clientloadoptions, commandlineargs, folders; using (StreamReader reader = new StreamReader(clientpath)) { @@ -1007,11 +1013,23 @@ public class GlobalFuncs try { commandlineargs = SecurityFuncs.Base64Decode(result[11]); + + bool parsedValue; + if (bool.TryParse(commandlineargs, out parsedValue)) + { + folders = SecurityFuncs.Base64Decode(result[11]); + commandlineargs = SecurityFuncs.Base64Decode(result[12]); + } + else + { + folders = "False"; + } } catch { //fake this option until we properly apply it. clientloadoptions = "2"; + folders = "False"; commandlineargs = SecurityFuncs.Base64Decode(result[10]); } @@ -1032,7 +1050,8 @@ public class GlobalFuncs { info.ClientLoadOptions = (Settings.ClientLoadOptions)Convert.ToInt32(clientloadoptions); } - + + info.SeperateFolders = Convert.ToBoolean(folders); info.CommandLineArgs = commandlineargs; } @@ -1650,12 +1669,12 @@ public class GlobalFuncs } } - public static string GetLuaFileName() + public static string GetLuaFileName(ScriptType type) { - return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient); + return GetLuaFileName(GlobalVars.UserConfiguration.SelectedClient, type); } - public static string GetLuaFileName(string ClientName) + public static string GetLuaFileName(string ClientName, ScriptType type) { string luafile = ""; @@ -1665,12 +1684,44 @@ public class GlobalFuncs } else { - luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + if (GlobalVars.SelectedClientInfo.SeperateFolders) + { + luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + } + else + { + luafile = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"; + } } return luafile; } + public static string GetClientSeperateFolderName(ScriptType type) + { + string rbxfolder = ""; + switch (type) + { + case ScriptType.Client: + case ScriptType.Solo: + case ScriptType.EasterEgg: + rbxfolder = "client"; + break; + case ScriptType.Server: + rbxfolder = "server"; + break; + case ScriptType.Studio: + rbxfolder = "studio"; + break; + case ScriptType.None: + default: + rbxfolder = ""; + break; + } + + return rbxfolder; + } + public static string GetClientEXEDir(ScriptType type) { return GetClientEXEDir(GlobalVars.UserConfiguration.SelectedClient, type); @@ -1683,6 +1734,27 @@ public class GlobalFuncs { rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe"; } + else if (GlobalVars.SelectedClientInfo.SeperateFolders) + { + switch (type) + { + case ScriptType.Client: + case ScriptType.Solo: + case ScriptType.EasterEgg: + rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_client.exe"; + break; + case ScriptType.Server: + rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_server.exe"; + break; + case ScriptType.Studio: + rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GetClientSeperateFolderName(type) + @"\\RobloxApp_studio.exe"; + break; + case ScriptType.None: + default: + rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe"; + break; + } + } else { switch (type) @@ -1742,7 +1814,7 @@ public class GlobalFuncs ReadClientValues(ClientName); #endif - string luafile = GetLuaFileName(ClientName); + string luafile = GetLuaFileName(ClientName, type); string rbxexe = GetClientEXEDir(ClientName, type); string mapfile = type.Equals(ScriptType.EasterEgg) ? GlobalPaths.ConfigDirData + "\\Appreciation.rbxl" : (nomap ? "" : GlobalVars.UserConfiguration.MapPath); string mapname = type.Equals(ScriptType.EasterEgg) ? "" : (nomap ? "" : GlobalVars.UserConfiguration.Map); diff --git a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs index 59028aa..54f0a62 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/ScriptFuncs.cs @@ -39,6 +39,10 @@ public class ScriptFuncs { rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp.exe"; } + if (info.SeperateFolders) + { + rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\client\\RobloxApp_client.exe"; + } else { rbxexe = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\RobloxApp_client.exe"; @@ -117,14 +121,30 @@ public class ScriptFuncs string code = GlobalFuncs.MultiLine( "--Load Script", //scriptcontents, - "dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')", + (GlobalVars.SelectedClientInfo.SeperateFolders ? + "dofile('rbxasset://../../content/scripts/" + GlobalPaths.ScriptName + ".lua')" : + "dofile('rbxasset://scripts/" + GlobalPaths.ScriptName + ".lua')"), GetScriptFuncForType(type), !string.IsNullOrWhiteSpace(GlobalPaths.AddonScriptPath) ? "dofile('" + GlobalPaths.AddonScriptPath + "')" : "" ); List list = new List(Regex.Split(code, Environment.NewLine)); string[] convertedList = list.ToArray(); - File.WriteAllLines(GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua", convertedList); + + if (GlobalVars.SelectedClientInfo.SeperateFolders) + { + string scriptsFolder = GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts"; + if (!Directory.Exists(scriptsFolder)) + { + Directory.CreateDirectory(scriptsFolder); + } + } + + File.WriteAllLines( + (GlobalVars.SelectedClientInfo.SeperateFolders ? + GlobalPaths.ClientDir + @"\\" + ClientName + @"\\" + GlobalFuncs.GetClientSeperateFolderName(type) + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua": + GlobalPaths.ClientDir + @"\\" + ClientName + @"\\content\\scripts\\" + GlobalPaths.ScriptGenName + ".lua"), + convertedList); } } #endregion diff --git a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs index 4e13f4a..c0d0ed2 100644 --- a/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs +++ b/Novetus/NovetusCore/StorageAndFunctions/SecurityFuncs.cs @@ -95,7 +95,11 @@ public class SecurityFuncs if (GlobalVars.SelectedClientInfo.LegacyMode) { rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp.exe"; - } + } + if (GlobalVars.SelectedClientInfo.SeperateFolders) + { + rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\client\\RobloxApp_client.exe"; + } else { rbxexe = GlobalPaths.BasePath + "\\clients\\" + client + "\\RobloxApp_client.exe"; diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs index 6c0fbcb..345e0ff 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.Designer.cs @@ -143,6 +143,7 @@ partial class ClientinfoEditor this.label9 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); + this.checkBox5 = new System.Windows.Forms.CheckBox(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -1058,12 +1059,24 @@ partial class ClientinfoEditor this.label10.TabIndex = 33; this.label10.Text = "When applying the settings (if there is a settings XML file):"; // + // checkBox5 + // + this.checkBox5.AutoSize = true; + this.checkBox5.Location = new System.Drawing.Point(171, 108); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.Size = new System.Drawing.Size(133, 17); + this.checkBox5.TabIndex = 34; + this.checkBox5.Text = "Uses Seperate Folders"; + this.checkBox5.UseVisualStyleBackColor = true; + this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged); + // // ClientinfoEditor // 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(632, 351); + this.Controls.Add(this.checkBox5); this.Controls.Add(this.label10); this.Controls.Add(this.comboBox1); this.Controls.Add(this.label9); @@ -1202,4 +1215,5 @@ partial class ClientinfoEditor private System.Windows.Forms.ToolStripMenuItem disabledToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem notificationsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem joinportToolStripMenuItem; + private System.Windows.Forms.CheckBox checkBox5; } diff --git a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs index 145b46a..b2c54bd 100644 --- a/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs +++ b/Novetus/NovetusLauncher/Forms/SDK/ClientinfoCreator.cs @@ -90,7 +90,7 @@ public partial class ClientinfoEditor : Form { string file, usesplayername, usesid, warning, legacymode, clientmd5, scriptmd5, desc, locked, fix2007, alreadyhassecurity, - cmdargsorclientoptions, commandargsver2; + cmdargsorclientoptions, commandargsver2, folders; using (StreamReader reader = new StreamReader(ofd.FileName)) { @@ -124,12 +124,30 @@ public partial class ClientinfoEditor : Form fix2007 = SecurityFuncs.Base64Decode(result[8]); alreadyhassecurity = SecurityFuncs.Base64Decode(result[9]); cmdargsorclientoptions = SecurityFuncs.Base64Decode(result[10]); + folders = ""; commandargsver2 = ""; + try { if (IsVersion2) { commandargsver2 = SecurityFuncs.Base64Decode(result[11]); + + bool parsedValue; + if (bool.TryParse(commandargsver2, out parsedValue)) + { + folders = SecurityFuncs.Base64Decode(result[11]); + commandargsver2 = SecurityFuncs.Base64Decode(result[12]); + } + else + { + folders = "False"; + + if (!label9.Text.Equals("v1 (v1.1)")) + { + label9.Text = "v2 (v1.3 Pre-Release 5)"; + } + } } } catch (Exception ex) @@ -172,6 +190,7 @@ public partial class ClientinfoEditor : Form SelectedClientInfo.Description = desc; SelectedClientInfo.Fix2007 = Convert.ToBoolean(fix2007); SelectedClientInfo.AlreadyHasSecurity = Convert.ToBoolean(alreadyhassecurity); + SelectedClientInfo.SeperateFolders = Convert.ToBoolean(folders); try { @@ -204,6 +223,7 @@ public partial class ClientinfoEditor : Form checkBox1.Checked = SelectedClientInfo.UsesPlayerName; checkBox2.Checked = SelectedClientInfo.UsesID; checkBox3.Checked = SelectedClientInfo.LegacyMode; + checkBox5.Checked = SelectedClientInfo.SeperateFolders; checkBox6.Checked = SelectedClientInfo.Fix2007; checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity; @@ -231,6 +251,7 @@ public partial class ClientinfoEditor : Form SecurityFuncs.Base64Encode(SelectedClientInfo.Fix2007.ToString()), SecurityFuncs.Base64Encode(SelectedClientInfo.AlreadyHasSecurity.ToString()), SecurityFuncs.Base64Encode(((int)SelectedClientInfo.ClientLoadOptions).ToString()), + SecurityFuncs.Base64Encode(SelectedClientInfo.SeperateFolders.ToString()), SecurityFuncs.Base64Encode(SelectedClientInfo.CommandLineArgs.ToString()) }; File.WriteAllText(SelectedClientInfoPath + "\\clientinfo.nov", SecurityFuncs.Base64Encode(string.Join("|", lines))); @@ -269,6 +290,7 @@ public partial class ClientinfoEditor : Form SelectedClientInfo.Fix2007.ToString(), SelectedClientInfo.AlreadyHasSecurity.ToString(), ((int)SelectedClientInfo.ClientLoadOptions).ToString(), + SelectedClientInfo.SeperateFolders.ToString(), SelectedClientInfo.CommandLineArgs.ToString() }; File.WriteAllLines(sfd.FileName, lines); @@ -303,6 +325,7 @@ public partial class ClientinfoEditor : Form ini.IniWriteValue(section, "Fix2007", SelectedClientInfo.Fix2007.ToString()); ini.IniWriteValue(section, "AlreadyHasSecurity", SelectedClientInfo.AlreadyHasSecurity.ToString()); ini.IniWriteValue(section, "ClientLoadOptions", ((int)SelectedClientInfo.ClientLoadOptions).ToString()); + ini.IniWriteValue(section, "SeperateFolders", SelectedClientInfo.SeperateFolders.ToString()); ini.IniWriteValue(section, "CommandLineArgs", SelectedClientInfo.CommandLineArgs.ToString()); } } @@ -366,6 +389,11 @@ public partial class ClientinfoEditor : Form SelectedClientInfo.ClientLoadOptions = (Settings.ClientLoadOptions)comboBox1.SelectedIndex; BeginInvoke(new Action(() => { comboBox1.Select(0, 0); })); } + + private void checkBox5_CheckedChanged(object sender, EventArgs e) + { + SelectedClientInfo.SeperateFolders = checkBox5.Checked; + } #endregion #region Functions @@ -384,13 +412,17 @@ public partial class ClientinfoEditor : Form string ClientName = ""; - if (!SelectedClientInfo.LegacyMode) + if (SelectedClientInfo.LegacyMode) { - ClientName = "\\RobloxApp_client.exe"; + ClientName = "\\RobloxApp.exe"; + } + else if (SelectedClientInfo.SeperateFolders) + { + ClientName = "\\client\\RobloxApp_client.exe"; } else { - ClientName = "\\RobloxApp.exe"; + ClientName = "\\RobloxApp_client.exe"; } string ClientMD5 = File.Exists(SelectedClientInfoPath + ClientName) ? SecurityFuncs.GenerateMD5(SelectedClientInfoPath + ClientName) : ""; @@ -431,6 +463,7 @@ public partial class ClientinfoEditor : Form checkBox2.Checked = SelectedClientInfo.UsesID; checkBox3.Checked = SelectedClientInfo.LegacyMode; checkBox4.Checked = Locked; + checkBox5.Checked = SelectedClientInfo.SeperateFolders; checkBox6.Checked = SelectedClientInfo.Fix2007; checkBox7.Checked = SelectedClientInfo.AlreadyHasSecurity; comboBox1.SelectedIndex = (int)SelectedClientInfo.ClientLoadOptions;