nn::fs::GetRomRequiredMemorySize Function

Syntax

s32 GetRomRequiredMemorySize(
     size_t maxFile,
     size_t maxDirectory,
     bool useCache = true
);

Arguments

Name Description
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 useCache Set to true to enable caching of metadata to memory, or false to disable metadata caching.

Return Values

Returns the calculated memory size.

Description

Gets the size of memory needed to mount a ROM archive.

This function calculates and returns the memory size needed to mount a ROM archive that accesses a ROMFS generated at build time. The returned memory size allows only the number of files specified by maxFile and the number of directories specified by maxDirectory to be opened simultaneously. If the useCache argument is set equal to true, this size includes the amount of memory required to cache ROMFS metadata in memory.

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 earlierA value of 0 or less is returned when an error occurs.
1.2 or laterControl jumps to the error display screen when an error occurs. (An invalid value is not returned.)
CTR-SDK 2.X2.0 or earlierA value of 0 or less is returned when an error occurs.
2.1 or laterControl jumps to the error display screen when an error occurs. (An invalid value is not returned.)

Revision History

2011/02/28
Added information on changes to return value specifications.
2010/12/14
Fixed the description of the return value when there is an internal error (this used to be described as "a negative value").
2010/08/16
Initial version.

CONFIDENTIAL