blocksds / sdk

Main BlocksDS SDK repository
https://blocksds.github.io/docs/
130 stars 5 forks source link

`nitroFSInit()` can't mount the nitroFS of a different ROM in some cases #135

Closed AntonioND closed 3 months ago

AntonioND commented 3 months ago

Unless the current ROM has a nitroFS filesystem, the checks at the start of nitroFSInit() will fail:

https://github.com/blocksds/libnds/blob/f123506cd56a5b5fd99c3da18174ecc2c5f30d8f/source/arm9/libc/nitrofs.c#L579

Also, I'm not sure if nitroFSInit() supports being called multiple times. I assume it doesn't, and that it can only be used once during the execution of the application.

I'm not sure if the intention of nitroFSInit() was to support this scenario. Maybe the idea was to be able to find yourself in a specific location, not a different ROM.

asiekierka commented 3 months ago

It should support being called multiple times, and it should work fine in the described scenario.

AntonioND commented 3 months ago

Actually, forget the part about that check in the code, that's not reading from the cartridge header, that's a value saved during initialization of NitroFS. I misunderstood how this function works.