nn::fs::MountRom Function

Syntax

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

Parameters

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
Result::IsSuccess Process was successful.
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 was revised in the SDK version below to transition to the error display screen when an error occurs, rather than returning the process to the application. Applications do not need to implement error handling for this function.

SeriesSDK versionReturn Value Specification
CTR-SDK 1.X1.1 and earlierOne of the results above is returned when an error occurs.
1.2 or laterAn error will cause a transition to the error display screen. (Only success is returned.)
CTR-SDK 2.X2.0 and earlierOne of the results above is returned when an error occurs.
2.1 or laterAn error will cause a transition to the error display screen. (Only success is returned.)

Revision History

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

CONFIDENTIAL