From 60fb594210452910da040a000c19d59a29612142 Mon Sep 17 00:00:00 2001 From: SDraw Date: Tue, 4 Mar 2025 23:25:04 +0300 Subject: [PATCH] New mod: VideoPlayerCookies --- README.md | 1 + ml_mods_cvr.sln | 6 +++++ ml_vpc/Main.cs | 26 +++++++++++++++++++ ml_vpc/Properties/AssemblyInfo.cs | 4 +++ ml_vpc/README.md | 17 ++++++++++++ ml_vpc/ml_vpc.csproj | 43 +++++++++++++++++++++++++++++++ 6 files changed, 97 insertions(+) create mode 100644 ml_vpc/Main.cs create mode 100644 ml_vpc/Properties/AssemblyInfo.cs create mode 100644 ml_vpc/README.md create mode 100644 ml_vpc/ml_vpc.csproj diff --git a/README.md b/README.md index 3b407ba..9f086d5 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,5 @@ Merged set of MelonLoader mods for ChilloutVR. |[Player Movement Copycat](/ml_pmc/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/PlayerMovementCopycat.dll)| |[Player Ragdoll Mod](/ml_prm/README.md)|1.2.2 [:arrow_down:](../../releases/latest/download/PlayerRagdollMod.dll)| |[Players Instance Notifier](/ml_pin/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/PlayersInstanceNotifier.dll)| +|[Video Player Cookies](/ml_vpc/README.md)|1.0.0 [:arrow_down:](../../releases/latest/download/VideoPlayerCookies.dll)| |[Vive Extended Input](/ml_vei/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ViveExtendedInput.dll)| diff --git a/ml_mods_cvr.sln b/ml_mods_cvr.sln index 38819c7..fa53b8e 100644 --- a/ml_mods_cvr.sln +++ b/ml_mods_cvr.sln @@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_dht", "ml_dht\ml_dht.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_bft", "ml_bft\ml_bft.csproj", "{331C995D-9648-44AD-8B02-D5F3A89FDC1F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_vpc", "ml_vpc\ml_vpc.csproj", "{7CF37B93-9341-422D-845C-9AB96DB4D0A1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -65,6 +67,10 @@ Global {331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Debug|x64.ActiveCfg = Debug|x64 {331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Release|x64.ActiveCfg = Release|x64 {331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Release|x64.Build.0 = Release|x64 + {7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Debug|x64.ActiveCfg = Debug|x64 + {7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Debug|x64.Build.0 = Debug|x64 + {7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Release|x64.ActiveCfg = Release|x64 + {7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ml_vpc/Main.cs b/ml_vpc/Main.cs new file mode 100644 index 0000000..547f1f2 --- /dev/null +++ b/ml_vpc/Main.cs @@ -0,0 +1,26 @@ +using ABI_RC.VideoPlayer; +using System.Reflection; +using System.IO; + +namespace ml_vpc +{ + public class VideoPlayerCookies : MelonLoader.MelonMod + { + static string ms_cookiesPath; + + public override void OnInitializeMelon() + { + HarmonyInstance.Patch(typeof(YoutubeDl).GetMethod("GetVideoMetaDataAsync", BindingFlags.NonPublic | BindingFlags.Static), + new HarmonyLib.HarmonyMethod(typeof(VideoPlayerCookies).GetMethod(nameof(OnGetYoutubeVideoMetaData_Prefix), BindingFlags.NonPublic | BindingFlags.Static)) + ); + + ms_cookiesPath = Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, "cookies.txt"); + } + + static void OnGetYoutubeVideoMetaData_Prefix(ref string parameter) + { + if(File.Exists(ms_cookiesPath)) + parameter += string.Format(" --cookies \"{0}\"", ms_cookiesPath); + } + } +} diff --git a/ml_vpc/Properties/AssemblyInfo.cs b/ml_vpc/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7b34652 --- /dev/null +++ b/ml_vpc/Properties/AssemblyInfo.cs @@ -0,0 +1,4 @@ +[assembly: MelonLoader.MelonInfo(typeof(ml_vpc.VideoPlayerCookies), "VideoPlayerCookies", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] +[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] +[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] diff --git a/ml_vpc/README.md b/ml_vpc/README.md new file mode 100644 index 0000000..7a5ce10 --- /dev/null +++ b/ml_vpc/README.md @@ -0,0 +1,17 @@ +# Video Player Cookies +This mod allows yt-dlp to use cookies for playing YouTube videos. + +# Installation +* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader) +* Get [latest release DLL](../../../releases/latest): + * Put `VideoPlayerCookies.dll` in `Mods` folder of game + +# Usage +* Acquire cookies for YouTube from your browser: + * Chromium based browsers: [Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) extension + * Firefox based browsers: [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt) extension +* Save result as file named `cookies.txt` in `/UserData` folder + +# Notes +* After first use yt-dlp will remove unnecessary cookies from file automatically. +* Cookies contain private information and access linked to your YouTube account, **do not share it to anyone**. diff --git a/ml_vpc/ml_vpc.csproj b/ml_vpc/ml_vpc.csproj new file mode 100644 index 0000000..328bf55 --- /dev/null +++ b/ml_vpc/ml_vpc.csproj @@ -0,0 +1,43 @@ + + + + netstandard2.1 + x64 + VideoPlayerCookies + SDraw + SDraw + + + + embedded + true + + + + + + + + + D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\0Harmony.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll + false + false + + + D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll + false + false + + + +