From 9ce3771e859d0eff3dd759b7bcda53eb869ca583 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 24 Oct 2024 04:27:30 +1000 Subject: [PATCH] Move gamedb init before single-instance check --- src/BizHawk.Client.EmuHawk/MainForm.cs | 9 -------- src/BizHawk.Client.EmuHawk/Program.cs | 2 ++ src/BizHawk.Emulation.Cores/GameDBHelper.cs | 23 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 src/BizHawk.Emulation.Cores/GameDBHelper.cs diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 6ba24893d3..d78c666f68 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -26,7 +26,6 @@ using BizHawk.Client.Common; using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.Base_Implementations; using BizHawk.Emulation.Cores; -using BizHawk.Emulation.Cores.Arcades.MAME; using BizHawk.Emulation.Cores.Computers.AppleII; using BizHawk.Emulation.Cores.Computers.Commodore64; using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES; @@ -407,14 +406,6 @@ namespace BizHawk.Client.EmuHawk } } - //do this threaded stuff early so it has plenty of time to run in background - Database.InitializeDatabase( - bundledRoot: Path.Combine(PathUtils.ExeDirectoryPath, "gamedb"), - userRoot: Path.Combine(PathUtils.DataDirectoryPath, "gamedb"), - silent: true); - BootGodDb.Initialize(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb")); - MAMEMachineDB.Initialize(Path.Combine(PathUtils.ExeDirectoryPath, "gamedb")); - _argParser = cliFlags; _getConfigPath = getConfigPath; GL = gl; diff --git a/src/BizHawk.Client.EmuHawk/Program.cs b/src/BizHawk.Client.EmuHawk/Program.cs index 6c00180fc1..3486bfd2d1 100644 --- a/src/BizHawk.Client.EmuHawk/Program.cs +++ b/src/BizHawk.Client.EmuHawk/Program.cs @@ -11,6 +11,7 @@ using BizHawk.Common; using BizHawk.Common.PathExtensions; using BizHawk.Client.Common; using BizHawk.Client.EmuHawk.CustomControls; +using BizHawk.Emulation.Cores; namespace BizHawk.Client.EmuHawk { @@ -314,6 +315,7 @@ namespace BizHawk.Client.EmuHawk var exitCode = 0; try { + GameDBHelper.BackgroundInitAll(); MainForm mf = new( cliFlags, workingGL, diff --git a/src/BizHawk.Emulation.Cores/GameDBHelper.cs b/src/BizHawk.Emulation.Cores/GameDBHelper.cs new file mode 100644 index 0000000000..e1c7f8afb3 --- /dev/null +++ b/src/BizHawk.Emulation.Cores/GameDBHelper.cs @@ -0,0 +1,23 @@ +using System.IO; + +using BizHawk.Common.PathExtensions; +using BizHawk.Emulation.Common; +using BizHawk.Emulation.Cores.Arcades.MAME; +using BizHawk.Emulation.Cores.Nintendo.NES; + +namespace BizHawk.Emulation.Cores +{ + public static class GameDBHelper + { + public static void BackgroundInitAll() + { + var bundledGamedbPath = Path.Combine(PathUtils.ExeDirectoryPath, "gamedb"); + Database.InitializeDatabase( + bundledRoot: bundledGamedbPath, + userRoot: Path.Combine(PathUtils.DataDirectoryPath, "gamedb"), + silent: true); + BootGodDb.Initialize(bundledGamedbPath); + MAMEMachineDB.Initialize(bundledGamedbPath); + } + } +}