1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2005 Michiel van der Kolk, Jens Arnold
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __ROCKMACROS_H__
22 #define __ROCKMACROS_H__
28 #define malloc(a) my_malloc(a)
29 void *my_malloc(size_t size
);
31 extern const struct plugin_api
* rb
;
32 extern int shut
,cleanshut
;
34 inline void vid_begin(void);
35 void die(char *message
, ...);
36 void doevents(void) ICODE_ATTR
;
38 int do_user_menu(void);
39 void setvidmode(void);
40 #if defined(HAVE_LCD_COLOR)
43 void vid_update(int scanline
);
46 extern struct dynarec_block newblock
;
47 void dynamic_recompile (struct dynarec_block
*newblock
);
50 #define USER_MENU_QUIT -2
52 /* Disable IBSS when using dynarec since it won't fit */
59 #define isdigit(c) ((c) >= '0' && (c) <= '9')
60 #define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
61 #define isalnum(c) (isdigit(c) || (isalpha(c)))
65 #define open(a,b) rb->sim_open((a),(b))
67 #define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
69 #define close(a) rb->sim_close((a))
71 #define read(a,b,c) rb->sim_read((a),(b),(c))
73 #define write(a,b,c) rb->sim_write((a),(b),(c))
74 #else /* !SIMULATOR */
75 #define open(a,b) rb->open((a),(b))
76 #define lseek(a,b,c) rb->lseek((a),(b),(c))
77 #define close(a) rb->close((a))
78 #define read(a,b,c) rb->read((a),(b),(c))
79 #define write(a,b,c) rb->write((a),(b),(c))
80 #endif /* !SIMULATOR */
82 #define strcat(a,b) rb->strcat((a),(b))
83 #define memset(a,b,c) rb->memset((a),(b),(c))
84 #define strcpy(a,b) rb->strcpy((a),(b))
85 #define strncpy(a,b,c) rb->strncpy((a),(b),(c))
86 #define strlen(a) rb->strlen((a))
87 #define strcmp(a,b) rb->strcmp((a),(b))
88 #define strchr(a,b) rb->strchr((a),(b))
89 #define strrchr(a,b) rb->strrchr((a),(b))
90 #define strcasecmp(a,b) rb->strcasecmp((a),(b))
91 #define srand(a) rb->srand((a))
92 #define rand() rb->rand()
93 #define atoi(a) rb->atoi((a))
94 #define strcat(a,b) rb->strcat((a),(b))
95 #define snprintf(...) rb->snprintf(__VA_ARGS__)
96 #define fdprintf(...) rb->fdprintf(__VA_ARGS__)
97 #define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_)
99 /* Using #define isn't enough with GCC 4.0.1 */
100 void* memcpy(void* dst
, const void* src
, size_t size
) ICODE_ATTR
;
103 int A
, B
, START
, SELECT
, MENU
;
104 int UP
, DOWN
, LEFT
, RIGHT
;
105 int frameskip
, fps
, maxskip
;
106 int sound
, scaling
, showstats
;
114 extern struct options options
;
115 #define savedir ROCKBOX_DIR "/rockboy"