Closed Maccraft123 closed 9 months ago
I haven't checked the code in depth (I have exams next week, so I don't think I will be able to), but you should remove most
#[derive(Copy)]
. I don't think that copying of big structs (Smdh
,Title
, etc) is a good idea, specially on a system like the 3DS
Sure, will do. Sorta got used to doing it whenever I can as I don't really care that much about performance until it becomes an issue. Will do my best to remember to not do that in future.
Tbh it might be a good idea to move Smdh
, and other data formats(NCCH, CIA etc), into their own crate, so that it could be used with tools that don't run on 3ds
Tbh it might be a good idea to move
Smdh
, and other data formats(NCCH, CIA etc), into their own crate, so that it could be used with tools that don't run on 3ds
That is a very interesting point, especially since our tools (mainly cargo-3ds
) would benefit immensely from having custom file format support rather than depending on installed binaries.
That is a very interesting point, especially since our tools (mainly
cargo-3ds
) would benefit immensely from having custom file format support rather than depending on installed binaries.
If you want, I can try making a proof of concept for Rust smdhtool
alternative and a Rust library to read/write SMDH data
This MR adds Smdh struct to read smdh data from ExeFS of CXI files and some related data, like flags and region lockout data. I wasn't really sure where to put it, so it went into
src/smdh.rs
and reading it went tosrc/services/am.rs
as it's closely related to titles. I'm not sure what can I do to make the actual-reading of data inTitle::get_smdh
look nicer. I had an idea to make a somewhat-generic code for reading/writing from/to weird ArchiveIds with custom binary paths but I'm not sure how to implement it. The other part that looks sorta ugly-ish is verifying that smdh's magic data is 'SMDH', as I can't directly access magic field ofSmdh
fromam.rs
and it doesn't really make sense to add a public getter for it, so I added a public-to-crate getter for it.I used https://www.3dbrew.org/wiki/SMDH and https://github.com/J-D-K/JKSM as references.