- [Core] Added new entry
This commit is contained in:
@@ -163,11 +163,20 @@ namespace AssetStudio
|
|||||||
case "UnityFS":
|
case "UnityFS":
|
||||||
if (Game.Type.IsBH3Group())
|
if (Game.Type.IsBH3Group())
|
||||||
{
|
{
|
||||||
var version = reader.ReadUInt32();
|
var version = Game.Type.IsBH3PrePre() ? 12 : reader.ReadUInt32();
|
||||||
if (version > 11)
|
if (version > 11)
|
||||||
{
|
{
|
||||||
Logger.Verbose($"Encrypted bundle header with key {version}");
|
if (Game.Type.IsBH3PrePre())
|
||||||
XORShift128.InitSeed(version);
|
{
|
||||||
|
Logger.Verbose($"Encrypted bundle header with key {reader.Length}");
|
||||||
|
XORShift128.InitSeed((uint)reader.Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.Verbose($"Encrypted bundle header with key {version}");
|
||||||
|
XORShift128.InitSeed(version);
|
||||||
|
}
|
||||||
|
|
||||||
header.version = 6;
|
header.version = 6;
|
||||||
header.unityVersion = "5.x.x";
|
header.unityVersion = "5.x.x";
|
||||||
header.unityRevision = "2017.4.18f1";
|
header.unityRevision = "2017.4.18f1";
|
||||||
@@ -322,25 +331,28 @@ namespace AssetStudio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DecryptHeader()
|
|
||||||
{
|
|
||||||
m_Header.flags ^= (ArchiveFlags)XORShift128.NextDecryptInt();
|
|
||||||
m_Header.size ^= XORShift128.NextDecryptLong();
|
|
||||||
m_Header.uncompressedBlocksInfoSize ^= XORShift128.NextDecryptUInt();
|
|
||||||
m_Header.compressedBlocksInfoSize ^= XORShift128.NextDecryptUInt();
|
|
||||||
XORShift128.Init = false;
|
|
||||||
Logger.Verbose($"Bundle header decrypted");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReadHeader(FileReader reader)
|
private void ReadHeader(FileReader reader)
|
||||||
{
|
{
|
||||||
if ((Game.Type.IsBH3Group()) && XORShift128.Init)
|
if (Game.Type.IsBH3Group() && XORShift128.Init)
|
||||||
{
|
{
|
||||||
m_Header.flags = (ArchiveFlags)reader.ReadUInt32();
|
if (Game.Type.IsBH3PrePre())
|
||||||
m_Header.size = reader.ReadInt64();
|
{
|
||||||
m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32();
|
m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32() ^ XORShift128.NextDecryptUInt();
|
||||||
m_Header.compressedBlocksInfoSize = reader.ReadUInt32();
|
m_Header.compressedBlocksInfoSize = reader.ReadUInt32() ^ XORShift128.NextDecryptUInt();
|
||||||
DecryptHeader();
|
m_Header.flags = (ArchiveFlags)(reader.ReadUInt32() ^ XORShift128.NextDecryptInt());
|
||||||
|
m_Header.size = reader.ReadInt64() ^ XORShift128.NextDecryptLong();
|
||||||
|
reader.ReadUInt32(); // version
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Header.flags = (ArchiveFlags)(reader.ReadUInt32() ^ XORShift128.NextDecryptInt());
|
||||||
|
m_Header.size = reader.ReadInt64() ^ XORShift128.NextDecryptLong();
|
||||||
|
m_Header.uncompressedBlocksInfoSize = reader.ReadUInt32() ^ XORShift128.NextDecryptUInt();
|
||||||
|
m_Header.compressedBlocksInfoSize = reader.ReadUInt32() ^ XORShift128.NextDecryptUInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
XORShift128.Init = false;
|
||||||
|
Logger.Verbose($"Bundle header decrypted");
|
||||||
|
|
||||||
var encUnityVersion = reader.ReadStringToNull();
|
var encUnityVersion = reader.ReadStringToNull();
|
||||||
var encUnityRevision = reader.ReadStringToNull();
|
var encUnityRevision = reader.ReadStringToNull();
|
||||||
|
|||||||
@@ -5,11 +5,11 @@ namespace AssetStudio
|
|||||||
{
|
{
|
||||||
public static class XORShift128
|
public static class XORShift128
|
||||||
{
|
{
|
||||||
public static bool Init = false;
|
private const long SEED = 0x61C8864E7A143579;
|
||||||
public static uint x = 0, y = 0, z = 0, w = 0, initseed = 0;
|
private const uint MT19937 = 0x6C078965;
|
||||||
|
private static uint x = 0, y = 0, z = 0, w = 0, initseed = 0;
|
||||||
|
|
||||||
const long SEED = 0x61C8864E7A143579;
|
public static bool Init = false;
|
||||||
const uint MT19937 = 0x6C078965;
|
|
||||||
|
|
||||||
public static void InitSeed(uint seed)
|
public static void InitSeed(uint seed)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace AssetStudio
|
|||||||
Games.Add(index++, new Mhy(GameType.GI_CB3Pre, GI_CBXMhyShiftRow, GI_CBXMhyKey, GI_CBXMhyMul, GI_CBXExpansionKey, GI_CBXSBox, GI_CBXInitVector, GI_CBXInitSeed));
|
Games.Add(index++, new Mhy(GameType.GI_CB3Pre, GI_CBXMhyShiftRow, GI_CBXMhyKey, GI_CBXMhyMul, GI_CBXExpansionKey, GI_CBXSBox, GI_CBXInitVector, GI_CBXInitSeed));
|
||||||
Games.Add(index++, new Mr0k(GameType.BH3, BH3ExpansionKey, BH3SBox, BH3InitVector, BH3BlockKey));
|
Games.Add(index++, new Mr0k(GameType.BH3, BH3ExpansionKey, BH3SBox, BH3InitVector, BH3BlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.BH3Pre, PackExpansionKey, blockKey: PackBlockKey));
|
Games.Add(index++, new Mr0k(GameType.BH3Pre, PackExpansionKey, blockKey: PackBlockKey));
|
||||||
|
Games.Add(index++, new Mr0k(GameType.BH3PrePre, PackExpansionKey, blockKey: PackBlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.SR_CB2, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
Games.Add(index++, new Mr0k(GameType.SR_CB2, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.SR, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
Games.Add(index++, new Mr0k(GameType.SR, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
||||||
Games.Add(index++, new Mr0k(GameType.ZZZ_CB1, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
Games.Add(index++, new Mr0k(GameType.ZZZ_CB1, Mr0kExpansionKey, initVector: Mr0kInitVector, blockKey: Mr0kBlockKey));
|
||||||
@@ -134,6 +135,7 @@ namespace AssetStudio
|
|||||||
GI_CB3Pre,
|
GI_CB3Pre,
|
||||||
BH3,
|
BH3,
|
||||||
BH3Pre,
|
BH3Pre,
|
||||||
|
BH3PrePre,
|
||||||
ZZZ_CB1,
|
ZZZ_CB1,
|
||||||
SR_CB2,
|
SR_CB2,
|
||||||
SR,
|
SR,
|
||||||
@@ -169,6 +171,7 @@ namespace AssetStudio
|
|||||||
public static bool IsGICB3Pre(this GameType type) => type == GameType.GI_CB3Pre;
|
public static bool IsGICB3Pre(this GameType type) => type == GameType.GI_CB3Pre;
|
||||||
public static bool IsBH3(this GameType type) => type == GameType.BH3;
|
public static bool IsBH3(this GameType type) => type == GameType.BH3;
|
||||||
public static bool IsBH3Pre(this GameType type) => type == GameType.BH3Pre;
|
public static bool IsBH3Pre(this GameType type) => type == GameType.BH3Pre;
|
||||||
|
public static bool IsBH3PrePre(this GameType type) => type == GameType.BH3PrePre;
|
||||||
public static bool IsZZZCB1(this GameType type) => type == GameType.ZZZ_CB1;
|
public static bool IsZZZCB1(this GameType type) => type == GameType.ZZZ_CB1;
|
||||||
public static bool IsSRCB2(this GameType type) => type == GameType.SR_CB2;
|
public static bool IsSRCB2(this GameType type) => type == GameType.SR_CB2;
|
||||||
public static bool IsSR(this GameType type) => type == GameType.SR;
|
public static bool IsSR(this GameType type) => type == GameType.SR;
|
||||||
@@ -191,7 +194,7 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public static bool IsBH3Group(this GameType type) => type switch
|
public static bool IsBH3Group(this GameType type) => type switch
|
||||||
{
|
{
|
||||||
GameType.BH3 or GameType.BH3Pre => true,
|
GameType.BH3 or GameType.BH3Pre or GameType.BH3PrePre => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -203,13 +206,13 @@ namespace AssetStudio
|
|||||||
|
|
||||||
public static bool IsBlockFile(this GameType type) => type switch
|
public static bool IsBlockFile(this GameType type) => type switch
|
||||||
{
|
{
|
||||||
GameType.BH3 or GameType.BH3Pre or GameType.SR or GameType.GI_Pack or GameType.TOT or GameType.ArknightsEndfield => true,
|
GameType.BH3 or GameType.BH3Pre or GameType.BH3PrePre or GameType.SR or GameType.GI_Pack or GameType.TOT or GameType.ArknightsEndfield => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
||||||
public static bool IsMhyGroup(this GameType type) => type switch
|
public static bool IsMhyGroup(this GameType type) => type switch
|
||||||
{
|
{
|
||||||
GameType.GI or GameType.GI_Pack or GameType.GI_CB1 or GameType.GI_CB2 or GameType.GI_CB3 or GameType.GI_CB3Pre or GameType.BH3 or GameType.BH3Pre or GameType.SR_CB2 or GameType.SR or GameType.ZZZ_CB1 or GameType.TOT => true,
|
GameType.GI or GameType.GI_Pack or GameType.GI_CB1 or GameType.GI_CB2 or GameType.GI_CB3 or GameType.GI_CB3Pre or GameType.BH3 or GameType.BH3Pre or GameType.BH3PrePre or GameType.SR_CB2 or GameType.SR or GameType.ZZZ_CB1 or GameType.TOT => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user