v1.1.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
abi/asset.h
1 /* -*- mode: C; c-basic-offset: 4; intent-tabs-mode: nil -*-
2  *
3  * This file is part of the public interface to the Sifteo SDK.
4  * Copyright <c> 2012 Sifteo, Inc. All rights reserved.
5  */
6 
7 #ifndef _SIFTEO_ABI_ASSET_H
8 #define _SIFTEO_ABI_ASSET_H
9 
10 #include <sifteo/abi/types.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 
17 #define _SYS_ASSETLOAD_BUF_SIZE 48 // Makes _SYSAssetLoaderCube come to 64 bytes
18 #define _SYS_MAX_ASSET_SLOTS 4 // Number of AssetSlots maximum per-program
19 #define _SYS_TILES_PER_ASSETSLOT 4096 // Number of tiles per AssetSlot
20 #define _SYS_ASSET_GROUPS_PER_SLOT 24 // Number of AssetGroups we can track per-slot
21 #define _SYS_ASSET_SLOTS_PER_BANK 4 // Number of AssetSlots maximum per-program
22 #define _SYS_ASSET_GROUP_SIZE_UNIT 16 // Basic unit of AssetGroup allocation, in tiles
23 #define _SYS_ASSET_GROUP_CRC_SIZE 16 // Number of bytes of AssetGroup CRC
24 
25 
26 struct _SYSAssetGroupHeader {
27  uint8_t reserved;
28  uint8_t ordinal;
29  uint16_t numTiles;
30  uint32_t dataSize;
31  uint8_t crc[_SYS_ASSET_GROUP_CRC_SIZE];
32  // Followed by compressed data
33 };
34 
35 struct _SYSAssetGroupCube {
36  uint16_t baseAddr;
37 };
38 
39 struct _SYSAssetGroup {
40  uint32_t pHdr;
41  // Followed by a _SYSAssetGroupCube array
42 };
43 
44 struct _SYSAssetLoaderCube {
45  uint32_t progress;
46  uint32_t total;
47  uint16_t reserved;
48  uint8_t head;
49  uint8_t tail;
50  uint8_t buf[_SYS_ASSETLOAD_BUF_SIZE];
51 };
52 
53 struct _SYSAssetLoader {
54  _SYSCubeIDVector busyCubes;
55  // Followed by a _SYSAssetLoaderCube array
56 };
57 
58 struct _SYSAssetConfiguration {
59  uint32_t pGroup;
60  _SYSVolumeHandle volume;
61  uint32_t dataSize;
62  uint16_t numTiles;
63  uint8_t ordinal;
64  _SYSAssetSlot slot;
65 };
66 
67 enum _SYSAssetImageFormat {
68  _SYS_AIF_PINNED = 0,
69  _SYS_AIF_FLAT,
70  _SYS_AIF_DUB_I8,
71  _SYS_AIF_DUB_I16,
72 };
73 
74 struct _SYSAssetImage {
75  uint32_t pAssetGroup;
76  uint16_t width;
77  uint16_t height;
78  uint16_t frames;
79  uint8_t format;
80  uint8_t reserved;
81  uint32_t pData;
82 };
83 
84 
85 #ifdef __cplusplus
86 } // extern "C"
87 #endif
88 
89 #endif