Skip to content

Commit

Permalink
Add setting to disable splash when console is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Jul 25, 2023
1 parent ffb228e commit fbec8a8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion BepInEx.SplashScreen.Patcher/BepInExSplashScreenPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,27 @@ public static void Initialize()
try
{
var config = (ConfigFile)AccessTools.Property(typeof(ConfigFile), "CoreConfig").GetValue(null, null);
if (!config.Bind("SplashScreen", "Enabled", true, "Display a splash screen with information about game load progress on game start-up.").Value)

var isEnabled = config.Bind("SplashScreen", "Enabled", true, "Display a splash screen with information about game load progress on game start-up.").Value;
#if DEBUG
const bool onlyNoConsoleDefault = false;
#else
const bool onlyNoConsoleDefault = true;
#endif
var consoleNotAllowed = config.Bind("SplashScreen", "OnlyNoConsole", onlyNoConsoleDefault, "Only display the splash screen if the logging console is turned off.").Value;

if (!isEnabled)
return;

if (consoleNotAllowed)
{
if (config.TryGetEntry("Logging.Console", "Enabled", out ConfigEntry<bool> entry) && entry.Value)
{
Logger.LogDebug("Not showing because console is enabled");
return;
}
}

var guiExecutablePath = Path.Combine(Path.GetDirectoryName(typeof(BepInExSplashScreenPatcher).Assembly.Location) ?? Paths.PatcherPluginPath, "BepInEx.SplashScreen.GUI.exe");

if (!File.Exists(guiExecutablePath))
Expand Down

0 comments on commit fbec8a8

Please sign in to comment.