Repository navigation
feat(nx-object): read a KIP1 and a CNMT, and expand packed segments - #14
Merged
Merged
Conversation
Completes the read side for the formats the crate already builds. Expanding a segment stays a separate call rather than an accessor: a reader borrows its buffer and has nowhere to put the result, so the allocation and the failure are both the caller's to see. - Add `blz::decompress`, taking the expanded length as an argument because a stored stream is padded to four bytes and records no length of its own - Add `read::kip`, proving each segment's stored bytes lie inside the image and expanding the three the header marks packed; `bss` reads as an empty slice, since it occupies no bytes in the file - Add `read::cnmt`, exposing the content records and leaving an extended header unread when the meta type is not one this crate models, rather than reinterpreting it as the wrong structure - Add `Nso::text`, `Nso::rodata`, and `Nso::data`, returning the segment as the loader maps it — page padding included, because the recorded size and hash both cover it - Fix two `compress` defects the new round-trip sweep found: a layout saving less than the trailer underflowed `extra_len` and panicked, and one saving exactly the trailer wrote a zero there, which is the marker for a stored stream and decoded as the wrong form Signed-off-by: Lorenzo Delgado <lnsdev@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the read side for the formats the crate already builds. Expanding a segment stays a separate call rather than an accessor: a reader borrows its buffer and has nowhere to put the result, so the allocation and the failure are both the caller's to see.
blz::decompress, taking the expanded length as an argument because a stored stream is padded to four bytes and records no length of its ownread::kip, proving each segment's stored bytes lie inside the image and expanding the three the header marks packed;bssreads as an empty slice, since it occupies no bytes in the fileread::cnmt, exposing the content records and leaving an extended header unread when the meta type is not one this crate models, rather than reinterpreting it as the wrong structureNso::text,Nso::rodata, andNso::data, returning the segment as the loader maps it — page padding included, because the recorded size and hash both cover itcompressdefects the new round-trip sweep found: a layout saving less than the trailer underflowedextra_lenand panicked, and one saving exactly the trailer wrote a zero there, which is the marker for a stored stream and decoded as the wrong form