File tree Expand file tree Collapse file tree 2 files changed +39
-2
lines changed
Expand file tree Collapse file tree 2 files changed +39
-2
lines changed Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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>
You can’t perform that action at this time.
0 commit comments