Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
- [Core] Added new entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Razmoth committed Sep 29, 2023
1 parent 8fbdff0 commit b2b1c15
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions AssetStudio/FileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ public static FileReader PreProcessing(this FileReader reader, Game game)
case GameType.CodenameJump:
reader = DecryptCodenameJump(reader);
break;
case GameType.GirlsFrontline:
reader = DecryptGirlsFrontline(reader);
break;
}
}
if (reader.FileType == FileType.BundleFile && game.Type.IsBlockFile() || reader.FileType == FileType.ENCRFile || reader.FileType == FileType.BlbFile)
Expand Down
4 changes: 3 additions & 1 deletion AssetStudio/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static GameManager()
Games.Add(index++, new Game(GameType.AliceGearAegis));
Games.Add(index++, new Game(GameType.ProjectSekai));
Games.Add(index++, new Game(GameType.CodenameJump));
Games.Add(index++, new Game(GameType.GirlsFrontline));
}
public static Game GetGame(GameType gameType) => GetGame((int)gameType);
public static Game GetGame(int index)
Expand Down Expand Up @@ -148,7 +149,8 @@ public enum GameType
ImaginaryFest,
AliceGearAegis,
ProjectSekai,
CodenameJump
CodenameJump,
GirlsFrontline
}

public static class GameTypes
Expand Down
29 changes: 29 additions & 0 deletions AssetStudio/ImportHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -869,5 +869,34 @@ public static FileReader DecryptCodenameJump(FileReader reader)
ms.Position = 0;
return new FileReader(reader.FullPath, ms);
}

public static FileReader DecryptGirlsFrontline(FileReader reader)
{
Logger.Verbose($"Attempting to decrypt file {reader.FileName} with Girls Frontline encryption");

var originalHeader = new byte[] { 0x55, 0x6E, 0x69, 0x74, 0x79, 0x46, 0x53, 0x00, 0x00, 0x00, 0x00, 0x07, 0x35, 0x2E, 0x78, 0x2E };

MemoryStream ms = new();
var key = reader.ReadBytes(0x10);
for (int i = 0; i < key.Length; i++)
{
var b = (byte)(key[i] ^ originalHeader[i]);
key[i] = b != originalHeader[i] ? b : originalHeader[i];
}

var data = reader.ReadBytes((int)reader.Remaining);
var size = Math.Min(data.Length, 0x8000);
for (int i = 0; i < size; i++)
{
data[i] ^= key[i % key.Length];
}

Logger.Verbose("Decrypted Girls Frontline file successfully !!");

ms.Write(originalHeader);
ms.Write(data);
ms.Position = 0;
return new FileReader(reader.FullPath, ms);
}
}
}

0 comments on commit b2b1c15

Please sign in to comment.