From 1a28bcba2c86eecc2d6dfa5adbc8f930f437c2d4 Mon Sep 17 00:00:00 2001 From: AuriRex Date: Fri, 20 Oct 2023 16:43:23 +0200 Subject: [PATCH] Changed namespace of Discord related classes Added temporary rich presence disabling code for R8 just in case --- .../Core/DiscordApi/ActivityManager.cs | 2 +- TheArchive.Core/Core/DiscordApi/Constants.cs | 2 +- TheArchive.Core/Core/DiscordApi/Core.cs | 2 +- .../Core/DiscordApi/ImageManager.cs | 2 +- .../Core/DiscordApi/LobbyManager.cs | 2 +- .../Core/DiscordApi/StorageManager.cs | 2 +- .../Core/DiscordApi/StoreManager.cs | 2 +- .../Core/Managers/DiscordManager.cs | 4 ++-- .../Core/Settings/RichPresenceSettings.cs | 3 +++ .../Features/Presence/DiscordRichPresence.cs | 22 +++++++++++++++++++ 10 files changed, 34 insertions(+), 9 deletions(-) diff --git a/TheArchive.Core/Core/DiscordApi/ActivityManager.cs b/TheArchive.Core/Core/DiscordApi/ActivityManager.cs index 048e3b4b..c386c6f3 100644 --- a/TheArchive.Core/Core/DiscordApi/ActivityManager.cs +++ b/TheArchive.Core/Core/DiscordApi/ActivityManager.cs @@ -1,6 +1,6 @@ using System; -namespace Discord +namespace TheArchive.Core.Discord { public partial class ActivityManager { diff --git a/TheArchive.Core/Core/DiscordApi/Constants.cs b/TheArchive.Core/Core/DiscordApi/Constants.cs index 8e77e1ba..b1eca98c 100644 --- a/TheArchive.Core/Core/DiscordApi/Constants.cs +++ b/TheArchive.Core/Core/DiscordApi/Constants.cs @@ -1,6 +1,6 @@ using System; -namespace Discord +namespace TheArchive.Core.Discord { static class Constants { diff --git a/TheArchive.Core/Core/DiscordApi/Core.cs b/TheArchive.Core/Core/DiscordApi/Core.cs index c092d471..28d8348f 100644 --- a/TheArchive.Core/Core/DiscordApi/Core.cs +++ b/TheArchive.Core/Core/DiscordApi/Core.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; using System.Text; -namespace Discord +namespace TheArchive.Core.Discord { public enum Result { diff --git a/TheArchive.Core/Core/DiscordApi/ImageManager.cs b/TheArchive.Core/Core/DiscordApi/ImageManager.cs index 292e2300..b36a78c3 100644 --- a/TheArchive.Core/Core/DiscordApi/ImageManager.cs +++ b/TheArchive.Core/Core/DiscordApi/ImageManager.cs @@ -4,7 +4,7 @@ using UnityEngine; #endif -namespace Discord +namespace TheArchive.Core.Discord { public partial struct ImageHandle { diff --git a/TheArchive.Core/Core/DiscordApi/LobbyManager.cs b/TheArchive.Core/Core/DiscordApi/LobbyManager.cs index c914ba83..ac58fb85 100644 --- a/TheArchive.Core/Core/DiscordApi/LobbyManager.cs +++ b/TheArchive.Core/Core/DiscordApi/LobbyManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; -namespace Discord +namespace TheArchive.Core.Discord { public partial class LobbyManager { diff --git a/TheArchive.Core/Core/DiscordApi/StorageManager.cs b/TheArchive.Core/Core/DiscordApi/StorageManager.cs index 65cfe72d..10f58c21 100644 --- a/TheArchive.Core/Core/DiscordApi/StorageManager.cs +++ b/TheArchive.Core/Core/DiscordApi/StorageManager.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Discord +namespace TheArchive.Core.Discord { public partial class StorageManager { diff --git a/TheArchive.Core/Core/DiscordApi/StoreManager.cs b/TheArchive.Core/Core/DiscordApi/StoreManager.cs index 48645767..172ff92a 100644 --- a/TheArchive.Core/Core/DiscordApi/StoreManager.cs +++ b/TheArchive.Core/Core/DiscordApi/StoreManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Text; -namespace Discord +namespace TheArchive.Core.Discord { public partial class StoreManager { diff --git a/TheArchive.Core/Core/Managers/DiscordManager.cs b/TheArchive.Core/Core/Managers/DiscordManager.cs index 6c7cb552..9eaef4bb 100644 --- a/TheArchive.Core/Core/Managers/DiscordManager.cs +++ b/TheArchive.Core/Core/Managers/DiscordManager.cs @@ -1,8 +1,8 @@ -using Discord; -using System; +using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; +using TheArchive.Core.Discord; using TheArchive.Core.Models; using TheArchive.Core.Settings; using TheArchive.Interfaces; diff --git a/TheArchive.Core/Core/Settings/RichPresenceSettings.cs b/TheArchive.Core/Core/Settings/RichPresenceSettings.cs index a15bb655..738870aa 100644 --- a/TheArchive.Core/Core/Settings/RichPresenceSettings.cs +++ b/TheArchive.Core/Core/Settings/RichPresenceSettings.cs @@ -6,6 +6,9 @@ namespace TheArchive.Core.Settings { public class RichPresenceSettings { + [FSHide] + public bool DoRundown8DisableCheck { get; set; } = true; + [FSHide] public bool DEBUG_UseDefaultSettings { get; set; } = false; diff --git a/TheArchive.IL2CPP/Features/Presence/DiscordRichPresence.cs b/TheArchive.IL2CPP/Features/Presence/DiscordRichPresence.cs index bfdee886..fff046aa 100644 --- a/TheArchive.IL2CPP/Features/Presence/DiscordRichPresence.cs +++ b/TheArchive.IL2CPP/Features/Presence/DiscordRichPresence.cs @@ -1,5 +1,7 @@ using CellMenu; +using GameData; using System; +using TheArchive.Core; using TheArchive.Core.Attributes; using TheArchive.Core.FeaturesAPI; using TheArchive.Core.Managers; @@ -34,6 +36,15 @@ public override void Init() public override void OnEnable() { + if (DiscordRPCSettings.DoRundown8DisableCheck && Is.R6OrLater && LikelyIsOnR8()) + { + FeatureLogger.Notice("Disabling Rich Presence for Rundown 8 for now!"); + DiscordRPCSettings.DoRundown8DisableCheck = false; + MarkSettingsAsDirty(DiscordRPCSettings); + FeatureManager.Instance.DisableFeature(this); + return; + } + try { DiscordManager.OnActivityJoin += DiscordManager_OnActivityJoin; @@ -45,6 +56,17 @@ public override void OnEnable() } } + private bool LikelyIsOnR8() + { +#if IL2CPP + var setupDB = GameSetupDataBlock.GetBlock(1); + + return BuildDB.BuildNumber > 33871 && setupDB.RundownIdsToLoad.Count > 7; +#else + return false; +#endif + } + public override void OnGameDataInitialized() { OnEnable();