Skip to content

Commit

Permalink
Set game name for Libretro when available
Browse files Browse the repository at this point in the history
resolves #4144
  • Loading branch information
YoshiRulz committed Jan 5, 2025
1 parent 407c26e commit d9da3cf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/BizHawk.Client.Common/RomLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,14 @@ Exception NoCoreForSystem(string sysID)
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;
Expand Down Expand Up @@ -826,6 +831,12 @@ public bool LoadRom(string path, CoreComm nextComm, string launchLibretroCore, s
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
Expand Down

0 comments on commit d9da3cf

Please sign in to comment.