(Xbox 1) Remove Video.cpp from RetroLaunch - still black

This commit is contained in:
twinaphex 2012-07-23 16:38:29 +02:00
parent b9090fca96
commit 2f51da4034
8 changed files with 40 additions and 218 deletions

View File

@ -372,9 +372,6 @@
<File
RelativePath="..\..\xbox1\RetroLaunch\IoSupport.cpp">
</File>
<File
RelativePath="..\..\xbox1\RetroLaunch\Launcher.cpp">
</File>
<File
RelativePath="..\..\xbox1\RetroLaunch\MenuMain.cpp">
</File>
@ -390,9 +387,6 @@
<File
RelativePath="..\..\xbox1\RetroLaunch\Surface.cpp">
</File>
<File
RelativePath="..\..\xbox1\RetroLaunch\Video.cpp">
</File>
</Filter>
</Filter>
<Filter

View File

@ -17,7 +17,8 @@
#ifdef _XBOX
#include "Font.h"
#include <xgraphics.h>
#include "../../general.h"
#include "../xdk_d3d8.h"
Font g_font;
@ -43,7 +44,7 @@ bool Font::Create(const string &szTTFFilename)
m_pFont->Release();
word *wcPathBuf = StringToWChar(szTTFFilename);
g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
HRESULT g_hResult = XFONT_OpenTrueTypeFont(wcPathBuf, 256 * 1024, &m_pFont);
delete [] wcPathBuf;
@ -80,6 +81,7 @@ void Font::Render(const string &str, int x, int y, dword height, dword style, D3
void Font::RenderToTexture(CSurface &texture, const string &str, dword height, dword style, D3DXCOLOR color, int maxWidth, bool fade)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (m_pFont == NULL)
return;
@ -114,7 +116,7 @@ void Font::RenderToTexture(CSurface &texture, const string &str, dword height, d
// create an temporary image surface to render to
D3DSurface *pTempSurface;
g_video.m_pD3DDevice->CreateImageSurface(dwTextureWidth, dwTextureHeight, D3DFMT_LIN_A8R8G8B8, &pTempSurface);
d3d->d3d_render_device->CreateImageSurface(dwTextureWidth, dwTextureHeight, D3DFMT_LIN_A8R8G8B8, &pTempSurface);
// clear the temporary surface
{

View File

@ -17,6 +17,8 @@
#include "Surface.h"
#include "Debug.h"
#include "../../general.h"
#include "../xdk_d3d8.h"
CSurface::CSurface()
@ -45,10 +47,11 @@ CSurface::~CSurface()
bool CSurface::Create(const string &szFilename)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (m_bLoaded)
Destroy();
g_hResult = D3DXCreateTextureFromFileExA(g_video.m_pD3DDevice, // d3d device
HRESULT g_hResult = D3DXCreateTextureFromFileExA(d3d->d3d_render_device, // d3d device
("D:\\" + szFilename).c_str(), // filename
D3DX_DEFAULT, D3DX_DEFAULT, // width/height
D3DX_DEFAULT, // mipmaps
@ -69,7 +72,7 @@ bool CSurface::Create(const string &szFilename)
}
// create a vertex buffer for the quad that will display the texture
g_hResult = g_video.m_pD3DDevice->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
g_hResult = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX,
D3DPOOL_MANAGED, &m_pVertexBuffer);
@ -87,10 +90,11 @@ bool CSurface::Create(const string &szFilename)
bool CSurface::Create(dword width, dword height)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (m_bLoaded)
Destroy();
g_hResult = g_video.m_pD3DDevice->CreateTexture(width, height, 1, 0,
HRESULT g_hResult = d3d->d3d_render_device->CreateTexture(width, height, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
&m_pTexture);
@ -105,7 +109,7 @@ bool CSurface::Create(dword width, dword height)
m_imageInfo.Format = D3DFMT_A8R8G8B8;
// create a vertex buffer for the quad that will display the texture
g_hResult = g_video.m_pD3DDevice->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
g_hResult = d3d->d3d_render_device->CreateVertexBuffer(4 * sizeof(DrawVerticeFormats),
D3DUSAGE_WRITEONLY,
D3DFVF_CUSTOMVERTEX,
D3DPOOL_MANAGED, &m_pVertexBuffer);
@ -157,6 +161,7 @@ bool CSurface::Render(int x, int y)
bool CSurface::Render(int x, int y, dword w, dword h)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
if (m_pTexture == NULL || m_pVertexBuffer == NULL || m_bLoaded == false)
return false;
@ -176,7 +181,7 @@ bool CSurface::Render(int x, int y, dword w, dword h)
// load the existing vertices
/*CustomVertex*/DrawVerticeFormats *pCurVerts;
g_hResult = m_pVertexBuffer->Lock(0, 0, (byte **)&pCurVerts, 0);
HRESULT g_hResult = m_pVertexBuffer->Lock(0, 0, (byte **)&pCurVerts, 0);
if (FAILED(g_hResult))
{
@ -189,20 +194,20 @@ bool CSurface::Render(int x, int y, dword w, dword h)
m_pVertexBuffer->Unlock();
g_video.m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
g_video.m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_video.m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3d->d3d_render_device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3d->d3d_render_device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3d->d3d_render_device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
// also blend the texture with the set alpha value
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
g_video.m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
d3d->d3d_render_device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
// draw the quad
g_video.m_pD3DDevice->SetTexture(0, m_pTexture);
g_video.m_pD3DDevice->SetStreamSource(0, m_pVertexBuffer, sizeof(DrawVerticeFormats));
g_video.m_pD3DDevice->SetVertexShader(D3DFVF_CUSTOMVERTEX);
g_video.m_pD3DDevice->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
d3d->d3d_render_device->SetTexture(0, m_pTexture);
d3d->d3d_render_device->SetStreamSource(0, m_pVertexBuffer, sizeof(DrawVerticeFormats));
d3d->d3d_render_device->SetVertexShader(D3DFVF_CUSTOMVERTEX);
d3d->d3d_render_device->DrawPrimitive(D3DPT_QUADLIST, 0, 1);
return true;
}

View File

@ -18,7 +18,6 @@
#pragma once
#include "Global.h"
#include "Video.h"
class CSurface
{

View File

@ -1,126 +0,0 @@
/**
* RetroLaunch 2012
*
* This program 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
* Foundation; either version 2 of the License, or (at your option) any later
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
* authors: Surreal64 CE Team (http://www.emuxtras.net)
*/
#include "Video.h"
#include "IniFile.h"
#include "Debug.h"
CVideo g_video;
HRESULT g_hResult;
CVideo::CVideo(void)
{
}
CVideo::~CVideo(void)
{
}
bool CVideo::SetDevice(IDirect3DDevice8 *D3D_Device)
{
m_pD3DDevice = D3D_Device;
return true;
}
bool CVideo::Create(HWND hDeviceWindow, bool bWindowed)
{
/*
// Create the Direct3D object (leave it DX8 or should we try DX9 for WIN32 ?)
m_pD3D = Direct3DCreate8(D3D_SDK_VERSION);
if (m_pD3D == NULL)
return false;
// set up the structure used to create the d3d device
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.BackBufferWidth = 640;
d3dpp.BackBufferHeight = 480;
d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount = 1;
//d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
//d3dpp.EnableAutoDepthStencil = false;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
//Fullscreen only
if(!bWindowed)
{
if(!g_iniFile.m_currentIniEntry.bVSync) {
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
}else{
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
}
}
g_hResult = m_pD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, NULL,
D3DCREATE_HARDWARE_VERTEXPROCESSING,
&d3dpp, &m_pD3DDevice);
if (FAILED(g_hResult))
{
g_debug.Print("Error: D3DCreate(), CreateDevice()");
return false;
}
// use an orthogonal matrix for the projection matrix
D3DXMATRIX mat;
D3DXMatrixOrthoOffCenterLH(&mat, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f);
m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &mat);
// use an identity matrix for the world and view matrices
D3DXMatrixIdentity(&mat);
m_pD3DDevice->SetTransform(D3DTS_WORLD, &mat);
m_pD3DDevice->SetTransform(D3DTS_VIEW, &mat);
// disable lighting
m_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
// disable z-buffer (see autodepthstencil)
m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, FALSE );
*/
return true;
}
void CVideo::BeginRender()
{
m_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0, 0, 0),
1.0f, 0);
m_pD3DDevice->BeginScene();
m_pD3DDevice->SetFlickerFilter(g_iniFile.m_currentIniEntry.dwFlickerFilter);
m_pD3DDevice->SetSoftDisplayFilter(g_iniFile.m_currentIniEntry.bSoftDisplayFilter);
}
void CVideo::EndRender()
{
m_pD3DDevice->EndScene();
m_pD3DDevice->Present(NULL, NULL, NULL, NULL);
}
void CVideo::CleanUp()
{
if( m_pD3DDevice != NULL)
m_pD3DDevice->Release();
if( m_pD3D != NULL)
m_pD3D->Release();
}

View File

@ -1,56 +0,0 @@
/**
* RetroLaunch 2012
*
* This program 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
* Foundation; either version 2 of the License, or (at your option) any later
* version. This program 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 this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. To contact the
* authors: Surreal64 CE Team (http://www.emuxtras.net)
*/
#pragma once
#include "Global.h"
#undef D3DFVF_CUSTOMVERTEX
//#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
/*
typedef struct CustomVertex
{
float x, y, z;
dword color;
float u, v;
//float rhw;
}CustomVertex;
*/
class CVideo
{
public:
CVideo(void);
~CVideo(void);
bool Create(HWND hDeviceWindow, bool bWindowed); //Device creation
bool SetDevice(IDirect3DDevice8 *D3D_Device);
void BeginRender();
void EndRender();
void CleanUp();
public:
/*Direct3D*/IDirect3D8 *m_pD3D; //D3D object
/*D3DDevice*/IDirect3DDevice8 *m_pD3DDevice; //D3D device
private:
//nothing
};
extern CVideo g_video;
extern HRESULT g_hResult;

View File

@ -93,6 +93,7 @@ static void set_default_settings (void)
static void get_environment_settings (void)
{
HRESULT ret;
(void)ret;
#ifdef HAVE_HDD_CACHE_PARTITION
ret = XSetFileCacheSize(0x100000);
@ -167,7 +168,6 @@ static void configure_libretro(const char *path_prefix, const char * extension)
#ifdef _XBOX1
#include "../../xbox1/RetroLaunch/Global.h"
#include "../../xbox1/RetroLaunch/Video.h"
#include "../../xbox1/RetroLaunch/IniFile.h"
#include "../../xbox1/RetroLaunch/IoSupport.h"
#include "../../xbox1/RetroLaunch/Input.h"
@ -193,14 +193,6 @@ static void menu_init(void)
g_IOSupport.Mount("G:", "Harddisk0\\Partition7");
// Get RetroArch's native d3d device
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
// Initialize Direct3D
//if (!g_video.Create(NULL, false))
//return;
if(!g_video.SetDevice(d3d->d3d_render_device))
return;
// Parse ini file for settings
g_iniFile.CheckForIniEntry();
@ -218,19 +210,31 @@ static void menu_init(void)
// Build menu here (Menu state -> Main Menu)
g_menuManager.Create();
g_console.mode_switch = MODE_MENU;
}
static void menu_free(void) {}
static void menu_loop(void)
{
xdk_d3d_video_t *d3d = (xdk_d3d_video_t*)driver.video_data;
//rarch_console_load_game("D:\\ssf2x.gba");
// Loop the app
while (!g_bExit)
{
g_video.BeginRender();
d3d->d3d_render_device->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0, 0, 0),
1.0f, 0);
d3d->d3d_render_device->BeginScene();
d3d->d3d_render_device->SetFlickerFilter(g_iniFile.m_currentIniEntry.dwFlickerFilter);
d3d->d3d_render_device->SetSoftDisplayFilter(g_iniFile.m_currentIniEntry.bSoftDisplayFilter);
g_input.GetInput();
g_menuManager.Update();
g_video.EndRender();
d3d->d3d_render_device->EndScene();
d3d->d3d_render_device->Present(NULL, NULL, NULL, NULL);
}
}
#endif