Skip to content

Commit

Permalink
Quality of life fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximumADHD committed Mar 3, 2024
1 parent dad1792 commit 3d289f0
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 110 deletions.
2 changes: 1 addition & 1 deletion Config/LatestReleaseTag.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2023.11.02
v2024.03.02
4 changes: 0 additions & 4 deletions ProjectSrc/Bootstrapper/FileManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Runtime.Serialization;
using System.Threading.Tasks;

using RobloxDeployHistory;
Expand All @@ -14,9 +13,6 @@ internal class FileManifest : Dictionary<string, string>
{
public string RawData { get; set; }

protected FileManifest(SerializationInfo info, StreamingContext context)
: base(info, context) { }

private FileManifest(string data, bool remapExtraContent = false)
{
using (var reader = new StringReader(data))
Expand Down
32 changes: 2 additions & 30 deletions ProjectSrc/Bootstrapper/StudioBootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ public class StudioBootstrapper

private static string AppSettings_XML;
private static string OAuth2Config_JSON;

private const string UserAgent = "RobloxStudioModManager";
public const string StartEvent = "RobloxStudioModManagerStart";

public event MessageFeed EchoFeed;
public event MessageFeed StatusFeed;

private readonly IBootstrapperState mainState;
private readonly VersionManifest versionRegistry;
private readonly Dictionary<string, string> fileRegistry;
private readonly Dictionary<string, PackageState> pkgRegistry;
private readonly SortedDictionary<string, string> fileRegistry;
private readonly SortedDictionary<string, PackageState> pkgRegistry;

private Dictionary<string, string[]> bySignature;
private Dictionary<string, string> newManifestEntries;
Expand All @@ -54,7 +52,6 @@ public class StudioBootstrapper
public int MaxProgress = 0;
public ProgressBarStyle ProgressBarStyle = ProgressBarStyle.Continuous;

private Task StartEventTask;
public object ProgressLock = new object();

public Channel Channel { get; set; } = "LIVE";
Expand All @@ -64,7 +61,6 @@ public class StudioBootstrapper
public bool CanForceStudioShutdown { get; set; } = false;

public bool ForceInstall { get; set; } = false;
public bool SetStartEvent { get; set; } = false;
public bool GenerateMetadata { get; set; } = false;
public bool RemapExtraContent { get; set; } = false;
public bool ApplyModManagerPatches { get; set; } = false;
Expand Down Expand Up @@ -1072,30 +1068,6 @@ await ClassIconEditor
setStatus("Starting Roblox Studio...");
echo("Roblox Studio is up to date!");

if (SetStartEvent)
{
StartEventTask = Task.Run(async () =>
{
var start = new SystemEvent(StartEvent);
bool started = await start
.WaitForEvent()
.ConfigureAwait(true);
start.Close();
if (started)
{
var delay = Task.Delay(3000);
await delay.ConfigureAwait(false);
Application.Exit();
}
start.Dispose();
});
}

await Task.Delay(1000);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion ProjectSrc/Forms/FlagEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace RobloxStudioModManager
public partial class FlagEditor : Form
{
private static VersionManifest versionRegistry => Program.State.VersionData;
private static Dictionary<string, FVariable> flagRegistry => Program.State.FlagEditor;
private static SortedDictionary<string, FVariable> flagRegistry => Program.State.FlagEditor;

private DataTable overrideTable;
private readonly Dictionary<string, DataRow> overrideRowLookup = new Dictionary<string, DataRow>();
Expand Down
62 changes: 11 additions & 51 deletions ProjectSrc/Forms/Launcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public partial class Launcher : Form
{
private static VersionManifest versionRegistry => Program.State.VersionData;
private readonly string[] args = null;
private bool prompting = false;

// hopefully temporary? probably not.
private const string channel = "LIVE";
Expand All @@ -40,7 +39,7 @@ private Channel getSelectedChannel()

private void promptNewRelease(string releaseTag)
{
prompting = true;
#if !DEBUG
Enabled = false;

DialogResult result = MessageBox.Show
Expand All @@ -60,8 +59,8 @@ private void promptNewRelease(string releaseTag)
Application.Exit();
}

prompting = false;
Enabled = true;
#endif
}

private async void Launcher_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -96,7 +95,7 @@ private async void Launcher_Load(object sender, EventArgs e)
if (args != null)
openStudioDirectory.Enabled = false;

// Grab the version currently being targetted.
// Grab the version currently being targeted.
string targetId = Program.State.TargetVersion;
const string latest = "(Use Latest)";

Expand Down Expand Up @@ -133,6 +132,8 @@ private async void Launcher_Load(object sender, EventArgs e)
if (target != null)
{
targetVersion.SelectedItem = target;
UseWaitCursor = false;
Enabled = true;
return;
}

Expand Down Expand Up @@ -365,8 +366,6 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)
{
ForceInstall = forceRebuild.Checked,
ApplyModManagerPatches = true,

SetStartEvent = true,
Channel = channel
};

Expand Down Expand Up @@ -449,7 +448,7 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)
var robloxStudioInfo = new ProcessStartInfo()
{
FileName = StudioBootstrapper.GetStudioPath(),
Arguments = $"-startEvent {StudioBootstrapper.StartEvent}"
Arguments = $""
};

if (args != null)
Expand All @@ -459,49 +458,7 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)
if (firstArg != null && firstArg.StartsWith("roblox-studio", Program.StringFormat))
{
// Arguments were passed by URI.
var argMap = new Dictionary<string, string>();

foreach (string commandPair in firstArg.Split('+'))
{
if (commandPair.Contains(':'))
{
string[] kvPair = commandPair.Split(':');

string key = kvPair[0];
string val = kvPair[1];

if (key == "gameinfo")
{
// The user is authenticating. This argument is a special case.
robloxStudioInfo.Arguments += " -url https://www.roblox.com/Login/Negotiate.ashx -ticket " + val;
}
else
{
argMap.Add(key, val);
robloxStudioInfo.Arguments += " -" + key + ' ' + val;
}
}
}

if (argMap.ContainsKey("launchmode") && !argMap.ContainsKey("task"))
{
string launchMode = argMap["launchmode"];

if (launchMode == "plugin")
{
string pluginId = argMap["pluginid"];
robloxStudioInfo.Arguments += "-task InstallPlugin -pluginId " + pluginId;
}
else if (launchMode == "edit")
{
robloxStudioInfo.Arguments += "-task EditPlace";
}
else if (launchMode == "asset")
{
string assetId = argMap["assetid"];
robloxStudioInfo.Arguments += "-task TryAsset -assetId " + assetId;
}
}
robloxStudioInfo.Arguments = firstArg;
}
else
{
Expand All @@ -518,10 +475,10 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)
}
}


if (openStudioDirectory.Checked)
{
Process.Start(studioRoot);
Environment.Exit(0);
}
else
{
Expand All @@ -530,6 +487,9 @@ private async void launchStudio_Click(object sender = null, EventArgs e = null)

Process.Start(robloxStudioInfo);
}

Program.SaveState();
Environment.Exit(Environment.ExitCode);
}

private void targetVersion_SelectedIndexChanged(object sender, EventArgs e)
Expand Down
10 changes: 8 additions & 2 deletions ProjectSrc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Newtonsoft.Json.Linq;

using Microsoft.Win32;
using System.Text;

namespace RobloxStudioModManager
{
Expand All @@ -17,7 +18,7 @@ static class Program
public const string RepoOwner = "MaximumADHD";
public const string RepoName = "Roblox-Studio-Mod-Manager";

public const string ReleaseTag = "v2023.11.02";
public const string ReleaseTag = "v2024.03.02";
public static readonly string BaseConfigUrl = $"https://raw.githubusercontent.com/{RepoOwner}/{RepoName}/{RepoBranch}/Config/";

public static readonly RegistryKey LegacyRegistry = Registry.CurrentUser.GetSubKey("SOFTWARE", "Roblox Studio Mod Manager");
Expand All @@ -29,6 +30,11 @@ static class Program
public static string RootDir { get; private set; }
public static ModManagerState State { get; private set; }

private static JsonSerializerSettings JsonSettings = new JsonSerializerSettings()
{
ContractResolver = new OrdinalSortJson()
};

public static RegistryKey GetSubKey(this RegistryKey key, params string[] path)
{
string constructedPath = Path.Combine(path);
Expand Down Expand Up @@ -115,7 +121,7 @@ static void ConvertLegacy(RegistryKey regKey, JObject node)
public static void SaveState()
{
var stateFile = Path.Combine(RootDir, "state.json");
string json = JsonConvert.SerializeObject(State, Formatting.Indented);
string json = JsonConvert.SerializeObject(State, Formatting.Indented, JsonSettings);
File.WriteAllText(stateFile, json);
}

Expand Down
66 changes: 62 additions & 4 deletions ProjectSrc/RobloxStudioModManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
Expand All @@ -47,7 +47,7 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
Expand Down Expand Up @@ -86,14 +86,65 @@
<DefineConstants>TRACE;ROBLOX_INTERNAL</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Internal|x64'">
<OutputPath>bin\x64\Internal\</OutputPath>
<DefineConstants>TRACE;ROBLOX_INTERNAL</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInternal|AnyCPU'">
<OutputPath>bin\DebugInternal\</OutputPath>
<DefineConstants>TRACE;ROBLOX_INTERNAL</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInternal|x64'">
<OutputPath>bin\x64\DebugInternal\</OutputPath>
<DefineConstants>TRACE;ROBLOX_INTERNAL</DefineConstants>
<Optimize>false</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -119,7 +170,14 @@
<DependentUpon>FlagCreator.cs</DependentUpon>
</Compile>
<Compile Include="History\*.cs" />
<Compile Include="Utility\*.cs" />
<Compile Include="Utility\AppState.cs" />
<Compile Include="Utility\CustomFlag.cs" />
<Compile Include="Utility\FVariable.cs" />
<Compile Include="Utility\KnownRoot.cs" />
<Compile Include="Utility\OrdinalSortJson.cs" />
<Compile Include="Utility\Package.cs" />
<Compile Include="Utility\RobloxInternal.cs" />
<Compile Include="Utility\SystemEvent.cs" />
<Compile Include="Bootstrapper\*.cs" />
<Compile Include="Forms\BootstrapperForm.cs">
<SubType>Form</SubType>
Expand Down
Loading

0 comments on commit 3d289f0

Please sign in to comment.