diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs
index ab9a5397e6..6c4ea0ddf2 100644
--- a/BizHawk.Client.Common/CoreFileProvider.cs
+++ b/BizHawk.Client.Common/CoreFileProvider.cs
@@ -17,19 +17,13 @@ namespace BizHawk.Client.Common
}
public string DllPath()
- {
- return Path.Combine(PathManager.GetExeDirectoryAbsolute(), "dll");
- }
+ => Path.Combine(PathManager.GetExeDirectoryAbsolute(), "dll");
- public string GetRetroSaveRAMDirectory()
- {
- return PathManager.RetroSaveRAMDirectory(Global.Game);
- }
+ public string GetRetroSaveRAMDirectory(GameInfo game)
+ => PathManager.RetroSaveRAMDirectory(game);
- public string GetRetroSystemPath()
- {
- return PathManager.RetroSystemPath(Global.Game);
- }
+ public string GetRetroSystemPath(GameInfo game)
+ => PathManager.RetroSystemPath(game);
#region EmuLoadHelper api
diff --git a/BizHawk.Client.Common/RomLoader.cs b/BizHawk.Client.Common/RomLoader.cs
index 00f83d6785..d58bb2d54f 100644
--- a/BizHawk.Client.Common/RomLoader.cs
+++ b/BizHawk.Client.Common/RomLoader.cs
@@ -291,24 +291,20 @@ namespace BizHawk.Client.Common
if (OpenAdvanced is OpenAdvanced_Libretro)
{
- string codePathPart = Path.GetFileNameWithoutExtension(nextComm.LaunchLibretroCore);
-
- var retro = new LibretroCore(nextComm, nextComm.LaunchLibretroCore);
- nextEmulator = retro;
-
// kind of dirty.. we need to stash this, and then we can unstash it in a moment, in case the core doesn't fail
var oldGame = Global.Game;
+ // must be done before LoadNoGame (which triggers retro_init and the paths to be consumed by the core)
+ // game name == name of core
+ string codePathPart = Path.GetFileNameWithoutExtension(nextComm.LaunchLibretroCore);
+ Global.Game = game = new GameInfo { Name = codePathPart, System = "Libretro" };
+ var retro = new LibretroCore(nextComm, game, nextComm.LaunchLibretroCore);
+ nextEmulator = retro;
+
if (retro.Description.SupportsNoGame && string.IsNullOrEmpty(path))
{
- // must be done before LoadNoGame (which triggers retro_init and the paths to be consumed by the core)
- // game name == name of core
- var gameName = codePathPart;
- Global.Game = game = new GameInfo { Name = gameName, System = "Libretro" };
-
// if we are allowed to run NoGame and we don't have a game, boot up the core that way
bool ret = retro.LoadNoGame();
-
Global.Game = oldGame;
if (!ret)
@@ -322,11 +318,6 @@ namespace BizHawk.Client.Common
{
bool ret;
- // must be done before LoadNoGame (which triggers retro_init and the paths to be consumed by the core)
- // game name == name of core + extensionless_game_filename
- var gameName = Path.Combine(codePathPart, Path.GetFileNameWithoutExtension(file.Name));
- Global.Game = game = new GameInfo { Name = gameName, System = "Libretro" };
-
// if the core requires an archive file, then try passing the filename of the archive
// (but do we ever need to actually load the contents of the archive file into ram?)
if (retro.Description.NeedsArchives)
diff --git a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs
index 49397012e3..2805eab9d7 100644
--- a/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs
+++ b/BizHawk.Client.EmuHawk/OpenAdvancedChooser.cs
@@ -78,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
//nope, we need to navigate to the dll path. this was a bad idea anyway. so many dlls get loaded, something to resolve them is needed
var coreComm = new CoreComm(null, null);
CoreFileProvider.SyncCoreCommInputSignals(coreComm);
- using var retro = new LibretroCore(coreComm, core);
+ using var retro = new LibretroCore(coreComm, Global.Game, core);
btnLibretroLaunchGame.Enabled = true;
if (retro.Description.SupportsNoGame)
btnLibretroLaunchNoGame.Enabled = true;
diff --git a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
index a444872991..62227fb8de 100644
--- a/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
+++ b/BizHawk.Emulation.Common/Interfaces/ICoreFileProvider.cs
@@ -15,12 +15,12 @@ namespace BizHawk.Emulation.Common
///
/// produces a path that contains saveram... because libretro cores need it
///
- string GetRetroSaveRAMDirectory();
+ string GetRetroSaveRAMDirectory(GameInfo game);
///
/// produces a path for use as a libretro system path (different for each core)
///
- string GetRetroSystemPath();
+ string GetRetroSystemPath(GameInfo game);
#region EmuLoadHelper api
diff --git a/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs b/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs
index a5db111597..fa279d4225 100644
--- a/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs
+++ b/BizHawk.Emulation.Cores/Libretro/LibretroCore.cs
@@ -18,10 +18,9 @@ namespace BizHawk.Emulation.Cores.Libretro
{
private LibretroApi api;
- public LibretroCore(CoreComm nextComm, string corePath)
+ // TODO: codepath just for introspection (lighter weight; no speex, no controls, etc.)
+ public LibretroCore(CoreComm nextComm, GameInfo game, string corePath)
{
- //TODO: codepath just for introspection (lighter weight; no speex, no controls, etc.)
-
ServiceProvider = new BasicServiceProvider(this);
_SyncSettings = new SyncSettings();
CoreComm = nextComm;
@@ -32,17 +31,17 @@ namespace BizHawk.Emulation.Cores.Libretro
if (api.comm->env.retro_api_version != 1)
throw new InvalidOperationException("Unsupported Libretro API version (or major error in interop)");
- //SO: I think I need these paths set before I call retro_set_environment
- //and I need retro_set_environment set so I can find out if the core supports no-game
- //therefore, I need a complete environment (including pathing) before I can complete my introspection of the core.
- //Sucky, but that's life.
- //I don't even know for sure what paths I should use until... (what?)
+ // SO: I think I need these paths set before I call retro_set_environment
+ // and I need retro_set_environment set so I can find out if the core supports no-game
+ // therefore, I need a complete environment (including pathing) before I can complete my introspection of the core.
+ // Sucky, but that's life.
+ // I don't even know for sure what paths I should use until... (what?)
- //not sure about each of these.. but we may be doing things different than retroarch.
- //I wish I could initialize these with placeholders during a separate introspection codepath..
- string SystemDirectory = CoreComm.CoreFileProvider.GetRetroSystemPath();
- string SaveDirectory = CoreComm.CoreFileProvider.GetRetroSaveRAMDirectory();
+ // not sure about each of these.. but we may be doing things different than retroarch.
+ // I wish I could initialize these with placeholders during a separate introspection codepath..
+ string SystemDirectory = CoreComm.CoreFileProvider.GetRetroSystemPath(game);
+ string SaveDirectory = CoreComm.CoreFileProvider.GetRetroSaveRAMDirectory(game);
string CoreDirectory = Path.GetDirectoryName(corePath);
string CoreAssetsDirectory = Path.GetDirectoryName(corePath);
diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings
index 780a41d45a..2720dc2e80 100644
--- a/BizHawk.sln.DotSettings
+++ b/BizHawk.sln.DotSettings
@@ -246,6 +246,8 @@
True
True
True
+ True
+
True
True
True
@@ -416,6 +418,7 @@
True
True
True
+ True
True
True
True
@@ -519,6 +522,7 @@
True
True
True
+ True
True
True
True