890405bb7c
This implementation is different from Luma3DS's which directly hooks the SDK functions. Instead, we read the RomFS's metadata and figure out the directory and file structure. Then, relocations (i.e. replacements/deletions/patches) are applied. Afterwards, we rebuild the metadata, and assign 'fake' data offsets to the files. When we want to read file data from this rebuilt RomFS, we use binary search to find the last data offset smaller or equal to the given offset and read from that file (either from the original RomFS, or from replacement files, or from buffered data with patches applied) and any later files when length is not enough. The code that rebuilds the metadata is pretty complex and uses quite a few variables to keep track of necessary information like metadata offsets. According to my tests, it is able to build RomFS-es identical to the original (but without trailing garbage data) when no relocations are applied. |
||
---|---|---|
.. | ||
arm | ||
cheats | ||
dumping | ||
file_sys | ||
frontend | ||
gdbstub | ||
hle | ||
hw | ||
loader | ||
rpc | ||
tracer | ||
3ds.h | ||
announce_multiplayer_session.cpp | ||
announce_multiplayer_session.h | ||
CMakeLists.txt | ||
core.cpp | ||
core.h | ||
core_timing.cpp | ||
core_timing.h | ||
custom_tex_cache.cpp | ||
custom_tex_cache.h | ||
memory.cpp | ||
memory.h | ||
mmio.h | ||
movie.cpp | ||
movie.h | ||
perf_stats.cpp | ||
perf_stats.h | ||
settings.cpp | ||
settings.h | ||
telemetry_session.cpp | ||
telemetry_session.h |