From 914e39c55ada12f17a6f8305c8a9b6eff70155cf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 1 Feb 2013 06:53:06 +0100 Subject: [PATCH] (RMenu) Refactor RMenu images --- general.h | 8 ++++++++ gfx/context/ps3_ctx.c | 9 ++++----- gfx/context/xdk_ctx.c | 31 ++++++++++++++----------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/general.h b/general.h index 8606266f7e..99125df5a1 100644 --- a/general.h +++ b/general.h @@ -36,6 +36,10 @@ #include "config.h" #endif +#ifdef HAVE_RMENU +#include "gfx/image.h" +#endif + // Platform-specific headers // PS3 #if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) @@ -561,6 +565,10 @@ struct global { oskutil_params oskutil_handle; } misc; +#endif +#ifdef HAVE_RMENU + struct texture_image menu_texture; + struct texture_image menu_panel; #endif } console; diff --git a/gfx/context/ps3_ctx.c b/gfx/context/ps3_ctx.c index 0aeb68f3a4..d34672cd0c 100644 --- a/gfx/context/ps3_ctx.c +++ b/gfx/context/ps3_ctx.c @@ -44,7 +44,6 @@ #if defined(HAVE_RMENU) GLuint menu_texture_id; -static struct texture_image menu_texture; #endif #if defined(HAVE_PSGL) @@ -311,7 +310,7 @@ static bool gfx_ctx_rmenu_init(void) glGenTextures(1, &menu_texture_id); RARCH_LOG("Loading texture image for menu...\n"); - if (!texture_image_load(default_paths.menu_border_file, &menu_texture)) + if (!texture_image_load(default_paths.menu_border_file, &g_extern.console.menu_texture)) { RARCH_ERR("Failed to load texture image for menu.\n"); return false; @@ -324,12 +323,12 @@ static bool gfx_ctx_rmenu_init(void) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexImage2D(GL_TEXTURE_2D, 0, RARCH_GL_INTERNAL_FORMAT32, - menu_texture.width, menu_texture.height, 0, - RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, menu_texture.pixels); + g_extern.console.menu_texture.width, g_extern.console.menu_texture.height, 0, + RARCH_GL_TEXTURE_TYPE32, RARCH_GL_FORMAT32, g_extern.console.menu_texture.pixels); glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); - free(menu_texture.pixels); + free(g_extern.console.menu_texture.pixels); menu_bg_inited = true; #endif diff --git a/gfx/context/xdk_ctx.c b/gfx/context/xdk_ctx.c index 0c478fc5e7..fc10741fdc 100644 --- a/gfx/context/xdk_ctx.c +++ b/gfx/context/xdk_ctx.c @@ -82,10 +82,7 @@ unsigned char drive_mapping_idx = 2; int xpos, ypos; #ifdef _XBOX1 -texture_image m_menuMainRomSelectPanel; -texture_image m_menuMainBG; - -// Rom list coords +// Rom list coordinates unsigned m_menuMainRomListPos_x; unsigned m_menuMainRomListPos_y; #endif @@ -144,19 +141,19 @@ static bool gfx_ctx_xdk_menu_init(void) // Load background image if(width == 640) { - texture_image_load("D:\\Media\\main-menu_480p.png", &m_menuMainBG); + texture_image_load("D:\\Media\\main-menu_480p.png", &g_extern.console.menu_texture); m_menuMainRomListPos_x = 60; m_menuMainRomListPos_y = 80; } else if(width == 1280) { - texture_image_load("D:\\Media\\main-menu_720p.png", &m_menuMainBG); + texture_image_load("D:\\Media\\main-menu_720p.png", &g_extern.console.menu_texture); m_menuMainRomListPos_x = 360; m_menuMainRomListPos_y = 130; } // Load rom selector panel - texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &m_menuMainRomSelectPanel); + texture_image_load("D:\\Media\\menuMainRomSelectPanel.png", &g_extern.console.menu_panel); //Display some text //Center the text (hardcoded) @@ -175,8 +172,8 @@ static void gfx_ctx_xdk_menu_frame(void* data) static void gfx_ctx_xdk_menu_free(void) { #ifdef _XBOX1 - texture_image_free(&m_menuMainBG); - texture_image_free(&m_menuMainRomSelectPanel); + texture_image_free(&g_extern.console.menu_texture); + texture_image_free(&g_extern.console.menu_panel); #endif } @@ -198,20 +195,20 @@ static bool gfx_ctx_xdk_window_has_focus(void) static void gfx_ctx_xdk_menu_draw_bg(rarch_position_t *position) { #ifdef _XBOX1 - m_menuMainBG.x = 0; - m_menuMainBG.y = 0; - texture_image_render(&m_menuMainBG); + g_extern.console.menu_texture.x = 0; + g_extern.console.menu_texture.y = 0; + texture_image_render(&g_extern.console.menu_texture); #endif } static void gfx_ctx_xdk_menu_draw_panel(rarch_position_t *position) { #ifdef _XBOX1 - m_menuMainRomSelectPanel.x = position->x; - m_menuMainRomSelectPanel.y = position->y; - m_menuMainRomSelectPanel.width = ROM_PANEL_WIDTH; - m_menuMainRomSelectPanel.height = ROM_PANEL_HEIGHT; - texture_image_render(&m_menuMainRomSelectPanel); + g_extern.console.menu_panel.x = position->x; + g_extern.console.menu_panel.y = position->y; + g_extern.console.menu_panel.width = ROM_PANEL_WIDTH; + g_extern.console.menu_panel.height = ROM_PANEL_HEIGHT; + texture_image_render(&g_extern.console.menu_panel); #endif }