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 int
calculateNumFiles
(File dir) protected static int
findLowestAvailableFileId
(ArrayList<byte[]> files) static Fnt.Folder
load
(byte[] fnt) Create aFolder
from filename table data.static Fnt.Folder
loadFromDisk
(File dir, ArrayList<byte[]> files) Create aFolder
from an unpacked filesystem on disk; This also grabs all the binary data for each file.static MemBuf
save
(Fnt.Folder root) Generates a MemBuf representing the root folder as a filename table.static void
writeFolderToDisk
(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 aFolder
from 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
- aFile
representation of the write pathfolder
- theFolder
object to writefiles
- anArrayList
ofbyte[]
's containing the file contents of the provided folder- Throws:
IOException
- if the specified file's parent directory does not exist.
-
loadFromDisk
Create aFolder
from an unpacked filesystem on disk; This also grabs all the binary data for each file.- Parameters:
dir
- aFile
representing the path to the unpacked data dir on disk to processfiles
- anArrayList
ofbyte[]
'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
-