Cleanup Xbox 360 code from d3d_ctx

This commit is contained in:
twinaphex 2018-03-02 17:03:34 +01:00
parent dbf2fae5c1
commit dfdbc00a84
2 changed files with 49 additions and 95 deletions

View File

@ -46,6 +46,7 @@
#ifndef _XBOX
#define HAVE_MONITOR
#define HAVE_WINDOW
#define D3D9_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
#endif
#ifdef HAVE_MENU
@ -62,6 +63,10 @@ static LPDIRECT3D9 g_pD3D9;
void *dinput;
#ifdef _XBOX
static bool d3d9_widescreen_mode = false;
#endif
static bool d3d9_set_resize(d3d_video_t *d3d,
unsigned new_width, unsigned new_height)
{
@ -603,7 +608,7 @@ static void d3d9_get_video_size(d3d_video_t *d3d,
*height = 480;
}
widescreen_mode = video_mode.fIsWideScreen;
d3d9_widescreen_mode = video_mode.fIsWideScreen;
}
#endif
@ -679,10 +684,8 @@ void d3d_make_d3dpp(void *data,
#ifdef _XBOX
d3dpp->MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp->EnableAutoDepthStencil = FALSE;
#if 0
if (!widescreen_mode)
if (!d3d9_widescreen_mode)
d3dpp->Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
#endif
d3dpp->MultiSampleQuality = 0;
#endif
}
@ -960,7 +963,7 @@ static void d3d9_set_nonblock_state(void *data, bool state)
#ifdef _XBOX
d3d_set_render_state(d3d->dev,
XBOX_PRESENTATIONINTERVAL,
D3D9_PRESENTATIONINTERVAL,
interval ?
D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE
);

View File

@ -36,26 +36,13 @@
#ifdef _MSC_VER
#ifndef _XBOX
#ifndef HAVE_DYLIB
#pragma comment( lib, "d3d9" )
#pragma comment( lib, "d3dx9" )
#endif
#ifdef HAVE_CG
#pragma comment( lib, "cgd3d9" )
#endif
#pragma comment( lib, "dxguid" )
#endif
#endif
#if defined(_XBOX1)
#if defined(_XBOX)
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTATIONINTERVAL
#define PresentationInterval FullScreen_PresentationInterval
#elif defined(_XBOX360)
#define XBOX_PRESENTATIONINTERVAL D3DRS_PRESENTINTERVAL
#endif
#ifdef _XBOX
static bool widescreen_mode = false;
#endif
typedef struct gfx_ctx_d3d_data
@ -200,10 +187,6 @@ static bool gfx_ctx_d3d_bind_api(void *data,
if (api == GFX_CTX_DIRECT3D8_API)
return true;
break;
case GFX_CTX_DIRECT3D9_API:
if (api == GFX_CTX_DIRECT3D9_API)
return true;
break;
default:
break;
}
@ -281,97 +264,65 @@ static void gfx_ctx_d3d_get_video_size(void *data,
unsigned *width, unsigned *height)
{
#ifdef _XBOX
#ifdef _XBOX360
XVIDEO_MODE video_mode;
#endif
d3d_video_t *d3d = (d3d_video_t*)data;
DWORD video_mode = XGetVideoFlags();
(void)width;
(void)height;
#if defined(_XBOX360)
XGetVideoMode(&video_mode);
*width = 640;
*height = 480;
widescreen_mode = false;
*width = video_mode.dwDisplayWidth;
*height = video_mode.dwDisplayHeight;
/* Only valid in PAL mode, not valid for HDTV modes! */
d3d->resolution_hd_enable = false;
if(video_mode.fIsHiDef)
if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
{
*width = 1280;
*height = 720;
d3d->resolution_hd_enable = true;
/* Check for 16:9 mode (PAL REGION) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
*width = 720;
//60 Hz, 720x480i
if(video_mode & XC_VIDEO_FLAGS_PAL_60Hz)
*height = 480;
else //50 Hz, 720x576i
*height = 576;
widescreen_mode = true;
}
}
else
{
*width = 640;
*height = 480;
/* Check for 16:9 mode (NTSC REGIONS) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
*width = 720;
*height = 480;
widescreen_mode = true;
}
}
widescreen_mode = video_mode.fIsWideScreen;
#elif defined(_XBOX1)
if(XGetAVPack() == XC_AV_PACK_HDTV)
{
DWORD video_mode = XGetVideoFlags();
*width = 640;
*height = 480;
widescreen_mode = false;
/* Only valid in PAL mode, not valid for HDTV modes! */
if(XGetVideoStandard() == XC_VIDEO_STANDARD_PAL_I)
if(video_mode & XC_VIDEO_FLAGS_HDTV_480p)
{
/* Check for 16:9 mode (PAL REGION) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
*width = 720;
//60 Hz, 720x480i
if(video_mode & XC_VIDEO_FLAGS_PAL_60Hz)
*height = 480;
else //50 Hz, 720x576i
*height = 576;
widescreen_mode = true;
}
*width = 640;
*height = 480;
widescreen_mode = false;
d3d->resolution_hd_enable = true;
}
else
else if(video_mode & XC_VIDEO_FLAGS_HDTV_720p)
{
/* Check for 16:9 mode (NTSC REGIONS) */
if(video_mode & XC_VIDEO_FLAGS_WIDESCREEN)
{
*width = 720;
*height = 480;
widescreen_mode = true;
}
*width = 1280;
*height = 720;
widescreen_mode = true;
d3d->resolution_hd_enable = true;
}
if(XGetAVPack() == XC_AV_PACK_HDTV)
else if(video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
{
if(video_mode & XC_VIDEO_FLAGS_HDTV_480p)
{
*width = 640;
*height = 480;
widescreen_mode = false;
d3d->resolution_hd_enable = true;
}
else if(video_mode & XC_VIDEO_FLAGS_HDTV_720p)
{
*width = 1280;
*height = 720;
widescreen_mode = true;
d3d->resolution_hd_enable = true;
}
else if(video_mode & XC_VIDEO_FLAGS_HDTV_1080i)
{
*width = 1920;
*height = 1080;
widescreen_mode = true;
d3d->resolution_hd_enable = true;
}
*width = 1920;
*height = 1080;
widescreen_mode = true;
d3d->resolution_hd_enable = true;
}
}
#endif
#endif
}
static void gfx_ctx_d3d_swap_interval(void *data, unsigned interval)