From fd9a0e93dc5917e70ca99f42f639b99b8b0b9508 Mon Sep 17 00:00:00 2001 From: D1GQ Date: Fri, 6 Mar 2026 12:43:32 -0600 Subject: [PATCH] Start adding Starlight support --- src/BAUPlugin.cs | 12 +++++++++++- src/Commands/DumpCommand.cs | 1 + src/ModInfo.cs | 5 +++++ .../Client/OptionsMenuBehaviourPatch.cs | 19 +++++++++++-------- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/BAUPlugin.cs b/src/BAUPlugin.cs index 464746d..8db4ea3 100644 --- a/src/BAUPlugin.cs +++ b/src/BAUPlugin.cs @@ -317,5 +317,15 @@ internal class BAUPlugin : BasePlugin /// Gets the game installation path for Among Us. /// /// The game installation path string. - internal static string GetGamePathToAmongUs() => Path.GetDirectoryName(Application.dataPath) ?? Application.dataPath; + internal static string GetGamePathToAmongUs() + { + if (!ModInfo.Starlight) + { + return Path.GetDirectoryName(Application.dataPath) ?? throw new Exception("Unable to find `Application.dataPath` path"); + } + else + { + return GetDataPathToAmongUs(); + } + } } \ No newline at end of file diff --git a/src/Commands/DumpCommand.cs b/src/Commands/DumpCommand.cs index 9d3653c..de20a42 100644 --- a/src/Commands/DumpCommand.cs +++ b/src/Commands/DumpCommand.cs @@ -9,6 +9,7 @@ internal sealed class DumpCommand : BaseCommand { internal override string Name => "dump"; internal override string Description => "Dump the entire log to the user's desktop"; + internal override bool ShowCommand() => !ModInfo.Starlight; internal override bool CanRunCommand(out string reason) { diff --git a/src/ModInfo.cs b/src/ModInfo.cs index 02d94e6..eb0d4fb 100644 --- a/src/ModInfo.cs +++ b/src/ModInfo.cs @@ -63,6 +63,11 @@ internal static class ModInfo /// internal const string DISCORD = "https://discord.gg/vjYrXpzNAn"; + /// + /// Indicator rather that BAU is running on Starlight. + /// + internal static readonly bool Starlight = OperatingSystem.IsAndroid(); + /// /// Retrieves metadata from the assembly attributes. /// diff --git a/src/Patches/Client/OptionsMenuBehaviourPatch.cs b/src/Patches/Client/OptionsMenuBehaviourPatch.cs index 26cf740..6b62af8 100644 --- a/src/Patches/Client/OptionsMenuBehaviourPatch.cs +++ b/src/Patches/Client/OptionsMenuBehaviourPatch.cs @@ -51,16 +51,19 @@ internal static class OptionsMenuBehaviourPatch ClientOptionItem.CreateToggle(Translator.GetString("BetterOption.ShowFPS"), BAUPlugin.ShowFPS, 1, __instance); // Button options (no toggle) - ClientOptionItem.CreateButton(Translator.GetString("BetterOption.SaveData"), 1, __instance, OpenSaveData, () => + if (!ModInfo.Starlight) { - // Only allow opening save data in lobby/main menu, not during gameplay - bool cannotOpen = GameState.IsInGame && !GameState.IsLobby; - if (cannotOpen) + ClientOptionItem.CreateButton(Translator.GetString("BetterOption.SaveData"), 1, __instance, OpenSaveData, () => { - BetterNotificationManager.Notify($"Cannot open save data while in gameplay!", 2.5f); - } - return !cannotOpen; - }); + // Only allow opening save data in lobby/main menu, not during gameplay + bool cannotOpen = GameState.IsInGame && !GameState.IsLobby; + if (cannotOpen) + { + BetterNotificationManager.Notify($"Cannot open save data while in gameplay!", 2.5f); + } + return !cannotOpen; + }); + } ClientOptionItem.CreateButton(Translator.GetString("BetterOption.ToVanilla"), 1, __instance, SwitchToVanilla, () => {