mirror of
https://github.com/libretro/RetroArch.git
synced 2024-10-08 15:13:24 +00:00
(360) Add 360 context file and use it
This commit is contained in:
parent
85850ffba1
commit
463fdd9bdf
30
360/menu.cpp
30
360/menu.cpp
@ -337,6 +337,7 @@ HRESULT CRetroArchQuickMenu::OnInit(XUIMessageInit * pInitData, BOOL& bHandled)
|
||||
|
||||
HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled )
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
int current_index;
|
||||
|
||||
if ( hObjPressed == m_quickmenulist)
|
||||
@ -365,7 +366,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
if(g_console.aspect_ratio_index >= ASPECT_RATIO_END)
|
||||
g_console.aspect_ratio_index = 0;
|
||||
|
||||
video_xdk360.set_aspect_ratio(NULL, g_console.aspect_ratio_index);
|
||||
gfx_ctx_set_aspect_ratio(d3d9, g_console.aspect_ratio_index);
|
||||
char aspectratio_label[32];
|
||||
snprintf(aspectratio_label, sizeof(aspectratio_label), "Aspect Ratio: %s", aspectratio_lut[g_console.aspect_ratio_index].name);
|
||||
wchar_t * aspectratio_label_w = rarch_convert_char_to_wchar(aspectratio_label);
|
||||
@ -397,7 +398,7 @@ HRESULT CRetroArchQuickMenu::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
m_quickmenulist.SetText(MENU_ITEM_ORIENTATION, L"Orientation: Normal");
|
||||
break;
|
||||
}
|
||||
video_xdk360.set_rotation(NULL, g_console.screen_orientation);
|
||||
video_xdk360.set_rotation(driver.video_data, g_console.screen_orientation);
|
||||
break;
|
||||
case MENU_ITEM_RESIZE_MODE:
|
||||
g_console.input_loop = INPUT_LOOP_RESIZE_MODE;
|
||||
@ -657,7 +658,7 @@ HRESULT CRetroArchSettings::OnNotifyPress( HXUIOBJ hObjPressed, int & bHandled
|
||||
case SETTING_SCALE_ENABLED:
|
||||
g_console.fbo_enabled = !g_console.fbo_enabled;
|
||||
m_settingslist.SetText(SETTING_SCALE_ENABLED, g_console.fbo_enabled ? L"Custom Scaling/Dual Shaders: ON" : L"Custom Scaling/Dual Shaders: OFF");
|
||||
xdk360_set_fbo_enable(g_console.fbo_enabled);
|
||||
gfx_ctx_set_fbo(g_console.fbo_enabled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -785,26 +786,18 @@ void menu_deinit (void)
|
||||
|
||||
void menu_loop(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
g_console.menu_enable = true;
|
||||
|
||||
HRESULT hr;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
if(g_console.emulator_initialized)
|
||||
video_xdk360.set_swap_block_state(NULL, true);
|
||||
d3d9->block_swap = true;
|
||||
|
||||
g_console.input_loop = INPUT_LOOP_MENU;
|
||||
|
||||
do
|
||||
{
|
||||
g_frame_count++;
|
||||
if(g_console.emulator_initialized)
|
||||
{
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
else
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
D3DCOLOR_ARGB(255, 32, 32, 64), 1.0f, 0);
|
||||
rarch_render_cached_frame();
|
||||
|
||||
XINPUT_STATE state;
|
||||
XInputGetState(0, &state);
|
||||
@ -853,11 +846,10 @@ void menu_loop(void)
|
||||
}
|
||||
}
|
||||
|
||||
video_xdk360.swap(NULL);
|
||||
gfx_ctx_swap_buffers();
|
||||
}while(g_console.menu_enable);
|
||||
|
||||
if(g_console.emulator_initialized)
|
||||
video_xdk360.set_swap_block_state(NULL, false);
|
||||
d3d9->block_swap = false;
|
||||
|
||||
g_console.ingame_menu_enable = false;
|
||||
}
|
||||
|
@ -150,6 +150,7 @@ static bool xdk360_key_pressed(void *data, int key)
|
||||
(void)data;
|
||||
XINPUT_STATE state;
|
||||
bool retval;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
XInputGetState(0, &state);
|
||||
retval = false;
|
||||
|
@ -15,13 +15,20 @@
|
||||
*/
|
||||
|
||||
// Xbox 360-specific headers
|
||||
#ifdef _XBOX
|
||||
#include <xtl.h>
|
||||
#include <xgraphics.h>
|
||||
#endif
|
||||
|
||||
#include "../driver.h"
|
||||
#include "xdk360_video.h"
|
||||
#include "xdk360_video_resources.h"
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
#include "../gfx/shader_hlsl.h"
|
||||
#endif
|
||||
|
||||
#include "./../gfx/gfx_context.h"
|
||||
#include "../console/console_ext.h"
|
||||
#include "../general.h"
|
||||
#include "../message.h"
|
||||
@ -31,9 +38,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
static bool g_quitting;
|
||||
static bool g_first_msg;
|
||||
unsigned g_frame_count;
|
||||
|
||||
/* Xbox 360 specific code */
|
||||
|
||||
@ -252,34 +257,50 @@ void PackedResource::Destroy()
|
||||
|
||||
/* end of Xbox 360 specific code */
|
||||
|
||||
static void xdk360_gfx_free(void * data)
|
||||
static void check_window(xdk360_video_t *d3d9)
|
||||
{
|
||||
bool quit, resize;
|
||||
|
||||
gfx_ctx_check_window(&quit,
|
||||
&resize, NULL, NULL,
|
||||
d3d9->frame_count);
|
||||
|
||||
if (quit)
|
||||
d3d9->quitting = true;
|
||||
else if (resize)
|
||||
d3d9->should_resize = true;
|
||||
}
|
||||
|
||||
static void xdk360_free(void * data)
|
||||
{
|
||||
#ifdef RARCH_CONSOLE
|
||||
if (driver.video_data)
|
||||
return;
|
||||
#endif
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
|
||||
|
||||
if (!vid)
|
||||
if (!d3d9)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_HLSL
|
||||
hlsl_deinit();
|
||||
vid->d3d_render_device->Release();
|
||||
vid->d3d_device->Release();
|
||||
#endif
|
||||
d3d9->d3d_render_device->Release();
|
||||
d3d9->d3d_device->Release();
|
||||
|
||||
free(vid);
|
||||
free(d3d9);
|
||||
}
|
||||
|
||||
void set_viewport(bool force_full)
|
||||
static void xdk360_set_viewport(bool force_full)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
|
||||
int width = vid->video_mode.fIsHiDef ? 1280 : 640;
|
||||
int height = vid->video_mode.fIsHiDef ? 720 : 480;
|
||||
int width = d3d9->video_mode.fIsHiDef ? 1280 : 640;
|
||||
int height = d3d9->video_mode.fIsHiDef ? 720 : 480;
|
||||
int m_viewport_x_temp, m_viewport_y_temp, m_viewport_width_temp, m_viewport_height_temp;
|
||||
float m_zNear, m_zFar;
|
||||
|
||||
@ -329,7 +350,7 @@ void set_viewport(bool force_full)
|
||||
vp.Y = m_viewport_y_temp;
|
||||
vp.MinZ = m_zNear;
|
||||
vp.MaxZ = m_zFar;
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
d3d9->d3d_render_device->SetViewport(&vp);
|
||||
|
||||
//if(gl->overscan_enable && !force_full)
|
||||
//{
|
||||
@ -339,10 +360,10 @@ void set_viewport(bool force_full)
|
||||
//}
|
||||
}
|
||||
|
||||
static void xdk360_set_orientation(void * data, uint32_t orientation)
|
||||
static void xdk360_set_rotation(void * data, unsigned orientation)
|
||||
{
|
||||
(void)data;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
|
||||
FLOAT angle;
|
||||
|
||||
switch(orientation)
|
||||
@ -363,18 +384,8 @@ static void xdk360_set_orientation(void * data, uint32_t orientation)
|
||||
|
||||
/* TODO: Move to D3DXMATRIX here */
|
||||
hlsl_set_proj_matrix(XMMatrixRotationZ(angle));
|
||||
}
|
||||
|
||||
static void xdk360_set_aspect_ratio(void * data, uint32_t aspectratio_index)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
|
||||
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
||||
|
||||
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
|
||||
g_settings.video.force_aspect = false;
|
||||
set_viewport(false);
|
||||
d3d9->should_resize = TRUE;
|
||||
}
|
||||
|
||||
static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
|
||||
@ -390,110 +401,103 @@ static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
|
||||
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
|
||||
}
|
||||
|
||||
void xdk360_set_fbo_enable (bool enable)
|
||||
void xdk360_init_fbo(xdk360_video_t *d3d9)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
vid->fbo_enabled = enable;
|
||||
}
|
||||
|
||||
void xdk360_gfx_init_fbo(xdk360_video_t *vid)
|
||||
{
|
||||
if (vid->lpTexture_ot)
|
||||
if (d3d9->lpTexture_ot)
|
||||
{
|
||||
vid->lpTexture_ot->Release();
|
||||
vid->lpTexture_ot = NULL;
|
||||
d3d9->lpTexture_ot->Release();
|
||||
d3d9->lpTexture_ot = NULL;
|
||||
}
|
||||
|
||||
if (vid->lpSurface)
|
||||
if (d3d9->lpSurface)
|
||||
{
|
||||
vid->lpSurface->Release();
|
||||
vid->lpSurface = NULL;
|
||||
d3d9->lpSurface->Release();
|
||||
d3d9->lpSurface = NULL;
|
||||
}
|
||||
|
||||
vid->d3d_render_device->CreateTexture(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
|
||||
d3d9->d3d_render_device->CreateTexture(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
|
||||
1, 0, g_console.gamma_correction_enable ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_A8R8G8B8 ) : D3DFMT_A8R8G8B8,
|
||||
0, &vid->lpTexture_ot, NULL);
|
||||
0, &d3d9->lpTexture_ot, NULL);
|
||||
|
||||
vid->d3d_render_device->CreateRenderTarget(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
|
||||
d3d9->d3d_render_device->CreateRenderTarget(512 * g_settings.video.fbo_scale_x, 512 * g_settings.video.fbo_scale_y,
|
||||
g_console.gamma_correction_enable ? ( D3DFORMAT )MAKESRGBFMT( D3DFMT_A8R8G8B8 ) : D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE,
|
||||
0, 0, &vid->lpSurface, NULL);
|
||||
0, 0, &d3d9->lpSurface, NULL);
|
||||
|
||||
vid->lpTexture_ot_as16srgb = *vid->lpTexture_ot;
|
||||
xdk360_convert_texture_to_as16_srgb(vid->lpTexture);
|
||||
xdk360_convert_texture_to_as16_srgb(&vid->lpTexture_ot_as16srgb);
|
||||
d3d9->lpTexture_ot_as16srgb = *d3d9->lpTexture_ot;
|
||||
xdk360_convert_texture_to_as16_srgb(d3d9->lpTexture);
|
||||
xdk360_convert_texture_to_as16_srgb(&d3d9->lpTexture_ot_as16srgb);
|
||||
}
|
||||
|
||||
static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
static void *xdk360_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
if (driver.video_data)
|
||||
return driver.video_data;
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)calloc(1, sizeof(xdk360_video_t));
|
||||
if (!vid)
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)calloc(1, sizeof(xdk360_video_t));
|
||||
if (!d3d9)
|
||||
return NULL;
|
||||
|
||||
vid->d3d_device = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!vid->d3d_device)
|
||||
d3d9->d3d_device = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!d3d9->d3d_device)
|
||||
{
|
||||
free(vid);
|
||||
free(d3d9);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get video settings
|
||||
|
||||
memset(&vid->video_mode, 0, sizeof(vid->video_mode));
|
||||
memset(&d3d9->video_mode, 0, sizeof(d3d9->video_mode));
|
||||
|
||||
XGetVideoMode(&vid->video_mode);
|
||||
XGetVideoMode(&d3d9->video_mode);
|
||||
|
||||
memset(&vid->d3dpp, 0, sizeof(vid->d3dpp));
|
||||
memset(&d3d9->d3dpp, 0, sizeof(d3d9->d3dpp));
|
||||
|
||||
// no letterboxing in 4:3 mode (if widescreen is
|
||||
// unsupported
|
||||
if(!vid->video_mode.fIsWideScreen)
|
||||
vid->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
|
||||
if(!d3d9->video_mode.fIsWideScreen)
|
||||
d3d9->d3dpp.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
|
||||
|
||||
vid->d3dpp.BackBufferWidth = vid->video_mode.fIsHiDef ? 1280 : 640;
|
||||
vid->d3dpp.BackBufferHeight = vid->video_mode.fIsHiDef ? 720 : 480;
|
||||
d3d9->d3dpp.BackBufferWidth = d3d9->video_mode.fIsHiDef ? 1280 : 640;
|
||||
d3d9->d3dpp.BackBufferHeight = d3d9->video_mode.fIsHiDef ? 720 : 480;
|
||||
if(g_console.gamma_correction_enable)
|
||||
{
|
||||
vid->d3dpp.BackBufferFormat = g_console.color_format ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : (D3DFORMAT)MAKESRGBFMT(D3DFMT_LIN_A1R5G5B5);
|
||||
vid->d3dpp.FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
|
||||
d3d9->d3dpp.BackBufferFormat = g_console.color_format ? (D3DFORMAT)MAKESRGBFMT(D3DFMT_A8R8G8B8) : (D3DFORMAT)MAKESRGBFMT(D3DFMT_LIN_A1R5G5B5);
|
||||
d3d9->d3dpp.FrontBufferFormat = (D3DFORMAT)MAKESRGBFMT(D3DFMT_LE_X8R8G8B8);
|
||||
}
|
||||
else
|
||||
{
|
||||
vid->d3dpp.BackBufferFormat = g_console.color_format ? D3DFMT_A8R8G8B8 : D3DFMT_LIN_A1R5G5B5;
|
||||
vid->d3dpp.FrontBufferFormat = D3DFMT_LE_X8R8G8B8;
|
||||
d3d9->d3dpp.BackBufferFormat = g_console.color_format ? D3DFMT_A8R8G8B8 : D3DFMT_LIN_A1R5G5B5;
|
||||
d3d9->d3dpp.FrontBufferFormat = D3DFMT_LE_X8R8G8B8;
|
||||
}
|
||||
|
||||
vid->d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
||||
vid->d3dpp.MultiSampleQuality = 0;
|
||||
vid->d3dpp.BackBufferCount = 2;
|
||||
vid->d3dpp.EnableAutoDepthStencil = FALSE;
|
||||
vid->d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
vid->d3dpp.PresentationInterval = video->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
d3d9->d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
||||
d3d9->d3dpp.MultiSampleQuality = 0;
|
||||
d3d9->d3dpp.BackBufferCount = 2;
|
||||
d3d9->d3dpp.EnableAutoDepthStencil = FALSE;
|
||||
d3d9->d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
|
||||
d3d9->d3dpp.PresentationInterval = video->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
||||
// D3DCREATE_HARDWARE_VERTEXPROCESSING is ignored on 360
|
||||
vid->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&vid->d3dpp, &vid->d3d_render_device);
|
||||
d3d9->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&d3d9->d3dpp, &d3d9->d3d_render_device);
|
||||
|
||||
hlsl_init(g_settings.video.cg_shader_path, vid->d3d_render_device);
|
||||
hlsl_init(g_settings.video.cg_shader_path, d3d9->d3d_render_device);
|
||||
|
||||
vid->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
|
||||
0, &vid->lpTexture, NULL);
|
||||
d3d9->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
|
||||
0, &d3d9->lpTexture, NULL);
|
||||
|
||||
xdk360_gfx_init_fbo(vid);
|
||||
xdk360_init_fbo(d3d9);
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
|
||||
vid->lpTexture->UnlockRect(0);
|
||||
d3d9->lpTexture->UnlockRect(0);
|
||||
|
||||
vid->last_width = 512;
|
||||
vid->last_height = 512;
|
||||
d3d9->last_width = 512;
|
||||
d3d9->last_height = 512;
|
||||
|
||||
vid->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||
0, 0, 0, &vid->vertex_buf, NULL);
|
||||
d3d9->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||
0, 0, 0, &d3d9->vertex_buf, NULL);
|
||||
|
||||
static const DrawVerticeFormats init_verts[] = {
|
||||
{ -1.0f, -1.0f, 0.0f, 1.0f },
|
||||
@ -503,9 +507,9 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
};
|
||||
|
||||
void *verts_ptr;
|
||||
vid->vertex_buf->Lock(0, 0, &verts_ptr, 0);
|
||||
d3d9->vertex_buf->Lock(0, 0, &verts_ptr, 0);
|
||||
memcpy(verts_ptr, init_verts, sizeof(init_verts));
|
||||
vid->vertex_buf->Unlock();
|
||||
d3d9->vertex_buf->Unlock();
|
||||
|
||||
static const D3DVERTEXELEMENT9 VertexElements[] =
|
||||
{
|
||||
@ -514,20 +518,20 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
D3DDECL_END()
|
||||
};
|
||||
|
||||
vid->d3d_render_device->CreateVertexDeclaration(VertexElements, &vid->v_decl);
|
||||
d3d9->d3d_render_device->CreateVertexDeclaration(VertexElements, &d3d9->v_decl);
|
||||
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
|
||||
d3d9->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
d3d9->d3d_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
|
||||
|
||||
D3DVIEWPORT9 vp = {0};
|
||||
vp.Width = vid->video_mode.fIsHiDef ? 1280 : 640;
|
||||
vp.Height = vid->video_mode.fIsHiDef ? 720 : 480;
|
||||
vp.Width = d3d9->video_mode.fIsHiDef ? 1280 : 640;
|
||||
vp.Height = d3d9->video_mode.fIsHiDef ? 720 : 480;
|
||||
vp.MinZ = 0.0f;
|
||||
vp.MaxZ = 1.0f;
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
d3d9->d3d_render_device->SetViewport(&vp);
|
||||
|
||||
if(g_console.viewports.custom_vp.width == 0)
|
||||
g_console.viewports.custom_vp.width = vp.Width;
|
||||
@ -535,27 +539,27 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
if(g_console.viewports.custom_vp.height == 0)
|
||||
g_console.viewports.custom_vp.height = vp.Height;
|
||||
|
||||
xdk360_set_orientation(NULL, g_console.screen_orientation);
|
||||
xdk360_set_rotation(d3d9, g_console.screen_orientation);
|
||||
|
||||
vid->fbo_enabled = 1;
|
||||
d3d9->fbo_enabled = 1;
|
||||
|
||||
return vid;
|
||||
return d3d9;
|
||||
}
|
||||
|
||||
static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
static bool xdk360_frame(void *data, const void *frame,
|
||||
unsigned width, unsigned height, unsigned pitch, const char *msg)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
|
||||
D3DSurface* pRenderTarget0;
|
||||
bool menu_enabled = g_console.menu_enable;
|
||||
|
||||
if (vid->last_width != width || vid->last_height != height)
|
||||
if (d3d9->last_width != width || d3d9->last_height != height)
|
||||
{
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
|
||||
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
|
||||
vid->lpTexture->UnlockRect(0);
|
||||
d3d9->lpTexture->UnlockRect(0);
|
||||
|
||||
float tex_w = width / 512.0f;
|
||||
float tex_h = height / 512.0f;
|
||||
@ -575,31 +579,34 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
void *verts_ptr;
|
||||
vid->vertex_buf->Lock(0, 0, &verts_ptr, 0);
|
||||
d3d9->vertex_buf->Lock(0, 0, &verts_ptr, 0);
|
||||
memcpy(verts_ptr, verts, sizeof(verts));
|
||||
vid->vertex_buf->Unlock();
|
||||
d3d9->vertex_buf->Unlock();
|
||||
|
||||
vid->last_width = width;
|
||||
vid->last_height = height;
|
||||
d3d9->last_width = width;
|
||||
d3d9->last_height = height;
|
||||
}
|
||||
|
||||
if(vid->fbo_enabled)
|
||||
if (d3d9->fbo_enabled)
|
||||
{
|
||||
vid->d3d_render_device->GetRenderTarget(0, &pRenderTarget0);
|
||||
vid->d3d_render_device->SetRenderTarget(0, vid->lpSurface);
|
||||
d3d9->d3d_render_device->GetRenderTarget(0, &pRenderTarget0);
|
||||
d3d9->d3d_render_device->SetRenderTarget(0, d3d9->lpSurface);
|
||||
}
|
||||
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
g_frame_count++;
|
||||
if (d3d9->should_resize)
|
||||
xdk360_set_viewport(false);
|
||||
|
||||
vid->d3d_render_device->SetTexture(0, vid->lpTexture);
|
||||
d3d9->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
d3d9->frame_count++;
|
||||
|
||||
d3d9->d3d_render_device->SetTexture(0, d3d9->lpTexture);
|
||||
|
||||
hlsl_use(1);
|
||||
if(vid->fbo_enabled)
|
||||
if(d3d9->fbo_enabled)
|
||||
{
|
||||
hlsl_set_params(width, height, 512, 512, g_settings.video.fbo_scale_x * width,
|
||||
g_settings.video.fbo_scale_y * height, g_frame_count);
|
||||
g_settings.video.fbo_scale_y * height, d3d9->frame_count);
|
||||
D3DVIEWPORT9 vp = {0};
|
||||
vp.Width = g_settings.video.fbo_scale_x * width;
|
||||
vp.Height = g_settings.video.fbo_scale_y * height;
|
||||
@ -607,55 +614,55 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
vp.Y = 0;
|
||||
vp.MinZ = 0.0f;
|
||||
vp.MaxZ = 1.0f;
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
d3d9->d3d_render_device->SetViewport(&vp);
|
||||
}
|
||||
else
|
||||
{
|
||||
hlsl_set_params(width, height, 512, 512, vid->d3dpp.BackBufferWidth,
|
||||
vid->d3dpp.BackBufferHeight, g_frame_count);
|
||||
hlsl_set_params(width, height, 512, 512, d3d9->d3dpp.BackBufferWidth,
|
||||
d3d9->d3dpp.BackBufferHeight, d3d9->frame_count);
|
||||
}
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
d3d9->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
for (unsigned y = 0; y < height; y++)
|
||||
{
|
||||
const uint8_t *in = (const uint8_t*)frame + y * pitch;
|
||||
uint8_t *out = (uint8_t*)d3dlr.pBits + y * d3dlr.Pitch;
|
||||
memcpy(out, in, width * sizeof(uint16_t));
|
||||
}
|
||||
vid->lpTexture->UnlockRect(0);
|
||||
d3d9->lpTexture->UnlockRect(0);
|
||||
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||
|
||||
vid->d3d_render_device->SetVertexDeclaration(vid->v_decl);
|
||||
vid->d3d_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
d3d9->d3d_render_device->SetVertexDeclaration(d3d9->v_decl);
|
||||
d3d9->d3d_render_device->SetStreamSource(0, d3d9->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
|
||||
vid->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
d3d9->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
||||
if(vid->fbo_enabled)
|
||||
if(d3d9->fbo_enabled)
|
||||
{
|
||||
vid->d3d_render_device->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, vid->lpTexture_ot,
|
||||
d3d9->d3d_render_device->Resolve(D3DRESOLVE_RENDERTARGET0, NULL, d3d9->lpTexture_ot,
|
||||
NULL, 0, 0, NULL, 0, 0, NULL);
|
||||
|
||||
vid->d3d_render_device->SetRenderTarget(0, pRenderTarget0);
|
||||
d3d9->d3d_render_device->SetRenderTarget(0, pRenderTarget0);
|
||||
pRenderTarget0->Release();
|
||||
vid->d3d_render_device->SetTexture(0, &vid->lpTexture_ot_as16srgb);
|
||||
d3d9->d3d_render_device->SetTexture(0, &d3d9->lpTexture_ot_as16srgb);
|
||||
|
||||
hlsl_use(2);
|
||||
hlsl_set_params(g_settings.video.fbo_scale_x * width, g_settings.video.fbo_scale_y * height, g_settings.video.fbo_scale_x * 512, g_settings.video.fbo_scale_y * 512, vid->d3dpp.BackBufferWidth,
|
||||
vid->d3dpp.BackBufferHeight, g_frame_count);
|
||||
set_viewport(false);
|
||||
hlsl_set_params(g_settings.video.fbo_scale_x * width, g_settings.video.fbo_scale_y * height, g_settings.video.fbo_scale_x * 512, g_settings.video.fbo_scale_y * 512, d3d9->d3dpp.BackBufferWidth,
|
||||
d3d9->d3dpp.BackBufferHeight, d3d9->frame_count);
|
||||
xdk360_set_viewport(false);
|
||||
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||
vid->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||
vid->d3d_render_device->SetVertexDeclaration(vid->v_decl);
|
||||
vid->d3d_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
vid->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.second_pass_smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||
d3d9->d3d_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||
d3d9->d3d_render_device->SetVertexDeclaration(d3d9->v_decl);
|
||||
d3d9->d3d_render_device->SetStreamSource(0, d3d9->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
d3d9->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
}
|
||||
|
||||
/* XBox 360 specific font code */
|
||||
@ -671,8 +678,8 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
xdk360_console_draw();
|
||||
}
|
||||
|
||||
if(!vid->block_swap)
|
||||
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
if(!d3d9->block_swap)
|
||||
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -680,8 +687,8 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
static void xdk360_set_swap_block_swap (void * data, bool toggle)
|
||||
{
|
||||
(void)data;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
vid->block_swap = toggle;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
d3d9->block_swap = toggle;
|
||||
|
||||
if(toggle)
|
||||
RARCH_LOG("Swap is set to blocked.\n");
|
||||
@ -692,36 +699,32 @@ static void xdk360_set_swap_block_swap (void * data, bool toggle)
|
||||
static void xdk360_swap (void * data)
|
||||
{
|
||||
(void)data;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)driver.video_data;
|
||||
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void xdk360_gfx_set_nonblock_state(void *data, bool state)
|
||||
static void xdk360_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
|
||||
/* XBox 360 specific code */
|
||||
if(state)
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||
else
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
|
||||
|
||||
if(d3d9->vsync)
|
||||
{
|
||||
RARCH_LOG("D3D Vsync => %s\n", state ? "off" : "on");
|
||||
gfx_ctx_set_swap_interval(state ? 0 : 1, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static bool xdk360_gfx_alive(void *data)
|
||||
static bool xdk360_alive(void *data)
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)data;
|
||||
check_window(d3d9);
|
||||
return !d3d9->quitting;
|
||||
}
|
||||
|
||||
static bool xdk360_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return !g_quitting;
|
||||
}
|
||||
|
||||
static bool xdk360_gfx_focus(void *data)
|
||||
{
|
||||
(void)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
void xdk360_video_set_vsync(bool vsync)
|
||||
{
|
||||
xdk360_gfx_set_nonblock_state(driver.video_data, vsync);
|
||||
return gfx_ctx_window_has_focus();
|
||||
}
|
||||
|
||||
// 360 needs a working graphics stack before RetroArch even starts.
|
||||
@ -739,7 +742,7 @@ static void xdk360_start(void)
|
||||
video_info.smooth = g_settings.video.smooth;
|
||||
video_info.input_scale = 2;
|
||||
|
||||
driver.video_data = xdk360_gfx_init(&video_info, NULL, NULL);
|
||||
driver.video_data = xdk360_init(&video_info, NULL, NULL);
|
||||
|
||||
g_first_msg = true;
|
||||
|
||||
@ -762,23 +765,20 @@ static void xdk360_stop(void)
|
||||
void *data = driver.video_data;
|
||||
driver.video_data = NULL;
|
||||
xdk360_console_deinit();
|
||||
xdk360_gfx_free(data);
|
||||
xdk360_free(data);
|
||||
}
|
||||
|
||||
const video_driver_t video_xdk360 = {
|
||||
xdk360_gfx_init,
|
||||
xdk360_gfx_frame,
|
||||
xdk360_gfx_set_nonblock_state,
|
||||
xdk360_gfx_alive,
|
||||
xdk360_gfx_focus,
|
||||
xdk360_init,
|
||||
xdk360_frame,
|
||||
xdk360_set_nonblock_state,
|
||||
xdk360_alive,
|
||||
xdk360_focus,
|
||||
NULL,
|
||||
xdk360_gfx_free,
|
||||
xdk360_free,
|
||||
"xdk360",
|
||||
xdk360_set_swap_block_swap,
|
||||
xdk360_swap,
|
||||
xdk360_set_aspect_ratio,
|
||||
xdk360_start,
|
||||
xdk360_stop,
|
||||
xdk360_restart,
|
||||
xdk360_set_orientation,
|
||||
xdk360_set_rotation,
|
||||
};
|
||||
|
@ -47,7 +47,10 @@ typedef struct xdk360_video
|
||||
{
|
||||
bool block_swap;
|
||||
bool fbo_enabled;
|
||||
bool vsync;
|
||||
bool should_resize;
|
||||
bool quitting;
|
||||
bool vsync;
|
||||
unsigned frame_count;
|
||||
unsigned last_width;
|
||||
unsigned last_height;
|
||||
IDirect3D9* d3d_device;
|
||||
@ -62,9 +65,6 @@ typedef struct xdk360_video
|
||||
LPDIRECT3DSURFACE9 lpSurface;
|
||||
} xdk360_video_t;
|
||||
|
||||
void xdk360_video_set_vsync (bool vsync);
|
||||
void xdk360_set_fbo_enable (bool enable);
|
||||
void xdk360_gfx_init_fbo(xdk360_video_t *vid);
|
||||
void set_viewport(bool force_full);
|
||||
|
||||
#endif
|
||||
|
@ -19,10 +19,8 @@
|
||||
|
||||
#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM
|
||||
|
||||
#define IS_TIMER_NOT_EXPIRED() (g_frame_count < g_console.timer_expiration_frame_count)
|
||||
#define IS_TIMER_NOT_EXPIRED() (d3d9->frame_count < g_console.timer_expiration_frame_count)
|
||||
#define IS_TIMER_EXPIRED() (!(IS_TIMER_NOT_EXPIRED()))
|
||||
#define SET_TIMER_EXPIRATION(value) g_console.timer_expiration_frame_count = g_frame_count + value;
|
||||
|
||||
extern unsigned g_frame_count;
|
||||
#define SET_TIMER_EXPIRATION(value) g_console.timer_expiration_frame_count = d3d9->frame_count + value;
|
||||
|
||||
#endif
|
||||
|
@ -51,6 +51,7 @@ VIDEO
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#include "../../gfx/context/ps3_ctx.c"
|
||||
#elif defined(_XBOX)
|
||||
#include "../../gfx/context/xdk360_ctx.c"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -54,16 +54,16 @@
|
||||
#elif defined(_XBOX)
|
||||
|
||||
#define video_init_func(video_info, input, input_data) \
|
||||
xdk360_gfx_init(video_info, input, input_data)
|
||||
xdk360_init(video_info, input, input_data)
|
||||
#define video_frame_func(data, width, height, pitch, msg) \
|
||||
xdk360_gfx_frame(driver.video_data, data, width, height, pitch, msg)
|
||||
xdk360_frame(driver.video_data, data, width, height, pitch, msg)
|
||||
#define video_set_nonblock_state_func(state) driver.video->set_nonblock_state(driver.video_data, state)
|
||||
#define video_alive_func() xdk360_gfx_alive(driver.video_data)
|
||||
#define video_focus_func() xdk360_gfx_focus(driver.video_data)
|
||||
#define video_alive_func() xdk360_alive(driver.video_data)
|
||||
#define video_focus_func() xdk360_focus(driver.video_data)
|
||||
#define video_xml_shader_func(path) driver.video->xml_shader(driver.video_data, path)
|
||||
#define video_free_func() xdk360_gfx_free(driver.video_data)
|
||||
#define video_set_rotation_func(orientation) xdk360_set_orientation(driver.video_data, orientation)
|
||||
#define video_set_aspect_ratio_func(aspectratio_idx) xdk360_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
||||
#define video_free_func() xdk360_free(driver.video_data)
|
||||
#define video_set_rotation_func(rotation) xdk360_set_rotation(driver.video_data, rotation)
|
||||
#define video_set_aspect_ratio_func(aspectratio_idx) gfx_ctx_set_aspect_ratio(driver.video_data, aspectratio_idx)
|
||||
|
||||
#define input_init_func() xdk360_input_initialize()
|
||||
#define input_poll_func() xdk360_input_poll(driver.input_data)
|
||||
|
3
driver.h
3
driver.h
@ -160,9 +160,6 @@ typedef struct video_driver
|
||||
|
||||
// Callbacks essentially useless on PC, but useful on consoles where the drivers are used for more stuff.
|
||||
#ifdef RARCH_CONSOLE
|
||||
void (*set_swap_block_state)(void *data, bool toggle); // Block swapping from being called in ::frame().
|
||||
void (*swap)(void *data); // Explicitly swap buffers. Only useful when set_swap_block_state() is set to true.
|
||||
void (*set_aspect_ratio)(void *data, unsigned aspectratio_idx); // TODO: refactor this properly to float.
|
||||
void (*start)(void);
|
||||
void (*stop)(void);
|
||||
void (*restart)(void);
|
||||
|
135
gfx/context/xdk360_ctx.c
Normal file
135
gfx/context/xdk360_ctx.c
Normal file
@ -0,0 +1,135 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../../driver.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "xdk360_ctx.h"
|
||||
|
||||
#include "../../360/xdk360_video.h"
|
||||
|
||||
void gfx_ctx_set_swap_interval(unsigned interval, bool inited)
|
||||
{
|
||||
(void)inited;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
if (interval)
|
||||
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
|
||||
else
|
||||
d3d9->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||
}
|
||||
|
||||
void gfx_ctx_check_window(bool *quit,
|
||||
bool *resize, unsigned *width, unsigned *height, unsigned frame_count)
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
*quit = false;
|
||||
*resize = false;
|
||||
|
||||
if (d3d9->quitting)
|
||||
*quit = true;
|
||||
|
||||
if (d3d9->should_resize)
|
||||
*resize = true;
|
||||
}
|
||||
|
||||
bool gfx_ctx_window_has_focus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gfx_ctx_set_resize(unsigned width, unsigned height) { }
|
||||
|
||||
void gfx_ctx_swap_buffers(void)
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
d3d9->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
bool gfx_ctx_menu_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gfx_ctx_update_window_title(bool reset) { }
|
||||
|
||||
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
|
||||
{
|
||||
(void)width;
|
||||
(void)height;
|
||||
}
|
||||
|
||||
bool gfx_ctx_init(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool gfx_ctx_set_video_mode(
|
||||
unsigned width, unsigned height,
|
||||
unsigned bits, bool fullscreen)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void gfx_ctx_destroy(void)
|
||||
{
|
||||
}
|
||||
|
||||
void gfx_ctx_input_driver(const input_driver_t **input, void **input_data) { }
|
||||
|
||||
void gfx_ctx_set_filtering(unsigned index, bool set_smooth) { }
|
||||
|
||||
void gfx_ctx_set_fbo(bool enable)
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
d3d9->fbo_enabled = enable;
|
||||
}
|
||||
|
||||
/*============================================================
|
||||
MISC
|
||||
TODO: Refactor
|
||||
============================================================ */
|
||||
|
||||
void gfx_ctx_set_projection(xdk360_video_t *d3d9, const struct gl_ortho *ortho, bool allow_rotate) { }
|
||||
|
||||
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index)
|
||||
{
|
||||
(void)data;
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
|
||||
if(g_console.aspect_ratio_index == ASPECT_RATIO_AUTO)
|
||||
rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);
|
||||
|
||||
g_settings.video.aspect_ratio = aspectratio_lut[g_console.aspect_ratio_index].value;
|
||||
g_settings.video.force_aspect = false;
|
||||
d3d9->should_resize = true;
|
||||
}
|
||||
|
||||
void gfx_ctx_set_overscan(void)
|
||||
{
|
||||
xdk360_video_t *d3d9 = (xdk360_video_t*)driver.video_data;
|
||||
if (!d3d9)
|
||||
return;
|
||||
|
||||
d3d9->should_resize = true;
|
||||
}
|
||||
|
20
gfx/context/xdk360_ctx.h
Normal file
20
gfx/context/xdk360_ctx.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _XDK360_CTX_H
|
||||
#define _XDK360_CTX_H
|
||||
|
||||
#endif
|
@ -28,6 +28,11 @@
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
#include "gl_common.h"
|
||||
#define VID_HANDLE gl_t
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_D3D9
|
||||
#define VID_HANDLE xdk360_video_t
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
@ -72,8 +77,8 @@ void gfx_ctx_set_filtering(unsigned index, bool set_smooth);
|
||||
void gfx_ctx_get_available_resolutions(void);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate);
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_D3D9)
|
||||
void gfx_ctx_set_projection(VID_HANDLE *gl, const struct gl_ortho *ortho, bool allow_rotate);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
3
gfx/gl.c
3
gfx/gl.c
@ -1295,9 +1295,6 @@ const video_driver_t video_gl = {
|
||||
"gl",
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
NULL, // FIXME: set_swap_block_state - to be removed
|
||||
NULL, // FIXME: swap - to be removed
|
||||
NULL, // FIXME: set_aspect_ratio - to be removed
|
||||
gl_start,
|
||||
gl_stop,
|
||||
gl_restart,
|
||||
|
@ -113,7 +113,7 @@
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6-rc1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.6-rc1";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -151,7 +151,7 @@
|
||||
<PREfast>AnalyzeOnly</PREfast>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;RARCH_CONSOLE;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -190,7 +190,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
@ -234,7 +234,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -275,7 +275,7 @@
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;main=rarch_main;RARCH_CONSOLE=1;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -316,7 +316,7 @@
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.6-rc1";_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;main=rarch_main;HAVE_CONFIGFILE;HAVE_FILEBROWSER;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_MAIN_WRAP;HAVE_RARCH_EXEC;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN;HAVE_HLSL;HAVE_VID_CONTEXT;HAVE_D3D9</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
|
Loading…
Reference in New Issue
Block a user