mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-06 05:38:48 +08:00
fix: (LPK) properly decrypt script file in patch
Tested on Nekonade Distortion: Ren'ai Jishou no Dead End and Sakura Synchronicity. Actually idk what the extra flag represents, but seems that only patch files use it.
This commit is contained in:
@@ -122,6 +122,7 @@ namespace GameRes.Formats.Lucifen
|
|||||||
public bool IsEncrypted;
|
public bool IsEncrypted;
|
||||||
public bool PackedEntries;
|
public bool PackedEntries;
|
||||||
public bool WholeCrypt;
|
public bool WholeCrypt;
|
||||||
|
public bool IsPatchFile;
|
||||||
public uint Key;
|
public uint Key;
|
||||||
public byte[] Prefix;
|
public byte[] Prefix;
|
||||||
}
|
}
|
||||||
@@ -206,7 +207,7 @@ namespace GameRes.Formats.Lucifen
|
|||||||
{
|
{
|
||||||
input.Read (data, 0, data.Length);
|
input.Read (data, 0, data.Length);
|
||||||
}
|
}
|
||||||
if (larc.Info.WholeCrypt)
|
if (larc.Info.WholeCrypt && !(larc.Info.IsPatchFile && lent.Name.HasExtension ("elg")))
|
||||||
{
|
{
|
||||||
larc.Scheme.DecryptContent (data);
|
larc.Scheme.DecryptContent (data);
|
||||||
}
|
}
|
||||||
@@ -257,15 +258,13 @@ namespace GameRes.Formats.Lucifen
|
|||||||
IsEncrypted = 0 != (flags & 4),
|
IsEncrypted = 0 != (flags & 4),
|
||||||
PackedEntries = 0 != (flags & 8),
|
PackedEntries = 0 != (flags & 8),
|
||||||
WholeCrypt = 0 != (flags & 0x10),
|
WholeCrypt = 0 != (flags & 0x10),
|
||||||
|
IsPatchFile = 0 != (flags & 0x20),
|
||||||
Key = key1
|
Key = key1
|
||||||
};
|
};
|
||||||
var reader = new IndexReader (lpk_info);
|
var reader = new IndexReader (lpk_info);
|
||||||
var dir = reader.Read (index);
|
var dir = reader.Read (index);
|
||||||
if (null == dir)
|
if (null == dir)
|
||||||
return null;
|
return null;
|
||||||
// this condition is fishy, probably patch files have additional bitflag set
|
|
||||||
if (lpk_info.WholeCrypt && Binary.AsciiEqual (basename, "PATCH"))
|
|
||||||
lpk_info.WholeCrypt = false;
|
|
||||||
return new LuciArchive (file, this, dir, scheme, reader.Info);
|
return new LuciArchive (file, this, dir, scheme, reader.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user