28 # error This is a userspace-only header, not allowed by the current build.
31 #include <sifteo/abi.h>
32 #include <sifteo/limits.h>
33 #include <sifteo/macros.h>
34 #include <sifteo/math.h>
59 operator const _SYSAssetGroup& ()
const {
return sys; }
60 operator _SYSAssetGroup& () {
return sys; }
61 operator const _SYSAssetGroup* ()
const {
return &sys; }
62 operator _SYSAssetGroup* () {
return &sys; }
76 _SYSAssetGroup *G = (_SYSAssetGroup*)
77 _SYS_lti_initializer(reinterpret_cast<const void*>(&sys), requireConst);
78 return reinterpret_cast<const _SYSAssetGroupHeader*
>(G->pHdr);
94 return roundup<unsigned>(
numTiles(), _SYS_ASSET_GROUP_SIZE_UNIT);
116 return cubes[cube].baseAddr;
135 return _SYS_asset_findInCache(*
this, vec) ==
vec;
147 return isInstalled(_SYSCubeIDVector(0x80000000 >> cube));
192 operator const _SYSAssetSlot& ()
const {
return sys; }
193 operator const _SYSAssetSlot* ()
const {
return &sys; }
201 return AssetSlot(_SYS_lti_counter(
"Sifteo.AssetGroupSlot", 0));
212 return _SYS_asset_slotTilesFree(*
this, cubes);
241 void erase(_SYSCubeIDVector cubes = -1)
const {
242 _SYS_asset_slotErase(*
this, cubes);
260 _SYS_lti_metadata(_SYS_METADATA_BOOT_ASSET,
"IBBBB",
264 _SYSCubeIDVector
vec = _SYS_asset_findInCache(group, -1);
AssetSlots are numbered containers, in a cube's flash memory, which can hold AssetGroups.
Definition: group.h:181
#define ALWAYS_INLINE
Always enable inlining for one function.
Definition: macros.h:76
A bundle of compressed tile data, for use by AssetImages.
Definition: group.h:54
ALWAYS_INLINE const _SYSAssetGroupHeader * sysHeader(bool requireConst=false) const
Get a pointer to the read-only system data for this asset group.
Definition: group.h:72
#define ASSERT(_x)
Runtime debug assertion.
Definition: macros.h:205
bool hasRoomFor(const AssetGroup &group, _SYSCubeIDVector cubes=-1) const
Is there room in this slot to load a particular AssetGroup without erasing the slot?
Definition: group.h:224
static ALWAYS_INLINE AssetSlot allocate()
Statically allocate a new AssetSlot.
Definition: group.h:200
uint16_t baseAddress(_SYSCubeID cube) const
Return the base address of this asset group, as loaded onto the specified cube.
Definition: group.h:114
#define CUBE_ALLOCATION
Compile-time cube limit for the current application.
Definition: limits.h:54
AssetSlot(const AssetSlot &other)
Copy constructor.
Definition: group.h:189
unsigned tilesFree(_SYSCubeIDVector cubes=-1) const
How much space is remaining in this slot, measured in tiles?
Definition: group.h:211
unsigned compressedSize() const
Get the compressed size of this asset group, in bytes.
Definition: group.h:100
unsigned tileAllocation() const
How many tiles will this group use up in its AssetSlot?
Definition: group.h:93
unsigned numTiles() const
Get the size of this asset group, in tiles.
Definition: group.h:84
bool isInstalled(_SYSCubeIDVector vec)
Is this AssetGroup installed on all cubes in the given vector?
Definition: group.h:134
ALWAYS_INLINE AssetSlot bootstrap(AssetGroup &group) const
Mark a particular AssetGroup as a "bootstrap" asset for this slot.
Definition: group.h:258
AssetSlot(_SYSAssetSlot sys)
Explicit conversion from a system object.
Definition: group.h:186
void erase(_SYSCubeIDVector cubes=-1) const
Erase this slot.
Definition: group.h:241
bool isInstalled(_SYSCubeID cube)
Is this AssetGroup installed on a particular cube?
Definition: group.h:146
Vector2< T > vec(T x, T y)
Create a Vector2, from a set of (x,y) coordinates.
Definition: math.h:658