diff --git a/apps/audio_path.c b/apps/audio_path.c
index e928880..22630f1 100644
--- a/apps/audio_path.c
+++ b/apps/audio_path.c
@@ -42,7 +42,7 @@
 #endif
 #endif

-#ifndef SIMULATOR
+#if (CONFIG_PLATFORM & CONFIG_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 **/

@@ -144,4 +144,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/buffering.c b/apps/buffering.c
index 8a6418f..c2cecdd 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 46d9223..22e692c 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/debug_menu.c b/apps/debug_menu.c
index 1288d9a..74c6a47 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"
@@ -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) || \
@@ -1322,9 +1322,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;
@@ -1411,7 +1411,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)
 {
@@ -1481,7 +1481,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
@@ -1779,7 +1779,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)
@@ -2100,7 +2100,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)
@@ -2651,10 +2651,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
@@ -2668,18 +2668,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 1faf4c9..460ab9e 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 e8043a7..bc49400 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/misc.c b/apps/misc.c
index 747abe0..2895576 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 e9102b2..ebc31fb 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 <string.h>
diff --git a/apps/playback.c b/apps/playback.c
index 0be45b0..9fb0a76 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;
@@ -2010,7 +2010,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 485601c..4a6db88 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 d626ef6..dba5e61 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
+#ifdef (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 a6b864b..709b93a 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
+#ifdef (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/scrobbler.c b/apps/scrobbler.c
index 401f5b9..2aa7c21 100644
--- a/apps/scrobbler.c
+++ b/apps/scrobbler.c
@@ -70,7 +70,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 25593e5..d5b3627 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -835,7 +835,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 36b723e..c8ec7bb 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 <time.h>
 #endif
 #ifdef HAVE_LCD_CHARCELLS
diff --git a/apps/tagcache.c b/apps/tagcache.c
index f4d3753..822a848 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);
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0ed1be4..8d15895 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -73,6 +73,13 @@
 #define AT91SAM9260  9260
 #define AS3525v2    35252

+/* platforms
+ * bit fields to allow PLATFORM_HOSTED to be OR'ed e.g. with a
+ * possible future PLATFORM_ANDROID (some OSes might need totally different
+ * handling to run on them than a stand-alone application) */
+#define PLATFORM_NATIVE (1<<0)
+#define PLATFORM_HOSTED (1<<1)
+
 /* CONFIG_KEYPAD */
 #define PLAYER_PAD          1
 #define RECORDER_PAD        2
@@ -496,6 +503,10 @@ Lyre prototype 1 */
 #define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
 #endif

+#ifndef CONFIG_PLATFORM
+#define CONFIG_PLATFORM PLATFORM_NATIVE
+#endif
+
 #ifndef CONFIG_TUNER
 #define CONFIG_TUNER 0
 #endif
diff --git a/firmware/export/config/sim.h b/firmware/export/config/sim.h
index d65b0fb..5dcb4f6 100644
--- a/firmware/export/config/sim.h
+++ b/firmware/export/config/sim.h
@@ -101,4 +101,5 @@

 #define HAVE_SDL
 #define HAVE_SDL_AUDIO
+#define CONFIG_PLATFORM PLATFORM_HOSTED
 #define _ISOC99_SOURCE 1