Class Fnt

java.lang.Object
io.github.turtleisaac.nds4j.Fnt

public class Fnt extends Object
  • Field Details

    • nextFolderId

      public static int nextFolderId
  • Constructor Details

    • Fnt

      public Fnt()
  • Method Details

    • load

      public static Fnt.Folder load(byte[] fnt)
      Create a Folder from filename table data. This is the inverse of save()
      Parameters:
      fnt - byte[] representation of the FNTB
      Returns:
      a Folder
    • save

      public static MemBuf save(Fnt.Folder root)
      Generates a MemBuf representing the root folder as a filename table. This is the inverse of load()
      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 - a File representation of the write path
      folder - the Folder object to write
      files - an ArrayList of byte[]'s containing the file contents of the provided folder
      Throws:
      IOException - if the specified file's parent directory does not exist.
    • loadFromDisk

      public static Fnt.Folder loadFromDisk(File dir, ArrayList<byte[]> files)
      Create a Folder from an unpacked filesystem on disk; This also grabs all the binary data for each file.
      Parameters:
      dir - a File representing the path to the unpacked data dir on disk to process
      files - an ArrayList of byte[]'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

      protected static int findLowestAvailableFileId(ArrayList<byte[]> files)
    • calculateNumFiles

      protected static int calculateNumFiles(File dir)