PixelFormat pf = qemu_pixelformat_from_pixman(dpy_surface->format);
/* create surface_qemu */
- if (console_width == get_emul_resolution_width() &&
- console_height == get_emul_resolution_height()) {
+ if (console_width == get_display_resolution_width() &&
+ console_height == get_display_resolution_height()) {
INFO("create SDL screen : (%d, %d)\n",
console_width, console_height);
pf.amask);
} else {
INFO("create blank screen : (%d, %d)\n",
- get_emul_resolution_width(), get_emul_resolution_height());
+ get_display_resolution_width(),
+ get_display_resolution_height());
surface_qemu = SDL_CreateRGBSurface(
SDL_SWSURFACE,
#endif
/* get current setting information and calculate screen size */
- display_width = get_emul_resolution_width();
- display_height = get_emul_resolution_height();
+ display_width = get_display_resolution_width();
+ display_height = get_display_resolution_height();
current_scale_factor = get_emul_win_scale();
short rotaton_type = get_emul_rotation();
/* rearrange multi-touch finger points */
if (get_emul_multi_touch_state()->multitouch_enable != 0) {
rearrange_finger_points(
- get_emul_resolution_width(), get_emul_resolution_height(),
+ get_display_resolution_width(), get_display_resolution_height(),
current_scale_factor, rotaton_type);
}
INFO("register SDL environment variable. "
"(SDL_WINDOWID = %s)\n", SDL_windowhack);
- set_emul_resolution(display_width, display_height);
set_emul_sdl_bpp(SDL_BPP);
maru_sdl_set_interpolation(false);
init_multi_touch_state();
surface_height(dpy_surface));
} else {
int shm_size =
- get_emul_resolution_width() * get_emul_resolution_height() * 4;
+ get_display_resolution_width() *
+ get_display_resolution_height() * 4;
memset(shared_memory, 0x00, (size_t)shm_size);
}
INFO("qemu_ds_shm_switch : (%d, %d)\n",
console_width, console_height);
- if (console_width == get_emul_resolution_width() &&
- console_height == get_emul_resolution_height()) {
+ if (console_width == get_display_resolution_width() &&
+ console_height == get_display_resolution_height()) {
is_fit_console_size = true;
}
}
INFO("maru shm init\n");
- set_emul_resolution(display_width, display_height);
set_emul_sdl_bpp(32);
if (blank_guide_enable == true) {
/* byte */
int shm_size =
- get_emul_resolution_width() * get_emul_resolution_height() * 4;
+ get_display_resolution_width() *
+ get_display_resolution_height() * 4;
/* base + 1 = sdb port */
/* base + 2 = shared memory key */
uiInfo->vmName = QString(get_vm_name()).trimmed();
qDebug() << "VM name :" << uiInfo->vmName;
- uiInfo->resolution.setWidth(get_emul_resolution_width());
- uiInfo->resolution.setHeight(get_emul_resolution_height());
+ uiInfo->resolution.setWidth(get_display_resolution_width());
+ uiInfo->resolution.setHeight(get_display_resolution_height());
uiInfo->basePort = get_emul_vm_base_port();
uiInfo->vmDataPath = QDir(get_vm_data_path()).canonicalPath();
extern bool hax_allowed;
#endif
+#include "ui/console.h"
#include "sysemu/sysemu.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
return log_path;
}
-/* display screen resolution */
-void set_emul_resolution(int width, int height)
-{
- _emul_info.resolution_w = width;
- _emul_info.resolution_h = height;
-
- LOG_INFO("emulator graphic resolution : %dx%d\n",
- _emul_info.resolution_w, _emul_info.resolution_h);
-}
-
-int get_emul_resolution_width(void)
-{
- return _emul_info.resolution_w;
-}
-
-int get_emul_resolution_height(void)
-{
- return _emul_info.resolution_h;
-}
-
/* sdl bits per pixel */
void set_emul_sdl_bpp(int bpp)
{
return vm_data_path;
}
+// display resolution
+static int initial_resolution_width = -1;
+static int initial_resolution_height = -1;
+
+#ifdef CONFIG_JAVA_UI
+static void set_resolution_legacy(void)
+{
+ char *resolution = get_variable("resolution");
+ if (!resolution) {
+ error_report("variable [resolution] is required.");
+ exit(1);
+ }
+ char **splitted = g_strsplit(resolution, "x", 2);
+ if (!splitted[0] || !splitted[1]) {
+ error_report("resolution value [%s] is weird. Please use format \"WIDTHxHEIGHT\"", resolution);
+ g_strfreev(splitted);
+ exit(1);
+ }
+ else {
+ set_initial_display_resolution(g_ascii_strtoull(splitted[0], NULL, 0),
+ g_ascii_strtoull(splitted[1], NULL, 0));
+ }
+ g_strfreev(splitted);
+ }
+#endif
+
+void set_initial_display_resolution(int width, int height)
+{
+ initial_resolution_width = width;
+ initial_resolution_height = height;
+}
+
+int get_display_resolution_width(void)
+{
+#ifdef CONFIG_JAVA_UI
+ if (initial_resolution_width == -1) {
+ set_resolution_legacy();
+ }
+#endif
+ return initial_resolution_width;
+}
+
+int get_display_resolution_height(void)
+{
+#ifdef CONFIG_JAVA_UI
+ if (initial_resolution_width == -1) {
+ set_resolution_legacy();
+ }
+#endif
+ return initial_resolution_height;
+}
+
#ifdef CONFIG_JAVA_UI
/* skin enabled */
static bool skin_enabled = true;
typedef struct EmulatorConfigInfo {
bool skin_enable;
- int resolution_w;
- int resolution_h;
int sdl_bpp;
bool input_mouse_enable;
bool input_touch_enable;
char const *get_log_path(void);
/* setter */
-void set_emul_resolution(int width, int height);
void set_emul_win_scale(double scale);
void set_emul_sdl_bpp(int bpp);
void set_emul_input_mouse_enable(bool on);
void set_sdb_connection(bool connected);
/* getter */
-int get_emul_resolution_width(void);
-int get_emul_resolution_height(void);
double get_emul_win_scale(void);
int get_emul_sdl_bpp(void);
bool is_emul_input_mouse_enable(void);
const char *get_profile_name(void);
bool is_gpu_accel_enabled(void);
const char *get_vm_data_path(void);
-#ifdef SUPPORT_LEGACY_ARGS
-void set_vm_data_path(const char *path);
-#endif
+void set_initial_display_resolution(int width, int height);
+int get_display_resolution_width(void);
+int get_display_resolution_height(void);
#ifdef CONFIG_JAVA_UI
void set_skin_enabled(bool enabled);
bool is_skin_enabled(void);
#endif
+#ifdef SUPPORT_LEGACY_ARGS
+void set_vm_data_path(const char *path);
+#endif
#endif /* __EMUL_STATE_H__ */
// Assemble new kernel cmdline
maru_kernel_cmdline = g_strdup_printf("%s sdb_port=%d, "
"vm_resolution=%dx%d", kernel_cmdline, get_emul_vm_base_port(),
- get_emul_resolution_width(), get_emul_resolution_height());
+ get_display_resolution_width(), get_display_resolution_height());
set_emul_host_ip(maru_kernel_cmdline);
LOG_INFO("kernel commandline : %s\n", maru_kernel_cmdline);
return -1;
}
- // set emulator resolution
- {
- char *resolution = get_variable("resolution");
- if (!resolution) {
- fprintf(stderr, "[resolution] is required.\n");
- return -1;
- }
- char **splitted = g_strsplit(resolution, "x", 2);
- if (!splitted[0] || !splitted[1]) {
- fprintf(stderr, "resolution value [%s] is weird. Please use format \"WIDTHxHEIGHT\"\n", resolution);
- g_strfreev(splitted);
- return -1;
- }
- else {
- set_emul_resolution(g_ascii_strtoull(splitted[0], NULL, 0),
- g_ascii_strtoull(splitted[1], NULL, 0));
- }
- g_strfreev(splitted);
- }
-
// assemble arguments for qemu and skin
#ifdef SUPPORT_SKIN_OPTIONS
if (!assemble_emulator_args(&_qemu_argc, _qemu_argv,
}
if (w != 0 && h != 0) {
- set_emul_resolution(w, h);
+ set_initial_display_resolution(w, h);
}
}
}
container->buffer = NULL;
container->length = 0;
- width = get_emul_resolution_width();
- height = get_emul_resolution_height();
+ width = get_display_resolution_width();
+ height = get_display_resolution_height();
image_stride = width * 4;
LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
png_infop info_ptr = NULL;
png_bytepp row_pointers = NULL;
- width = get_emul_resolution_width();
- height = get_emul_resolution_height();
+ width = get_display_resolution_width();
+ height = get_display_resolution_height();
image_stride = width * 4;
LOG_TRACE("width %d, height %d, stride %d, raw image %d\n",
LOG_TRACE("enter: %s\n", __func__);
- resolution.width = get_emul_resolution_width();
- resolution.height = get_emul_resolution_height();
+ resolution.width = get_display_resolution_width();
+ resolution.height = get_display_resolution_height();
mt.type = EVENTCAST__TOUCH_MSG__TYPE__RESOLUTION;
mt.resolution = &resolution;
Framebuffer *request_screenshot(void)
{
- const int length = get_emul_resolution_width() * get_emul_resolution_height() * 4;
+ const int length = get_display_resolution_width() *
+ get_display_resolution_height() * 4;
INFO("screenshot data length : %d\n", length);
if (0 >= length) {
#include "displayswapper.h"
extern "C" {
-void qt5_graphic_hw_update(void);
int qt5_graphic_hw_display(void);
}
#endif
#ifdef CONFIG_MARU
} else if (strstart(p, "maru_sdl", &opts)) {
-# ifdef CONFIG_SDL
+# if defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
display = DT_MARU_SDL;
# else
fprintf(stderr, "maru_sdl support is disabled\n");
exit(1);
# endif
} else if (strstart(p, "maru_shm", &opts)) {
-# ifdef CONFIG_USE_SHM
+# if defined(CONFIG_USE_SHM) && defined(CONFIG_JAVA_UI)
display = DT_MARU_SHM;
# else
fprintf(stderr, "maru_shm is disabled\n");
# endif
} else if (strstart(p, "maru_qt", &opts)) {
# ifdef CONFIG_QT
- if (*opts) {
+ display = DT_MARU_QT_ONSCREEN;
+ while (*opts) {
const char *nextopt;
if (strstart(opts, ",rendering=", &nextopt)) {
opts = nextopt;
} else {
goto invalid_maru_qt_args;
}
+ } else if (strstart(opts, ",resolution=", &nextopt)) {
+ opts = nextopt;
+ char *endptr = NULL;
+ // Resolution should be formed "640x480" or "640*480".
+ int width = (int)g_ascii_strtoll(opts, &endptr, 10);
+ int height = (int)g_ascii_strtoll(++endptr, &endptr, 10);
+ if (width == 0 || height == 0) {
+ goto invalid_maru_qt_args;
+ }
+ set_initial_display_resolution(width, height);
+ nextopt = endptr;
} else {
invalid_maru_qt_args:
fprintf(stderr, "Invalid maru_qt option string: %s\n", p);
exit(1);
}
- } else {
- display = DT_MARU_QT_ONSCREEN;
+ opts = nextopt;
}
# else
error_report("maru_qt is disabled.\n");