From f6c2c2c57d1126d7514113da46aa3fd52f814b23 Mon Sep 17 00:00:00 2001 From: CatalystG Date: Sat, 23 Mar 2013 12:21:30 -0400 Subject: [PATCH] (BlackBerry) Add initial in-game RGUI support. --- frontend/frontend_bbqnx.c | 60 +++++++++++++++++++++++++++++++++++++-- frontend/menu/rgui.c | 2 ++ gfx/context/bbqnx_ctx.c | 44 +++++++++++++++------------- playbook/.cproject | 13 +++++---- playbook/qnx_input.c | 5 ++++ 5 files changed, 95 insertions(+), 29 deletions(-) diff --git a/frontend/frontend_bbqnx.c b/frontend/frontend_bbqnx.c index 5dfca69f8c..42411ae040 100644 --- a/frontend/frontend_bbqnx.c +++ b/frontend/frontend_bbqnx.c @@ -30,14 +30,67 @@ int rarch_main(int argc, char *argv[]) g_extern.verbose = true; +#ifdef HAVE_RGUI + menu_init(); + g_extern.lifecycle_mode_state |= 1ULL << MODE_INIT; + + for (;;) + { + if (g_extern.lifecycle_mode_state & (1ULL << MODE_GAME)) + { + while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate()); + g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME); + } + else if (g_extern.lifecycle_mode_state & (1ULL << MODE_INIT)) + { + if (g_extern.main_is_init) + rarch_main_deinit(); + + struct rarch_main_wrap args = {0}; + + args.verbose = g_extern.verbose; + args.sram_path = NULL; + args.state_path = NULL; + args.rom_path = "shared/documents/roms/snes9x-next/ChronoTrigger.smc"; + args.libretro_path = "app/native/lib/test.so"; + args.config_path = "app/native/retroarch.cfg"; + + int init_ret = rarch_main_init_wrap(&args); + if (init_ret == 0) + { + RARCH_LOG("rarch_main_init() succeeded.\n"); + g_extern.lifecycle_mode_state |= (1ULL << MODE_GAME); + } + else + { + RARCH_ERR("rarch_main_init() failed.\n"); + g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU); + } + + g_extern.lifecycle_mode_state &= ~(1ULL << MODE_INIT); + } + else if (g_extern.lifecycle_mode_state & (1ULL << MODE_MENU)) + { + g_extern.lifecycle_mode_state |= 1ULL << MODE_MENU_PREINIT; + while (menu_iterate()); + g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU); + } + else + break; + } + + menu_free(); + if (g_extern.main_is_init) + rarch_main_deinit(); +#else struct rarch_main_wrap args = {0}; args.verbose = g_extern.verbose; args.sram_path = NULL; args.state_path = NULL; - args.rom_path = "/accounts/1000/shared/documents/roms/quake/pak0.pak"; - args.libretro_path = "/accounts/1000/appdata/com.RetroArch.testDev_m_RetroArch181dafc7/app/native/lib/test.so"; - args.config_path = "/accounts/1000/appdata/com.RetroArch.testDev_m_RetroArch181dafc7/app/native/retroarch.cfg"; + args.rom_path = "shared/documents/roms/snes9x-next/ChronoTrigger.smc"; + args.libretro_path = "app/native/lib/test.so"; + args.config_path = "app/native/retroarch.cfg"; rarch_init_msg_queue(); @@ -46,6 +99,7 @@ int rarch_main(int argc, char *argv[]) while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate()); rarch_main_deinit(); +#endif rarch_deinit_msg_queue(); diff --git a/frontend/menu/rgui.c b/frontend/menu/rgui.c index 0e18a2aa15..e11b35c1e6 100644 --- a/frontend/menu/rgui.c +++ b/frontend/menu/rgui.c @@ -410,7 +410,9 @@ static void render_text(rgui_handle_t *rgui) blit_line(rgui, TERM_START_X + 15, 15, title, true); blit_line(rgui, TERM_START_X + 15, (TERM_HEIGHT * FONT_HEIGHT_STRIDE) + TERM_START_Y + 2, g_extern.title_buf, true); +#ifndef __BLACKBERRY_QNX__ blit_line(rgui, TERM_HEIGHT - 80, (TERM_HEIGHT * FONT_HEIGHT_STRIDE) + TERM_START_Y + 2, PACKAGE_VERSION, true); +#endif unsigned x = TERM_START_X; unsigned y = TERM_START_Y; diff --git a/gfx/context/bbqnx_ctx.c b/gfx/context/bbqnx_ctx.c index 825398bd7d..1b32be974f 100644 --- a/gfx/context/bbqnx_ctx.c +++ b/gfx/context/bbqnx_ctx.c @@ -64,8 +64,6 @@ static void gfx_ctx_destroy(void) eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroyContext(g_egl_dpy, g_egl_ctx); eglDestroySurface(g_egl_dpy, g_egl_surf); - screen_destroy_window(screen_win); - screen_destroy_context(screen_ctx); eglTerminate(g_egl_dpy); eglReleaseThread(); @@ -99,24 +97,27 @@ static bool gfx_ctx_init(void) * create an EGL surface to receive libscreen events */ RARCH_LOG("Initializing screen context...\n"); - screen_create_context(&screen_ctx, 0); - - if (screen_request_events(screen_ctx) != BPS_SUCCESS) + if (!screen_ctx) { - RARCH_ERR("screen_request_events failed.\n"); - goto screen_error; - } + screen_create_context(&screen_ctx, 0); - if (navigator_request_events(0) != BPS_SUCCESS) - { - RARCH_ERR("navigator_request_events failed.\n"); - goto screen_error; - } + if (screen_request_events(screen_ctx) != BPS_SUCCESS) + { + RARCH_ERR("screen_request_events failed.\n"); + goto screen_error; + } - if (navigator_rotation_lock(false) != BPS_SUCCESS) - { - RARCH_ERR("navigator_location_lock failed.\n"); - goto screen_error; + if (navigator_request_events(0) != BPS_SUCCESS) + { + RARCH_ERR("navigator_request_events failed.\n"); + goto screen_error; + } + + if (navigator_rotation_lock(false) != BPS_SUCCESS) + { + RARCH_ERR("navigator_location_lock failed.\n"); + goto screen_error; + } } const EGLint attribs[] = { @@ -173,10 +174,13 @@ static bool gfx_ctx_init(void) goto error; } - if (screen_create_window(&screen_win, screen_ctx)) + if(!screen_win) { - RARCH_ERR("screen_create_window failed:.\n"); - goto error; + if (screen_create_window(&screen_win, screen_ctx)) + { + RARCH_ERR("screen_create_window failed:.\n"); + goto error; + } } if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_FORMAT, &format)) diff --git a/playbook/.cproject b/playbook/.cproject index 3f3868f477..08524a5a61 100644 --- a/playbook/.cproject +++ b/playbook/.cproject @@ -40,6 +40,7 @@ + @@ -143,7 +144,7 @@ - - - - - -