(360) Don't bake in HAVE_XUI anymore; buildfixes for C++

This commit is contained in:
twinaphex 2018-04-23 17:35:36 +02:00
parent fec8d3294c
commit 789ef63dee
5 changed files with 48 additions and 35 deletions

View File

@ -606,8 +606,7 @@ void d3d9x_constant_table_set_matrix(LPDIRECT3DDEVICE9 dev,
}
const bool d3d9x_constant_table_set_float(void *p,
void *a,
const void *b, float val)
void *a, void *b, float val)
{
#if defined(HAVE_D3DX)
LPDIRECT3DDEVICE9 dev = (LPDIRECT3DDEVICE9)a;

View File

@ -245,7 +245,7 @@ static INLINE void d3d9_lock_rectangle_clear(void *tex,
level = 0;
#endif
memset(lr->pBits, level, rectangle_height * lr->Pitch);
d3d9_unlock_rectangle(tex);
d3d9_unlock_rectangle((LPDIRECT3DTEXTURE9)tex);
}
static INLINE void d3d9_set_texture(
@ -668,7 +668,7 @@ void d3d9x_constant_table_set_matrix(LPDIRECT3DDEVICE9 dev,
const void *d3d9x_get_buffer_ptr(void *data);
const bool d3d9x_constant_table_set_float(void *p,
void *a, const void *b, float val);
void *a, void *b, float val);
void *d3d9x_constant_table_get_constant_by_name(void *_tbl,
void *_handle, void *_name);

View File

@ -397,7 +397,7 @@ typedef struct
float m_fFontBottomPadding; /* Padding below the strike zone. */
float m_fFontYAdvance; /* Number of pixels to move the cursor for a line feed. */
wchar_t * m_TranslatorTable; /* ASCII to glyph lookup table. */
void *m_pFontTexture;
LPDIRECT3DTEXTURE9 m_pFontTexture;
const GLYPH_ATTR* m_Glyphs; /* Array of glyphs. */
} xdk360_video_font_t;
@ -420,7 +420,7 @@ typedef struct
static PackedResource m_xprResource;
static bool xdk360_video_font_create_shaders(xdk360_video_font_t * font, void *dev)
static bool xdk360_video_font_create_shaders(xdk360_video_font_t * font, LPDIRECT3DDEVICE9 dev)
{
ID3DXBuffer* pShaderCode = NULL;
@ -443,7 +443,7 @@ static bool xdk360_video_font_create_shaders(xdk360_video_font_t * font, void *d
if (!d3d9_vertex_declaration_new(dev, decl, (void**)&font->s_FontLocals.m_pFontVertexDecl))
goto error;
if (!d3dx_compile_shader( font_hlsl_d3d9_program, sizeof(font_hlsl_d3d9_program)-1 ,
if (!d3d9x_compile_shader( font_hlsl_d3d9_program, sizeof(font_hlsl_d3d9_program)-1 ,
NULL, NULL, "main_vertex", "vs.2.0", 0, &pShaderCode, NULL, NULL ))
goto error;
@ -453,7 +453,7 @@ static bool xdk360_video_font_create_shaders(xdk360_video_font_t * font, void *d
d3d9x_buffer_release(pShaderCode);
if (!d3dx_compile_shader(font_hlsl_d3d9_program, sizeof(font_hlsl_d3d9_program)-1 ,
if (!d3d9x_compile_shader(font_hlsl_d3d9_program, sizeof(font_hlsl_d3d9_program)-1 ,
NULL, NULL, "main_fragment", "ps.2.0", 0,&pShaderCode, NULL, NULL ))
goto error;
@ -468,8 +468,8 @@ static bool xdk360_video_font_create_shaders(xdk360_video_font_t * font, void *d
error:
if (pShaderCode)
d3d9x_buffer_release(pShaderCode);
d3d9_free_pixel_shader(font->d3d->dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_free_vertex_shader(font->d3d->dev, font->s_FontLocals.m_pFontVertexShader);
d3d9_free_pixel_shader((LPDIRECT3DDEVICE9)font->d3d->dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_free_vertex_shader((LPDIRECT3DDEVICE9)font->d3d->dev, font->s_FontLocals.m_pFontVertexShader);
d3d9_vertex_declaration_free(font->s_FontLocals.m_pFontVertexDecl);
font->s_FontLocals.m_pFontPixelShader = NULL;
font->s_FontLocals.m_pFontVertexShader = NULL;
@ -505,11 +505,11 @@ static void *xdk360_init_font(void *video_data,
if (FAILED( m_xprResource.Create(font_path, 0, NULL)))
goto error;
pFontTexture = m_xprResource.GetTexture( "FontTexture" );
pFontTexture = (LPDIRECT3DTEXTURE9)m_xprResource.GetTexture( "FontTexture" );
pFontData = m_xprResource.GetData( "FontData");
/* Save a copy of the texture. */
font->m_pFontTexture = pFontTexture;
font->m_pFontTexture = (LPDIRECT3DTEXTURE9)pFontTexture;
/* Check version of file (to make sure it matches up with the FontMaker tool). */
pData = (const uint8_t*)pFontData;
@ -537,7 +537,7 @@ static void *xdk360_init_font(void *video_data,
font->m_Glyphs = ((const FontFileStrikesImage_t *)pData)->m_Glyphs;
/* Create the vertex and pixel shaders for rendering the font */
if (!xdk360_video_font_create_shaders(font, font->d3d->dev))
if (!xdk360_video_font_create_shaders(font, (LPDIRECT3DDEVICE9)font->d3d->dev))
{
RARCH_ERR( "Could not create font shaders.\n" );
goto error;
@ -566,8 +566,8 @@ static void xdk360_free_font(void *data, bool is_threaded)
font->m_cMaxGlyph = 0;
font->m_TranslatorTable = NULL;
d3d9_free_pixel_shader(font->d3d->dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_free_vertex_shader(font->d3d->dev, font->s_FontLocals.m_pFontVertexShader);
d3d9_free_pixel_shader((LPDIRECT3DDEVICE9)font->d3d->dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_free_vertex_shader((LPDIRECT3DDEVICE9)font->d3d->dev, font->s_FontLocals.m_pFontVertexShader);
d3d9_vertex_declaration_free(font->s_FontLocals.m_pFontVertexDecl);
font->s_FontLocals.m_pFontPixelShader = NULL;
@ -583,24 +583,35 @@ static void xdk360_free_font(void *data, bool is_threaded)
static void xdk360_render_msg_post(xdk360_video_font_t * font)
{
if (!font || !font->d3d || !font->d3d->dev)
LPDIRECT3DDEVICE9 dev;
if (!font || !font->d3d)
return;
dev = (LPDIRECT3DDEVICE9)font->d3d->dev;
d3d9_set_texture(font->d3d->dev, 0, NULL);
d3d9_set_vertex_declaration(font->d3d->dev, NULL);
d3d9_set_vertex_shader(font->d3d->dev, 0, NULL);
d3d9_set_pixel_shader(font->d3d->dev, NULL);
d3d9_set_render_state(font->d3d->dev, D3DRS_VIEWPORTENABLE, font->m_dwSavedState);
if (!dev)
return;
d3d9_set_texture(dev, 0, NULL);
d3d9_set_vertex_declaration(dev, NULL);
d3d9_set_vertex_shader(dev, 0, NULL);
d3d9_set_pixel_shader(dev, NULL);
d3d9_set_render_state(dev, D3DRS_VIEWPORTENABLE, font->m_dwSavedState);
}
static void xdk360_render_msg_pre(xdk360_video_font_t * font)
{
float vTexScale[4];
D3DSURFACE_DESC TextureDesc;
LPDIRECT3DDEVICE9 dev;
if (!font || !font->d3d || !font->d3d->dev)
if (!font || !font->d3d)
return;
dev = (LPDIRECT3DDEVICE9)font->d3d->dev;
if (!dev)
return;
/* Save state. */
d3d9_get_render_state(font->d3d->dev, D3DRS_VIEWPORTENABLE,
(DWORD*)&font->m_dwSavedState );
@ -610,18 +621,18 @@ static void xdk360_render_msg_pre(xdk360_video_font_t * font)
d3d9_texture_get_level_desc(font->m_pFontTexture, 0, &TextureDesc);
/* Set render state. */
d3d9_set_texture(font->d3d->dev, 0, font->m_pFontTexture);
d3d9_set_texture(dev, 0, font->m_pFontTexture);
vTexScale[0] = 1.0f / TextureDesc.Width;
vTexScale[1] = 1.0f / TextureDesc.Height;
vTexScale[2] = 0.0f;
vTexScale[3] = 0.0f;
d3d9_set_render_state(font->d3d->dev, D3DRS_VIEWPORTENABLE, FALSE);
d3d9_set_vertex_declaration(font->d3d->dev, font->s_FontLocals.m_pFontVertexDecl);
d3d9_set_vertex_shader(font->d3d->dev, 0, font->s_FontLocals.m_pFontVertexShader);
d3d9_set_pixel_shader(font->d3d->dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_set_vertex_shader_constantf(font->d3d->dev, 2, vTexScale, 1);
d3d9_set_render_state(dev, D3DRS_VIEWPORTENABLE, FALSE);
d3d9_set_vertex_declaration(dev, font->s_FontLocals.m_pFontVertexDecl);
d3d9_set_vertex_shader(dev, 0, font->s_FontLocals.m_pFontVertexShader);
d3d9_set_pixel_shader(dev, font->s_FontLocals.m_pFontPixelShader);
d3d9_set_vertex_shader_constantf(dev, 2, vTexScale, 1);
}
static void xdk360_draw_text(xdk360_video_font_t *font,

View File

@ -15,6 +15,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#define CINTERFACE
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
@ -47,6 +49,7 @@
#include "../../gfx/drivers/d3d.h"
#include "../../gfx/common/d3d_common.h"
#include "../../gfx/common/d3d9_common.h"
#define XUI_CONTROL_NAVIGATE_OK (XUI_CONTROL_NAVIGATE_RIGHT + 1)
@ -236,7 +239,7 @@ HRESULT XuiTextureLoader(IXuiDevice *pDevice, LPCWSTR szFileName,
D3DX_DEFAULT_NONPOW2,
1,
D3DUSAGE_CPU_CACHED_MEMORY,
(D3DFORMAT)d3d_get_argb8888_format(),
(D3DFORMAT)d3d9_get_argb8888_format(),
D3DPOOL_DEFAULT,
D3DX_FILTER_NONE,
D3DX_FILTER_NONE,

View File

@ -113,7 +113,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;HAVE_XINPUT2;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_XUI;HAVE_MENU;HAVE_NETWORKING;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;HAVE_XINPUT2;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_MENU;HAVE_NETWORKING;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
@ -152,7 +152,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_XUI;HAVE_MENU;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_MENU;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
@ -192,7 +192,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_XUI;HAVE_MENU;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_MENU;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
@ -237,7 +237,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XUI;HAVE_MENU;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_MENU;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -279,7 +279,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XUI;HAVE_MENU;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE=1;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_MENU;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -321,7 +321,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_XUI;HAVE_MENU;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);HAVE_XINPUT2;_CRT_SECURE_NO_WARNINGS;RARCH_CONSOLE;HAVE_MENU;HAVE_NETWORKING;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_RARCH_EXEC;D3DCOMPILE_USEVOIDS;HAVE_RUNAHEAD;HAVE_GRIFFIN;HAVE_HLSL;HAVE_CC_RESAMPLER;HAVE_D3D9;HAVE_D3D;RARCH_INTERNAL;MSB_FIRST;_XBOX360;WANT_ZLIB;HAVE_XAUDIO;HAVE_RPNG;HAVE_RJPEG;HAVE_THREADS;HAVE_FILTERS_BUILTIN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\..\..\deps\zlib;$(SolutionDir)\..\..\libretro-common\include;$(SolutionDir)\..\..\deps;$(SolutionDir)\..\..\deps\stb;$(SolutionDir)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>