mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-19 01:12:33 +00:00
Merge pull request #43 from freakdave/master
(Xbox 1) Fixed screen rotation code
This commit is contained in:
commit
f41c252f6f
@ -1868,15 +1868,23 @@ static void ingame_menu_resize(item *items, menu *current_menu, uint64_t input)
|
|||||||
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
|
gfx_ctx_set_aspect_ratio(NULL, g_console.aspect_ratio_index);
|
||||||
|
|
||||||
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_LEFT))
|
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_LEFT))
|
||||||
#ifdef _XBOX1
|
{
|
||||||
|
#ifdef _XBOX
|
||||||
if(g_console.viewports.custom_vp.x >= 4)
|
if(g_console.viewports.custom_vp.x >= 4)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
g_console.viewports.custom_vp.x -= 4;
|
g_console.viewports.custom_vp.x -= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(input & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
else if(input & (1 << RETRO_DEVICE_ID_JOYPAD_LEFT))
|
||||||
#ifdef _XBOX1
|
{
|
||||||
|
#ifdef _XBOX
|
||||||
if(g_console.viewports.custom_vp.x > 0)
|
if(g_console.viewports.custom_vp.x > 0)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
g_console.viewports.custom_vp.x -= 1;
|
g_console.viewports.custom_vp.x -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_RIGHT))
|
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_RIGHT))
|
||||||
g_console.viewports.custom_vp.x += 4;
|
g_console.viewports.custom_vp.x += 4;
|
||||||
@ -1889,15 +1897,23 @@ static void ingame_menu_resize(item *items, menu *current_menu, uint64_t input)
|
|||||||
g_console.viewports.custom_vp.y += 1;
|
g_console.viewports.custom_vp.y += 1;
|
||||||
|
|
||||||
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_DOWN))
|
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_LEFT_DPAD_DOWN))
|
||||||
#ifdef _XBOX1
|
{
|
||||||
|
#ifdef _XBOX
|
||||||
if(g_console.viewports.custom_vp.y >= 4)
|
if(g_console.viewports.custom_vp.y >= 4)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
g_console.viewports.custom_vp.y -= 4;
|
g_console.viewports.custom_vp.y -= 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(input & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
else if(input & (1 << RETRO_DEVICE_ID_JOYPAD_DOWN))
|
||||||
#ifdef _XBOX1
|
{
|
||||||
|
#ifdef _XBOX
|
||||||
if(g_console.viewports.custom_vp.y > 0)
|
if(g_console.viewports.custom_vp.y > 0)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
g_console.viewports.custom_vp.y -= 1;
|
g_console.viewports.custom_vp.y -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_LEFT))
|
if(input & (1 << RETRO_DEVICE_ID_JOYPAD_ANALOG_RIGHT_DPAD_LEFT))
|
||||||
g_console.viewports.custom_vp.width -= 4;
|
g_console.viewports.custom_vp.width -= 4;
|
||||||
|
@ -249,7 +249,7 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#if defined(_XBOX)
|
#if defined(_XBOX)
|
||||||
XINPUT_STATE state;
|
XINPUT_STATE state; //C4101
|
||||||
|
|
||||||
get_environment_settings();
|
get_environment_settings();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ void gfx_ctx_clear(void)
|
|||||||
#ifdef _XBOX1
|
#ifdef _XBOX1
|
||||||
device_ptr->d3d_render_device->BeginScene();
|
device_ptr->d3d_render_device->BeginScene();
|
||||||
device_ptr->d3d_render_device->SetFlickerFilter(1);
|
device_ptr->d3d_render_device->SetFlickerFilter(1);
|
||||||
device_ptr->d3d_render_device->SetSoftDisplayFilter(1);
|
device_ptr->d3d_render_device->SetSoftDisplayFilter(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
wchar_t strw_buffer[128];
|
wchar_t strw_buffer[128];
|
||||||
unsigned font_x, font_y;
|
unsigned font_x, font_y;
|
||||||
|
FLOAT angle;
|
||||||
|
|
||||||
static void check_window(xdk_d3d_video_t *d3d)
|
static void check_window(xdk_d3d_video_t *d3d)
|
||||||
{
|
{
|
||||||
@ -147,31 +148,26 @@ static void xdk_d3d_set_rotation(void * data, unsigned orientation)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)data;
|
||||||
FLOAT angle;
|
|
||||||
|
|
||||||
switch(orientation)
|
switch(orientation)
|
||||||
{
|
{
|
||||||
case ORIENTATION_NORMAL:
|
case ORIENTATION_NORMAL:
|
||||||
angle = M_PI * 0 / 180;
|
angle = M_PI * 0 / 180;
|
||||||
|
RARCH_LOG("D3D8: Set rotation to ORIENTATION_NORMAL\n");
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_VERTICAL:
|
case ORIENTATION_VERTICAL:
|
||||||
angle = M_PI * 270 / 180;
|
angle = M_PI * 270 / 180;
|
||||||
|
RARCH_LOG("D3D8: Set rotation to ORIENTATION_VERTICAL\n");
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_FLIPPED:
|
case ORIENTATION_FLIPPED:
|
||||||
angle = M_PI * 180 / 180;
|
angle = M_PI * 180 / 180;
|
||||||
|
RARCH_LOG("D3D8: Set rotation to ORIENTATION_FLIPPED\n");
|
||||||
break;
|
break;
|
||||||
case ORIENTATION_FLIPPED_ROTATED:
|
case ORIENTATION_FLIPPED_ROTATED:
|
||||||
angle = M_PI * 90 / 180;
|
angle = M_PI * 90 / 180;
|
||||||
|
RARCH_LOG("D3D8: Set rotation to ORIENTATION_FLIPPED_ROTATED\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
D3DXMATRIX p_out;
|
|
||||||
D3DXMatrixIdentity(&p_out);
|
|
||||||
d3d->d3d_render_device->SetTransform(D3DTS_PROJECTION, &p_out);
|
|
||||||
|
|
||||||
d3d->should_resize = TRUE;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||||
@ -187,7 +183,7 @@ static void *xdk_d3d_init(const video_info_t *video, const input_driver_t **inpu
|
|||||||
if (!d3d->d3d_device)
|
if (!d3d->d3d_device)
|
||||||
{
|
{
|
||||||
free(d3d);
|
free(d3d);
|
||||||
RARCH_ERR("Failed to create a D3D8 object.\n");
|
RARCH_ERR("D3D8: Failed to create a D3D8 object.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,13 +425,16 @@ static bool xdk_d3d_frame(void *data, const void *frame,
|
|||||||
d3d->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
d3d->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||||
d3d->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
d3d->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||||
|
|
||||||
D3DXMATRIX p_out;
|
d3d->d3d_render_device->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
|
||||||
|
|
||||||
|
D3DXMATRIX p_out, p_rotate;
|
||||||
D3DXMatrixIdentity(&p_out);
|
D3DXMatrixIdentity(&p_out);
|
||||||
d3d->d3d_render_device->SetTransform(D3DTS_WORLD, &p_out);
|
D3DXMatrixRotationZ(&p_rotate, angle);
|
||||||
|
|
||||||
|
d3d->d3d_render_device->SetTransform(D3DTS_WORLD, &p_rotate);
|
||||||
d3d->d3d_render_device->SetTransform(D3DTS_VIEW, &p_out);
|
d3d->d3d_render_device->SetTransform(D3DTS_VIEW, &p_out);
|
||||||
d3d->d3d_render_device->SetTransform(D3DTS_PROJECTION, &p_out);
|
d3d->d3d_render_device->SetTransform(D3DTS_PROJECTION, &p_out);
|
||||||
|
|
||||||
d3d->d3d_render_device->SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
|
|
||||||
d3d->d3d_render_device->SetStreamSource(0, d3d->vertex_buf, sizeof(DrawVerticeFormats));
|
d3d->d3d_render_device->SetStreamSource(0, d3d->vertex_buf, sizeof(DrawVerticeFormats));
|
||||||
d3d->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
|
d3d->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
|
||||||
|
|
||||||
@ -483,7 +482,7 @@ static void xdk_d3d_set_nonblock_state(void *data, bool state)
|
|||||||
|
|
||||||
if(d3d->vsync)
|
if(d3d->vsync)
|
||||||
{
|
{
|
||||||
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
|
RARCH_LOG("D3D8: Vsync => %s\n", state ? "off" : "on");
|
||||||
gfx_ctx_set_swap_interval(state ? 0 : 1, TRUE);
|
gfx_ctx_set_swap_interval(state ? 0 : 1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user