1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2005 Michiel van der Kolk, Jens Arnold
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __ROCKMACROS_H__
#define __ROCKMACROS_H__
#include "plugin.h"
#include "autoconf.h"
#define malloc(a) my_malloc(a)
void *my_malloc(size_t size);
extern struct plugin_api* rb;
extern int shut,cleanshut;
void vid_init(void);
inline void vid_begin(void);
void die(char *message, ...);
void *sys_timer(void);
int sys_elapsed(long *oldtick);
int pcm_submit(void);
void pcm_init(void);
void doevents(void) ICODE_ATTR;
void ev_poll(void);
int do_user_menu(void);
void loadstate(int fd);
void savestate(int fd);
void setvidmode(void);
void set_pal(void);
#if !defined(HAVE_LCD_COLOR)
void vid_update(int scanline);
#endif
#ifdef DYNAREC
extern struct dynarec_block newblock;
void dynamic_recompile (struct dynarec_block *newblock);
#endif
#define USER_MENU_QUIT -2
/* Disable ICODE for the ARMs */
#ifdef CPU_ARM
#undef ICODE_ATTR
#define ICODE_ATTR
#endif
/* Disable IBSS when using dynarec since it won't fit */
#ifdef DYNAREC
#undef IBSS_ATTR
#define IBSS_ATTR
#endif
/* libc functions */
#define isdigit(c) ((c) >= '0' && (c) <= '9')
#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
#define isalnum(c) (isdigit(c) || (isalpha(c)))
#ifdef SIMULATOR
#undef open
#define open(a,b) rb->sim_open((a),(b))
#undef lseek
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
#undef close
#define close(a) rb->sim_close((a))
#undef read
#define read(a,b,c) rb->sim_read((a),(b),(c))
#undef write
#define write(a,b,c) rb->sim_write((a),(b),(c))
#else /* !SIMULATOR */
#define open(a,b) rb->open((a),(b))
#define lseek(a,b,c) rb->lseek((a),(b),(c))
#define close(a) rb->close((a))
#define read(a,b,c) rb->read((a),(b),(c))
#define write(a,b,c) rb->write((a),(b),(c))
#endif /* !SIMULATOR */
#define strcat(a,b) rb->strcat((a),(b))
#define memset(a,b,c) rb->memset((a),(b),(c))
#define strcpy(a,b) rb->strcpy((a),(b))
#define strncpy(a,b,c) rb->strncpy((a),(b),(c))
#define strlen(a) rb->strlen((a))
#define strcmp(a,b) rb->strcmp((a),(b))
#define strchr(a,b) rb->strchr((a),(b))
#define strrchr(a,b) rb->strrchr((a),(b))
#define strcasecmp(a,b) rb->strcasecmp((a),(b))
#define srand(a) rb->srand((a))
#define rand() rb->rand()
#define atoi(a) rb->atoi((a))
#define strcat(a,b) rb->strcat((a),(b))
#define snprintf(...) rb->snprintf(__VA_ARGS__)
#define fdprintf(...) rb->fdprintf(__VA_ARGS__)
#define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_)
/* Using #define isn't enough with GCC 4.0.1 */
void* memcpy(void* dst, const void* src, size_t size) ICODE_ATTR;
struct options {
int A, B, START, SELECT, MENU;
int UP, DOWN, LEFT, RIGHT;
int frameskip, fps, maxskip;
int sound, fullscreen, showstats;
int rotate;
int pal;
int dirty;
};
bool plugbuf;
extern struct options options;
#define savedir ROCKBOX_DIR "/rockboy"
#endif
|