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/audio_path.c | 6 ++--- apps/bitmaps/mono/SOURCES | 2 +- apps/bitmaps/remote_mono/SOURCES | 2 +- apps/buffering.c | 2 +- apps/codecs.c | 22 ++++++++--------- apps/codecs.h | 2 +- apps/codecs/codec_crt0.c | 2 +- apps/codecs/lib/SOURCES | 2 +- apps/codecs/lib/tlsf/src/tlsf.c | 4 +++- apps/codecs/libm4a/demux.c | 4 +--- apps/codecs/libspc/spc_codec.h | 2 +- apps/codecs/libtremor/ctype.c | 3 ++- apps/debug_menu.c | 38 +++++++++++++++--------------- apps/filetree.c | 2 +- apps/main.c | 4 +++- apps/menus/main_menu.c | 2 +- apps/misc.c | 2 +- apps/pcmbuf.c | 2 +- apps/playback.c | 6 ++--- apps/playlist.c | 2 +- apps/plugin.c | 30 +++++++++++------------ apps/plugin.h | 24 +++++++++---------- 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 +- apps/radio/radio.c | 4 ++-- apps/recorder/peakmeter.c | 6 ++--- apps/scrobbler.c | 3 ++- apps/settings.c | 2 +- apps/status.h | 2 +- apps/tagcache.c | 2 +- 51 files changed, 132 insertions(+), 126 deletions(-) (limited to 'apps') diff --git a/apps/audio_path.c b/apps/audio_path.c index 0469d4412a..dab43ebf42 100644 --- a/apps/audio_path.c +++ b/apps/audio_path.c @@ -42,7 +42,7 @@ #endif #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef AUDIO_CPU_BOOST static void audio_cpu_boost(bool state) @@ -115,7 +115,7 @@ int audio_get_spdif_sample_rate(void) } /* audio_get_spdif_sample_rate */ #endif /* HAVE_SPDIF_IN */ -#else /* SIMULATOR */ +#else /* PLATFORM_HOSTED */ /** Sim stubs **/ @@ -153,4 +153,4 @@ int audio_get_spdif_sample_rate(void) } /* audio_get_spdif_sample_rate */ #endif /* HAVE_SPDIF_IN */ -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ diff --git a/apps/bitmaps/mono/SOURCES b/apps/bitmaps/mono/SOURCES index 4d9008e8a3..2dccf2ad4f 100644 --- a/apps/bitmaps/mono/SOURCES +++ b/apps/bitmaps/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/bitmaps/remote_mono/SOURCES b/apps/bitmaps/remote_mono/SOURCES index 83b71c10b2..75f641fd95 100644 --- a/apps/bitmaps/remote_mono/SOURCES +++ b/apps/bitmaps/remote_mono/SOURCES @@ -1,3 +1,3 @@ -#if defined(SIMULATOR) && defined(__APPLE__) +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) osx_remote_dummy.bmp #endif diff --git a/apps/buffering.c b/apps/buffering.c index 8a6418fd22..c2cecddf03 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -1488,7 +1488,7 @@ void buffering_thread(void) base_handle_id = (int)ev.data; break; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) case SYS_USB_CONNECTED: LOGFQUEUE("buffering < SYS_USB_CONNECTED"); usb_acknowledge(SYS_USB_CONNECTED_ACK); diff --git a/apps/codecs.c b/apps/codecs.c index 46d9223560..22e692c111 100644 --- a/apps/codecs.c +++ b/apps/codecs.c @@ -54,20 +54,20 @@ #define LOGF_ENABLE #include "logf.h" -#ifdef SIMULATOR -#define PREFIX(_x_) sim_ ## _x_ -#else -#define PREFIX -#endif +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) -#ifdef SIMULATOR +#define PREFIX(_x_) sim_ ## _x_ #if CONFIG_CODEC == SWCODEC unsigned char codecbuf[CODEC_SIZE]; #endif void *sim_codec_load_ram(char* codecptr, int size, void **pd); void sim_codec_close(void *pd); -#else + +#else /* !PLATFORM_HOSTED */ + +#define PREFIX #define sim_codec_close(x) + #endif size_t codec_size; @@ -77,7 +77,7 @@ extern void* plugin_get_audio_buffer(size_t *buffer_size); #undef open static int open(const char* pathname, int flags, ...) { -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) int fd; if (flags & O_CREAT) { @@ -201,7 +201,7 @@ static int codec_load_ram(int size, struct codec_api *api) { struct codec_header *hdr; int status; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) hdr = (struct codec_header *)codecbuf; if (size <= (signed)sizeof(struct codec_header) @@ -220,7 +220,7 @@ static int codec_load_ram(int size, struct codec_api *api) codec_size = hdr->end_addr - codecbuf; -#else /* SIMULATOR */ +#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) void *pd; hdr = sim_codec_load_ram(codecbuf, size, &pd); @@ -241,7 +241,7 @@ static int codec_load_ram(int size, struct codec_api *api) codec_size = codecbuf - codecbuf; -#endif /* SIMULATOR */ +#endif /* CONFIG_PLATFORM */ if (hdr->api_version > CODEC_API_VERSION || hdr->api_version < CODEC_MIN_API_VERSION) { sim_codec_close(pd); diff --git a/apps/codecs.h b/apps/codecs.h index 27c9caba13..c3dbc4aaa3 100644 --- a/apps/codecs.h +++ b/apps/codecs.h @@ -254,7 +254,7 @@ extern unsigned char codecbuf[]; extern size_t codec_size; #ifdef CODEC -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* plugin_* is correct, codecs use the plugin linker script */ extern unsigned char plugin_start_addr[]; extern unsigned char plugin_end_addr[]; diff --git a/apps/codecs/codec_crt0.c b/apps/codecs/codec_crt0.c index ed313634e3..dd0f99ffd8 100644 --- a/apps/codecs/codec_crt0.c +++ b/apps/codecs/codec_crt0.c @@ -36,7 +36,7 @@ extern enum codec_status codec_main(void); enum codec_status codec_start(void) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef USE_IRAM ci->memcpy(iramstart, iramcopy, iramend - iramstart); ci->memset(iedata, 0, iend - iedata); diff --git a/apps/codecs/lib/SOURCES b/apps/codecs/lib/SOURCES index da77f97d30..49e744721d 100644 --- a/apps/codecs/lib/SOURCES +++ b/apps/codecs/lib/SOURCES @@ -24,6 +24,6 @@ setjmp_cf.S setjmp_mips.S #endif -#elif defined(SIMULATOR) && defined(__APPLE__) +#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(__APPLE__) osx.dummy.c #endif diff --git a/apps/codecs/lib/tlsf/src/tlsf.c b/apps/codecs/lib/tlsf/src/tlsf.c index 570e472607..87f8d262ee 100644 --- a/apps/codecs/lib/tlsf/src/tlsf.c +++ b/apps/codecs/lib/tlsf/src/tlsf.c @@ -104,6 +104,7 @@ #include #endif +#include "config.h" #include "tlsf.h" #if !defined(__GNUC__) @@ -164,7 +165,8 @@ #define PAGE_SIZE (getpagesize()) #endif -#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX) +#if defined(ROCKBOX) && (CONFIG_PLATFORM & PLATFORM_HOSTED) && defined(DEBUG) \ + || !defined(ROCKBOX) int printf(const char* fmt, ...); #define PRINT_MSG(fmt, args...) printf(fmt, ## args) #define ERROR_MSG(fmt, args...) printf(fmt, ## args) diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c index 8c7189e158..bde2238409 100644 --- a/apps/codecs/libm4a/demux.c +++ b/apps/codecs/libm4a/demux.c @@ -37,10 +37,8 @@ #include "m4a.h" -#if defined(DEBUG) || defined(SIMULATOR) -#ifdef DEBUGF #undef DEBUGF -#endif +#if defined(DEBUG) #define DEBUGF qtmovie->stream->ci->debugf #else #define DEBUGF(...) diff --git a/apps/codecs/libspc/spc_codec.h b/apps/codecs/libspc/spc_codec.h index 95d09fa091..b3a445c596 100644 --- a/apps/codecs/libspc/spc_codec.h +++ b/apps/codecs/libspc/spc_codec.h @@ -51,7 +51,7 @@ /* TGB is the only target fast enough for gaussian and realtime BRR decode */ /* echo is almost fast enough but not quite */ #if defined(TOSHIBA_GIGABEAT_F) || defined(TOSHIBA_GIGABEAT_S) ||\ - defined(SIMULATOR) || MEMORYSIZE <= 2 + (CONFIG_PLATFORM & PLATFORM_HOSTED) || MEMORYSIZE <= 2 /* Don't cache BRR waves */ #define SPC_BRRCACHE 0 diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c index 359be61e5a..9f22047675 100644 --- a/apps/codecs/libtremor/ctype.c +++ b/apps/codecs/libtremor/ctype.c @@ -1,3 +1,4 @@ -#ifndef SIMULATOR +#include "config.h" +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "libc/ctype.c" #endif diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 8da022453d..bd969df0c0 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -53,7 +53,7 @@ #include "lcd-remote.h" #include "crc32.h" #include "logf.h" -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "disk.h" #include "adc.h" #include "power.h" @@ -276,7 +276,7 @@ static unsigned int ticks, boost_ticks, freq_sum; static void dbg_audio_task(void) { -#ifndef SIMULATOR +#ifdef CPUFREQ_NORMAL if(FREQ > CPUFREQ_NORMAL) boost_ticks++; freq_sum += FREQ/1000000; /* in MHz */ @@ -371,7 +371,7 @@ static bool dbg_buffering_thread(void) screens[i].putsf(0, line++, "handle count: %d", (int)d.num_handles); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) screens[i].putsf(0, line++, "cpu freq: %3dMHz", (int)((FREQ + 500000) / 1000000)); #endif @@ -758,7 +758,7 @@ static bool dbg_hw_info(void) #endif /* !HAVE_LCD_BITMAP */ #endif /* !SIMULATOR */ -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) static const char* dbg_partitions_getname(int selected_item, void *data, char *buffer, size_t buffer_len) { @@ -786,7 +786,7 @@ bool dbg_partitions(void) info.get_name = dbg_partitions_getname; return simplelist_show_list(&info); } -#endif +#endif /* PLATFORM_NATIVE */ #if defined(CPU_COLDFIRE) && defined(HAVE_SPDIF_OUT) static bool dbg_spdif(void) @@ -928,7 +928,7 @@ static bool dbg_spdif(void) lcd_putsf(0, line++, "Clock accuracy: %d", x); line++; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) lcd_putsf(0, line++, "Measured freq: %ldHz", spdif_measure_frequency()); #endif @@ -950,7 +950,7 @@ static bool dbg_spdif(void) } #endif /* CPU_COLDFIRE */ -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef HAVE_LCD_BITMAP /* button definitions */ #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ @@ -1334,9 +1334,9 @@ bool dbg_ports(void) return false; } #endif /* !HAVE_LCD_BITMAP */ -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ -#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) +#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE) static bool dbg_pcf(void) { int line; @@ -1423,7 +1423,7 @@ static bool dbg_cpufreq(void) } #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#if defined(HAVE_TSC2100) && !defined(SIMULATOR) +#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "tsc2100.h" static char *itob(int n, int len) { @@ -1493,7 +1493,7 @@ static bool tsc2100_debug(void) return simplelist_show_list(&info); } #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef HAVE_LCD_BITMAP /* * view_battery() shows a automatically scaled graph of the battery voltage @@ -1785,7 +1785,7 @@ static bool view_battery(void) #endif /* HAVE_LCD_BITMAP */ #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) #if (CONFIG_STORAGE & STORAGE_MMC) @@ -2106,7 +2106,7 @@ static bool dbg_disk_info(void) info.scroll_all = true; return simplelist_show_list(&info); } -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ #ifdef HAVE_DIRCACHE static int dircache_callback(int btn, struct gui_synclist *lists) @@ -2672,10 +2672,10 @@ static const struct the_menu_item menuitems[] = { || CONFIG_CPU == DM320 || defined(CPU_S5L870X) || CONFIG_CPU == AS3525v2 { "View I/O ports", dbg_ports }, #endif -#if (CONFIG_RTC == RTC_PCF50605) && !defined(SIMULATOR) +#if (CONFIG_RTC == RTC_PCF50605) && (CONFIG_PLATFORM & PLATFORM_NATIVE) { "View PCF registers", dbg_pcf }, #endif -#if defined(HAVE_TSC2100) && !defined(SIMULATOR) +#if defined(HAVE_TSC2100) && (CONFIG_PLATFORM & PLATFORM_NATIVE) { "TSC2100 debug", tsc2100_debug }, #endif #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -2689,18 +2689,18 @@ static const struct the_menu_item menuitems[] = { #endif { "View OS stacks", dbg_os }, #ifdef HAVE_LCD_BITMAP -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) { "View battery", view_battery }, #endif { "Screendump", dbg_screendump }, #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) { "View HW info", dbg_hw_info }, #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) { "View partitions", dbg_partitions }, #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) { "View disk info", dbg_disk_info }, #if (CONFIG_STORAGE & STORAGE_ATA) { "Dump ATA identify info", dbg_identify_info}, diff --git a/apps/filetree.c b/apps/filetree.c index 1faf4c987e..460ab9e453 100644 --- a/apps/filetree.c +++ b/apps/filetree.c @@ -597,7 +597,7 @@ int ft_enter(struct tree_context* c) break; #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* firmware file */ case FILE_ATTR_MOD: splash(0, ID2P(LANG_WAIT)); diff --git a/apps/main.c b/apps/main.c index 2555deb12f..19249241bb 100644 --- a/apps/main.c +++ b/apps/main.c @@ -115,6 +115,8 @@ #ifdef SIMULATOR #include "sim_tasks.h" +#endif +#ifdef HAVE_SDL #include "system-sdl.h" #endif @@ -313,7 +315,7 @@ static void init_tagcache(void) } #endif -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) static void init(void) { diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 3dd6348e57..32164ff3e0 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c @@ -347,7 +347,7 @@ static int info_action_callback(int action, struct gui_synclist *lists) #endif ) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) struct info_data *info = (struct info_data *)lists->data; int i; info->new_data = true; diff --git a/apps/misc.c b/apps/misc.c index 41988363ad..bae8dfbd07 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -251,7 +251,7 @@ static void system_restore(void) static bool clean_shutdown(void (*callback)(void *), void *parameter) { -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (void)callback; (void)parameter; bookmark_autobookmark(false); diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index e9102b2a73..ebc31fbb2e 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c @@ -30,7 +30,7 @@ /* Define LOGF_ENABLE to enable logf output in this file */ /*#define LOGF_ENABLE*/ #include "logf.h" -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #include "cpu.h" #endif #include diff --git a/apps/playback.c b/apps/playback.c index 6be869f83a..4a28a9d008 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -468,7 +468,7 @@ unsigned char *audio_get_recording_buffer(size_t *buffer_size) bool audio_load_encoder(int afmt) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) const char *enc_fn = get_codec_filename(afmt | CODEC_TYPE_ENCODER); if (!enc_fn) return false; @@ -493,7 +493,7 @@ bool audio_load_encoder(int afmt) void audio_remove_encoder(void) { -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) /* force encoder codec unload (if currently loaded) */ if (ci.enc_codec_loaded <= 0) return; @@ -2008,7 +2008,7 @@ static void audio_thread(void) LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); audio_finalise_track_change(); break; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) case SYS_USB_CONNECTED: LOGFQUEUE("audio < SYS_USB_CONNECTED"); if (playing) diff --git a/apps/playlist.c b/apps/playlist.c index 485601cd7e..4a6db883f7 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -1318,7 +1318,7 @@ static void playlist_thread(void) dirty_pointers = false; break ; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) case SYS_USB_CONNECTED: usb_acknowledge(SYS_USB_CONNECTED_ACK); usb_wait_for_disconnect(&playlist_queue); diff --git a/apps/plugin.c b/apps/plugin.c index d626ef6488..56d2be9f40 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -57,7 +57,7 @@ #include "usbstack/usb_hid.h" #endif -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #define PREFIX(_x_) sim_ ## _x_ #else #define PREFIX @@ -72,7 +72,7 @@ static unsigned int open_files; #endif -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; void *sim_plugin_load(char *plugin, void **pd); void sim_plugin_close(void *pd); @@ -157,7 +157,7 @@ static const struct plugin_api rockbox_api = { lcd_yuv_set_options, #endif #endif /* MEMORYSIZE > 2 */ -#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) +#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE) lcd_blit_mono, lcd_blit_grey_phase, #endif /* LCD_DEPTH */ @@ -366,7 +366,7 @@ static const struct plugin_api rockbox_api = { #endif reset_poweroff_timer, -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) system_memory_guard, &cpu_frequency, @@ -377,7 +377,7 @@ static const struct plugin_api rockbox_api = { cpu_boost, #endif #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ #ifdef HAVE_SCHEDULER_BOOSTCTRL trigger_cpu_boost, cancel_cpu_boost, @@ -415,7 +415,7 @@ static const struct plugin_api rockbox_api = { remove_event, send_event, -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) /* special simulator hooks */ #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 sim_lcd_ex_init, @@ -437,7 +437,7 @@ static const struct plugin_api rockbox_api = { memset, memcpy, memmove, -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) _ctype_, #endif atoi, @@ -467,7 +467,7 @@ static const struct plugin_api rockbox_api = { #ifdef AUDIOHW_HAVE_EQ sound_enum_hw_eq_band_setting, #endif -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) mp3_play_data, mp3_play_pause, mp3_play_stop, @@ -589,7 +589,7 @@ static const struct plugin_api rockbox_api = { battery_level, battery_level_safe, battery_time, -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) battery_voltage, #endif #if CONFIG_CHARGING @@ -603,7 +603,7 @@ static const struct plugin_api rockbox_api = { #endif /* misc */ -#if !defined(SIMULATOR) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) &errno, #endif srand, @@ -727,15 +727,15 @@ int plugin_load(const char* plugin, const void* parameter) { int rc, i; struct plugin_header *hdr; -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) void *pd; -#else /* !SIMULATOR */ +#else /* PLATFOR_NATIVE */ int fd; ssize_t readsize; #if NUM_CORES > 1 unsigned my_core; #endif -#endif /* !SIMULATOR */ +#endif /* CONFIG_PLATFORM */ #if LCD_DEPTH > 1 fb_data* old_backdrop; @@ -755,7 +755,7 @@ int plugin_load(const char* plugin, const void* parameter) splash(0, ID2P(LANG_WAIT)); strcpy(current_plugin, plugin); -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) hdr = sim_plugin_load((char *)plugin, &pd); if (pd == NULL) { splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); @@ -990,7 +990,7 @@ static int open_wrapper(const char* pathname, int flags, ...) /* we don't have an 'open' function. it's a define. and we need * the real file_open, hence PREFIX() doesn't work here */ int fd; -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) if (flags & O_CREAT) { va_list ap; diff --git a/apps/plugin.h b/apps/plugin.h index a6b864ba44..b0f4e051c5 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -233,7 +233,7 @@ struct plugin_api { void (*lcd_yuv_set_options)(unsigned options); #endif #endif /* MEMORYSIZE > 2 */ -#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) +#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE) void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width, int bheight, int stride); void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases, @@ -474,7 +474,7 @@ struct plugin_api { #endif void (*reset_poweroff_timer)(void); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) int (*system_memory_guard)(int newmode); long *cpu_frequency; #ifdef HAVE_ADJUSTABLE_CPU_FREQ @@ -484,7 +484,7 @@ struct plugin_api { void (*cpu_boost)(bool on_off); #endif #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ #ifdef HAVE_SCHEDULER_BOOSTCTRL void (*trigger_cpu_boost)(void); void (*cancel_cpu_boost)(void); @@ -530,7 +530,7 @@ struct plugin_api { void (*remove_event)(unsigned short id, void (*handler)(void *data)); void (*send_event)(unsigned short id, void *data); -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) /* special simulator hooks */ #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int)); @@ -553,7 +553,7 @@ struct plugin_api { void* (*memset)(void *dst, int c, size_t length); void* (*memcpy)(void *out, const void *in, size_t n); void* (*memmove)(void *out, const void *in, size_t n); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) const unsigned char *_rbctype_; #endif int (*atoi)(const char *str); @@ -584,7 +584,7 @@ struct plugin_api { int (*sound_enum_hw_eq_band_setting)(unsigned int band, unsigned int band_setting); #endif /* AUDIOHW_HAVE_EQ */ -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, size_t* size)); void (*mp3_play_pause)(bool play); @@ -593,7 +593,7 @@ struct plugin_api { #if CONFIG_CODEC != SWCODEC void (*bitswap)(unsigned char *data, int length); #endif -#endif /* !SIMULATOR */ +#endif /* PLATFORM_NATIVE */ #if CONFIG_CODEC == SWCODEC const unsigned long *audio_master_sampr_list; const unsigned long *hw_freq_sampr; @@ -731,7 +731,7 @@ struct plugin_api { int (*battery_level)(void); bool (*battery_level_safe)(void); int (*battery_time)(void); -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) unsigned int (*battery_voltage)(void); #endif #if CONFIG_CHARGING @@ -745,7 +745,7 @@ struct plugin_api { #endif /* misc */ -#if !defined(SIMULATOR) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) int* __errno; #endif void (*srand)(unsigned int seed); @@ -902,7 +902,7 @@ struct plugin_header { }; #ifdef PLUGIN -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) extern unsigned char plugin_start_addr[]; extern unsigned char plugin_end_addr[]; #define PLUGIN_HEADER \ @@ -911,14 +911,14 @@ extern unsigned char plugin_end_addr[]; __attribute__ ((section (".header")))= { \ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ plugin_start_addr, plugin_end_addr, plugin_start, &rb }; -#else /* SIMULATOR */ +#else /* PLATFORM_HOSTED */ #define PLUGIN_HEADER \ const struct plugin_api *rb DATA_ATTR; \ const struct plugin_header __header \ __attribute__((visibility("default"))) = { \ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ NULL, NULL, plugin_start, &rb }; -#endif /* SIMULATOR */ +#endif /* CONFIG_PLATFORM */ #ifdef PLUGIN_USE_IRAM /* Declare IRAM variables */ 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); diff --git a/apps/radio/radio.c b/apps/radio/radio.c index 3dfa9a10f0..3728afc39c 100644 --- a/apps/radio/radio.c +++ b/apps/radio/radio.c @@ -420,10 +420,10 @@ int radio_screen(void) bool have_recorded = false; int timeout = current_tick + HZ/10; unsigned int last_seconds = 0; -#ifndef SIMULATOR +#if !defined(SIMULATOR) unsigned int seconds = 0; struct audio_recording_options rec_options; -#endif +#endif /* SIMULATOR */ #endif /* CONFIG_CODEC != SWCODEC */ #ifndef HAVE_NOISY_IDLE_MODE int button_timeout = current_tick + (2*HZ); diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index 164b14b15c..9e93638717 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c @@ -18,7 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ -#ifdef SIMULATOR +#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) #include /* sim uses rand for peakmeter simulation */ #endif #include "config.h" @@ -538,7 +538,7 @@ void pm_reset_clipcount(void) void peak_meter_playback(bool playback) { int i; -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (void)playback; #elif CONFIG_CODEC == SWCODEC pm_playback = playback; @@ -595,7 +595,7 @@ void peak_meter_peek(void) left = pm_cur_left; right = pm_cur_right; #else -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) pm_cur_left = left = mas_codec_readreg(pm_src_left); pm_cur_right = right = mas_codec_readreg(pm_src_right); #else diff --git a/apps/scrobbler.c b/apps/scrobbler.c index 401f5b93b6..8d9f694ec2 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c @@ -24,6 +24,7 @@ http://www.audioscrobbler.net/wiki/Portable_Player_Logging */ #include +#include #include "file.h" #include "logf.h" #include "metadata.h" @@ -70,7 +71,7 @@ static unsigned long timestamp; #endif /* Crude work-around for Archos Sims - return a set amount */ -#if (CONFIG_CODEC != SWCODEC) && defined(SIMULATOR) +#if (CONFIG_CODEC != SWCODEC) && (CONFIG_PLATFORM & PLATFORM_HOSTED) unsigned long audio_prev_elapsed(void) { return 120000; diff --git a/apps/settings.c b/apps/settings.c index 12987c4746..2f6ce4cb92 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -837,7 +837,7 @@ void settings_apply(bool read_disk) #ifdef HAVE_DISK_STORAGE storage_spindown(global_settings.disk_spindown); #endif -#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR) +#if (CONFIG_CODEC == MAS3507D) && (CONFIG_PLATFORM & PLATFORM_NATIVE) dac_line_in(global_settings.line_in); #endif set_poweroff_timeout(global_settings.poweroff); diff --git a/apps/status.h b/apps/status.h index 36b723ecb8..c8ec7bb354 100644 --- a/apps/status.h +++ b/apps/status.h @@ -45,7 +45,7 @@ void status_set_ffmode(enum playmode mode); enum playmode status_get_ffmode(void); int current_playmode(void); -#ifdef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #include #endif #ifdef HAVE_LCD_CHARCELLS diff --git a/apps/tagcache.c b/apps/tagcache.c index f4d3753768..822a84870c 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -4442,7 +4442,7 @@ static void tagcache_thread(void) case SYS_POWEROFF: break ; -#ifndef SIMULATOR +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) case SYS_USB_CONNECTED: logf("USB: TagCache"); usb_acknowledge(SYS_USB_CONNECTED_ACK); -- cgit v1.2.3