nn::fs::MountRom Function

Syntax

Result MountRom(
     const char * archiveName,
     size_t maxFile,
     size_t maxDirectory,
     void * workingMemory,
     size_t workingMemorySize,
     bool useCache = true
);

Arguments

Name Description
in archiveName Specifies the name of the archive. (In the overloaded version of this function in which this argument is omitted, "rom:" is specified implicitly.)
in maxFile The maximum number of files that can be opened simultaneously.
in maxDirectory The maximum number of directories that can be opened simultaneously.
in workingMemory The starting address of the memory region used for ROM archive operations.
in workingMemorySize The size of the memory region used for ROM archive operations.
in useCache Set to true to enable caching of metadata to memory, or false to disable metadata caching.

Return Values

Returns the result of the operation.
Value Description
Success. Process was successful. The return value's IsSuccess function returns true in this state.
ResultNotFound There is no ROMFS. Confirm that the content of the RSF file is correct. You must not allow this error to occur in retail products.
ResultAlreadyExists The specified archive name is already mounted.
You must not allow this error to occur in retail products.
ResultNotEnoughSpace An insufficient memory size was specified to workingMemory. You must not allow this error to occur in retail products.
A value other than the above. An unexpected or fatal error occurred.

Description

Mounts a ROM archive.

This function mounts a ROM archive that accesses a ROMFS generated at build time. The numbers of files and directories you can simultaneously open from the ROM archive are specified by maxFile and maxDirectory, respectively.

The region passed into workingMemory must be no smaller than the size calculated by the GetRomRequiredMemorySize function. You can cache ROMFS metadata to memory by setting the useCache argument to true. This reduces the time taken to open files and scan directories. However, it also increases the amount of memory required.

The following page has hints on how to handle mount errors. Please use this as a reference.

About the return values:

This function has been revised in the following SDK versions to jump to an error display screen, without returning control to the application, when an error occurs. Applications do not need to implement error handling for this function.

SeriesSDK versionReturn value specifications
CTR-SDK 1.X1.1 or earlierOne of the Result values above is returned when an error occurs.
1.2 or laterControl jumps to the error display screen when an error occurs. (This only returns a value indicating success.)
CTR-SDK 2.X2.0 or earlierOne of the Result values above is returned when an error occurs.
2.1 or laterControl jumps to the error display screen when an error occurs. (This only returns a value indicating success.)

Revision History

2011/02/28
Added information on changes to return value specifications.
2010/12/14
Added return values.
2010/09/10
Initial version.

CONFIDENTIAL