Skip to content

Commit 0350519

Browse files
committed
Small fixes, print XvcRegionFlags
1 parent cd5e1d8 commit 0350519

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

LibXboxOne/XVD/XVDStructs.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public string SignedBy
142142
var headerData = GetHeaderWithoutSignature();
143143
foreach(var signKey in DurangoKeys.GetAllXvdSigningKeys())
144144
{
145-
if(HashUtils.VerifySignature(signKey.Value.KeyData, Signature, headerData))
145+
if(signKey.Value.KeyData != null && HashUtils.VerifySignature(signKey.Value.KeyData, Signature, headerData))
146146
return signKey.Key;
147147
}
148148
return "<UNKNOWN>";
@@ -364,7 +364,7 @@ public struct XvcRegionHeader
364364
/* 0x0 */ public XvcRegionId Id;
365365
/* 0x4 */ public ushort KeyId;
366366
/* 0x6 */ public ushort Padding6;
367-
/* 0x8 */ public uint Flags;
367+
/* 0x8 */ public XvcRegionFlags Flags;
368368
/* 0xC */ public uint FirstSegmentIndex;
369369

370370
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
@@ -422,7 +422,22 @@ public string ToString(bool formatted)
422422
keyid += " (not encrypted)";
423423
b.AppendLineSpace(fmt + "Description: " + Description.Replace("\0", ""));
424424
b.AppendLineSpace(fmt + "Key ID: 0x" + keyid);
425-
b.AppendLineSpace(fmt + "Flags: 0x" + Flags.ToString("X"));
425+
b.AppendLineSpace(fmt + "Flags: 0x" + ((uint)Flags).ToString("X"));
426+
if (Flags.HasFlag(XvcRegionFlags.Resident))
427+
b.AppendLineSpace(fmt + " - Resident");
428+
if (Flags.HasFlag(XvcRegionFlags.InitialPlay))
429+
b.AppendLineSpace(fmt + " - InitialPlay");
430+
if (Flags.HasFlag(XvcRegionFlags.Preview))
431+
b.AppendLineSpace(fmt + " - Preview");
432+
if (Flags.HasFlag(XvcRegionFlags.FileSystemMetadata))
433+
b.AppendLineSpace(fmt + " - FileSystemMetadata");
434+
if (Flags.HasFlag(XvcRegionFlags.Present))
435+
b.AppendLineSpace(fmt + " - Present");
436+
if (Flags.HasFlag(XvcRegionFlags.OnDemand))
437+
b.AppendLineSpace(fmt + " - OnDemand");
438+
if (Flags.HasFlag(XvcRegionFlags.Available))
439+
b.AppendLineSpace(fmt + " - Available");
440+
426441
b.AppendLineSpace(fmt + "Offset: 0x" + Offset.ToString("X"));
427442
b.AppendLineSpace(fmt + "Length: 0x" + Length.ToString("X"));
428443
b.AppendLineSpace(fmt + "Hash: 0x" + Hash.ToString("X"));

XVDTool/Program.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ void PrintKnownKeys<T>(KeyType type, KeyValuePair<T,DurangoKeyEntry>[] keyCollec
389389
{
390390
if (!file.GetXvcKeyByGuid(cikToUse, out byte[] outputKey))
391391
{
392-
Console.WriteLine("Error: unable to find key for key GUID " +
393-
new Guid(file.XvcInfo.EncryptionKeyIds[0].KeyId));
392+
Console.WriteLine("Error: unable to find key for key GUID " + cikToUse);
394393
return;
395394
}
396395
keyToUse = $"{cikToUse}: {outputKey.ToHexString()}";

0 commit comments

Comments
 (0)