NCF Library
  • â„šī¸About
  • 📚Libraries
    • AAMP
    • BFRES
    • BYML
    • SARC
    • Yaz0
  • âœī¸Planned Libraries
    • BFLIM
    • BNTX
    • RSTB
  • 📑Other Libraries
    • MsbtLib
Powered by GitBook
On this page
  • Usage
  • Examples
  1. Libraries

AAMP

Work in progress page.

Usage

Usage examples for reading, writing, and editing AAMP files using AampLibrary.

Examples

Editing an ActorPack's AAMP files.

Uses AampLibray, SarcLibrary, and Yaz0Library

using Nintendo.Aamp;
using Nintendo.Sarc;
using Nintendo.Yaz0;

// Store the SARC file path
string sarcFile = "C:\Botw\Game\content\Actor\Pack\Armor_001_Upper.sbactorpack";

// Decompress the Yaz0 compressed SARC
// and store the decompressed bytes
byte[] sarcData = Yaz0.DecompressFast(sarcFile);

// Construct a SarcFile object from
// the decompressed bytes
SarcFile sarc = new(sarcData);

// Load the gparamlist AAMP file from the SARC
var aamp = AampFile.FromBinary(
    sarc.Files[$"Actor/GeneralParamList/{name}.bgparamlist"]
);

// Use indexing on the RootNode to
// modify the AAMP keys
// 
// In this example, I'm indexing for the EffectType
// and EffectLevel in the first ParamObject
aamp.RootNode.ParamObjects[1].ParamEntries[0].Value = new StringEntry("AttackUp");
aamp.RootNode.ParamObjects[1].ParamEntries[1].Value = 2;

// Once the edits have been made, serialize
// the object to binary to be put back in
// the SarcFile
byte[] aampData = aamp.ToBinary();

// Update the SarcFile entry
sarc.Files[$"Actor/GeneralParamList/{name}.bgparamlist"] = aampData;

// Serialize and compress the SarcFile
byte[] compressedSarcData = Yaz0.CompressFast(sarc.ToBinary());

// Finally, write the modified SARC
File.WriteAllBytes(file, );
PreviousAboutNextBFRES

Last updated 2 years ago

📚