Skip to content

Commit

Permalink
Merge pull request #138 from BigBang1112/dev
Browse files Browse the repository at this point in the history
GBX.NET 2.1.1
  • Loading branch information
BigBang1112 authored Jan 22, 2025
2 parents 0cb2f89 + d698961 commit 21b8d88
Show file tree
Hide file tree
Showing 106 changed files with 1,879 additions and 220 deletions.
16 changes: 13 additions & 3 deletions Generators/GBX.NET.Generators/ChunkL/MemberSerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,32 +301,42 @@ private void AppendRead(int indent, ChunkProperty chunkProperty)
var contextual = archives.TryGetValue(chunkProperty.Type.PrimaryType, out var archiveModel)
&& archiveModel.ChunkLDefinition?.Properties.ContainsKey("contextual") == true;

var comma = false;

if (contextual)
{
sb.Append('n');
comma = true;
}

if (chunkProperty.Properties?.TryGetValue("version", out var version) == true)
{
if (contextual)
if (comma)
{
sb.Append(", ");
}

sb.Append("version: ");
sb.Append(version);

comma = true;
}

if (chunkProperty.Properties?.ContainsKey("external") == true && !chunkProperty.Type.IsArray)
{
sb.Append(", out ");
if (comma)
{
sb.Append(", ");
}

sb.Append("out ");

if (!self && !isUnknown)
{
sb.Append("n.");
}

sb.Append(name);
sb.Append(char.ToLowerInvariant(name[0]) + name.Substring(1));
sb.Append("File");
}

Expand Down
2 changes: 1 addition & 1 deletion Generators/GBX.NET.Generators/ClassChunkLMixedGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public virtual void Initialize(IncrementalGeneratorInitializationContext context
var classIdContents = context.AdditionalTextsProvider
.Where(static file =>
{
return file.Path.EndsWith("ClassId.txt") && Path.GetDirectoryName(file.Path).EndsWith("Resources");
return (file.Path.EndsWith("ClassId.txt") || file.Path.EndsWith("ClassIdManual.txt")) && Path.GetDirectoryName(file.Path).EndsWith("Resources");
})
.Select((additionalText, cancellationToken) =>
{
Expand Down
9 changes: 8 additions & 1 deletion Generators/GBX.NET.Generators/Utils/ClassIdParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ public static Dictionary<uint, string> Parse(TextReader reader)
// combine engine and class like EECCC000
var classId = (uint)((currentEngineByte << 24) | (classPart << 12));

result.Add(classId, currentClassName);
if (!result.TryGetValue(classId, out var curName) || string.IsNullOrEmpty(curName))
{
result[classId] = currentClassName;
}
else
{
throw new Exception($"Duplicate class id {classId:X8} with names '{curName}' and '{currentClassName}'.");
}
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ For any questions, open an issue, join the [GameBox Sandbox Discord server](http

Many *essential* Gbx files from many games are supported:

- **Trackmania (2020)**, October 2024 update
- **Trackmania (2020)**, December 2024 update
- **ManiaPlanet 4**(.1), TM2/SM
- **Trackmania Turbo**
- ManiaPlanet 3, TM2/SM
Expand Down Expand Up @@ -87,7 +87,7 @@ Here are some of the known file types to start with:
| LightMapCache.Gbx | [CHmsLightMapCache](Src/GBX.NET/Engines/Hms/CHmsLightMapCache.chunkl) | No | No
| SystemConfig.Gbx | [CSystemConfig](Src/GBX.NET/Engines/System/CSystemConfig.chunkl) | Yes | Yes
| FidCache.Gbx | [CMwRefBuffer](Src/GBX.NET/Engines/MwFoundations/CMwRefBuffer.chunkl) | Yes | Yes
| Scores.Gbx | [CGamePlayerScore](Src/GBX.NET/Engines/Game/CGamePlayerScore.chunkl) | Yes | No
| Scores.Gbx | [CGamePlayerScore](Src/GBX.NET/Engines/Game/CGamePlayerScore.chunkl) | No | No

**Full list of supported file types is available in the [SUPPORTED GBX FILE TYPES](SUPPORTED_GBX_FILE_TYPES.md)**.

Expand Down
Binary file added Resources/ClassIdManual.txt
Binary file not shown.
2 changes: 0 additions & 2 deletions Resources/Wrap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@
08050000 090E5000
08051000 09126000
08053000 090BF000
08055000 09125000
0805A000 090B2000
0805B000 090B3000
0900D000 0900F000
09012000 09047000
09063000 09026000
09068000 09026000
090E3000 2E006000
Expand Down
21 changes: 19 additions & 2 deletions SUPPORTED_GBX_FILE_TYPES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Older extensions | Latest extension | Class | Read (whole) | Write | Read (heade
| | Shape.Gbx | [CPlugSurface](Src/GBX.NET/Engines/Plug/CPlugSurface.chunkl) | Yes | Yes
| | Macroblock.Gbx | [CGameCtnMacroBlockInfo](Src/GBX.NET/Engines/Game/CGameCtnMacroBlockInfo.chunkl) | Yes | Yes | Yes
| | SystemConfig.Gbx | [CSystemConfig](Src/GBX.NET/Engines/System/CSystemConfig.chunkl) | Yes | Yes
| | FidCache.Gbx | [CMwRefBuffer](Src/GBX.NET/Engines/MwFoundations/CMwRefBuffer.chunkl) | Yes | Yes
| RefBuffer.Gbx | FidCache.Gbx | [CMwRefBuffer](Src/GBX.NET/Engines/MwFoundations/CMwRefBuffer.chunkl) | Yes | Yes
| | Profile.Gbx | [CGamePlayerProfile](Src/GBX.NET/Engines/Game/CGamePlayerProfile.chunkl) | Up to TMF | Up to TMF | Yes
| | Spawn.Gbx | [CGameSpawnModel](Src/GBX.NET/Engines/GameData/CGameSpawnModel.chunkl) | Yes | Yes
| ConstructionCampaign.Gbx | Campaign.Gbx | [CGameCtnCampaign](Src/GBX.NET/Engines/Game/CGameCtnCampaign.chunkl) | Yes | Yes
Expand All @@ -24,6 +24,7 @@ Older extensions | Latest extension | Class | Read (whole) | Write | Read (heade
| TMDecorationSize.Gbx | DecorationSize.Gbx | [CGameCtnDecorationSize](Src/GBX.NET/Engines/Game/CGameCtnDecorationSize.chunkl) | Yes | Yes | Yes
| TMDecorationMood.Gbx | DecorationMood.Gbx | [CGameCtnDecorationMood](Src/GBX.NET/Engines/Game/CGameCtnDecorationMood.chunkl) | Yes | Yes | Yes
| TMDecorationAudio.Gbx | DecorationAudio.Gbx | [CGameCtnDecorationAudio](Src/GBX.NET/Engines/Game/CGameCtnDecorationAudio.chunkl) | Yes | Yes | Yes
| | Scene3d.Gbx | [CSceneLayout](Src/GBX.NET/Engines/Scene/CSceneLayout.chunkl) | Yes | Yes
| TMEDClassic.Gbx | EDClassic.Gbx | [CGameCtnBlockInfoClassic](Src/GBX.NET/Engines/Game/CGameCtnBlockInfoClassic.chunkl) | Yes | Yes | Yes
| TMEDClip.Gbx | EDClip.Gbx | [CGameCtnBlockInfoClip](Src/GBX.NET/Engines/Game/CGameCtnBlockInfoClip.chunkl) | Yes | Yes | Yes
| TMEDFlat.Gbx | EDFlat.Gbx | [CGameCtnBlockInfoFlat](Src/GBX.NET/Engines/Game/CGameCtnBlockInfoFlat.chunkl) | Yes | Yes | Yes
Expand All @@ -39,13 +40,29 @@ Older extensions | Latest extension | Class | Read (whole) | Write | Read (heade
| | MotionManagerWeathers.Gbx | [CPlugWeatherModel](Src/GBX.NET/Engines/Plug/CPlugWeatherModel.chunkl) | Up to TMUF | Yes
| | RallyLeafManager.Gbx | [CMotionManagerLeaves](Src/GBX.NET/Engines/Motion/CMotionManagerLeaves.chunkl) | Yes | Yes
| | GameSkin.Gbx | [CPlugGameSkin](Src/GBX.NET/Engines/Plug/CPlugGameSkin.chunkl) | Yes | Yes
| | VehicleTunings.Gbx | [CPlugVehiclePhyTunings](Src/GBX.NET/Engines/Plug/CPlugVehiclePhyTunings.chunkl) | Up to TM2 | Up to TM2 | Yes
| | VehicleTunings.Gbx | [CPlugVehiclePhyTunings](Src/GBX.NET/Engines/Plug/CPlugVehiclePhyTunings.chunkl) | Up to TM2 | Up to TM2
| | CtrlCam.Gbx | [CGameControlCamera](Src/GBX.NET/Engines/Game/CGameControlCamera.chunkl) | Yes | Yes
| | CtrlCamTarget.Gbx | [CGameControlCameraTarget](Src/GBX.NET/Engines/Game/CGameControlCameraTarget.chunkl) | Yes | Yes
| | CtrlCamOrbital3d.Gbx | [CGameControlCameraOrbital3d](Src/GBX.NET/Engines/Game/CGameControlCameraOrbital3d.chunkl) | Yes | Yes
| | CtrlCamTmRace.Gbx | [CGameControlCameraTrackManiaRace](Src/GBX.NET/Engines/TrackMania/CGameControlCameraTrackManiaRace.chunkl) | Yes | Yes
| | CtrlCamTmRace2.Gbx | [CGameControlCameraTrackManiaRace2](Src/GBX.NET/Engines/TrackMania/CGameControlCameraTrackManiaRace2.chunkl) | Yes | Yes
| | CtrlCamTmRace3.Gbx | [CGameControlCameraTrackManiaRace3](Src/GBX.NET/Engines/TrackMania/CGameControlCameraTrackManiaRace3.chunkl) | Yes | Yes
| | DecoSolid.Gbx | [CPlugDecoratorSolid](Src/GBX.NET/Engines/CPlug/CPlugDecoratorSolid.chunkl) | Yes | Yes
| | TrackManiaVehicle.Gbx | [CSceneVehicleCar](Src/GBX.NET/Engines/Scene/CSceneVehicleCar.chunkl) | Only TMUF | Only TMUF
| TMVehicle.Gbx | ConstructionVehicle.Gbx | [CGameItemModel](Src/GBX.NET/Engines/GameData/CGameItemModel.chunkl) | Yes | Yes | Yes
| | ParticleModel.Gbx | [CPlugParticleEmitterModel](Src/GBX.NET/Engines/CPlug/CPlugParticleEmitterModel.chunkl) | Up to TMUF | Up to TMUF
| | VehicleStruct.Gbx | [CPlugVehicleVisModelShared](Src/GBX.NET/Engines/GameData/CPlugVehicleVisModelShared.chunkl) | Yes | Yes
| | FuncClouds.Gbx | [CPlugClouds](Src/GBX.NET/Engines/Plug/CPlugClouds.chunkl) | Yes | Yes
| | FuncShader.Gbx | [CFuncShaderLayerUV](Src/GBX.NET/Engines/Func/CFuncShaderLayerUV.chunkl) | Yes | Yes
| | AmbientOcc.Gbx | [CHmsAmbientOcc](Src/GBX.NET/Engines/Hms/CHmsAmbientOcc.chunkl) | Yes | Yes
| | ObjectInfo.Gbx | [CGameItemModel](Src/GBX.NET/Engines/GameData/CGameItemModel.chunkl) | Yes | Yes | Yes
| | Mobil.Gbx | [CSceneMobil](Src/GBX.NET/Engines/Scene/CSceneMobil.chunkl) | Yes | Yes
| | Solid.Gbx | [CPlugSolid](Src/GBX.NET/Engines/Plug/CPlugSolid.cs) | Yes | Yes
| | Material.Gbx | [CPlugMaterial](Src/GBX.NET/Engines/Plug/CPlugMaterial.cs) | Up to TM2 | No
| | Shader.Gbx | [CPlugShader](Src/GBX.NET/Engines/Plug/CPlugShader.cs) | Up to TMUF | No
| | Texture.Gbx | [CPlugBitmap](Src/GBX.NET/Engines/Plug/CPlugBitmap.cs) | Up to TMUF | No
| | Light.Gbx | [CPlugLight](Src/GBX.NET/Engines/Plug/CPlugLight.cs) | Yes | Yes
| | Prefab.Gbx | [CPlugPrefab](Src/GBX.NET/Engines/Plug/CPlugPrefab.cs) | Yes | Yes
| | Wagon.Gbx | [CPlugTrainWagonModel](Src/GBX.NET/Engines/Plug/CPlugTrainWagonModel.cs) | Yes | Yes

- <sup>1</sup>Safety reasons. Consider extracting `CGameCtnGhost` from `CGameCtnReplayRecord`, transfer it over to `CGameCtnMediaBlockGhost`, add it to `CGameCtnMediaClip`, and save it as `.Clip.Gbx`, which you can then import in MediaTracker.
8 changes: 4 additions & 4 deletions Src/GBX.NET.PAK/Exceptions/NotAPakException.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace GBX.NET.Exceptions;
namespace GBX.NET.PAK.Exceptions;

[Serializable]
public class NotAPakException : Exception
{
public NotAPakException() : base("Pak data stream was not identified.") { }
public NotAPakException(string message) : base(message) { }
public NotAPakException(string message, Exception? innerException) : base(message, innerException) { }
public NotAPakException() : base("Pak data stream was not identified.") { }
public NotAPakException(string message) : base(message) { }
public NotAPakException(string message, Exception? innerException) : base(message, innerException) { }
}
4 changes: 2 additions & 2 deletions Src/GBX.NET.PAK/GBX.NET.PAK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>GBX.NET.PAK</PackageId>
<VersionPrefix>2.0.0</VersionPrefix>
<VersionPrefix>2.1.0</VersionPrefix>
<Authors>BigBang1112</Authors>
<Description>Support for Pak (NadeoPak) package files, integrated with GBX.NET.</Description>
<Copyright>Copyright (c) 2024 Petr Pivoňka</Copyright>
Expand Down Expand Up @@ -45,7 +45,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="NativeSharpZlib" Version="0.2.6" />
<PackageReference Include="NativeSharpZlib" Version="0.2.8" />
<PackageReference Include="Zomp.SyncMethodGenerator" Version="1.4.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Loading

0 comments on commit 21b8d88

Please sign in to comment.