Skip to content

Commit

Permalink
Changed namespace of Discord related classes
Browse files Browse the repository at this point in the history
Added temporary rich presence disabling code for R8 just in case
  • Loading branch information
AuriRex committed Oct 20, 2023
1 parent 27edf68 commit 1a28bcb
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/ActivityManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Discord
namespace TheArchive.Core.Discord
{
public partial class ActivityManager
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Discord
namespace TheArchive.Core.Discord
{
static class Constants
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Runtime.InteropServices;
using System.Text;

namespace Discord
namespace TheArchive.Core.Discord
{
public enum Result
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/ImageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEngine;
#endif

namespace Discord
namespace TheArchive.Core.Discord
{
public partial struct ImageHandle
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/LobbyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text;

namespace Discord
namespace TheArchive.Core.Discord
{
public partial class LobbyManager
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/StorageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;

namespace Discord
namespace TheArchive.Core.Discord
{
public partial class StorageManager
{
Expand Down
2 changes: 1 addition & 1 deletion TheArchive.Core/Core/DiscordApi/StoreManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text;

namespace Discord
namespace TheArchive.Core.Discord
{
public partial class StoreManager
{
Expand Down
4 changes: 2 additions & 2 deletions TheArchive.Core/Core/Managers/DiscordManager.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 3 additions & 0 deletions TheArchive.Core/Core/Settings/RichPresenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
22 changes: 22 additions & 0 deletions TheArchive.IL2CPP/Features/Presence/DiscordRichPresence.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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();
Expand Down

0 comments on commit 1a28bcb

Please sign in to comment.