diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f6d0a..eac995a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### UpdateChecker v1.0.0 +- Initial release + ### StandaloneThirdPerson v1.2.0 - Added a freeform camera (You can thank [ljoonal](https://github.com/ljoonal/) for that) diff --git a/ILRepack/ILRepack.Lib.MSBuild.Task.dll b/ILRepack/ILRepack.Lib.MSBuild.Task.dll new file mode 100644 index 0000000..af94f94 Binary files /dev/null and b/ILRepack/ILRepack.Lib.MSBuild.Task.dll differ diff --git a/ILRepack/ILRepack.Lib.MSBuild.Task.targets b/ILRepack/ILRepack.Lib.MSBuild.Task.targets new file mode 100644 index 0000000..e3222f2 --- /dev/null +++ b/ILRepack/ILRepack.Lib.MSBuild.Task.targets @@ -0,0 +1,42 @@ + + + + + + + $(ProjectDir)ILRepack.targets + + + + + + + + + + + + + + + + + + + $([System.IO.Directory]::GetFiles("%(Directories.Identity)", "*", System.IO.SearchOption.AllDirectories).get_Length()) + + + + + \ No newline at end of file diff --git a/ILRepack/ILRepack.dll b/ILRepack/ILRepack.dll new file mode 100644 index 0000000..73c7950 Binary files /dev/null and b/ILRepack/ILRepack.dll differ diff --git a/README.md b/README.md index 88d6fa8..32b6b57 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ Modding the VRChat client is against VRChat's Terms of Service. Therefore use th - [ActionMenuApi](#actionmenuapi) - [ActionMenuUtils](#actionmenuutils) - [StandaloneThirdPerson](#standalonethirdperson) +- [UpdateChecker](#updatechecker) - [WorldPredownload](#worldpredownload) ## Canny Posts @@ -27,6 +28,12 @@ To Build simply: 3. Inside `Directory.Build.props` edit the path inside `` to the path of your own game install 4. Build Solution + +### ILRepack +A copy of [ILRepack.Lib.MSBuild.Task](https://github.com/ravibpatel/ILRepack.Lib.MSBuild.Task) and [ILRepack](https://github.com/gluck/il-repack) are included in the repo to build the solution + + + ## ActionMenuApi This mod doesn't do anything on it's own. @@ -88,6 +95,19 @@ More information [here](https://github.com/gompocp/ActionMenuApi) - Credit to [ljoonal](https://github.com/ljoonal/) some of the math is loosely based off of their [third person mod for cvr](https://github.com/ljoonal/CVR-Mods/blob/main/ThirdPersonCamera/ThirdPersonCamera.cs) - Some acknowledgement needs to be given to [emmVRC](https://github.com/emmVRC/) as they are the people that originally (afaik ¯\\\_(ツ)_/¯ ) had a third person mod for vrchat +## UpdateChecker + +- Simple mod for people who dislike auto updaters +- Checks for mod updates and lets you know in the console +- Only works for mods that follow the semver format + +### Preview +![Console Preview](https://i.imgur.com/s3BP2qf.png) + +### Acknowledgements + +- Some code was used from [Slaynash](https://github.com/Slaynash/VRCModUpdater/blob/main/Core/VRCModUpdaterCore.cs) + ## WorldPredownload - You can hit preload on an invite, on a world page or on a friend user page diff --git a/UpdateChecker/Main.cs b/UpdateChecker/Main.cs new file mode 100644 index 0000000..0b6982a --- /dev/null +++ b/UpdateChecker/Main.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Net; +using MelonLoader; +using Newtonsoft.Json; +using Semver; +using Main = UpdateChecker.Main; + +[assembly: MelonGame("VRChat", "VRChat")] +[assembly: MelonInfo(typeof(Main), "UpdateChecker", "1.0.0", "gompo", "https://github.com/gompocp/VRChatMods/releases/")] +[assembly: MelonColor(ConsoleColor.Magenta)] + +namespace UpdateChecker +{ + public partial class Main : MelonMod + { + public override void OnApplicationStart() + { + // Api fetching code comes from: https://github.com/Slaynash/VRCModUpdater/blob/main/Core/VRCModUpdaterCore.cs + string apiResponse; + using var client = new WebClient + { + Headers = {["User-Agent"] = "UpdateChecker"} + }; + apiResponse = client.DownloadString("https://api.vrcmg.com/v0/mods.json"); + if (string.IsNullOrEmpty(apiResponse)) + { + MelonLogger.Error("Failed to contact api"); + return; + } + List mods = JsonConvert.DeserializeObject>(apiResponse); + + if (mods == null || mods.Count == 0) + { + MelonLogger.Error("Didn't receive any mods from the api"); + return; + } + + Dictionary workingModsLookUpTable = new Dictionary(); + Dictionary brokenModsLookUpTable = new Dictionary(); + + foreach (var mod in mods) + { + if(mod.versions.Count == 0) continue; + var modVersion = mod.versions[0]; + try + { + modVersion.SemVersion = SemVersion.Parse(modVersion.modversion); + } + catch (ArgumentException) + { + } + foreach (var alias in mod.aliases) + { + if(modVersion.ApprovalStatus == 2) + brokenModsLookUpTable.Add(alias, modVersion); + else if(modVersion.ApprovalStatus == 1) + workingModsLookUpTable.Add(alias, modVersion); + } + } + + foreach (var melonmod in MelonHandler.Mods) + { + try + { + SemVersion semVersion = SemVersion.Parse(melonmod.Info.Version); + if (workingModsLookUpTable.ContainsKey(melonmod.Info.Name)) + { + var latestVersion = workingModsLookUpTable[melonmod.Info.Name]; + if (latestVersion.SemVersion == null) + { + throw new ArgumentException(); + } + if (semVersion < latestVersion.SemVersion) + { + MelonLogger.Msg(ConsoleColor.Green,$"Mod {melonmod.Info.Name} by {melonmod.Info.Author} is out of date. {melonmod.Info.Version} --> {latestVersion.modversion}"); + } + } + else if (brokenModsLookUpTable.ContainsKey(melonmod.Info.Name)) + { + MelonLogger.Msg(ConsoleColor.Yellow,$"Running currently broken mod: {melonmod.Info.Name} by {melonmod.Info.Author}"); + } + else if (!melonmod.Info.Name.Equals("UpdateChecker")) + { + MelonLogger.Msg(ConsoleColor.Blue,$"Running unknown mod: {melonmod.Info.Name} by {melonmod.Info.Author}"); + } + + } + catch(ArgumentException) + { + MelonLogger.Msg(ConsoleColor.Red,$"MelonMod {melonmod.Info.Name} isn't following semver. Skipping..."); + } + } + } + } +} \ No newline at end of file diff --git a/UpdateChecker/Mod.cs b/UpdateChecker/Mod.cs new file mode 100644 index 0000000..a3941f6 --- /dev/null +++ b/UpdateChecker/Mod.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace UpdateChecker +{ + public class Mod + { + public List aliases; + public List versions; + } +} \ No newline at end of file diff --git a/UpdateChecker/ModVersion.cs b/UpdateChecker/ModVersion.cs new file mode 100644 index 0000000..1098117 --- /dev/null +++ b/UpdateChecker/ModVersion.cs @@ -0,0 +1,13 @@ +using Semver; + +namespace UpdateChecker +{ + public class ModVersion + { + public string name; + public string modversion; + public SemVersion SemVersion; + public string downloadlink; + public int ApprovalStatus; + } +} \ No newline at end of file diff --git a/UpdateChecker/UpdateChecker.csproj b/UpdateChecker/UpdateChecker.csproj new file mode 100644 index 0000000..15abefe --- /dev/null +++ b/UpdateChecker/UpdateChecker.csproj @@ -0,0 +1,31 @@ + + + net472 + true + 1.0.0.0 + 9 + + + + + + + + + + $(OutputPath) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/VRChatMods.sln b/VRChatMods.sln index 50852a7..36e527e 100644 --- a/VRChatMods.sln +++ b/VRChatMods.sln @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntegrityCheckGenerator", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StandaloneThirdPerson", "StandaloneThirdPerson\StandaloneThirdPerson.csproj", "{A5F07D37-CAB2-43C7-98AF-F8184CC71DA1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateChecker", "UpdateChecker\UpdateChecker.csproj", "{2D0C38BE-2E7A-4E10-A066-9397D319EC4E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -48,5 +50,9 @@ Global {A5F07D37-CAB2-43C7-98AF-F8184CC71DA1}.Debug|Any CPU.Build.0 = Debug|Any CPU {A5F07D37-CAB2-43C7-98AF-F8184CC71DA1}.Release|Any CPU.ActiveCfg = Release|Any CPU {A5F07D37-CAB2-43C7-98AF-F8184CC71DA1}.Release|Any CPU.Build.0 = Release|Any CPU + {2D0C38BE-2E7A-4E10-A066-9397D319EC4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D0C38BE-2E7A-4E10-A066-9397D319EC4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D0C38BE-2E7A-4E10-A066-9397D319EC4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D0C38BE-2E7A-4E10-A066-9397D319EC4E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/WorldPredownload/Patches.cs b/WorldPredownload/Patches.cs index ed6079b..48706ff 100644 --- a/WorldPredownload/Patches.cs +++ b/WorldPredownload/Patches.cs @@ -17,8 +17,6 @@ using InfoType = VRC.UI.PageUserInfo.EnumNPublicSealedvaNoOnOfSeReBlInFa10Unique; using ListType = UiUserList.EnumNPublicSealedvaNoInFrOnOfSeInFa9vUnique; -//using OnDownloadComplete = AssetBundleDownloadManager.MulticastDelegateNInternalSealedVoObUnique; - namespace WorldPredownload { [HarmonyPatch(typeof(NetworkManager), "OnLeftRoom")]