v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Sifteo::Volume Class Reference

A coarse-grained region of external memory. More...

#include <sifteo/filesystem.h>

Public Types

enum  Type { T_GAME = _SYS_FS_VOL_GAME, T_LAUNCHER = _SYS_FS_VOL_LAUNCHER }
 Enumeration of common volume types. More...
 

Public Member Functions

void exec () const
 Transfer control to a new program. More...
 
 operator const _SYSVolumeHandle () const
 Implicit conversion to system object.
 
bool operator!= (_SYSVolumeHandle other) const
 Inequality comparison operator.
 
bool operator== (_SYSVolumeHandle other) const
 Equality comparison operator.
 
 Volume ()
 Default constructor, leaves the Volume with an invalid value of zero.
 
 Volume (_SYSVolumeHandle vh)
 Initialize from a system object.
 

Static Public Member Functions

template<unsigned T>
static void list (unsigned volType, Array< Volume, T > &volumes)
 List all volumes of the specified type. More...
 
static Volume previous ()
 Return the Volume corresponding to the previously running program. More...
 
static Volume running ()
 Return the Volume corresponding to the currently running program. More...
 

Detailed Description

A coarse-grained region of external memory.

Volumes are used by the operating system for various purposes, including storing games.

Typical games will not need Volume objects. They are only useful if you need to launch or retrieve data from other programs or other bundles of data which were installed separately from your game.

Member Function Documentation

void Sifteo::Volume::exec ( ) const
inline

Transfer control to a new program.

Fully replaces the current program in memory. Does not return. For Volumes containing a valid ELF binary only.

This does not automatically call System::setCubeRange() on behalf of the new program, nor does it load any bootstrap assets. Both of these tasks are typically done by the Launcher app, before calling exec(), by reading the volume metadata with MappedVolume::metadata().

Warning
While it is possible to call Volume::current().exec() to restart the current program, there is an edge case to be aware of: Programs may be deleted or upgraded while they are running, in which case Volume::current() refers to a volume which has been deleted. Deleted volumes will not be recycled as long as they are mapped, so programs normally continue running correctly in this case. But a deleted volume cannot be executed or mapped. If this edge case is important to avoid, one approach would be to search for the new version of your own application, if any, using Volume::list().
template<unsigned T>
static void Sifteo::Volume::list ( unsigned  volType,
Array< Volume, T > &  volumes 
)
inlinestatic

List all volumes of the specified type.

Populates an Array with the results.

static Volume Sifteo::Volume::previous ( )
inlinestatic

Return the Volume corresponding to the previously running program.

This refers to the program that was running before the last exec(). For normal games, this will always be the Volume associated with the system launcher.

If there was no previously running program (the system booted directly into the current Volume) this returns a volume with the invalid value of zero.

static Volume Sifteo::Volume::running ( )
inlinestatic

Return the Volume corresponding to the currently running program.

This can be used in various ways, such as skipping the current game in a listing of other games, reading your own metadata, or accessing saved objects that belong to you.


The documentation for this class was generated from the following file: