Skip to content

Commit

Permalink
Merge pull request #4 from tfinnegan937/master
Browse files Browse the repository at this point in the history
Fixed the exefs filesystem parser such that it doesnt attempt to deco…
  • Loading branch information
Martmists-GH authored Jan 7, 2024
2 parents ea2993d + 496add7 commit 72dc758
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class CXIFileSystem(private val fsFSRL: FSRLRoot, private var provider: ByteProv
val exefsStart = tell()
val codeSection = exefsHeader.fileHeaders_10.first { it.filename_8.stripNulls() == fileName }

val size = if (metadata.ncchEx.sci.flags and 0x1 == 1.toByte()) {
val size = if (metadata.ncchEx.sci.flags and 0x1 == 1.toByte() && fileName.stripNulls() == ".code") {
skip(codeSection.offset.toLong())
val exefsCode = readBytes(codeSection.size)
exefsCode.lzssSize()
Expand All @@ -133,7 +133,7 @@ class CXIFileSystem(private val fsFSRL: FSRLRoot, private var provider: ByteProv
provider.getInputStream(0).reader {
seek(exefsStart + codeSection.offset)
var code = readBytes(codeSection.size)
if (metadata.ncchEx.sci.flags and 0x1 == 1.toByte()) {
if (metadata.ncchEx.sci.flags and 0x1 == 1.toByte() && fileName.stripNulls() == ".code") {
code = code.lzss()
}
out.write(code)
Expand Down

0 comments on commit 72dc758

Please sign in to comment.