Package io.github.turtleisaac.nds4j
Class Fnt
java.lang.Object
io.github.turtleisaac.nds4j.Fnt
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static intcalculateNumFiles(File dir) protected static intfindLowestAvailableFileId(ArrayList<byte[]> files) static Fnt.Folderload(byte[] fnt) Create aFolderfrom filename table data.static Fnt.FolderloadFromDisk(File dir, ArrayList<byte[]> files) Create aFolderfrom an unpacked filesystem on disk; This also grabs all the binary data for each file.static MemBufsave(Fnt.Folder root) Generates a MemBuf representing the root folder as a filename table.static voidwriteFolderToDisk(File dir, Fnt.Folder folder, ArrayList<byte[]> files) writes the ROM's internal filesystem to disk at the specified path
-
Field Details
-
nextFolderId
public static int nextFolderId
-
-
Constructor Details
-
Fnt
public Fnt()
-
-
Method Details
-
load
Create aFolderfrom filename table data. This is the inverse ofsave()- Parameters:
fnt- byte[] representation of the FNTB- Returns:
- a
Folder
-
save
Generates a MemBuf representing the root folder as a filename table. This is the inverse ofload()- Parameters:
root- a Folder object for the root folder- Returns:
- a MemBuf
-
writeFolderToDisk
public static void writeFolderToDisk(File dir, Fnt.Folder folder, ArrayList<byte[]> files) throws IOException writes the ROM's internal filesystem to disk at the specified path- Parameters:
dir- aFilerepresentation of the write pathfolder- theFolderobject to writefiles- anArrayListofbyte[]'s containing the file contents of the provided folder- Throws:
IOException- if the specified file's parent directory does not exist.
-
loadFromDisk
Create aFolderfrom an unpacked filesystem on disk; This also grabs all the binary data for each file.- Parameters:
dir- aFilerepresenting the path to the unpacked data dir on disk to processfiles- anArrayListofbyte[]'s to fill with the contents of a directory on disk- Returns:
- a
Folder - Throws:
RuntimeException- if the specified path on disk does not exist or is not a directory
-
findLowestAvailableFileId
-
calculateNumFiles
-