File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed
xivModdingFramework/SqPack/FileTypes Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -242,8 +242,18 @@ await Task.Run(async () =>
242
242
using ( var binaryReader = new BinaryReader ( File . OpenRead ( datFilePath ) ) )
243
243
{
244
244
binaryReader . BaseStream . Seek ( 24 , SeekOrigin . Begin ) ;
245
- var b = binaryReader . ReadByte ( ) ;
246
- if ( b != 0 )
245
+ bool anyNonZero = false ;
246
+ for ( int byteIdx = 0 ; byteIdx < 8 ; byteIdx ++ )
247
+ {
248
+ if ( binaryReader . ReadByte ( ) != 0 )
249
+ {
250
+ anyNonZero = true ;
251
+ break ;
252
+ }
253
+ }
254
+
255
+ // If there is any data in these bytes, it is an original dat.
256
+ if ( anyNonZero )
247
257
{
248
258
datList . Add ( datFilePath ) ;
249
259
}
@@ -293,8 +303,18 @@ await Task.Run(async () =>
293
303
using ( var binaryReader = new BinaryReader ( File . OpenRead ( datFilePath ) ) )
294
304
{
295
305
binaryReader . BaseStream . Seek ( 24 , SeekOrigin . Begin ) ;
306
+ bool anyNonZero = false ;
307
+ for ( int byteIdx = 0 ; byteIdx < 8 ; byteIdx ++ )
308
+ {
309
+ if ( binaryReader . ReadByte ( ) != 0 )
310
+ {
311
+ anyNonZero = true ;
312
+ break ;
313
+ }
314
+ }
296
315
297
- if ( binaryReader . ReadByte ( ) == 0 )
316
+ // If it's all zeros, this is a custom modded dat.
317
+ if ( ! anyNonZero )
298
318
{
299
319
datList . Add ( datFilePath ) ;
300
320
}
You can’t perform that action at this time.
0 commit comments