2005-03-02 23:49:38 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Michiel van der Kolk, Jens Arnold
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-03-02 23:49:38 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2006-01-20 13:05:52 +00:00
|
|
|
#ifndef __ROCKMACROS_H__
|
|
|
|
#define __ROCKMACROS_H__
|
2005-03-02 23:49:38 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
#include "plugin.h"
|
2005-03-02 23:49:38 +00:00
|
|
|
|
2005-05-07 22:41:17 +00:00
|
|
|
#include "autoconf.h"
|
2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
#define malloc(a) my_malloc(a)
|
|
|
|
void *my_malloc(size_t size);
|
|
|
|
|
2008-05-13 09:57:56 +00:00
|
|
|
extern const struct plugin_api* rb;
|
2005-03-02 23:49:38 +00:00
|
|
|
extern int shut,cleanshut;
|
|
|
|
void vid_init(void);
|
2006-01-20 13:05:52 +00:00
|
|
|
inline void vid_begin(void);
|
2005-03-02 23:49:38 +00:00
|
|
|
void die(char *message, ...);
|
2006-01-20 13:05:52 +00:00
|
|
|
void doevents(void) ICODE_ATTR;
|
2005-03-02 23:49:38 +00:00
|
|
|
void ev_poll(void);
|
2005-03-03 19:54:47 +00:00
|
|
|
int do_user_menu(void);
|
2007-06-24 16:00:55 +00:00
|
|
|
void setvidmode(void);
|
2007-10-16 18:16:22 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
2007-02-06 21:41:08 +00:00
|
|
|
void set_pal(void);
|
2007-10-16 18:16:22 +00:00
|
|
|
#else
|
2007-02-06 21:41:08 +00:00
|
|
|
void vid_update(int scanline);
|
|
|
|
#endif
|
|
|
|
#ifdef DYNAREC
|
|
|
|
extern struct dynarec_block newblock;
|
|
|
|
void dynamic_recompile (struct dynarec_block *newblock);
|
|
|
|
#endif
|
|
|
|
|
2005-03-03 19:54:47 +00:00
|
|
|
#define USER_MENU_QUIT -2
|
|
|
|
|
2007-02-06 21:41:08 +00:00
|
|
|
/* Disable IBSS when using dynarec since it won't fit */
|
|
|
|
#ifdef DYNAREC
|
|
|
|
#undef IBSS_ATTR
|
|
|
|
#define IBSS_ATTR
|
|
|
|
#endif
|
|
|
|
|
2005-03-03 19:54:47 +00:00
|
|
|
/* 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)))
|
2005-03-02 23:49:38 +00:00
|
|
|
|
|
|
|
#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))
|
2007-07-20 17:06:55 +00:00
|
|
|
#undef close
|
2007-10-09 15:37:43 +00:00
|
|
|
#define close(a) rb->sim_close((a))
|
2007-09-08 12:20:53 +00:00
|
|
|
#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))
|
2005-03-02 23:49:38 +00:00
|
|
|
#else /* !SIMULATOR */
|
|
|
|
#define open(a,b) rb->open((a),(b))
|
|
|
|
#define lseek(a,b,c) rb->lseek((a),(b),(c))
|
2006-01-20 13:05:52 +00:00
|
|
|
#define close(a) rb->close((a))
|
2007-09-08 12:20:53 +00:00
|
|
|
#define read(a,b,c) rb->read((a),(b),(c))
|
|
|
|
#define write(a,b,c) rb->write((a),(b),(c))
|
2005-03-02 23:49:38 +00:00
|
|
|
#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__)
|
2005-03-03 19:44:02 +00:00
|
|
|
#define fdprintf(...) rb->fdprintf(__VA_ARGS__)
|
2005-03-02 23:49:38 +00:00
|
|
|
#define tolower(_A_) (isupper(_A_) ? (_A_ - 'A' + 'a') : _A_)
|
|
|
|
|
2005-09-28 17:36:42 +00:00
|
|
|
/* Using #define isn't enough with GCC 4.0.1 */
|
2007-02-06 21:41:08 +00:00
|
|
|
void* memcpy(void* dst, const void* src, size_t size) ICODE_ATTR;
|
2006-01-10 21:55:56 +00:00
|
|
|
|
2006-01-20 13:05:52 +00:00
|
|
|
struct options {
|
|
|
|
int A, B, START, SELECT, MENU;
|
2007-06-24 16:00:55 +00:00
|
|
|
int UP, DOWN, LEFT, RIGHT;
|
2006-01-20 13:05:52 +00:00
|
|
|
int frameskip, fps, maxskip;
|
2007-10-16 18:16:22 +00:00
|
|
|
int sound, scaling, showstats;
|
2007-06-24 16:00:55 +00:00
|
|
|
int rotate;
|
2007-02-06 21:41:08 +00:00
|
|
|
int pal;
|
2007-06-24 16:00:55 +00:00
|
|
|
int dirty;
|
2006-01-20 13:05:52 +00:00
|
|
|
};
|
|
|
|
|
2008-10-18 23:31:29 +00:00
|
|
|
extern bool plugbuf;
|
2007-04-18 07:41:31 +00:00
|
|
|
|
2006-01-20 13:05:52 +00:00
|
|
|
extern struct options options;
|
2007-09-10 09:46:36 +00:00
|
|
|
#define savedir ROCKBOX_DIR "/rockboy"
|
2006-01-20 13:05:52 +00:00
|
|
|
|
|
|
|
#endif
|