Skip to content

Commit

Permalink
v0.2.6 Update, See CHANGELOG for Full Details
Browse files Browse the repository at this point in the history
  • Loading branch information
HerpDerpinstine committed Aug 6, 2020
1 parent 45ab9ca commit 6cc958e
Show file tree
Hide file tree
Showing 76 changed files with 2,172 additions and 1,800 deletions.
Binary file modified BaseLibs/MelonLoader/Dependencies/mono-2.0-bdwgc.dll
Binary file not shown.
Binary file not shown.
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Version List:

[v0.2.6 Open-Beta](#v026-open-beta)
[v0.2.5 Open-Beta](#v025-open-beta)
[v0.2.4 Open-Beta](#v024-open-beta)
[v0.2.3 Open-Beta](#v023-open-beta)
Expand All @@ -13,6 +14,57 @@

---

### v0.2.6 Open-Beta:

1. Fixed Issue with Logger Timestamp making New Lines.
2. Added Silent Launch Option to Installer. (Credits to trevtv :P)
3. Fixed Internal Failure caused by DisableAnalytics for certain users.
4. Added Operating System log to startup info.
5. Added ValueTupleBridge to Managed Folder.
6. Added Unified Attributes for both Plugins and Mods.
7. Added Legacy Attribute Support.
8. Fixed Logger Issue with new Unified Attributes.
9. Deprecated MelonModLogger, use MelonLogger instead.
10. Deprecated ModPrefs, use MelonPrefs instead.
11. Added HarmonyInstance Method for easier Unpatching of Mods and Plugins.
12. Create MelonLoaderComponent after first scene load in Mono Games. (Credits to knah :D)
13. Removed Launch Option --melonloader.devpluginsonly.
14. Removed Launch Option --melonloader.devmodsonly.
15. Added Launch Option --melonloader.loadmodeplugins.
16. Added Launch Option --melonloader.loadmodemods.
17. Fixed Issue with Debug Mode causing Crashes for Some Games.
18. Fixed Issue with Manual Zip overriding Latest Version.
19. Fixed Issue where Manual Zip would get set as Default Selection.
20. Unity Analytics now redirected to localhost, rather than throwing null and exceptions. (Credits to Emilia :3)
21. Plugins are now able to use OnUpdate.
22. Plugins are now able to use OnLateUpdate.
23. Plugins are now able to use OnGUI.
24. Added GetUnityTlsInterface to Imports.
25. Implemented Native Sided SSL/TLS/HTTPS Fix.
26. Temporarily disabled DisableAnalytics.
27. Fixed Issue with Support Modules not loading due to Missing Method errors.
28. Fixed Issue with attaching dnSpy on Il2Cpp Games.
29. Replaced mono-2.0-bdwgc.dll with dnSpy Debug dll.
30. Debug Mode will now use LoadFrom instead of Load for breakpoint compatibility.
31. Fixed Crash Issue with DisableAnalytics.
32. Temporarily Disabled Console Logger Callbacks.
33. Revised Console Logger Callbacks.
34. Fixed Issue with LogMelonError not running Callbacks.
35. Deprecated MelonLoader.Main use MelonLoaderBase or MelonHandler instead.
36. Revised Base Melon Handling.
37. Revised IniFile.
38. Fixed Issue with Plugins not getting OnUpdate called.
39. Fixed Issue with Plugins not getting OnLateUpdate called.
40. Fixed Issue with Plugins not getting OnGUI called.
41. Plugins are now able to use VRChat_OnUiManagerInit.
42. Fixed Coroutine Queue for Mono Games.
43. Added Launch Option --melonloader.consoleontop. (Credits to trevtv :P)
44. Fixed Issue with Assembly Generator not stopping when failing to Download.
45. Escalated Assembly Generator failures to Internal Failures.
46. Fixed Issue where Assembly Generator failures would cause a Crash.

---

### v0.2.5 Open-Beta:

1. Fixed Issue that prevented deserializing structs with TinyJSON. (Credits to zeobviouslyfakeacc :3)
Expand Down
41 changes: 33 additions & 8 deletions MelonLoader.AssemblyGenerator/AssemblyGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal static class Main
private static string localConfigPath = null;
private static LocalConfig localConfig = null;
private static Il2CppConfig il2cppConfig = new Il2CppConfig();
private static bool DownloadedSuccessfully = true;

internal static bool Initialize(string unityVersion, string gameRoot, string gameDataDir)
{
Expand Down Expand Up @@ -86,14 +87,36 @@ private static bool AssemblyGenerateCheck(string unityVersion)
private static void DownloadDependencies(string unityVersion)
{
Logger.Log("Downloading Il2CppDumper");
DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppDumperUrl, ExternalToolVersions.Il2CppDumperVersion, localConfig.DumperVersion, Il2CppDumper.BaseFolder, TempFileCache.CreateFile());
localConfig.DumperVersion = ExternalToolVersions.Il2CppDumperVersion;
localConfig.Save(localConfigPath);
try
{
DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppDumperUrl, ExternalToolVersions.Il2CppDumperVersion, localConfig.DumperVersion, Il2CppDumper.BaseFolder, TempFileCache.CreateFile());
localConfig.DumperVersion = ExternalToolVersions.Il2CppDumperVersion;
localConfig.Save(localConfigPath);
}
catch (Exception ex)
{
DownloadedSuccessfully = false;
Logger.LogError(ex.ToString());
Logger.Log("Can't download Il2CppDumper!");
}
if (!DownloadedSuccessfully)
return;

Logger.Log("Downloading Il2CppAssemblyUnhollower");
DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppAssemblyUnhollowerUrl, ExternalToolVersions.Il2CppAssemblyUnhollowerVersion, localConfig.UnhollowerVersion, Il2CppAssemblyUnhollower.BaseFolder, TempFileCache.CreateFile());
localConfig.UnhollowerVersion = ExternalToolVersions.Il2CppAssemblyUnhollowerVersion;
localConfig.Save(localConfigPath);
try
{
DownloaderAndUnpacker.Run(ExternalToolVersions.Il2CppAssemblyUnhollowerUrl, ExternalToolVersions.Il2CppAssemblyUnhollowerVersion, localConfig.UnhollowerVersion, Il2CppAssemblyUnhollower.BaseFolder, TempFileCache.CreateFile());
localConfig.UnhollowerVersion = ExternalToolVersions.Il2CppAssemblyUnhollowerVersion;
localConfig.Save(localConfigPath);
}
catch (Exception ex)
{
DownloadedSuccessfully = false;
Logger.LogError(ex.ToString());
Logger.Log("Can't download Il2CppAssemblyUnhollower!");
}
if (!DownloadedSuccessfully)
return;

Logger.Log("Downloading Unity Dependencies");
string tempfile = TempFileCache.CreateFile();
Expand Down Expand Up @@ -142,16 +165,18 @@ private static void DownloadDependencies(string unityVersion)
}
catch (Exception ex)
{
Logger.LogError("Can't download Unity Dependencies, Unstripping will NOT be done!");
Logger.LogError(ex.ToString());
Logger.LogError("Can't download Unity Dependencies, Unstripping will NOT be done!");
}
}
}

private static bool AssemblyGenerate(string gameRoot, string unityVersion, string gameDataDir)
{
DownloadDependencies(unityVersion);

if (!DownloadedSuccessfully)
return false;

FixIl2CppDumperConfig();

Logger.Log("Executing Il2CppDumper...");
Expand Down
11 changes: 3 additions & 8 deletions MelonLoader.AssemblyGenerator/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
using System.Resources;
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle(MelonLoader.BuildInfo.Description)]
[assembly: AssemblyDescription(MelonLoader.BuildInfo.Description)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(MelonLoader.BuildInfo.Company)]
[assembly: AssemblyProduct(MelonLoader.BuildInfo.Name + ".GeneratorProcess")]
[assembly: AssemblyCopyright("Created by " + MelonLoader.BuildInfo.Author)]
[assembly: AssemblyTrademark(MelonLoader.BuildInfo.Company)]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
//[assembly: Guid("")]
[assembly: Guid("b323399d-2c8d-46ee-9ce5-2f970f7f2db9")]
[assembly: AssemblyVersion(MelonLoader.BuildInfo.Version)]
[assembly: AssemblyFileVersion(MelonLoader.BuildInfo.Version)]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyFileVersion(MelonLoader.BuildInfo.Version)]
2 changes: 1 addition & 1 deletion MelonLoader.AssemblyGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class Program
public static int Main(string[] args)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | (SecurityProtocolType)3072;
webClient.Headers.Add("User-Agent", "Unity web player");

if (args.Length < 4)
Expand Down
2 changes: 1 addition & 1 deletion MelonLoader.Installer/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private void btnInstall_Click(object sender, EventArgs e)
string selectedVersion = ((((string)cbVersions.Items[cbVersions.SelectedIndex]).StartsWith("Latest")) ? (string)cbVersions.Items[cbVersions.SelectedIndex + 1] : (string)cbVersions.Items[cbVersions.SelectedIndex]);
bool legacy_install = (selectedVersion.Equals("v0.2.1") || selectedVersion.Equals("v0.2") || selectedVersion.Equals("v0.1.0"));

Program.Install(dirpath, selectedVersion, legacy_install);
Program.Install(dirpath, selectedVersion, legacy_install, false);

Program.SetDisplayText("SUCCESS!");
MessageBox.Show("Installation Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
Expand Down
4 changes: 2 additions & 2 deletions MelonLoader.Installer/MelonLoader.Installer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFramework>net472</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>latest</LangVersion>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<Authors>Lava Gang</Authors>
<Company>discord.gg/2Wn3N2P</Company>
<Copyright>Lava Gang</Copyright>
Expand All @@ -15,7 +15,7 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<StartupObject>MelonLoader.Installer.Program</StartupObject>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.1.0</AssemblyVersion>
<Description>Installer for MelonLoader</Description>
<Product>MelonLoader.Installer</Product>
<PackageId>MelonLoader.Installer</PackageId>
Expand Down
104 changes: 91 additions & 13 deletions MelonLoader.Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using MelonLoader.LightJson;
#pragma warning disable 0168

namespace MelonLoader.Installer
{
static class Program
{
internal static bool ShouldCheckForUpdates = true;
internal static string Title = "MelonLoader Installer";
private static string ExeName = null;
internal static string ManualZipPath = null;
Expand All @@ -25,18 +25,32 @@ static class Program
private static readonly string[] filesToCleanUp = new string[] { "Mono.Cecil.dll", "version.dll", "winmm.dll" };
private static readonly string[] foldersToCleanUp = new string[] { "Logs", "MelonLoader" };

public static bool silent;
public static string silentPath;

[STAThread]
static void Main()
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol |= (SecurityProtocolType)3072;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | (SecurityProtocolType)3072;
webClient.Headers.Add("User-Agent", "Unity web player");
webClient.DownloadProgressChanged += (object sender, DownloadProgressChangedEventArgs info) => SetPercentage(info.ProgressPercentage);
Application.SetCompatibleTextRenderingDefault(false);
Application.EnableVisualStyles();

var args = Environment.GetCommandLineArgs();
foreach (string arg in args)
{
bool isSelf = Path.GetFullPath(arg) == Assembly.GetExecutingAssembly().Location;
if (File.Exists(arg) && arg.EndsWith(".exe") && !isSelf)
{
silent = true;
silentPath = Path.GetDirectoryName(arg);
}
}

ExeName = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName);
if (ExeName.EndsWith(".tmp.exe"))
if (ShouldCheckForUpdates && ExeName.EndsWith(".tmp.exe"))
{
string original_exe_path = (Directory.GetCurrentDirectory() + "\\" + ExeName.Substring(0, (ExeName.Length - 8)));
File.Delete(original_exe_path);
Expand All @@ -46,30 +60,75 @@ static void Main()
}
else
{
string tempfilepath = (Directory.GetCurrentDirectory() + "\\" + ExeName + ".tmp.exe");
if (File.Exists(tempfilepath))
File.Delete(tempfilepath);
if (ShouldCheckForUpdates)
{
string tempfilepath = (Directory.GetCurrentDirectory() + "\\" + ExeName + ".tmp.exe");
if (File.Exists(tempfilepath))
File.Delete(tempfilepath);
}
ManualZipPath = (Directory.GetCurrentDirectory() + "\\MelonLoader.zip");
Install_GUI();

if (silent)
Install_NoGUI();
else
Install_GUI();
}
}

static void Install_NoGUI()
{
try
{
string version = null;
JsonArray data = (JsonArray)JsonValue.Parse(webClient.DownloadString("https://api.github.com/repos/HerpDerpinstine/MelonLoader/releases")).AsJsonArray;
if (data.Count > 0)
version = data[0]["tag_name"].AsString;
try
{
Install(silentPath, version, false, true);
Environment.Exit(0);
}
catch (Exception ex)
{
MessageBox.Show("Installation failed; upload the created log to #melonloader-support on discord", Title);
File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString());
Environment.Exit(-1);
}

}
catch (Exception ex)
{
MessageBox.Show("Failed to Get Version List; upload the created log to #melonloader-support on discord", Title);
File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString());
Environment.Exit(-1);
}
}

static void Install_GUI()
{
int selected_index = 0;

try
{
mainForm = new MainForm();
mainForm.cbVersions.Items.Clear();
if (File.Exists(ManualZipPath))

bool should_add_manual = File.Exists(ManualZipPath);
if (should_add_manual)
mainForm.cbVersions.Items.Add("Manual Zip");
JsonArray data = (JsonArray)JsonValue.Parse(webClient.DownloadString("https://api.github.com/repos/HerpDerpinstine/MelonLoader/releases")).AsJsonArray;
if (data.Count > 0)
{
bool has_added_latest = false;
foreach (var x in data)
{
string version = x["tag_name"].AsString;
if (mainForm.cbVersions.Items.Count <= 0)
if (!has_added_latest)
{
has_added_latest = true;
mainForm.cbVersions.Items.Add("Latest (" + version + ")");
selected_index = (should_add_manual ? 1 : 0);
}
mainForm.cbVersions.Items.Add(version);
}
}
Expand All @@ -83,18 +142,22 @@ static void Install_GUI()
Application.Exit();
}

mainForm.cbVersions.SelectedIndex = 0;
mainForm.cbVersions.SelectedItem = mainForm.cbVersions.Items[0];
if ((selected_index < 0) || (selected_index > (mainForm.cbVersions.Items.Count - 1)))
selected_index = 0;
mainForm.cbVersions.SelectedIndex = selected_index;
mainForm.cbVersions.SelectedItem = mainForm.cbVersions.Items[selected_index];
mainForm.Show();
Application.Run(mainForm);
}

internal static void Install(string dirpath, string selectedVersion, bool legacy_install)
internal static void Install(string dirpath, string selectedVersion, bool legacy_install, bool silent_install)
{
if (File.Exists(ManualZipPath) && selectedVersion.Equals("Manual Zip"))
Install_ManualZip(dirpath);
else if (legacy_install)
Install_Legacy(dirpath, selectedVersion);
else if (silent_install)
Install_Silent(dirpath, selectedVersion);
else
Install_Normal(dirpath, selectedVersion);
TempFileCache.ClearCache();
Expand All @@ -116,6 +179,16 @@ private static void Install_Legacy(string dirpath, string selectedVersion)
Install_Legacy_02(dirpath, selectedVersion);
}

private static void Install_Silent(string dirpath, string selectedVersion)
{
string tempfilepath = TempFileCache.CreateFile();
webClient.DownloadFileAsync(new Uri("https://github.com/HerpDerpinstine/MelonLoader/releases/download/" + selectedVersion + "/MelonLoader.zip"), tempfilepath);
while (webClient.IsBusy) { }
Cleanup(dirpath);
ExtractZip(dirpath, tempfilepath);
CreateDirectories(dirpath, selectedVersion, false);
}

internal static void SetDisplayText(string text)
{
mainForm.Invoke(new Action(() => {
Expand All @@ -125,6 +198,9 @@ internal static void SetDisplayText(string text)

internal static void SetPercentage(int percent)
{
if (silent)
return;

mainForm.Invoke(new Action(() => {
mainForm.progressBar.Value = percent;
mainForm.lblProgressPer.Text = percent.ToString() + "%";
Expand Down Expand Up @@ -349,6 +425,8 @@ internal static string GetUnityVersion(string exepath)

internal static void CheckForUpdates()
{
if (!ShouldCheckForUpdates)
return;
try
{
string response = webClient.DownloadString("https://github.com/HerpDerpinstine/MelonLoader/raw/master/MelonLoader.Installer/MelonLoader.Installer.csproj");
Expand Down
1 change: 0 additions & 1 deletion MelonLoader.Installer/version.txt

This file was deleted.

Loading

0 comments on commit 6cc958e

Please sign in to comment.