Important: The information in this document is obsolete and should not be used for new development.
Inserting the ROM Resource Map
Many system resources are stored in ROM. System software calls theInitResources
function during system startup, and the Resource Manager creates a special heap zone in the system heap and builds a resource map that points to the ROM resources.The Resource Manager normally searches ROM resources only when you use the
RGetResource
function to get a handle to the resource, and even then only after it searches the System file's resource fork. To search for a resource in ROM before searching the System file's resource fork, your application must first alter the resource search order by inserting the ROM resource map in front of the System file's resource map.When the value of the global variable
RomMapInsert
isTRUE
, the Resource Manager inserts the ROM resource map before the System file's resource map for the next call only. When the value ofRomMapInsert
isTRUE
, the adjacent variableTmpResLoad
determines whether the value of the global variableResLoad
is consideredTRUE
orFALSE
, overriding the actual value ofResLoad
for the next call only. The values of theRomMapInsert
andTmpResLoad
variables are cleared after each call to a Resource Manager routine.The
RGetResource
function first callsGetResource
. IfGetResource
cannot locate the requested resource in the resource chain,RGetResource
setsRomMapInsert
toTRUE
, then callsGetResource
again.To set the
RomMapInsert
andTmpResLoad
variables in tandem yourself, you can use two global constants. Set the system global variableRomMapInsert
to the global constantmapTrue
to insert the ROM resource map withSetResLoad(TRUE)
. SetRomMapInsert
to the global constantmapFalse
to insert the ROM resource map withSetResLoad(FALSE)
.There is no real resource fork associated with the ROM resources; the ROM resource map has a path number of 1 (an illegal path reference number). There are two ways to determine whether a handle references a ROM resource. First, you can set up
RomMapInsert
andTmpResLoad
and callHomeResFile
; if 1 is returned, the handle is to a ROM resource. Second, you can dereference the handle and check whether the master pointer points to ROM by comparing it to the global variableROMBase
.