NNL is a C++ library dedicated to the modding of two PlayStation Portable titles:
Once built, you can run the tests. Note: you must provide the main asset archive from NSLAR (ULUS10447):
To generate the local HTML API reference, run the custom documentation target after the build step:
This example shows how to extract Naruto's asset from the game archives and convert the data into a standard GLB file.
#include <iostream>
int main() {
std::filesystem::path cfc_dig_path = std::filesystem::u8path("0000.BIN");
if(!std::filesystem::exists(cfc_dig_path)){
std::cerr << "Error: The file does not exist: " << std::filesystem::absolute(cfc_dig_path) << std::endl;
return 1;
}
{
std::cerr << "Error: Invalid file format" << std::endl;
return 1;
}
const std::size_t naruto_archive_index = 8;
const std::size_t naruto_3d_asset_index = 0;
Buffer& naruto_bin_3d_asset = cfc_ent.at(naruto_3d_asset_index);
for (std::size_t i = 0; i < simple_ast.
animations.size(); i++) {
if (!names[i].empty()) sanim.name += "_" + *names[i].begin();
}
std::filesystem::path out_path = std::filesystem::u8path("naruto.glb");
return 0;
}
std::map< u16, std::set< std::string > > GetAnimationNames(const ActionConfig &action_config)
Returns a map of animation IDs and names of all actions in which those animations were used.
ActionConfig Import(BufferView buffer)
Parses a binary file and converts it to ActionConfig.
tsl::ordered_map< action::Id, Action > ActionConfig
Represents a collection of actions associated with an entity.
Definition action.hpp:286
Holds a collection of skeletal animations.
Definition animation.hpp:92
std::vector< SAnimation > Convert(const AnimationContainer &animations)
Converts multiple in-game animations to a simpler format.
AnimationContainer Import(BufferView buffer)
Imports animations from a binary file.
Asset Import(BufferView buffer)
Parses a binary file and converts it into an Asset object.
std::map< u32, Buffer > Asset
A container for related parts of a complete asset.
Definition asset.hpp:57
DigEntry Import(BufferView buffer)
Parses a binary file and converts it into a DigEntry object.
std::vector< Buffer > DigEntry
A nested archive within a top-level Dig archive.
Definition dig_entry.hpp:48
Buffer Decompress(BufferView buffer, u32 decompressed_size)
Decompress binary data.
u32 decompressed_size
Definition dig.hpp:55
TData buffer
Binary file buffer that stores a nested archive.
Definition dig.hpp:58
TFileRecord< Buffer > FileRecord
A raw entry in the dig archive.
Definition dig.hpp:67
std::vector< FileRecord > Dig
A primary game data archive.
Definition dig.hpp:90
Dig Import(BufferView buffer)
Parses a binary file and converts it into a Dig object.
Represents a 3D model with various components.
Definition model.hpp:478
Model Import(BufferView buffer)
Parses a binary file and converts it to a structured model.
Model Convert(SModel &&smodel, const std::vector< ConvertParam > &mesh_params, bool move_with_root=false)
Converts a simplified model representation to the in-game format.
std::vector< SAnimation > animations
Skeletal animations.
Definition sasset3d.hpp:120
std::vector< SVisibilityAnimation > visibility_animations
Visibility animations for mesh groups of the model.
Definition sasset3d.hpp:121
std::vector< STexture > textures
Textures used by the materials of the model.
Definition sasset3d.hpp:119
SModel model
The 3D model.
Definition sasset3d.hpp:118
void ExportGLB(const std::filesystem::path &path, bool flip=true, bool pack_textures=true) const
Exports the asset data to a GLB file.
Represents a 3D asset composed of various components.
Definition sasset3d.hpp:116
Holds a collection of visibility animations.
Definition visanimation.hpp:104
AnimationContainer Convert(std::vector< SVisibilityAnimation > &&sanimations)
Converts multiple simple visibility animations to the in-game format.
AnimationContainer Import(BufferView buffer)
Imports animations from a binary file.
std::vector< STexture > Convert(const TextureContainer &texture_container, bool mipmaps=false)
Converts a container of textures to a simplified representation.
std::vector< Texture > TextureContainer
Type alias for a container of textures.
Definition texture.hpp:191
TextureContainer Import(BufferView buffer)
Parses a binary file and converts it to a structured texture container.
constexpr u32 kTextureContainer
Definition asset.hpp:194
constexpr u32 kVisanimationContainer
Definition asset.hpp:205
constexpr u32 kActionConfig
Definition asset.hpp:196
constexpr u32 kModel
Definition asset.hpp:193
constexpr u32 kAnimationContainer
Definition asset.hpp:195
Definition exception.hpp:56
An all-in-one header for the library.