From 4b0d3620c7141d3328a9d0b5853248abb668a074 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 16 Jul 2012 02:15:47 +0200 Subject: [PATCH] (360/Xbox 1) Move reusable XDK files to new folder - xdk -and create header for XDK definitions --- 360/xdk_d3d9.cpp | 2 +- 360/xdk_d3d9.h | 26 ++++---------- console/griffin/griffin.c | 2 +- gfx/fonts/xdk360_fonts.h | 2 +- xbox1/xdk_d3d8.h | 31 ++++------------ xdk/xdk_defines.h | 65 ++++++++++++++++++++++++++++++++++ {360 => xdk}/xdk_resources.cpp | 15 ++++++++ {360 => xdk}/xdk_resources.h | 31 ++++++++-------- 8 files changed, 112 insertions(+), 62 deletions(-) create mode 100644 xdk/xdk_defines.h rename {360 => xdk}/xdk_resources.cpp (91%) rename {360 => xdk}/xdk_resources.h (86%) diff --git a/360/xdk_d3d9.cpp b/360/xdk_d3d9.cpp index d3bbc49c82..a92b390f2f 100644 --- a/360/xdk_d3d9.cpp +++ b/360/xdk_d3d9.cpp @@ -38,7 +38,7 @@ #include "../gfx/fonts/xdk360_fonts.h" #endif -#include "xdk_resources.h" +#include "../xdk/xdk_resources.h" extern video_console_t video_console; extern xdk360_video_font_t m_Font; diff --git a/360/xdk_d3d9.h b/360/xdk_d3d9.h index 5ce5248379..25de09b596 100644 --- a/360/xdk_d3d9.h +++ b/360/xdk_d3d9.h @@ -18,6 +18,7 @@ #define _XDK360_VIDEO_H #include +#include "../xdk/xdk_defines.h" #define DFONT_MAX 4096 #define PRIM_FVF (D3DFVF_XYZRHW | D3DFVF_TEX1) @@ -41,19 +42,6 @@ typedef struct DrawVerticeFormats float u, v; } DrawVerticeFormats; -/* Direct3D 9 */ -#define LPDIRECT3D_PTR LPDIRECT3D9 -#define LPDIRECT3DDEVICE_PTR LPDIRECT3DDEVICE9 -#define LPDIRECT3DTEXTURE_PTR LPDIRECT3DTEXTURE9 -#define LPDIRECT3DSURFACE_PTR LPDIRECT3DSURFACE9 -#define LPDIRECT3DVERTEXBUFFER_PTR LPDIRECT3DVERTEXBUFFER9 - -#define D3DVIEWPORT D3DVIEWPORT9 -#define D3DVERTEXELEMENT D3DVERTEXELEMENT9 - -#define direct3d_create_ctx Direct3DCreate9 -#define IDirect3DVertexDeclaration IDirect3DVertexDeclaration9 - typedef struct xdk_d3d_video { bool block_swap; @@ -64,16 +52,16 @@ typedef struct xdk_d3d_video unsigned frame_count; unsigned last_width; unsigned last_height; - LPDIRECT3D_PTR d3d_device; - LPDIRECT3DDEVICE_PTR d3d_render_device; - LPDIRECT3DVERTEXBUFFER_PTR vertex_buf; - LPDIRECT3DTEXTURE_PTR lpTexture; + LPDIRECT3D d3d_device; + LPDIRECT3DDEVICE d3d_render_device; + LPDIRECT3DVERTEXBUFFER vertex_buf; + LPDIRECT3DTEXTURE lpTexture; D3DTexture lpTexture_ot_as16srgb; - LPDIRECT3DTEXTURE_PTR lpTexture_ot; + LPDIRECT3DTEXTURE lpTexture_ot; IDirect3DVertexDeclaration9* v_decl; XVIDEO_MODE video_mode; D3DPRESENT_PARAMETERS d3dpp; - LPDIRECT3DSURFACE_PTR lpSurface; + LPDIRECT3DSURFACE lpSurface; } xdk_d3d_video_t; #endif diff --git a/console/griffin/griffin.c b/console/griffin/griffin.c index b5c6cc465e..4744e36ffb 100644 --- a/console/griffin/griffin.c +++ b/console/griffin/griffin.c @@ -99,7 +99,7 @@ VIDEO DRIVER #include "../../gfx/gfx_common.c" #ifdef _XBOX -#include "../../360/xdk_resources.cpp" +#include "../../xdk/xdk_resources.cpp" #if defined(HAVE_D3D9) #include "../../360/xdk_d3d9.cpp" #elif defined(HAVE_D3D8) diff --git a/gfx/fonts/xdk360_fonts.h b/gfx/fonts/xdk360_fonts.h index 1fef7ce713..69cb967f0e 100644 --- a/gfx/fonts/xdk360_fonts.h +++ b/gfx/fonts/xdk360_fonts.h @@ -17,7 +17,7 @@ #ifndef RARCH_360_FONTS_H #define RARCH_360_FONTS_H -#include "../../360/xdk_resources.h" +#include "../../xdk/xdk_resources.h" #define PAGE_UP (255) #define PAGE_DOWN (-255) diff --git a/xbox1/xdk_d3d8.h b/xbox1/xdk_d3d8.h index 8fc0d16b5b..64e720d58a 100644 --- a/xbox1/xdk_d3d8.h +++ b/xbox1/xdk_d3d8.h @@ -20,6 +20,8 @@ #include #include +#include "../xdk/xdk_defines.h" + #define SHOW_DEBUG_INFO #define DFONT_MAX 4096 @@ -45,27 +47,6 @@ typedef struct DrawVerticeFormats float u, v; } DrawVerticeFormats; -/* Direct3D 8 */ -#define LPDIRECT3D_PTR LPDIRECT3D8 -#define LPDIRECT3DDEVICE_PTR LPDIRECT3DDEVICE8 -#define LPDIRECT3DTEXTURE_PTR LPDIRECT3DTEXTURE8 -#define LPDIRECT3DSURFACE_PTR LPDIRECT3DSURFACE8 -#define LPDIRECT3DVERTEXBUFFER_PTR LPDIRECT3DVERTEXBUFFER8 - -#define D3DVIEWPORT D3DVIEWPORT8 -#define D3DVERTEXELEMENT D3DVERTEXELEMENT8 - -#define direct3d_create_ctx Direct3DCreate8 -#define IDirect3DVertexBuffer IDirect3DVertexBuffer8 - -#define SetSamplerState SetTextureStageState -#define D3DLOCK_NOSYSLOCK (0) - -#define D3DSAMP_ADDRESSU D3DTSS_ADDRESSU -#define D3DSAMP_ADDRESSV D3DTSS_ADDRESSV -#define D3DSAMP_MAGFILTER D3DTSS_MAGFILTER -#define D3DSAMP_MINFILTER D3DTSS_MINFILTER - typedef struct xdk_d3d_video { bool block_swap; @@ -76,10 +57,10 @@ typedef struct xdk_d3d_video unsigned frame_count; unsigned last_width; unsigned last_height; - LPDIRECT3D_PTR d3d_device; - LPDIRECT3DDEVICE_PTR d3d_render_device; - LPDIRECT3DVERTEXBUFFER_PTR vertex_buf; - LPDIRECT3DTEXTURE_PTR lpTexture; + LPDIRECT3D d3d_device; + LPDIRECT3DDEVICE d3d_render_device; + LPDIRECT3DVERTEXBUFFER vertex_buf; + LPDIRECT3DTEXTURE lpTexture; DWORD video_mode; D3DPRESENT_PARAMETERS d3dpp; XFONT *debug_font; diff --git a/xdk/xdk_defines.h b/xdk/xdk_defines.h new file mode 100644 index 0000000000..afafba0d81 --- /dev/null +++ b/xdk/xdk_defines.h @@ -0,0 +1,65 @@ +/* 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 . + */ + +#ifndef _XDK_DEFINES_H +#define _XDK_DEFINES_H + +#if defined(_XBOX1) +/* XBox 1*/ +#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE8 +#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE8 +#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE8 +#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE8 +#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER8 +#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE8 +#define LPDIRECT3D LPDIRECT3D8 +#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE8 +#define LPDIRECT3DSURFACE LPDIRECT3DSURFACE8 + +#define D3DVIEWPORT D3DVIEWPORT8 +#define D3DVERTEXELEMENT D3DVERTEXELEMENT8 + +#define direct3d_create_ctx Direct3DCreate8 +#define IDirect3DVertexBuffer IDirect3DVertexBuffer8 + +#define SetSamplerState SetTextureStageState +#define D3DLOCK_NOSYSLOCK (0) + +#define D3DSAMP_ADDRESSU D3DTSS_ADDRESSU +#define D3DSAMP_ADDRESSV D3DTSS_ADDRESSV +#define D3DSAMP_MAGFILTER D3DTSS_MAGFILTER +#define D3DSAMP_MINFILTER D3DTSS_MINFILTER + +#elif defined(_XBOX360) +/* XBox 360*/ +#define LPDIRECT3D LPDIRECT3D9 +#define LPDIRECT3DDEVICE LPDIRECT3DDEVICE9 +#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9 +#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE9 +#define LPDIRECT3DSURFACE LPDIRECT3DSURFACE9 +#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE9 +#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER9 +#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE9 + +#define D3DVIEWPORT D3DVIEWPORT9 +#define D3DVERTEXELEMENT D3DVERTEXELEMENT9 + +#define direct3d_create_ctx Direct3DCreate9 +#define IDirect3DVertexDeclaration IDirect3DVertexDeclaration9 + +#endif + +#endif diff --git a/360/xdk_resources.cpp b/xdk/xdk_resources.cpp similarity index 91% rename from 360/xdk_resources.cpp rename to xdk/xdk_resources.cpp index 3446bc65ce..f39e4f9ca5 100644 --- a/360/xdk_resources.cpp +++ b/xdk/xdk_resources.cpp @@ -1,3 +1,18 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * + * 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 . + */ + #include #include "xdk_resources.h" diff --git a/360/xdk_resources.h b/xdk/xdk_resources.h similarity index 86% rename from 360/xdk_resources.h rename to xdk/xdk_resources.h index 701c4f2bbb..cdfa001b7d 100644 --- a/360/xdk_resources.h +++ b/xdk/xdk_resources.h @@ -1,21 +1,22 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2012 - Hans-Kristian Arntzen + * + * 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 . + */ + #ifndef RARCH_XDK_RESOURCE_H #define RARCH_XDK_RESOURCE_H -#if defined(_XBOX1) -#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE8 -#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE8 -#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE8 -#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE8 -#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER8 -#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE8 -#elif defined(_XBOX360) -#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE9 -#define LPDIRECT3DTEXTURE LPDIRECT3DTEXTURE9 -#define LPDIRECT3DCUBETEXTURE LPDIRECT3DCUBETEXTURE9 -#define LPDIRECT3DVOLUMETEXTURE LPDIRECT3DVOLUMETEXTURE9 -#define LPDIRECT3DVERTEXBUFFER LPDIRECT3DVERTEXBUFFER9 -#define LPDIRECT3DRESOURCE LPDIRECT3DRESOURCE9 -#endif +#include "xdk_defines.h" DWORD XBResource_SizeOf( LPDIRECT3DRESOURCE pResource );