Skip to content

Commit

Permalink
Gathered Nitro model bundles and created an empty loader for them.
Browse files Browse the repository at this point in the history
  • Loading branch information
MeltyPlayer committed Nov 30, 2024
1 parent 4d300e9 commit 089c1d4
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using fin.io;
using fin.model.io;

namespace nitro.api;

public class NsbmdModelFileBundle : IModelFileBundle {
public required IReadOnlyTreeFile NsbmdFile { get; init; }

public required string? GameName { get; init; }
public IReadOnlyTreeFile MainFile => this.NsbmdFile;
}
20 changes: 20 additions & 0 deletions FinModelUtility/Formats/Nitro/Nitro/src/api/NsbmdModelImporter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using fin.model;
using fin.model.impl;
using fin.model.io.importers;
using fin.util.sets;

namespace nitro.api;

public class NsbmdModelImporter : IModelImporter<NsbmdModelFileBundle> {
public IModel Import(NsbmdModelFileBundle fileBundle) {
var nsbmdFile = fileBundle.NsbmdFile;

var files = nsbmdFile.AsFileSet();
var model = new ModelImpl {
FileBundle = fileBundle,
Files = files,
};

return model;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<ProjectReference Include="..\..\Formats\Level5\Level5\Level5.csproj" />
<ProjectReference Include="..\..\Formats\Mod\Mod\Mod.csproj" />
<ProjectReference Include="..\..\Formats\Modl\Modl\Modl.csproj" />
<ProjectReference Include="..\..\Formats\Nitro\Nitro\Nitro.csproj" />
<ProjectReference Include="..\..\Formats\Ssm\Ssm\Ssm.csproj" />
<ProjectReference Include="..\..\Formats\Visceral\Visceral\Visceral.csproj" />
<ProjectReference Include="..\..\Formats\Vrml\Vrml\Vrml.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

using modl.api;

using nitro.api;

using pmdc.api;

using ttyd.api;
Expand Down Expand Up @@ -55,6 +57,8 @@ MeleeModelFileBundle meleeModelFileBundle
=> new MeleeModelImporter().Import(meleeModelFileBundle),
ModModelFileBundle modModelFileBundle
=> new ModModelImporter().Import(modModelFileBundle),
NsbmdModelFileBundle nsbmdModelFileBundle
=> new NsbmdModelImporter().Import(nsbmdModelFileBundle),
OmdModelFileBundle omdModelFileBundle
=> new OmdModelImporter().Import(omdModelFileBundle),
OotModelFileBundle ootModelFileBundle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using SceneGate.Ekona.Containers.Rom;

using uni.platforms;
using uni.platforms.ds;

using Yarhl.FileSystem;

Expand All @@ -20,13 +21,7 @@ public void GatherFileBundles(
return;
}

using var game = NodeFactory.FromFile(phantomHourglassRom.FullPath);
game.TransformWith<Binary2NitroRom>();

var names = new List<string>();

foreach (var node in Navigator.IterateNodes(game)) {
names.Add(node.Name);
}
var fileHierarchy
= new DsFileHierarchyExtractor().ExtractFromRom(phantomHourglassRom);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using fin.io.bundles;
using fin.util.progress;

using nitro.api;

using uni.platforms;
using uni.platforms.ds;

Expand All @@ -16,6 +18,14 @@ public void GatherFileBundles(
return;
}

new DsFileHierarchyExtractor().ExtractFromRom(superMario64DsRom);
var fileHierarchy
= new DsFileHierarchyExtractor().ExtractFromRom(superMario64DsRom);

foreach (var bmdFile in
fileHierarchy.Root.FilesWithExtensionRecursive(".bmd")) {
organizer.Add(new NsbmdModelFileBundle {
GameName = "super_mario_64_ds", NsbmdFile = bmdFile
}.Annotate(bmdFile));
}
}
}

0 comments on commit 089c1d4

Please sign in to comment.