Skip to content

Commit

Permalink
Move gamedb init before single-instance check
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Oct 23, 2024
1 parent 09a39a5 commit 9ce3771
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/BizHawk.Client.EmuHawk/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
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;
Expand Down Expand Up @@ -407,14 +406,6 @@ public MainForm(
}
}

//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;
Expand Down
2 changes: 2 additions & 0 deletions src/BizHawk.Client.EmuHawk/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using BizHawk.Common.PathExtensions;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.CustomControls;
using BizHawk.Emulation.Cores;

namespace BizHawk.Client.EmuHawk
{
Expand Down Expand Up @@ -314,6 +315,7 @@ IGL CheckRenderer(IGL gl)
var exitCode = 0;
try
{
GameDBHelper.BackgroundInitAll();
MainForm mf = new(
cliFlags,
workingGL,
Expand Down
23 changes: 23 additions & 0 deletions src/BizHawk.Emulation.Cores/GameDBHelper.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 9ce3771

Please sign in to comment.