Get rid of MODE_MENU_HD too -g_extern.lifecycle_state can now

be used for 'injecting' button presses (i.e. libretro button presses
and/or meta button presses)
This commit is contained in:
twinaphex 2014-10-02 21:57:01 +02:00
parent c1a75ec68a
commit 7a6ee6a300
6 changed files with 22 additions and 27 deletions

View File

@ -165,9 +165,7 @@ static void* rmenu_xui_init(void)
d3d_video_t *d3d= (d3d_video_t*)driver.video_data;
bool hdmenus_allowed = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD));
if (hdmenus_allowed)
if (d3d->resolution_hd_enable)
RARCH_LOG("HD menus enabled.\n");
D3DPRESENT_PARAMETERS d3dpp;
@ -210,7 +208,7 @@ static void* rmenu_xui_init(void)
goto error;
}
hr = XuiSceneCreate(hdmenus_allowed ?
hr = XuiSceneCreate(d3d->resolution_hd_enable ?
L"file://game:/media/hd/" : L"file://game:/media/sd/",
L"rarch_main.xur", NULL, &root_menu);
if (FAILED(hr))
@ -257,7 +255,8 @@ static void xui_render_message(const char *msg)
size_t i, j;
struct string_list *list = string_split(msg, "\n");
if (!list)
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
if (!list || !d3d)
return;
if (list->elems == 0)
@ -281,8 +280,7 @@ static void xui_render_message(const char *msg)
msglen = RMENU_TERM_WIDTH;
}
#endif
float msg_width = (g_extern.lifecycle_state &
(1ULL << MODE_MENU_HD)) ? 160 : 100;
float msg_width = d3d->resolution_hd_enable ? 160 : 100;
float msg_height = 120;
float msg_offset = 32;

View File

@ -141,12 +141,6 @@ enum action_state
RARCH_ACTION_STATE_FORCE_QUIT,
};
enum menu_enums
{
MODE_NONE = 0,
MODE_MENU_HD,
};
enum sound_mode_enums
{
SOUND_MODE_NORMAL = 0,

View File

@ -334,7 +334,7 @@ static void gfx_ctx_d3d_input_driver(void *data, const input_driver_t **input, v
static void gfx_ctx_d3d_get_video_size(void *data, unsigned *width, unsigned *height)
{
(void)data;
d3d_video_t *d3d = (d3d_video_t*)driver.video_data;
#ifdef _XBOX
(void)width;
(void)height;
@ -345,17 +345,18 @@ static void gfx_ctx_d3d_get_video_size(void *data, unsigned *width, unsigned *he
*width = video_mode.dwDisplayWidth;
*height = video_mode.dwDisplayHeight;
driver.resolution_hd_enable = false;
if(video_mode.fIsHiDef)
{
*width = 1280;
*height = 720;
g_extern.lifecycle_state |= (1ULL << MODE_MENU_HD);
driver.resolution_hd_enable = true;
}
else
{
*width = 640;
*height = 480;
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_HD);
}
widescreen_mode = video_mode.fIsWideScreen;
@ -402,21 +403,21 @@ static void gfx_ctx_d3d_get_video_size(void *data, unsigned *width, unsigned *he
*width = 640;
*height = 480;
widescreen_mode = false;
g_extern.lifecycle_state |= (1ULL << MODE_MENU_HD);
driver.resolution_hd_enable = true;
}
else if(video_mode & XC_VIDEO_FLAGS_HDTV_720p)
{
*width = 1280;
*height = 720;
widescreen_mode = true;
g_extern.lifecycle_state |= (1ULL << MODE_MENU_HD);
driver.resolution_hd_enable = true;
}
else if(video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
{
*width = 1920;
*height = 1080;
widescreen_mode = true;
g_extern.lifecycle_state |= (1ULL << MODE_MENU_HD);
driver.resolution_hd_enable = true;
}
}
#endif

View File

@ -1570,7 +1570,7 @@ static bool d3d_frame(void *data, const void *frame,
float msg_width = 60;
float msg_height = 365;
#elif defined(_XBOX360)
float msg_width = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 160 : 100;
float msg_width = d3d->resolution_dh_enable ? 160 : 100;
float msg_height = 120;
#endif
font_parms.x = msg_width;

View File

@ -171,6 +171,8 @@ typedef struct d3d_video
unsigned tex_w;
unsigned tex_h;
#endif
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
} d3d_video_t;
#ifndef _XBOX

View File

@ -21,7 +21,7 @@
#include "../../general.h"
#include "../../xdk/xdk_resources.h"
#define FONT_SCALE ((g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 2 : 1)
#define FONT_SCALE(d3d) ((d3d->resolution_hd_enable) ? 2 : 1)
typedef struct GLYPH_ATTR
{
@ -363,7 +363,7 @@ static void xdk_video_font_draw_text(xdk360_video_font_t *font, void *video_data
{
// Handle the newline character
m_fCursorX = x;
m_fCursorY += font->m_fFontYAdvance * FONT_SCALE;
m_fCursorY += font->m_fFontYAdvance * FONT_SCALE(d3d);
continue;
}
@ -375,10 +375,10 @@ static void xdk_video_font_draw_text(xdk360_video_font_t *font, void *video_data
else
pGlyph = &font->m_Glyphs[0];
float fOffset = FONT_SCALE * (float)pGlyph->wOffset;
float fAdvance = FONT_SCALE * (float)pGlyph->wAdvance;
float fWidth = FONT_SCALE * (float)pGlyph->wWidth;
float fHeight = FONT_SCALE * font->m_fFontHeight;
float fOffset = FONT_SCALE(d3d) * (float)pGlyph->wOffset;
float fAdvance = FONT_SCALE(d3d) * (float)pGlyph->wAdvance;
float fWidth = FONT_SCALE(d3d) * (float)pGlyph->wWidth;
float fHeight = FONT_SCALE(d3d) * font->m_fFontHeight;
m_fCursorX += fOffset;
@ -454,7 +454,7 @@ static void xdk_render_msg(void *data, const char *str_msg,
}
else
{
x = (g_extern.lifecycle_state & (1ULL << MODE_MENU_HD)) ? 160 : 100;
x = d3d->resolution_hd_enable ? 160 : 100;
y = 120;
}