Package io.github.turtleisaac.nds4j
Class NintendoDsRom
java.lang.Object
io.github.turtleisaac.nds4j.NintendoDsRom
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionNintendoDsRom
(byte[] data) Creates aNintendoDsRom
object from a providedbyte[]
representing the bytes of a ROM file -
Method Summary
Modifier and TypeMethodDescriptionstatic NintendoDsRom
Reads aNintendoDsRom
from a ROM file on diskstatic NintendoDsRom
Reads aNintendoDsRom
from a ROM file on diskstatic NintendoDsRom
fromUnpacked
(File dir) Creates aNintendoDsRom
from an unpacked ROM on diskstatic NintendoDsRom
fromUnpacked
(String dir) Creates aNintendoDsRom
from an unpacked ROM on diskbyte[]
getFileByName
(String filename) Return the data for the file with the given filename (path).byte[]
save
(boolean updateDeviceCapacity) Generate abyte[]
representation of this ROMvoid
saveToFile
(File filePath, boolean updateDeviceCapacity) Generate binary file representing this ROM, and save it to the file specified by filePath.void
saveToFile
(String filePath, boolean updateDeviceCapacity) Generate binary file representing this ROM, and save it to the file specified by filePath.void
setFileByName
(String filename, byte[] data) Set the data for the file with the given filename (path).toString()
void
Unpacks the rom to the target directory on diskvoid
Unpacks the rom to the target directory on disk
-
Constructor Details
-
NintendoDsRom
public NintendoDsRom(byte[] data) Creates aNintendoDsRom
object from a providedbyte[]
representing the bytes of a ROM file- Parameters:
data
- abyte[]
-
-
Method Details
-
fromFile
Reads aNintendoDsRom
from a ROM file on disk- Parameters:
file
- aString
containing the path to a ROM file on disk- Returns:
- a
NintendoDsRom
-
fromFile
Reads aNintendoDsRom
from a ROM file on disk- Parameters:
file
- aFile
containing the path to a ROM file on disk- Returns:
- a
NintendoDsRom
-
save
public byte[] save(boolean updateDeviceCapacity) Generate abyte[]
representation of this ROM- Parameters:
updateDeviceCapacity
- whether the rom capacity code in the header will be changed (boolean)- Returns:
- a
byte[]
-
saveToFile
Generate binary file representing this ROM, and save it to the file specified by filePath.- Parameters:
filePath
-String
containing path to file on disk where the rom will be savedupdateDeviceCapacity
- whether the rom capacity code in the header will be changed (boolean)- Throws:
IOException
- if the specified file's parent directory does not exist.
-
saveToFile
Generate binary file representing this ROM, and save it to the file specified by filePath.- Parameters:
filePath
-File
containing path to file on disk where the rom will be savedupdateDeviceCapacity
- whether the rom capacity code in the header will be changed (boolean)- Throws:
IOException
- if the specified file's parent directory does not exist.
-
fromUnpacked
Creates aNintendoDsRom
from an unpacked ROM on disk- Parameters:
dir
- aString
containing the path to an unpacked ROM on disk- Returns:
- a
NintendoDsRom
-
fromUnpacked
Creates aNintendoDsRom
from an unpacked ROM on disk- Parameters:
dir
- aFile
containing the path to an unpacked ROM on disk- Returns:
- a
NintendoDsRom
-
unpack
Unpacks the rom to the target directory on disk- Parameters:
dir
- aString
containing the path to the target directory- Throws:
IOException
- if any of the output files fail to be written
-
unpack
Unpacks the rom to the target directory on disk- Parameters:
dir
- aFile
object containing the path to the target directory- Throws:
IOException
- if any of the output files fail to be written
-
getFileByName
Return the data for the file with the given filename (path).- Parameters:
filename
- aString
path to a file in the ROM- Returns:
- a byte[] representing the file contents
-
setFileByName
Set the data for the file with the given filename (path).- Parameters:
filename
- aString
path to a file in the ROMdata
- abyte[]
containing the new file contents
-
toString
-