(XDK) Reports screen resolution now at device init

This commit is contained in:
twinaphex 2012-10-01 01:17:30 +02:00
parent 011037eea2
commit 4ae233f1f0
5 changed files with 74 additions and 3 deletions

View File

@ -497,6 +497,11 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
RARCH_LOG("Found D3D context: %s\n", d3d->driver->ident);
d3d->driver->get_video_size(&d3d->full_x, &d3d->full_y);
RARCH_LOG("Detecting screen resolution: %ux%u.\n", d3d->full_x, d3d->full_y);
gfx_ctx_xdk_set_swap_interval(d3d->vsync ? 1 : 0);
#ifdef HAVE_HLSL
hlsl_init(g_settings.video.cg_shader_path, d3d->d3d_render_device);
#endif
@ -507,8 +512,6 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
xdk_d3d_set_rotation(d3d, g_console.screen_orientation);
gfx_ctx_xdk_set_swap_interval(d3d->vsync ? 1 : 0);
HRESULT hr = d3d9_init_font("game:\\media\\Arial_12.xpr");
if(hr < 0)

View File

@ -54,6 +54,8 @@ typedef struct xdk_d3d_video
unsigned frame_count;
unsigned last_width;
unsigned last_height;
unsigned full_x;
unsigned full_y;
LPDIRECT3D d3d_device;
LPDIRECT3DDEVICE d3d_render_device;
LPDIRECT3DVERTEXBUFFER vertex_buf;

View File

@ -125,9 +125,70 @@ static void gfx_ctx_xdk_update_window_title(bool reset) { }
static void gfx_ctx_xdk_get_video_size(unsigned *width, unsigned *height)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
#if defined(_XBOX360)
XVIDEO_MODE video_mode;
XGetVideoMode(&video_mode);
*width = video_mode.dwDisplayWidth;
*height = video_mode.dwDisplayHeight;
#elif defined(_XBOX1)
DWORD video_mode = XGetVideoFlags();
*width = 640;
*height = 480;
// Only valid in PAL mode, not valid for HDTV modes!
if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
{
// Check for 16:9 mode (PAL REGION)
if(d3d->video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
if(d3d->video_mode & XC_VIDEO_FLAGS_PAL_60Hz)
{ //60 Hz, 720x480i
*width = 720;
*height = 480;
}
else
{ //50 Hz, 720x576i
*width = 720;
*height = 576;
}
}
}
else
{
// Check for 16:9 mode (NTSC REGIONS)
if(d3d->video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
*width = 720;
*height = 480;
}
}
if(XGetAVPack() == XC_AV_PACK_HDTV)
{
if(d3d->video_mode & XC_VIDEO_FLAGS_HDTV_480p)
{
*width = 640;
*height = 480;
}
else if(d3d->video_mode & XC_VIDEO_FLAGS_HDTV_720p)
{
*width = 1280;
*height = 720;
}
else if(d3d->video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
{
*width = 1920;
*height = 1080;
}
}
#else
/* TODO: implement */
(void)width;
(void)height;
#endif
}
static bool gfx_ctx_xdk_init(void)

View File

@ -189,10 +189,13 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
RARCH_LOG("Found D3D context: %s\n", d3d->driver->ident);
xdk_d3d_set_rotation(d3d, g_console.screen_orientation);
d3d->driver->get_video_size(&d3d->full_x, &d3d->full_y);
RARCH_LOG("Detecting screen resolution: %ux%u.\n", d3d->full_x, d3d->full_y);
gfx_ctx_xdk_set_swap_interval(d3d->vsync ? 1 : 0);
xdk_d3d_set_rotation(d3d, g_console.screen_orientation);
// load debug font (toggle option in later revisions ?)
XFONT_OpenDefaultFont(&d3d->debug_font);
d3d->debug_font->SetBkMode(XFONT_TRANSPARENT);

View File

@ -57,6 +57,8 @@ typedef struct xdk_d3d_video
unsigned last_height;
unsigned win_width;
unsigned win_height;
unsigned full_x;
unsigned full_y;
LPDIRECT3D d3d_device;
LPDIRECT3DDEVICE d3d_render_device;
LPDIRECT3DVERTEXBUFFER vertex_buf;