Last active
April 24, 2026 20:22
-
-
Save vtf6259/37e8a742c88811b0fbe5bb5d2429ff28 to your computer and use it in GitHub Desktop.
osu!lazer Portable mode, Create a file named osuPortable no file extension you will see a osu! storage error on first startup just select start fresh.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/.gitignore b/.gitignore | |
| index 1fec94d..fec9261 100644 | |
| --- a/.gitignore | |
| +++ b/.gitignore | |
| @@ -344,3 +344,6 @@ FodyWeavers.xsd | |
| .idea/.idea.osu.Desktop/.idea/misc.xml | |
| .idea/.idea.osu.Android/.idea/deploymentTargetDropDown.xml | |
| +# osu Portable mode | |
| +osuPortable | |
| +osuPortableSaveData | |
| diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs | |
| index 65b480e..80b6665 100644 | |
| --- a/osu.Desktop/Program.cs | |
| +++ b/osu.Desktop/Program.cs | |
| @@ -13,6 +13,8 @@ | |
| using osu.Game; | |
| using osu.Game.IPC; | |
| using osu.Game.Tournament; | |
| +using osu.Game.Utils; | |
| +using osu.Game.Configuration; | |
| using SDL; | |
| using Velopack; | |
| @@ -70,10 +72,15 @@ public static void Main(string[] args) | |
| // Back up the cwd before DesktopGameHost changes it | |
| string cwd = Environment.CurrentDirectory; | |
| - | |
| + SharedVariables.cwd = cwd; | |
| + string[] files = Directory.GetFiles(cwd); | |
| + foreach (var item in files) { if(Path.GetFileName(item) == "osuPortable") { | |
| + Console.WriteLine("osu Portable mode is enabled"); | |
| + SharedVariables.portableMode = true; | |
| + Directory.CreateDirectory("osuPortableSaveData"); | |
| + }} | |
| string gameName = base_game_name; | |
| bool tournamentClient = false; | |
| - | |
| foreach (string arg in args) | |
| { | |
| string[] split = arg.Split('='); | |
| diff --git a/osu.Game/Configuration/SharedVariables.cs b/osu.Game/Configuration/SharedVariables.cs | |
| new file mode 100644 | |
| index 0000000..6bb1bc2 | |
| --- /dev/null | |
| +++ b/osu.Game/Configuration/SharedVariables.cs | |
| @@ -0,0 +1,6 @@ | |
| +namespace osu.Game.Configuration { | |
| + public class SharedVariables { | |
| + public static bool portableMode; | |
| + public static string cwd; | |
| + } | |
| +} | |
| diff --git a/osu.Game/Configuration/StorageConfigManager.cs b/osu.Game/Configuration/StorageConfigManager.cs | |
| index 40c0e70..49ea7dd 100644 | |
| --- a/osu.Game/Configuration/StorageConfigManager.cs | |
| +++ b/osu.Game/Configuration/StorageConfigManager.cs | |
| @@ -3,6 +3,9 @@ | |
| using osu.Framework.Configuration; | |
| using osu.Framework.Platform; | |
| +using osu.Game.Utils; | |
| +using osu.Game.Configuration; | |
| +using System; | |
| namespace osu.Game.Configuration | |
| { | |
| @@ -19,7 +22,16 @@ protected override void InitialiseDefaults() | |
| { | |
| base.InitialiseDefaults(); | |
| - SetDefault(StorageConfig.FullPath, string.Empty); | |
| + if (IsDesktop.isDesktop()) { | |
| + if(!SharedVariables.portableMode) { | |
| + SetDefault(StorageConfig.FullPath, string.Empty); | |
| + return; | |
| + } | |
| + SetDefault(StorageConfig.FullPath, SharedVariables.cwd + "/osuPortableSaveData"); | |
| + Console.WriteLine(SharedVariables.cwd); | |
| + } else { | |
| + SetDefault(StorageConfig.FullPath, string.Empty); | |
| + } | |
| } | |
| } | |
| diff --git a/osu.Game/Utils/IsDesktop.cs b/osu.Game/Utils/IsDesktop.cs | |
| new file mode 100644 | |
| index 0000000..8056601 | |
| --- /dev/null | |
| +++ b/osu.Game/Utils/IsDesktop.cs | |
| @@ -0,0 +1,12 @@ | |
| +using System.Runtime.InteropServices; | |
| + | |
| +namespace osu.Game.Utils { | |
| + public static class IsDesktop { | |
| + public static bool isDesktop() { | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return true; | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) return true; | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return true; | |
| + return false; | |
| + } | |
| + } | |
| +} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/.gitignore b/.gitignore | |
| index 1fec94d..fec9261 100644 | |
| --- a/.gitignore | |
| +++ b/.gitignore | |
| @@ -344,3 +344,6 @@ FodyWeavers.xsd | |
| .idea/.idea.osu.Desktop/.idea/misc.xml | |
| .idea/.idea.osu.Android/.idea/deploymentTargetDropDown.xml | |
| +# osu Portable mode | |
| +osuPortable | |
| +osuPortableSaveData | |
| diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs | |
| index 65b480e..307f298 100644 | |
| --- a/osu.Desktop/Program.cs | |
| +++ b/osu.Desktop/Program.cs | |
| @@ -13,6 +13,8 @@ | |
| using osu.Game; | |
| using osu.Game.IPC; | |
| using osu.Game.Tournament; | |
| +using osu.Game.Utils; | |
| +using osu.Game.Configuration; | |
| using SDL; | |
| using Velopack; | |
| @@ -70,7 +72,13 @@ public static void Main(string[] args) | |
| // Back up the cwd before DesktopGameHost changes it | |
| string cwd = Environment.CurrentDirectory; | |
| - | |
| + SharedVariables.cwd = cwd; | |
| + string[] files = Directory.GetFiles(cwd); | |
| + foreach (var item in files) { if(Path.GetFileName(item) == "osuPortable") { | |
| + Console.WriteLine("osu Portable mode is enabled"); | |
| + SharedVariables.portableMode = true; | |
| + Directory.CreateDirectory("osuPortableSaveData"); | |
| + }} | |
| string gameName = base_game_name; | |
| bool tournamentClient = false; | |
| diff --git a/osu.Game/Configuration/SharedVariables.cs b/osu.Game/Configuration/SharedVariables.cs | |
| new file mode 100644 | |
| index 0000000..3df7e8e | |
| --- /dev/null | |
| +++ b/osu.Game/Configuration/SharedVariables.cs | |
| @@ -0,0 +1,6 @@ | |
| +namespace osu.Game.Configuration { | |
| + public class SharedVariables { | |
| + public static bool portableMode; | |
| + public static string cwd; | |
| + } | |
| +} | |
| \ No newline at end of file | |
| diff --git a/osu.Game/Configuration/StorageConfigManager.cs b/osu.Game/Configuration/StorageConfigManager.cs | |
| index 40c0e70..1e5b619 100644 | |
| --- a/osu.Game/Configuration/StorageConfigManager.cs | |
| +++ b/osu.Game/Configuration/StorageConfigManager.cs | |
| @@ -3,6 +3,9 @@ | |
| using osu.Framework.Configuration; | |
| using osu.Framework.Platform; | |
| +using osu.Game.Utils; | |
| +using osu.Game.Configuration; | |
| +using System; | |
| namespace osu.Game.Configuration | |
| { | |
| @@ -18,8 +21,16 @@ public StorageConfigManager(Storage storage) | |
| protected override void InitialiseDefaults() | |
| { | |
| base.InitialiseDefaults(); | |
| - | |
| - SetDefault(StorageConfig.FullPath, string.Empty); | |
| + if (IsDesktop.isDesktop()) { | |
| + if(!SharedVariables.portableMode) { | |
| + SetDefault(StorageConfig.FullPath, string.Empty); | |
| + return; | |
| + } | |
| + SetDefault(StorageConfig.FullPath, SharedVariables.cwd + "/osuPortableSaveData"); | |
| + Console.WriteLine(SharedVariables.cwd); | |
| + } else { | |
| + SetDefault(StorageConfig.FullPath, string.Empty); | |
| + } | |
| } | |
| } | |
| diff --git a/osu.Game/Utils/IsDesktop.cs b/osu.Game/Utils/IsDesktop.cs | |
| new file mode 100644 | |
| index 0000000..7b6e628 | |
| --- /dev/null | |
| +++ b/osu.Game/Utils/IsDesktop.cs | |
| @@ -0,0 +1,12 @@ | |
| +using System.Runtime.InteropServices; | |
| + | |
| +namespace osu.Game.Utils { | |
| + public static class IsDesktop { | |
| + public static bool isDesktop() { | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) return true; | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) return true; | |
| + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) return true; | |
| + return false; | |
| + } | |
| + } | |
| +} | |
| \ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment