46 #ifndef __D4D_EXTSRC_H
47 #define __D4D_EXTSRC_H
49 #if !defined(__MQX__) && !defined(D4D_OS_MQX)
63 #ifndef D4D_IMG_WORK_PATH_DEFAULT
64 #define D4D_IMG_WORK_PATH_DEFAULT "a:\\"
71 #ifndef D4D_FNT_WORK_PATH_DEFAULT
72 #define D4D_FNT_WORK_PATH_DEFAULT "a:\\"
78 #ifndef D4D_DRIVE_MAX_STRLEN
79 #define D4D_DRIVE_MAX_STRLEN 8
139 #define D4D_SEEK_SET 1
141 #define D4D_SEEK_CUR 2
143 #define D4D_SEEK_END 3
213 #define D4D_DECLARE_LOCALE_FUNCTIONS(D4DLOCALE_TranslateStr, D4DLOCALE_GetTranslateStrLength) \
214 const D4DLOCALE_FUNCTIONS d4d_extsrcLocale = \
216 D4DLOCALE_TranslateStr, \
217 D4DLOCALE_GetTranslateStrLength \
230 #define D4D_DECLARE_FILE_FUNCTIONS(D4DFILE_fopen, D4DFILE_fclose, D4DFILE_read, D4DFILE_write, D4DFILE_fseek, D4DFILE_ftell) \
231 const D4DFILE_FUNCTIONS d4d_extsrcFile = \
243 #if D4D_ENDIAN == D4D_ENDIAN_LITTLE
245 #define D4D_READ8L(x) (x)
247 #define D4D_READ16L(x) (x)
249 #define D4D_READ32L(x) (x)
252 #define D4D_READ8B(x) (x)
254 #define D4D_READ16B(x) D4D_SwapWord((x))
256 #define D4D_READ32B(x) D4D_SwapLong((x))
259 #define D4D_WRITE8L(x) (x)
261 #define D4D_WRITE16L(x) (x)
263 #define D4D_WRITE32L(x) (x)
266 #define D4D_WRITE8B(x) (x)
268 #define D4D_WRITE16B(x) D4D_SwapWord((x))
270 #define D4D_WRITE32B(x) D4D_SwapLong((x))
274 #define D4D_READ8L(x) (x)
275 #define D4D_READ16L(x) D4D_SwapWord((x))
276 #define D4D_READ32L(x) D4D_SwapLong((x))
278 #define D4D_READ8B(x) (x)
279 #define D4D_READ16B(x) (x)
280 #define D4D_READ32B(x) (x)
282 #define D4D_WRITE8L(x) (x)
283 #define D4D_WRITE16L(x) D4D_SwapWord((x))
284 #define D4D_WRITE32L(x) D4D_SwapLong((x))
286 #define D4D_WRITE8B(x) (x)
287 #define D4D_WRITE16B(x) (x)
288 #define D4D_WRITE32B(x) (x)
303 #define D4D_FileOpen d4d_extsrcFile.D4DFILE_fopen
305 #define D4D_FileClose d4d_extsrcFile.D4DFILE_fclose
307 #define D4D_FileRead d4d_extsrcFile.D4DFILE_read
309 #define D4D_FileWrite d4d_extsrcFile.D4DFILE_write
311 #define D4D_FileSeek d4d_extsrcFile.D4DFILE_fseek
313 #define D4D_FileTell d4d_extsrcFile.D4DFILE_ftell
317 #if defined(__MQX__) || defined(D4D_OS_MQX)
318 #define D4D_MemAlloc(size) _mem_alloc(size)
320 #define D4D_MemAlloc(size) malloc(size)
326 #if defined(__MQX__) || defined(D4D_OS_MQX)
327 #define D4D_MemFree(pMem) _mem_free(pMem)
329 #define D4D_MemFree(pMem) free(pMem)
335 #if defined(__MQX__) || defined(D4D_OS_MQX)
336 #define D4D_MemCopy(pDst, pSrc, size) _mem_copy(pSrc, pDst, size)
338 #define D4D_MemCopy(pDst, pSrc, size) memcpy(pDst, pSrc, size)
369 #define D4D_CompareStringsUniversal(s1, s2) D4D_CompareStringsUnicode(s1, s2)
371 #define D4D_CompareStringsUniversal(s1, s2) D4D_CompareStrings(s1, s2)
struct D4DFILE_FUNCTIONS_S D4DFILE_FUNCTIONS
eGUI structure to store API for external files support
D4D_WCHAR D4D_TCHAR
Type definition of eGUI character (it depends on UNICODE setting if this is D4D_CHAR or D4D_WCHAR)...
int(* D4DLOCALE_GET_TRANSLATE_STR_LEN)(const D4D_TCHAR *originTxt)
String translate string get lenght function for customized strings.
D4D_WCHAR * D4D_StrCatUnicode(register D4D_WCHAR *sd, register const D4D_WCHAR *ss)
The function concatenate strings (terminated by zero) (UNICODE version)
D4D_CHAR * D4D_StrCopy(register D4D_CHAR *sd, register const D4D_CHAR *ss)
The function copy string one string to other one (terminated by zero)
D4D_FILEPTR(* D4DFILE_FOPEN)(D4D_CHAR *filename, D4D_CHAR *mode)
File open eGUI function type.
D4DLOCALE_GET_TRANSLATE_STR_LEN D4DLOCALE_GetTranslateStrLength
Pointer to Get Translate String Length Function.
D4DFILE_FSEEK D4DFILE_fseek
Pointer to File Seek Function.
D4DFILE_READ D4DFILE_read
Pointer to File Read Function.
eGUI structure to store API for external files support
Word D4D_SwapWord(Word n)
The function swap bytes in Word.
LWord D4D_SwapLong(LWord n)
The function swap bytes in Long.
D4DFILE_FTELL D4DFILE_ftell
Pointer to File Tell Function.
int(* D4DFILE_FCLOSE)(D4D_FILEPTR p_file)
File close eGUI function type.
D4D_CHAR * D4D_GetFileExtension(D4D_CHAR *pFileName)
D4D_WCHAR * D4D_StrCopyAscii2Unicode(register D4D_WCHAR *sd, register const D4D_CHAR *ss)
The function copy string one string (STANDARD 8 bit) to other one (UNICODE)(terminated by zero) ...
int D4D_CompareStringsUnicode(const D4D_WCHAR *s1, const D4D_WCHAR *s2)
The function copare two strings (terminated by zero) (UNICODE version)
D4DFILE_FCLOSE D4DFILE_fclose
Pointer to File Close Function.
struct D4DLOCALE_FUNCTIONS_S D4DLOCALE_FUNCTIONS
eGUI structure to store API for external strings (translated) support
unsigned long LWord
Type definition of LWord (unsigned 32-bit).
eGUI structure to store API for external strings (translated) support
long(* D4DFILE_FTELL)(D4D_FILEPTR p_file)
File tell eGUI function type.
const D4DLOCALE_FUNCTIONS d4d_extsrcLocale
int(* D4DFILE_READ)(D4D_FILEPTR p_file, void *buffer, int size)
File read eGUI function type.
D4D_CHAR * D4D_StrCat(register D4D_CHAR *sd, register const D4D_CHAR *ss)
The function concatenate strings (terminated by zero)
D4D_WCHAR_TYPE D4D_WCHAR
Type definition of eGUI wide char.
int(* D4DFILE_WRITE)(D4D_FILEPTR p_file, const void *buffer, int size)
File write eGUI function type.
LWord D4D_BOOL
Type definition of eGUI boolean.
char D4D_CHAR
Type definition of eGUI ASCII character.
void D4D_ToUpper(D4D_CHAR *s)
The function convert all small alpha characters to upper in string(terminated by zero) ...
int(* D4DFILE_FSEEK)(D4D_FILEPTR p_file, long offset, int origin)
File seek eGUI function type.
D4D_CHAR * D4D_StrCopyUnicode2Ascii(register D4D_CHAR *sd, register const D4D_WCHAR *ss)
The function copy string one string (UNICODE) to other one (STANDARD 8 bit)(terminated by zero) ...
int D4D_CompareStrings(const D4D_CHAR *s1, const D4D_CHAR *s2)
The function copare two strings (terminated by zero)
int(* D4DLOCALE_TRANSLATE_STR)(const D4D_TCHAR *originTxt, D4D_TCHAR *newTxt, int offset, int size)
String translate function for customizing strings.
const D4DFILE_FUNCTIONS d4d_extsrcFile
D4DLOCALE_TRANSLATE_STR D4DLOCALE_TranslateStr
Pointer to Translate String Function.
D4DFILE_FOPEN D4DFILE_fopen
Pointer to File Open Function.
unsigned short Word
Type definition of Word (unsigned 16-bit).
D4DFILE_WRITE D4DFILE_write
Pointer to File Write Function.
D4D_BOOL D4D_FileIsAbsolutePath(D4D_CHAR *pFileName)
void * D4D_FILEPTR
Type definition of eGUI file pointer.
int D4D_StrLen(register const D4D_CHAR *s)
The function returns length of string terminated by zero.