mikroSDK Reference Manual
resource_manager.h
Go to the documentation of this file.
1
29#ifndef _RESOURCE_MANAGER_H
30#define _RESOURCE_MANAGER_H
31
32//Dependencies
33#include "compiler_port.h"
34#include "error.h"
35
36//C++ guard
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41
46typedef enum
47{
48 RES_TYPE_DIR = 1,
49 RES_TYPE_FILE = 2
50} ResType;
51
52
53//CodeWarrior or Win32 compiler?
54#if defined(__CWCC__) || defined(_WIN32)
55 #pragma pack(push, 1)
56#endif
57
58
64{
65 char_t type;
66 uint32_t dataStart;
67 uint32_t dataLength;
68 uint8_t nameLength;
69 char_t name[];
70} ResEntry;
71
72
77typedef __packed_struct
78{
79 char_t type;
80 uint32_t dataStart;
81 uint32_t dataLength;
82 uint8_t nameLength;
83} ResRootEntry;
84
85
90typedef __packed_struct
91{
92 uint32_t totalSize;
93 ResRootEntry rootEntry;
94} ResHeader;
95
96
97//CodeWarrior or Win32 compiler?
98#if defined(__CWCC__) || defined(_WIN32)
99 #pragma pack(pop)
100#endif
101
102
103typedef struct
104{
105 uint_t type;
106 uint_t volume;
107 uint32_t dataStart;
108 uint32_t dataLength;
109 uint8_t nameLength;
110 char_t name[];
111} DirEntry;
112
113
114//Resource management
115error_t resGetData(const char_t *path, const uint8_t **data, size_t *length);
116
117error_t resSearchFile(const char_t *path, DirEntry *dirEntry);
118
119//error_t resOpenDirectory(Directory *directory, const DirEntry *entry);
120//error_t resReadDirectory(Directory *directory, DirEntry *entry);
121
122#if 0
123typedef struct
124{
125 uint_t mode;
126 uint32_t start;
127 uint32_t size;
128 uint32_t offset;
129} FsFile;
130
131error_t resOpenFile(FsFile *file, const DirEntry *dirEntry, uint_t mode);
132error_t resSeekFile(FsFile *file, uint32_t *position);
133uint_t resReadFile(FsFile *file, void *data, size_t length);
134#endif
135
136//C++ guard
137#ifdef __cplusplus
138}
139#endif
140
141#endif
Compiler specific definitions.
Error codes description.
error_t
Error codes.
Definition error.h:43
void FsFile
File descriptor.
Definition fs_port_fatfs.h:60
typedef __packed_struct
Resource entry.
Definition resource_manager.h:64
ResType
Resource type.
Definition resource_manager.h:47
Definition resource_manager.h:104