Skip to content

Commit

Permalink
Importer: Detect MATb files
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Mar 19, 2024
1 parent e8cb217 commit 15e3a06
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Refresh.GameServer/Importing/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ protected GameAssetType DetermineAssetType(Span<byte> data, TokenPlatform? token
// LBP assets
if (MatchesMagic(data, "TEX "u8)) return GameAssetType.Texture;
if (MatchesMagic(data, "GTF "u8)) return GameAssetType.GameDataTexture;
if (MatchesMagic(data, "MATb"u8)) return GameAssetType.Material;
if (MatchesMagic(data, "PLNb"u8)) return GameAssetType.Plan;
if (MatchesMagic(data, "LVLb"u8)) return GameAssetType.Level;
if (MatchesMagic(data, "GMTb"u8)) return GameAssetType.Material;
if (MatchesMagic(data, "GMTb"u8)) return GameAssetType.GfxMaterial;
if (MatchesMagic(data, "MSHb"u8)) return GameAssetType.Mesh;
if (MatchesMagic(data, "PALb"u8)) return GameAssetType.Palette;
if (MatchesMagic(data, "FSHb"u8)) return GameAssetType.Script;
Expand Down
1 change: 1 addition & 0 deletions Refresh.GameServer/Types/Assets/AssetSafetyLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static AssetSafetyLevel FromAssetType(GameAssetType type)
GameAssetType.Mip => AssetSafetyLevel.Safe,
GameAssetType.GriefSongState => AssetSafetyLevel.Safe,

GameAssetType.GfxMaterial => AssetSafetyLevel.PotentiallyUnwanted,
GameAssetType.Material => AssetSafetyLevel.PotentiallyUnwanted,
GameAssetType.Mesh => AssetSafetyLevel.PotentiallyUnwanted,
GameAssetType.GameDataTexture => AssetSafetyLevel.PotentiallyUnwanted,
Expand Down
1 change: 1 addition & 0 deletions Refresh.GameServer/Types/Assets/GameAsset.Conversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ private string TransformImage(TokenGame game, IDataStore dataStore, Func<string,
case GameAssetType.Level:
case GameAssetType.Painting:
case GameAssetType.Plan:
case GameAssetType.GfxMaterial:
case GameAssetType.Material:
case GameAssetType.Mesh:
case GameAssetType.Palette:
Expand Down
9 changes: 8 additions & 1 deletion Refresh.GameServer/Types/Assets/GameAssetType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public enum GameAssetType
/// <remarks>
/// Magic: GMTb
/// </remarks>
Material = 5,
GfxMaterial = 5,
/// <summary>
/// A mesh used for custom models.
/// </summary>
Expand Down Expand Up @@ -121,4 +121,11 @@ public enum GameAssetType
/// A file containing information about the currently playing song, uploaded during a grief report.
/// </summary>
GriefSongState = 16,
/// <summary>
/// A material file, contains information about a material's physical properties
/// </summary>
/// <remarks>
/// Magic: MATb
/// </remarks>
Material = 17,
}

0 comments on commit 15e3a06

Please sign in to comment.