- [Core] Added new entry

This commit is contained in:
Razmoth
2023-08-29 21:35:27 +04:00
parent f196f5911b
commit 6d128063da
3 changed files with 45 additions and 1 deletions

View File

@@ -178,7 +178,6 @@ namespace AssetStudio
case GameType.FantasyOfWind: case GameType.FantasyOfWind:
reader = DecryptFantasyOfWind(reader); reader = DecryptFantasyOfWind(reader);
break; break;
break;
case GameType.HelixWaltz2: case GameType.HelixWaltz2:
reader = ParseHelixWaltz2(reader); reader = ParseHelixWaltz2(reader);
break; break;
@@ -191,6 +190,9 @@ namespace AssetStudio
case GameType.ImaginaryFest: case GameType.ImaginaryFest:
reader = DecryptImaginaryFest(reader); reader = DecryptImaginaryFest(reader);
break; break;
case GameType.AliceGearAegis:
reader = DecryptAliceGearAegis(reader);
break;
} }
} }
if (reader.FileType == FileType.BundleFile && game.Type.IsBlockFile()) if (reader.FileType == FileType.BundleFile && game.Type.IsBlockFile())

View File

@@ -36,6 +36,7 @@ namespace AssetStudio
Games.Add(index++, new Game(GameType.AnchorPanic)); Games.Add(index++, new Game(GameType.AnchorPanic));
Games.Add(index++, new Game(GameType.DreamscapeAlbireo)); Games.Add(index++, new Game(GameType.DreamscapeAlbireo));
Games.Add(index++, new Game(GameType.ImaginaryFest)); Games.Add(index++, new Game(GameType.ImaginaryFest));
Games.Add(index++, new Game(GameType.AliceGearAegis));
} }
public static Game GetGame(GameType gameType) => GetGame((int)gameType); public static Game GetGame(GameType gameType) => GetGame((int)gameType);
public static Game GetGame(int index) public static Game GetGame(int index)
@@ -143,6 +144,7 @@ namespace AssetStudio
AnchorPanic, AnchorPanic,
DreamscapeAlbireo, DreamscapeAlbireo,
ImaginaryFest, ImaginaryFest,
AliceGearAegis,
} }
public static class GameTypes public static class GameTypes

View File

@@ -759,5 +759,45 @@ namespace AssetStudio
} }
} }
} }
public static FileReader DecryptAliceGearAegis(FileReader reader)
{
Logger.Verbose($"Attempting to decrypt file {reader.FileName} with Alice Gear Aegis encryption");
var key = new byte[] { 0x1B, 0x59, 0x62, 0x33, 0x78, 0x76, 0x45, 0xB3, 0x5B, 0x48, 0x39, 0xD7, 0x9C, 0x21, 0x89, 0x94 };
var header = new Header()
{
signature = reader.ReadStringToNull(),
version = reader.ReadUInt32(),
unityVersion = reader.ReadStringToNull(),
unityRevision = reader.ReadStringToNull(),
size = reader.ReadInt64()
};
if (header.signature == "UnityFS" && header.size == reader.Length)
{
reader.Position = 0;
return reader;
}
reader.Position = 8;
var seed = (reader.Length - reader.Position) % key.Length;
var encryptedBlock = reader.ReadBytes(0x80);
var data = reader.ReadBytes((int)reader.Remaining);
for (int i = 0; i < encryptedBlock.Length; i++)
{
encryptedBlock[i] ^= key[seed % key.Length];
seed++;
}
Logger.Verbose("Decrypted Alice Gear Aegis file successfully !!");
MemoryStream ms = new();
ms.Write(Encoding.UTF8.GetBytes("UnityFS\x00"));
ms.Write(encryptedBlock);
ms.Write(data);
ms.Position = 0;
return new FileReader(reader.FullPath, ms);
}
} }
} }