Skip to content

Commit

Permalink
Support LBP3 level chunks (#408)
Browse files Browse the repository at this point in the history
Closes #400
  • Loading branch information
jvyden authored Apr 16, 2024
2 parents 0d7b4ba + 794d1b4 commit 6e89979
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Refresh.GameServer/Importing/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ protected GameAssetType DetermineAssetType(Span<byte> data, TokenPlatform? token
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, "CHKb"u8)) return GameAssetType.LevelChunk;
if (MatchesMagic(data, "GMTb"u8)) return GameAssetType.GfxMaterial;
if (MatchesMagic(data, "MSHb"u8)) return GameAssetType.Mesh;
if (MatchesMagic(data, "PALb"u8)) return GameAssetType.Palette;
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 @@ -28,6 +28,7 @@ public static AssetSafetyLevel FromAssetType(GameAssetType type)
return type switch
{
GameAssetType.Level => AssetSafetyLevel.Safe,
GameAssetType.LevelChunk => AssetSafetyLevel.Safe,
GameAssetType.Plan => AssetSafetyLevel.Safe,
GameAssetType.MoveRecording => AssetSafetyLevel.Safe,
GameAssetType.SyncedProfile => AssetSafetyLevel.Safe,
Expand Down
6 changes: 5 additions & 1 deletion Refresh.GameServer/Types/Assets/GameAsset.Conversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,13 @@ private string TransformImage(TokenGame game, IDataStore dataStore, Func<string,
case GameAssetType.MoveRecording:
case GameAssetType.VoiceRecording:
case GameAssetType.SyncedProfile:
case GameAssetType.GriefSongState:
case GameAssetType.SoftPhysicsSettings:
case GameAssetType.Bevel:
case GameAssetType.LevelChunk:
case GameAssetType.Unknown:
default:
//If we dont know what asset type this is, just hope that whatever is asking for it knows what it is
// If we don't know what asset type this is, just hope that whatever is asking for it knows what it is
return null;
}
}
Expand Down
9 changes: 9 additions & 0 deletions Refresh.GameServer/Types/Assets/GameAssetType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,13 @@ public enum GameAssetType
/// Magic: BEVb
/// </remarks>
Bevel = 19,
/// <summary>
/// A chunk of a level, containing objects and such.
/// Used for 'Dynamic Thermometer' levels in LBP3.
/// </summary>
/// <remarks>
/// Magic: CHKb
/// </remarks>
/// <seealso cref="Level"/>
LevelChunk = 20,
}

0 comments on commit 6e89979

Please sign in to comment.