Set game name for Libretro when available

resolves #4144
This commit is contained in:
YoshiRulz 2025-01-05 22:39:44 +10:00 committed by YoshiRulz
parent 407c26e9d5
commit d9da3cfa60
1 changed files with 12 additions and 1 deletions

View File

@ -302,9 +302,14 @@ namespace BizHawk.Client.Common
return game;
}
private Disc/*?*/ InstantiateDiscFor(string path)
=> DiscExtensions.CreateAnyType(
path,
str => DoLoadErrorCallback(message: str, systemId: "???"/*TODO we should NOT be doing this, even if it's just for error display*/, LoadErrorType.DiscError));
private bool LoadDisc(string path, CoreComm nextComm, HawkFile file, string ext, string forcedCoreName, out IEmulator nextEmulator, out GameInfo game)
{
var disc = DiscExtensions.CreateAnyType(path, str => DoLoadErrorCallback(str, "???", LoadErrorType.DiscError));
var disc = InstantiateDiscFor(path);
if (disc == null)
{
game = null;
@ -826,6 +831,12 @@ namespace BizHawk.Client.Common
retro.Dispose();
return false;
}
// else success; update game name
var ext = file.Extension;
var gi = Disc.IsValidExtension(ext)
? MakeGameFromDisc(InstantiateDiscFor(path), ext: ext, name: Path.GetFileNameWithoutExtension(file.Name))
: new RomGame(file).GameInfo;
Game.Name = $"{gi.Name} [{Game.Name/* core name */}]";
}
}
else