From 35e8b1429a2cdcf6580f6d25890fed9865165d0b Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 21 Jun 2010 16:53:00 +0000 Subject: Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with #if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/BUILD_OVERLAY | 2 +- apps/plugins/SOURCES | 4 ++-- apps/plugins/beatbox/beatbox.c | 2 +- apps/plugins/bitmaps/mono/SOURCES | 2 +- apps/plugins/bitmaps/remote_mono/SOURCES | 2 +- apps/plugins/bitmaps/remote_native/SOURCES | 2 +- apps/plugins/chip8.c | 14 +++++++------- apps/plugins/doom/rockdoom.c | 6 +++--- apps/plugins/doom/rockmacros.h | 2 +- apps/plugins/goban.c | 2 +- apps/plugins/imageviewer/imageviewer.h | 2 +- apps/plugins/lib/SOURCES | 6 +++--- apps/plugins/lib/pluginlib_exit.h | 2 +- apps/plugins/lua/rockaux.c | 2 +- apps/plugins/lua/rockconf.h | 2 +- apps/plugins/lua/rocklibc.h | 2 +- apps/plugins/midi/midiutil.h | 2 ++ apps/plugins/pacbox/pacbox_lcd.c | 2 +- apps/plugins/rockboy/rockboy.c | 2 +- apps/plugins/test_codec.c | 2 +- apps/plugins/test_disk.c | 4 ++-- apps/plugins/test_fps.c | 6 +++--- apps/plugins/test_mem.c | 2 +- 23 files changed, 38 insertions(+), 36 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/BUILD_OVERLAY b/apps/plugins/BUILD_OVERLAY index 0afcbfbbf9..dd129333c2 100644 --- a/apps/plugins/BUILD_OVERLAY +++ b/apps/plugins/BUILD_OVERLAY @@ -4,6 +4,6 @@ * they will grep for "YES" to see if overlay plugins must be built */ -#if PLUGIN_BUFFER_SIZE <= 0x20000 && !defined(SIMULATOR) +#if PLUGIN_BUFFER_SIZE <= 0x20000 && (CONFIG_PLATFORM & PLATFORM_NATIVE) YES #endif diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 9e4b66ec14..a63bb922b6 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -65,7 +65,7 @@ iriverify.c -#ifndef SIMULATOR /* those plugins only run on hardware */ +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* those plugins only run on hardware */ /* Overlays loaders */ #if PLUGIN_BUFFER_SIZE <= 0x20000 && defined(HAVE_LCD_BITMAP) @@ -132,7 +132,7 @@ wavplay.c wavrecord.c #endif -#endif /* SIMULATOR */ +#endif /* PLATFORM_NATIVE */ diff --git a/apps/plugins/beatbox/beatbox.c b/apps/plugins/beatbox/beatbox.c index 1a940e1047..a51f738cd2 100644 --- a/apps/plugins/beatbox/beatbox.c +++ b/apps/plugins/beatbox/beatbox.c @@ -125,7 +125,7 @@ PLUGIN_IRAM_DECLARE #undef SYNC -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #define SYNC #endif diff --git a/apps/plugins/bitmaps/mono/SOURCES b/apps/plugins/bitmaps/mono/SOURCES index 0152e92e0d..813ede362c 100644 --- a/apps/plugins/bitmaps/mono/SOURCES +++ b/apps/plugins/bitmaps/mono/SOURCES @@ -61,6 +61,6 @@ superdom_boarditems.160x128x1.bmp #endif #endif /* HAVE_LCD_BITMAP */ -#if defined(SIMULATOR) && defined(__APPLE__) +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) osx.dummy.bmp #endif diff --git a/apps/plugins/bitmaps/remote_mono/SOURCES b/apps/plugins/bitmaps/remote_mono/SOURCES index c59aab6107..b6be5138c9 100644 --- a/apps/plugins/bitmaps/remote_mono/SOURCES +++ b/apps/plugins/bitmaps/remote_mono/SOURCES @@ -1,3 +1,3 @@ -#if defined(SIMULATOR) && defined(__APPLE__) +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) osx.dummy.bmp #endif diff --git a/apps/plugins/bitmaps/remote_native/SOURCES b/apps/plugins/bitmaps/remote_native/SOURCES index 2bc3d59c07..b3cc2157ff 100644 --- a/apps/plugins/bitmaps/remote_native/SOURCES +++ b/apps/plugins/bitmaps/remote_native/SOURCES @@ -1,4 +1,4 @@ -#if defined(SIMULATOR) && defined(__APPLE__) +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) osx.dummy.bmp #endif diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index be66d6351f..a1372cd608 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c @@ -1185,7 +1185,7 @@ static byte chip8_keymap[16]; static unsigned long starttimer; /* Timer value at the beginning */ static unsigned long cycles; /* Number of update cycles (50Hz) */ -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) static bool is_playing; /* one frame of bitswapped mp3 data */ @@ -1208,14 +1208,14 @@ static void callback(unsigned char** start, size_t* size) *start = beep; /* give it the same frame again */ *size = sizeof(beep); } -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ /****************************************************************************/ /* Turn sound on */ /****************************************************************************/ static void chip8_sound_on (void) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) if (!is_playing) rb->mp3_play_pause(true); /* kickoff audio */ #endif @@ -1226,7 +1226,7 @@ static void chip8_sound_on (void) /****************************************************************************/ static void chip8_sound_off (void) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) if (!is_playing) rb->mp3_play_pause(false); /* pause audio */ #endif @@ -1266,7 +1266,7 @@ static void chip8_update_display(void) *row++ = w; } } -#if defined(SIMULATOR) || (LCD_DEPTH > 1) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || (LCD_DEPTH > 1) rb->lcd_set_drawmode(DRMODE_SOLID); rb->lcd_mono_bitmap(lcd_framebuf[0], CHIP8_X, CHIP8_Y, CHIP8_LCDWIDTH, CHIP8_HEIGHT); @@ -1428,7 +1428,7 @@ static bool chip8_run(const char* file) #endif rb->lcd_update(); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* init sound */ is_playing = rb->mp3_is_playing(); /* would we disturb playback? */ if (!is_playing) /* no? then we can make sound */ @@ -1442,7 +1442,7 @@ static bool chip8_run(const char* file) cycles = 0; chip8(); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) if (!is_playing) { /* stop it if we used audio */ rb->mp3_play_stop(); /* Stop audio playback */ diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 26afdd93db..042212812a 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c @@ -62,7 +62,7 @@ int fileexists(const char * fname) return -1; } -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) int my_open(const char *file, int flags, ...) { if(fpoint==8) @@ -111,7 +111,7 @@ int my_close(int id) bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) // Here is a hacked up printf command to get the output from the game. int printf(const char *fmt, ...) { @@ -751,7 +751,7 @@ enum plugin_status plugin_start(const void* parameter) printf("There were still: %d files open\n", fpoint); while(fpoint>0) { -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) close(filearray[fpoint]); #else rb->close(filearray[fpoint]); diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index 89c943622a..3276aa1539 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h @@ -42,7 +42,7 @@ char *my_strtok( char * s, const char * delim ); #undef read_line #define read_line(a,b,c) rb->read_line((a),(b),(c)) -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #define open(a, ...) rb->open((a), __VA_ARGS__) #define close(a) rb->close((a)) #else diff --git a/apps/plugins/goban.c b/apps/plugins/goban.c index 8c8aa7a449..7bb6744dde 100644 --- a/apps/plugins/goban.c +++ b/apps/plugins/goban.c @@ -20,7 +20,7 @@ ****************************************************************************/ #include "plugin.h" -#if PLUGIN_BUFFER_SIZE < 0x10000 && !defined(SIMULATOR) +#if PLUGIN_BUFFER_SIZE < 0x10000 && (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "lib/overlay.h" diff --git a/apps/plugins/imageviewer/imageviewer.h b/apps/plugins/imageviewer/imageviewer.h index 5f22b03e97..79ac5ed9f1 100644 --- a/apps/plugins/imageviewer/imageviewer.h +++ b/apps/plugins/imageviewer/imageviewer.h @@ -386,7 +386,7 @@ #define PLUGIN_ABORT 11 #define PLUGIN_OUTOFMEM 12 -#if !defined(SIMULATOR) && defined(HAVE_DISK_STORAGE) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) && defined(HAVE_DISK_STORAGE) #define DISK_SPINDOWN #endif #if PLUGIN_BUFFER_SIZE >= MIN_MEM diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 2c4209b6d2..fa12f94730 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -28,7 +28,7 @@ grey_sh.S #endif /* HAVE_LCD_BITMAP && LCD_DEPTH < 4 */ -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) overlay.c #endif @@ -76,7 +76,7 @@ pluginlib_albumart.c pluginlib_touchscreen.c #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef CPU_ARM ../../codecs/lib/setjmp_arm.S @@ -90,4 +90,4 @@ pluginlib_touchscreen.c ../../codecs/lib/setjmp_mips.S #endif -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ diff --git a/apps/plugins/lib/pluginlib_exit.h b/apps/plugins/lib/pluginlib_exit.h index 6cded9d56f..00cbc8dc7f 100644 --- a/apps/plugins/lib/pluginlib_exit.h +++ b/apps/plugins/lib/pluginlib_exit.h @@ -23,7 +23,7 @@ #define __PLUGINLIB_EXIT_H__ #include "config.h" -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "../../codecs/lib/setjmp.h" #else #include diff --git a/apps/plugins/lua/rockaux.c b/apps/plugins/lua/rockaux.c index 1f832d4cc7..f10a1cb021 100644 --- a/apps/plugins/lua/rockaux.c +++ b/apps/plugins/lua/rockaux.c @@ -24,7 +24,7 @@ #define _ROCKCONF_H_ /* Protect against unwanted include */ #include "lua.h" -#if !defined(SIMULATOR) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) int errno = 0; #endif diff --git a/apps/plugins/lua/rockconf.h b/apps/plugins/lua/rockconf.h index 7fbc89f166..dd7f98f1d7 100644 --- a/apps/plugins/lua/rockconf.h +++ b/apps/plugins/lua/rockconf.h @@ -31,7 +31,7 @@ #undef LUA_PATH_DEFAULT #define LUA_PATH_DEFAULT "$/?.lua;" "$/?/init.lua;" VIEWERS_DIR"/lua/?.lua;" VIEWERS_DIR"/lua/?/init.lua;" -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "../../codecs/lib/setjmp.h" #else #include diff --git a/apps/plugins/lua/rocklibc.h b/apps/plugins/lua/rocklibc.h index 9b68f429d2..44f916fded 100644 --- a/apps/plugins/lua/rocklibc.h +++ b/apps/plugins/lua/rocklibc.h @@ -26,7 +26,7 @@ #include #include "plugin.h" -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #include #define PREFIX(_x_) sim_ ## _x_ #else diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index b1ed6569b7..d7a252035d 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h @@ -39,6 +39,8 @@ improved to increase MAX_VOICES for targets that can do 22kHz */ #ifdef CPU_PP #define MAX_VOICES 16 +#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) +#define MAX_VOICES 48 #else #define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */ #endif /* CPU_PP */ diff --git a/apps/plugins/pacbox/pacbox_lcd.c b/apps/plugins/pacbox/pacbox_lcd.c index 64b12f08eb..c4df2fa6cd 100644 --- a/apps/plugins/pacbox/pacbox_lcd.c +++ b/apps/plugins/pacbox/pacbox_lcd.c @@ -28,7 +28,7 @@ #include "arcade.h" #include "hardware.h" -#if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES) +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) || !defined(IRIVER_H300_SERIES) void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf) { diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index b95cd6d0ff..797971c734 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -403,7 +403,7 @@ enum plugin_status plugin_start(const void* parameter) = rb->plugin_get_audio_buffer(&audio_buffer_free); plugbuf=false; } -#if MEM <= 8 && !defined(SIMULATOR) +#if MEM <= 8 && (CONFIG_PLATFORM & PLATFORM_NATIVE) /* loaded as an overlay plugin, protect from overwriting ourselves */ if ((unsigned)(plugin_start_addr - (unsigned char *)audio_bufferbase) < audio_buffer_free) diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index 9598881790..77ad9c9530 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -697,7 +697,7 @@ static enum plugin_status test_track(const char* filename) rb->snprintf(str,sizeof(str),"%d.%02d%% realtime",(int)speed/100,(int)speed%100); log_text(str,true); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* show effective clockrate in MHz needed for realtime decoding */ if (speed > 0) { diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c index 443e9eb18b..08e1a39704 100644 --- a/apps/plugins/test_disk.c +++ b/apps/plugins/test_disk.c @@ -114,7 +114,7 @@ static bool test_fs(void) log_init(); log_text("test_disk WRITE&VERIFY", true); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz", *rb->cpu_frequency); log_text(text_buf, true); @@ -304,7 +304,7 @@ static bool test_speed(void) rb->memset(audiobuf, 'T', audiobuflen); log_init(); log_text("test_disk SPEED TEST", true); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) rb->snprintf(text_buf, sizeof(text_buf), "CPU clock: %ld Hz", *rb->cpu_frequency); log_text(text_buf, true); diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c index 52a56d5954..62e7f489b0 100644 --- a/apps/plugins/test_fps.c +++ b/apps/plugins/test_fps.c @@ -340,7 +340,7 @@ static void time_greyscale(void) /* plugin entry point */ enum plugin_status plugin_start(const void* parameter) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) char str[32]; int cpu_freq; #endif @@ -350,7 +350,7 @@ enum plugin_status plugin_start(const void* parameter) (void)parameter; log_init(); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ #endif backlight_force_on(); /* backlight control in lib/helper.c */ @@ -370,7 +370,7 @@ enum plugin_status plugin_start(const void* parameter) time_remote_update(); #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) if (*rb->cpu_frequency != cpu_freq) rb->snprintf(str, sizeof(str), "CPU clock changed!"); else diff --git a/apps/plugins/test_mem.c b/apps/plugins/test_mem.c index 2a8582bc45..f648c0073a 100644 --- a/apps/plugins/test_mem.c +++ b/apps/plugins/test_mem.c @@ -194,7 +194,7 @@ enum plugin_status plugin_start(const void* parameter) rb->screens[0]->clear_display(); rb->screens[0]->putsf(0, line++, "%s", boost?"boosted":"unboosted"); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) rb->screens[0]->putsf(0, line++, "clock: %d Hz", *rb->cpu_frequency); #endif rb->screens[0]->putsf(0, line++, "loop#: %d", ++count); -- cgit v1.2.3