Skip to content

Commit a2dca3e

Browse files
committed
add GOZ
1 parent 0c399b2 commit a2dca3e

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

AssetStudio/FileReader.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ public static FileReader PreProcessing(this FileReader reader, Game game)
303303
case GameType.DawnOfKingdom:
304304
reader = DecryptDawnOfKingdom(reader);
305305
break;
306+
case GameType.GOZ:
307+
reader = DecryptGOZ(reader);
308+
break;
306309

307310
}
308311
}

AssetStudio/GameManager.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ static GameManager()
6868
Games.Add(index++, new Game(GameType.LATALE));
6969
Games.Add(index++, new Game(GameType.SRU));
7070
Games.Add(index++, new Game(GameType.DawnOfKingdom));
71+
Games.Add(index++, new Game(GameType.GOZ));
7172

7273
}
7374

@@ -217,7 +218,8 @@ public enum GameType
217218
SSTX,
218219
LATALE,
219220
SRU,
220-
DawnOfKingdom
221+
DawnOfKingdom,
222+
GOZ
221223
}
222224

223225
public static class GameTypes
@@ -261,6 +263,7 @@ public static class GameTypes
261263
public static bool isSSTX(this GameType type) => type == GameType.SSTX;
262264
public static bool isLATALE(this GameType type) => type == GameType.LATALE;
263265
public static bool isDawnOfKingdom(this GameType type) => type == GameType.DawnOfKingdom;
266+
public static bool IsGOZ(this GameType type) => type == GameType.GOZ;
264267

265268
public static bool IsGIGroup(this GameType type) => type switch
266269
{

AssetStudio/ImportHelper.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,14 +1685,14 @@ public static FileReader DecryptDawnOfKingdom(FileReader reader)
16851685
signature = "UnityFS",
16861686
unityVersion = "5.x.x",
16871687
unityRevision = "2019.4.0f1",
1688-
size = reader.ReadInt64()+16,
1688+
size = reader.ReadInt64() + 16,
16891689
compressedBlocksInfoSize = reader.ReadUInt32(),
16901690
uncompressedBlocksInfoSize = reader.ReadUInt32(),
16911691
flags = (ArchiveFlags)reader.ReadUInt32(),
16921692
};
16931693
m_Header.WriteToStream(ms, 15);
16941694
var data = reader.ReadBytes((int)reader.Remaining);
1695-
1695+
16961696
ms.Write(data);
16971697
//File.WriteAllBytes("dawntest.bin", ms.ToArray());
16981698
ms.Position = 0;
@@ -1739,5 +1739,32 @@ public static FileReader DecryptSRU(FileReader reader)
17391739

17401740

17411741
}
1742+
public static FileReader DecryptGOZ(FileReader reader)
1743+
{
1744+
//_key = Convert.FromBase64String("5pvoKUvp2EinvR5C");
1745+
//_salt = Convert.FromBase64String("Vh6TCcm4sJsO9VpS");
1746+
//decrypt abc textasset to get final key
1747+
var key = Convert.FromHexString("DF18C8086D7F9F76374C212DE51B01506760A10D39B89CADBB15A3F5CD026D39");
1748+
var IV = Convert.FromHexString("FE1A4BA3A9FB1E20A17E816F546C6E8D");
1749+
var data = reader.ReadBytes((int)reader.Remaining);
1750+
using var rijndael = new RijndaelManaged
1751+
{
1752+
KeySize = 256,
1753+
BlockSize = 128,
1754+
Mode = CipherMode.CBC,
1755+
Padding = PaddingMode.PKCS7,
1756+
Key = key,
1757+
IV = IV
1758+
1759+
};
1760+
using var decryptor = rijndael.CreateDecryptor();
1761+
byte[] decryptedData = decryptor.TransformFinalBlock(data, 0, data.Length);
1762+
1763+
var ms = new MemoryStream();
1764+
ms.Write(decryptedData, 0, decryptedData.Length);
1765+
ms.Position = 0;
1766+
//File.WriteAllBytes("GOZ.bin", ms.ToArray());
1767+
return new FileReader(reader.FullPath, ms);
1768+
}
17421769
}
17431770
}

0 commit comments

Comments
 (0)