mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 22:43:41 +00:00
(360) Attempt to make clear in xdk360_video.cpp what is 360-specific
and what is not
This commit is contained in:
parent
6c5285c792
commit
ce7275393e
@ -27,7 +27,7 @@ static xdk360_video_font_t m_Font;
|
||||
void xdk360_console_draw(void)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *m_pd3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
|
||||
|
||||
// The top line
|
||||
unsigned int nTextLine = ( video_console.m_nCurLine -
|
||||
@ -55,7 +55,7 @@ HRESULT xdk360_console_init( LPCSTR strFontFileName, unsigned long colBackColor,
|
||||
unsigned long colTextColor)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *m_pd3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *m_pd3dDevice = vid->d3d_render_device;
|
||||
|
||||
video_console.first_message = true;
|
||||
video_console.m_Buffer = NULL;
|
||||
@ -354,7 +354,7 @@ static HRESULT xdk360_video_font_create_shaders (xdk360_video_font_t * font)
|
||||
|
||||
// Cache this global into a register
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *pd3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *pd3dDevice = vid->d3d_render_device;
|
||||
|
||||
hr = pd3dDevice->CreateVertexDeclaration( decl, &s_FontLocals.m_pFontVertexDecl );
|
||||
|
||||
@ -482,7 +482,7 @@ HRESULT xdk360_video_font_init(xdk360_video_font_t * font, const char * strFontF
|
||||
}
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *pd3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *pd3dDevice = vid->d3d_render_device;
|
||||
|
||||
// Initialize the window
|
||||
D3DDISPLAYMODE DisplayMode;
|
||||
@ -604,7 +604,7 @@ void xdk360_video_font_begin (xdk360_video_font_t * font)
|
||||
{
|
||||
// Cache the global pointer into a register
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *pD3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *pD3dDevice = vid->d3d_render_device;
|
||||
|
||||
// Save state
|
||||
if( font->m_bSaveState )
|
||||
@ -681,7 +681,7 @@ void xdk360_video_font_end(xdk360_video_font_t * font)
|
||||
{
|
||||
// Cache the global pointer into a register
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *pD3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *pD3dDevice = vid->d3d_render_device;
|
||||
|
||||
D3DDevice_SetTexture_Inline(pD3dDevice, 0, NULL);
|
||||
D3DDevice_SetVertexDeclaration(pD3dDevice, NULL);
|
||||
@ -711,7 +711,7 @@ void xdk360_video_font_draw_text(xdk360_video_font_t * font, float fOriginX, flo
|
||||
return;
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
D3DDevice *pd3dDevice = vid->xdk360_render_device;
|
||||
D3DDevice *pd3dDevice = vid->d3d_render_device;
|
||||
|
||||
// Set the color as a vertex shader constant
|
||||
float vColor[4];
|
||||
|
@ -489,7 +489,7 @@ int menu_init (void)
|
||||
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
|
||||
hr = app.InitShared(vid->xdk360_render_device, &vid->d3dpp, XuiPNGTextureLoader);
|
||||
hr = app.InitShared(vid->d3d_render_device, &vid->d3dpp, XuiPNGTextureLoader);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
@ -544,8 +544,8 @@ void menu_loop(void)
|
||||
ssnes_render_cached_frame();
|
||||
}
|
||||
else
|
||||
D3DDevice_Clear(vid->xdk360_render_device, 0, NULL,
|
||||
D3DCLEAR_TARGET, D3DCOLOR_ARGB(255, 32, 32, 64), 1.0, 0, FALSE);
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
D3DCOLOR_ARGB(255, 32, 32, 64), 1.0f, 0);
|
||||
|
||||
XINPUT_STATE state;
|
||||
XInputGetState(0, &state);
|
||||
|
@ -14,8 +14,10 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Xbox 360-specific headers
|
||||
#include <xtl.h>
|
||||
#include <xgraphics.h>
|
||||
|
||||
#include "../driver.h"
|
||||
#include "xdk360_video.h"
|
||||
#include "xdk360_video_resources.h"
|
||||
@ -34,6 +36,8 @@ static bool g_first_msg;
|
||||
unsigned g_frame_count;
|
||||
void *g_d3d;
|
||||
|
||||
/* Xbox 360 specific code */
|
||||
|
||||
struct XPR_HEADER
|
||||
{
|
||||
unsigned long dwMagic;
|
||||
@ -179,6 +183,8 @@ void PackedResource::Destroy()
|
||||
m_bInitialized = FALSE;
|
||||
}
|
||||
|
||||
/* end of Xbox 360 specific code */
|
||||
|
||||
static void xdk360_gfx_free(void * data)
|
||||
{
|
||||
if (g_d3d)
|
||||
@ -193,8 +199,8 @@ static void xdk360_gfx_free(void * data)
|
||||
vid->vertex_buf->Release();
|
||||
vid->v_decl->Release();
|
||||
hlsl_deinit();
|
||||
vid->xdk360_render_device->Release();
|
||||
vid->xdk360_device->Release();
|
||||
vid->d3d_render_device->Release();
|
||||
vid->d3d_device->Release();
|
||||
|
||||
free(vid);
|
||||
}
|
||||
@ -202,7 +208,7 @@ static void xdk360_gfx_free(void * data)
|
||||
static void set_viewport(bool force_full)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
vid->xdk360_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
|
||||
int width = vid->video_mode.fIsHiDef ? 1280 : 640;
|
||||
@ -255,7 +261,7 @@ static void set_viewport(bool force_full)
|
||||
vp.Y = m_viewport_y_temp;
|
||||
vp.MinZ = m_zNear;
|
||||
vp.MaxZ = m_zFar;
|
||||
vid->xdk360_render_device->SetViewport(&vp);
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
|
||||
//if(gl->overscan_enable && !force_full)
|
||||
//{
|
||||
@ -287,6 +293,7 @@ static void xdk360_set_orientation(void * data, uint32_t orientation)
|
||||
break;
|
||||
}
|
||||
|
||||
/* TODO: Move to D3DXMATRIX here */
|
||||
hlsl_set_proj_matrix(XMMatrixRotationZ(angle));
|
||||
}
|
||||
|
||||
@ -308,8 +315,8 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
if (!vid)
|
||||
return NULL;
|
||||
|
||||
vid->xdk360_device = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!vid->xdk360_device)
|
||||
vid->d3d_device = Direct3DCreate9(D3D_SDK_VERSION);
|
||||
if (!vid->d3d_device)
|
||||
{
|
||||
free(vid);
|
||||
return NULL;
|
||||
@ -340,12 +347,12 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
vid->d3dpp.PresentationInterval = video->vsync ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
|
||||
|
||||
// D3DCREATE_HARDWARE_VERTEXPROCESSING is ignored on 360
|
||||
vid->xdk360_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&vid->d3dpp, &vid->xdk360_render_device);
|
||||
vid->d3d_device->CreateDevice(0, D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&vid->d3dpp, &vid->d3d_render_device);
|
||||
|
||||
hlsl_init(g_settings.video.cg_shader_path, vid->xdk360_render_device);
|
||||
hlsl_init(g_settings.video.cg_shader_path, vid->d3d_render_device);
|
||||
|
||||
vid->xdk360_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
|
||||
vid->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
|
||||
0, &vid->lpTexture, NULL);
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
@ -356,7 +363,7 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
vid->last_width = 512;
|
||||
vid->last_height = 512;
|
||||
|
||||
vid->xdk360_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||
vid->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
|
||||
0, 0, 0, &vid->vertex_buf, NULL);
|
||||
|
||||
static const DrawVerticeFormats init_verts[] = {
|
||||
@ -378,20 +385,20 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
D3DDECL_END()
|
||||
};
|
||||
|
||||
vid->xdk360_render_device->CreateVertexDeclaration(VertexElements, &vid->v_decl);
|
||||
vid->d3d_render_device->CreateVertexDeclaration(VertexElements, &vid->v_decl);
|
||||
|
||||
vid->xdk360_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
|
||||
vid->xdk360_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
vid->xdk360_render_device->SetRenderState(D3DRS_ZENABLE, FALSE);
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
vid->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.MinZ = 0.0f;
|
||||
vp.MaxZ = 1.0f;
|
||||
vid->xdk360_render_device->SetViewport(&vp);
|
||||
vid->d3d_render_device->SetViewport(&vp);
|
||||
|
||||
xdk360_set_orientation(NULL, g_console.screen_orientation);
|
||||
|
||||
@ -403,7 +410,7 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
|
||||
vid->xdk360_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
vid->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
|
||||
0xff000000, 1.0f, 0);
|
||||
g_frame_count++;
|
||||
|
||||
@ -438,7 +445,7 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
hlsl_set_params(width, height, 512, 512, vid->d3dpp.BackBufferWidth,
|
||||
vid->d3dpp.BackBufferHeight, g_frame_count);
|
||||
|
||||
vid->xdk360_render_device->SetTexture(0, NULL);
|
||||
vid->d3d_render_device->SetTexture(0, NULL);
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
@ -450,16 +457,18 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
vid->lpTexture->UnlockRect(0);
|
||||
|
||||
vid->xdk360_render_device->SetTexture(0, vid->lpTexture);
|
||||
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MINFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_MAGFILTER, g_settings.video.smooth ? D3DTEXF_LINEAR : D3DTEXF_POINT);
|
||||
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);
|
||||
vid->xdk360_render_device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);
|
||||
vid->d3d_render_device->SetTexture(0, vid->lpTexture);
|
||||
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);
|
||||
|
||||
vid->xdk360_render_device->SetVertexDeclaration(vid->v_decl);
|
||||
vid->xdk360_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
vid->d3d_render_device->SetVertexDeclaration(vid->v_decl);
|
||||
vid->d3d_render_device->SetStreamSource(0, vid->vertex_buf, 0, sizeof(DrawVerticeFormats));
|
||||
|
||||
vid->xdk360_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
vid->d3d_render_device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
|
||||
|
||||
/* XBox 360 specific font code */
|
||||
if (msg)
|
||||
{
|
||||
if(IS_TIMER_EXPIRED() || g_first_msg)
|
||||
@ -473,7 +482,7 @@ static bool xdk360_gfx_frame(void *data, const void *frame,
|
||||
}
|
||||
|
||||
if(!vid->block_swap)
|
||||
vid->xdk360_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -494,17 +503,18 @@ static void xdk360_swap (void * data)
|
||||
{
|
||||
(void)data;
|
||||
xdk360_video_t *vid = (xdk360_video_t*)g_d3d;
|
||||
vid->xdk360_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
vid->d3d_render_device->Present(NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void xdk360_gfx_set_nonblock_state(void *data, bool state)
|
||||
{
|
||||
xdk360_video_t *vid = (xdk360_video_t*)data;
|
||||
SSNES_LOG("D3D Vsync => %s\n", state ? "off" : "on");
|
||||
/* XBox 360 specific code */
|
||||
if(state)
|
||||
vid->xdk360_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_IMMEDIATE);
|
||||
else
|
||||
vid->xdk360_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
|
||||
vid->d3d_render_device->SetRenderState(D3DRS_PRESENTINTERVAL, D3DPRESENT_INTERVAL_ONE);
|
||||
}
|
||||
|
||||
static bool xdk360_gfx_alive(void *data)
|
||||
@ -542,6 +552,7 @@ void xdk360_video_init(void)
|
||||
|
||||
g_first_msg = true;
|
||||
|
||||
/* XBox 360 specific font code */
|
||||
HRESULT hr = xdk360_console_init("game:\\media\\Arial_12.xpr",
|
||||
0xff000000, 0xffffffff );
|
||||
|
||||
|
@ -46,8 +46,8 @@ typedef struct xdk360_video
|
||||
bool vsync;
|
||||
unsigned last_width;
|
||||
unsigned last_height;
|
||||
IDirect3D9* xdk360_device;
|
||||
IDirect3DDevice9* xdk360_render_device;
|
||||
IDirect3D9* d3d_device;
|
||||
IDirect3DDevice9* d3d_render_device;
|
||||
IDirect3DVertexBuffer9* vertex_buf;
|
||||
IDirect3DTexture9* lpTexture;
|
||||
IDirect3DVertexDeclaration9* v_decl;
|
||||
|
@ -36,7 +36,7 @@ struct hlsl_program
|
||||
D3DXHANDLE mvp;
|
||||
LPD3DXCONSTANTTABLE v_ctable;
|
||||
LPD3DXCONSTANTTABLE f_ctable;
|
||||
XMMATRIX mvp_val;
|
||||
XMMATRIX mvp_val; /* TODO: Move to D3DXMATRIX here */
|
||||
};
|
||||
|
||||
static IDirect3DDevice9 *d3d_device_ptr;
|
||||
@ -111,6 +111,7 @@ void hlsl_set_params(unsigned width, unsigned height,
|
||||
set_param_2f(prg[active_index].out_size_v, out_size, prg[active_index].v_ctable);
|
||||
set_param_1f(prg[active_index].frame_cnt_v, (float)frame_count, prg[active_index].v_ctable);
|
||||
|
||||
/* TODO: Move to D3DXMATRIX here */
|
||||
prg[active_index].v_ctable->SetMatrix(d3d_device_ptr, prg[active_index].mvp, (D3DXMATRIX*)&prg[active_index].mvp_val);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user