diff --git a/ArcFormats/ArcPACKDAT.cs b/ArcFormats/ArcPACKDAT.cs index f9feddfe..d89b264e 100644 --- a/ArcFormats/ArcPACKDAT.cs +++ b/ArcFormats/ArcPACKDAT.cs @@ -80,11 +80,12 @@ namespace GameRes.Formats.SystemEpsylon public override Stream OpenEntry (ArcFile arc, Entry entry) { var pentry = entry as PackDatEntry; - if (null == pentry || entry.Size < 4 || 0 == (pentry.Flags & 0x10000)) + if (null == pentry || entry.Size < 4 + || !(0 != (pentry.Flags & 0x10000) || entry.Name.HasExtension (".s"))) return arc.File.CreateStream (entry.Offset, entry.Size); var input = arc.File.View.ReadBytes (entry.Offset, pentry.Size); - if (input.Length == pentry.Size) + if (0 != (pentry.Flags & 0x10000)) { unsafe { @@ -92,7 +93,7 @@ namespace GameRes.Formats.SystemEpsylon { uint* encoded = (uint*)buf_raw; uint key = pentry.Size >> 2; - key = (key << (((int)key & 7) + 8)) ^ key; + key ^= key << (((int)key & 7) + 8); for (uint i = entry.Size / 4; i != 0; --i ) { *encoded ^= key; @@ -102,6 +103,11 @@ namespace GameRes.Formats.SystemEpsylon } } } + if (entry.Name.HasExtension (".s")) + { + for (int i = 0; i < input.Length; ++i) + input[i] ^= 0xFF; + } return new BinMemoryStream (input, entry.Name); } }