aboutsummaryrefslogtreecommitdiffstats
path: root/android/main-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'android/main-common.c')
-rw-r--r--android/main-common.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/android/main-common.c b/android/main-common.c
index bb07943..3c8b320 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -19,8 +19,16 @@
#include <process.h>
#endif
+#ifndef CONFIG_STANDALONE_CORE
#include <SDL.h>
#include <SDL_syswm.h>
+#include "android/qemulator.h"
+#include "android/skin/image.h"
+#include "android/skin/trackball.h"
+#include "android/skin/keyboard.h"
+#include "android/skin/file.h"
+#include "android/skin/window.h"
+#endif
#include "console.h"
@@ -31,13 +39,7 @@
#include "android/globals.h"
#include "android/resource.h"
#include "android/user-config.h"
-#include "android/qemulator.h"
#include "android/display.h"
-#include "android/skin/image.h"
-#include "android/skin/trackball.h"
-#include "android/skin/keyboard.h"
-#include "android/skin/file.h"
-#include "android/skin/window.h"
@@ -54,6 +56,20 @@
/*** CONFIGURATION
***/
+#ifdef CONFIG_STANDALONE_CORE
+
+void
+user_config_init( void )
+{
+}
+
+/* only call this function on normal exits, so that ^C doesn't save the configuration */
+void
+user_config_done( void )
+{
+}
+
+#else /* !CONFIG_STANDALONE_CORE */
static AUserConfig* userConfig;
void
@@ -86,6 +102,7 @@ user_config_get_window_pos( int *window_x, int *window_y )
if (userConfig)
auserConfig_getWindowPos(userConfig, window_x, window_y);
}
+#endif /* !CONFIG_STANDALONE_CORE */
unsigned convertBytesToMB( uint64_t size )
{
@@ -105,6 +122,7 @@ uint64_t convertMBToBytes( unsigned megaBytes )
}
+#ifndef CONFIG_STANDALONE_CORE
/***********************************************************************/
/***********************************************************************/
/***** *****/
@@ -199,7 +217,7 @@ write_default_keyset( void )
}
}
-
+#endif /* !CONFIG_STANDALONE_CORE */
/***********************************************************************/
/***********************************************************************/
@@ -209,6 +227,8 @@ write_default_keyset( void )
/***********************************************************************/
/***********************************************************************/
+#ifndef CONFIG_STANDALONE_CORE
+
void *readpng(const unsigned char* base, size_t size, unsigned *_width, unsigned *_height);
#ifdef CONFIG_DARWIN
@@ -269,15 +289,19 @@ sdl_set_window_icon( void )
}
}
+#ifndef CONFIG_STANDALONE_CORE
SDL_Surface* icon = sdl_surface_from_argb32( icon_pixels, icon_w, icon_h );
if (icon != NULL) {
SDL_WM_SetIcon(icon, NULL);
SDL_FreeSurface(icon);
free( icon_pixels );
}
+#endif
+
#endif /* !_WIN32 */
}
}
+#endif /* !CONFIG_STANDALONE_CORE */
/***********************************************************************/
/***********************************************************************/
@@ -290,7 +314,7 @@ sdl_set_window_icon( void )
const char* skin_network_speed = NULL;
const char* skin_network_delay = NULL;
-
+#ifndef CONFIG_STANDALONE_CORE
static void sdl_at_exit(void)
{
user_config_done();
@@ -319,6 +343,7 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
android_display_init(ds, qframebuffer_fifo_get());
#endif
}
+#endif
/* list of skin aliases */
static const struct {
@@ -462,6 +487,26 @@ DEFAULT_SKIN:
}
+#ifdef CONFIG_STANDALONE_CORE
+void
+init_sdl_ui(AConfig* skinConfig,
+ const char* skinPath,
+ AndroidOptions* opts)
+{
+ signal(SIGINT, SIG_DFL);
+#ifndef _WIN32
+ signal(SIGQUIT, SIG_DFL);
+ /* prevent SIGTTIN and SIGTTOUT from stopping us. this is necessary to be
+ * able to run the emulator in the background (e.g. "emulator &").
+ * despite the fact that the emulator should not grab input or try to
+ * write to the output in normal cases, we're stopped on some systems
+ * (e.g. OS X)
+ */
+ signal(SIGTTIN, SIG_IGN);
+ signal(SIGTTOU, SIG_IGN);
+#endif
+}
+#else /* !CONFIG_STANDALONE_CORE */
void
init_sdl_ui(AConfig* skinConfig,
const char* skinPath,
@@ -536,6 +581,7 @@ init_sdl_ui(AConfig* skinConfig,
qemulator_get()->onion_rotation = rotate;
}
}
+#endif /* !CONFIG_STANDALONE_CORE */
int64_t get_screen_pixels(AConfig* skinConfig)
{