Skip to content

Commit 5d63fa7

Browse files
committed
Fix TR11 archives from consoles not opening
This was already fixed for the PS4 but that fix was platform specific, instead of relying on the user specifying the platform just detect whether the field is there and skip over it.
1 parent bb3771e commit 5d63fa7

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

Yura.Shared/Archive/TigerArchive.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,13 @@ public override void Open()
3737

3838
var numArchives = reader.ReadUInt32();
3939
var numRecords = reader.ReadUInt32();
40+
var dlcIndex = reader.ReadUInt32();
4041

41-
// Skip 4 bytes, or 8 in version 5 or later (unless Orbis)
42-
reader.Position += version >= 5 && Options.Platform != Platform.Orbis ? 8 : 4;
42+
// Workaround for an extra field in the PC version of TR11
43+
if (version == 5 && reader.PeekUInt32() < 255)
44+
{
45+
reader.Position += 4;
46+
}
4347

4448
// Skip over the config name
4549
reader.Position += 32;

Yura.Shared/IO/DataReader.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,39 @@ public float ReadSingle()
152152
return BitConverter.ToSingle(InternalRead(stackalloc byte[4]));
153153
}
154154

155+
/// <summary>
156+
/// Reads a byte from the stream without advancing the position
157+
/// </summary>
158+
/// <returns>The read byte</returns>
159+
public byte PeekByte()
160+
{
161+
var value = ReadByte();
162+
_stream.Position -= 1;
163+
return value;
164+
}
165+
166+
/// <summary>
167+
/// Reads a signed 32-bit integer from the stream without advancing the position
168+
/// </summary>
169+
/// <returns>The read integer</returns>
170+
public int PeekInt32()
171+
{
172+
var value = ReadInt32();
173+
_stream.Position -= 4;
174+
return value;
175+
}
176+
177+
/// <summary>
178+
/// Reads an unsigned 32-bit integer from the stream without advancing the position
179+
/// </summary>
180+
/// <returns>The read integer</returns>
181+
public uint PeekUInt32()
182+
{
183+
var value = ReadUInt32();
184+
_stream.Position -= 4;
185+
return value;
186+
}
187+
155188
/// <summary>
156189
/// Reads a null-terminated string from the stream
157190
/// </summary>

0 commit comments

Comments
 (0)