From 6f3fd9740eaf2fd2327756e93e1d406399f9c08b Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 24 Oct 2024 04:45:01 +1000 Subject: [PATCH] Add setup for profiling gamedb simply build with `-p:MachineExtraCompilationFlag=BIZHAWKBUILD_RUN_ONLY_GAMEDB_INIT` --- src/BizHawk.Client.EmuHawk/Program.cs | 4 ++++ src/BizHawk.Emulation.Cores/GameDBHelper.cs | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/src/BizHawk.Client.EmuHawk/Program.cs b/src/BizHawk.Client.EmuHawk/Program.cs index 3486bfd2d1..3a61f32e6e 100644 --- a/src/BizHawk.Client.EmuHawk/Program.cs +++ b/src/BizHawk.Client.EmuHawk/Program.cs @@ -316,6 +316,9 @@ namespace BizHawk.Client.EmuHawk try { GameDBHelper.BackgroundInitAll(); +#if BIZHAWKBUILD_RUN_ONLY_GAMEDB_INIT + GameDBHelper.WaitForThreadAndQuickTest(); +#else MainForm mf = new( cliFlags, workingGL, @@ -362,6 +365,7 @@ namespace BizHawk.Client.EmuHawk movieSession.Movie.Save(); } } +#endif } catch (Exception e) when (!Debugger.IsAttached) { diff --git a/src/BizHawk.Emulation.Cores/GameDBHelper.cs b/src/BizHawk.Emulation.Cores/GameDBHelper.cs index e1c7f8afb3..a7aafbf1ff 100644 --- a/src/BizHawk.Emulation.Cores/GameDBHelper.cs +++ b/src/BizHawk.Emulation.Cores/GameDBHelper.cs @@ -1,5 +1,6 @@ using System.IO; +using BizHawk.Common; using BizHawk.Common.PathExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Cores.Arcades.MAME; @@ -19,5 +20,13 @@ namespace BizHawk.Emulation.Cores BootGodDb.Initialize(bundledGamedbPath); MAMEMachineDB.Initialize(bundledGamedbPath); } + + public static void WaitForThreadAndQuickTest() + { + RomStatus StatusFor(string hashDigest) + => Database.CheckDatabase(hashDigest)?.Status ?? RomStatus.NotInDatabase; + Console.WriteLine(StatusFor(SHA1Checksum.EmptyFile)); // NotInDatabase + Console.WriteLine(StatusFor("3064E664D34859649B67559F0ED0C2FFD6948031")); // BadDump + } } }