Resource system: Difference between revisions
→Archives: clarify archive handling
imported>Leoetlino |
imported>Leoetlino (→Archives: clarify archive handling) |
||
Line 39: | Line 39: | ||
The resource system can be configured to try loading from an [[SARC]] archive first. | The resource system can be configured to try loading from an [[SARC]] archive first. | ||
To load from an archive, the global resource pack pointer (<code>res::ResourceMgrTask::sInstance->packRes</code> @ this+0x9c06f0 in Switch 1.5.0) | To load from an archive, a pointer to the archive resource handle should be set in <code>ResourceLoadArg::packRes</code> @ 0x58. If it is null, and if ResourceMgrTask's flag 2 is not set<ref>0x71012087EC</ref>, packRes will automatically be set to the global resource pack pointer (<code>res::ResourceMgrTask::sInstance->packRes</code> @ this+0x9c06f0 in Switch 1.5.0). Files in the archive can then be accessed as if they were at the root of the romfs/content partition. For example, if <code>EventFlow/Test.bfevfl</code> is a file in <code>Pack/TitleBG.pack</code>, the path that is for loading is <code>EventFlow/Test.bfevfl</code>, not <code>Pack/TitleBG.pack/EventFlow/Test.bfevfl</code>. | ||
Calls to any of the resource loading functions will automatically check whether the specified resource exists in the archive. If it does exist, it will be loaded from the archive. If the file cannot be found in the archive, the game will ignore the active resource pack and load from the usual file device. | Calls to any of the resource loading functions will automatically check whether the specified resource exists in the archive. If it does exist, it will be loaded from the archive. If the file cannot be found in the archive, the game will ignore the active resource pack and load from the usual file device. |