fix FS#8187 - charging breaks sleep timer. Now if the timer goes off and the player...
[Rockbox.git] / apps / plugins / rockboy / rockmacros.h
blob179de2313fa2ad3e53b104dc7beee99571d8b800
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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__
24 #include "plugin.h"
26 #include "autoconf.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;
33 void vid_init(void);
34 inline void vid_begin(void);
35 void die(char *message, ...);
36 void doevents(void) ICODE_ATTR;
37 void ev_poll(void);
38 int do_user_menu(void);
39 void setvidmode(void);
40 #if defined(HAVE_LCD_COLOR)
41 void set_pal(void);
42 #else
43 void vid_update(int scanline);
44 #endif
45 #ifdef DYNAREC
46 extern struct dynarec_block newblock;
47 void dynamic_recompile (struct dynarec_block *newblock);
48 #endif
50 #define USER_MENU_QUIT -2
52 /* Disable IBSS when using dynarec since it won't fit */
53 #ifdef DYNAREC
54 #undef IBSS_ATTR
55 #define IBSS_ATTR
56 #endif
58 /* libc functions */
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)))
63 #ifdef SIMULATOR
64 #undef open
65 #define open(a,b) rb->sim_open((a),(b))
66 #undef lseek
67 #define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
68 #undef close
69 #define close(a) rb->sim_close((a))
70 #undef read
71 #define read(a,b,c) rb->sim_read((a),(b),(c))
72 #undef write
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;
102 struct options {
103 int A, B, START, SELECT, MENU;
104 int UP, DOWN, LEFT, RIGHT;
105 int frameskip, fps, maxskip;
106 int sound, scaling, showstats;
107 int rotate;
108 int pal;
109 int dirty;
112 bool plugbuf;
114 extern struct options options;
115 #define savedir ROCKBOX_DIR "/rockboy"
117 #endif