Add more debug information when loading game files

This commit is contained in:
TSR Berry 2023-07-22 17:37:27 +02:00 committed by Emmanuel Hansen
parent 979db1def3
commit fa16c9c3bd

View File

@ -142,12 +142,12 @@ namespace LibRyujinx
} }
var gameInfo = new GameInfo var gameInfo = new GameInfo
{ {
FileSize = gameStream.Length * 0.000000000931, TitleName = "Unknown", TitleId = "0000000000000000", FileSize = gameStream.Length * 0.000000000931, TitleName = "Unknown", TitleId = "0000000000000000",
Developer = "Unknown", Developer = "Unknown",
Version = "0", Version = "0",
Icon = null, Icon = null,
}; };
const Language TitleLanguage = Language.AmericanEnglish; const Language TitleLanguage = Language.AmericanEnglish;
@ -225,6 +225,12 @@ namespace LibRyujinx
gameInfo.TitleId = id; gameInfo.TitleId = id;
if (controlFs == null)
{
Logger.Error?.Print(LogClass.Application, $"No control FS was returned. Unable to process game any further: {gameInfo.TitleName}");
return null;
}
// Check if there is an update available. // Check if there is an update available.
if (IsUpdateApplied(gameInfo.TitleId, out IFileSystem? updatedControlFs)) if (IsUpdateApplied(gameInfo.TitleId, out IFileSystem? updatedControlFs))
{ {
@ -376,6 +382,11 @@ namespace LibRyujinx
} }
(_, _, Nca? controlNca) = GetGameData(SwitchDevice.VirtualFileSystem, pfs, 0); (_, _, Nca? controlNca) = GetGameData(SwitchDevice.VirtualFileSystem, pfs, 0);
if (controlNca == null)
{
Logger.Warning?.Print(LogClass.Application, "Control NCA is null. Unable to load control FS.");
}
// Return the ControlFS // Return the ControlFS
controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); controlFs = controlNca?.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
titleId = controlNca?.Header.TitleId.ToString("x16"); titleId = controlNca?.Header.TitleId.ToString("x16");
@ -447,9 +458,9 @@ namespace LibRyujinx
if (patchNca != null && controlNca != null) if (patchNca != null && controlNca != null)
{ {
updatedControlFs = controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None); updatedControlFs = controlNca.OpenFileSystem(NcaSectionType.Data, IntegrityCheckLevel.None);
}
return true; return true;
}
} }
catch (InvalidDataException) catch (InvalidDataException)
{ {