More XDK related guff

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5085 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2017-03-28 19:18:47 +00:00
parent 98beab3f53
commit 492feafd1d
4 changed files with 27 additions and 17 deletions

View File

@ -71,7 +71,7 @@ void VARGS Sys_Printf (char *fmt, ...)
char msg[MAXPRINTMSG]; char msg[MAXPRINTMSG];
va_start (argptr,fmt); va_start (argptr,fmt);
Q_snprintfz (msg,sizeof(msg)-1, fmt,argptr); vsnprintf(msg,sizeof(msg)-1, fmt,argptr);
msg[sizeof(msg)-1] = 0; //_vsnprintf sucks. msg[sizeof(msg)-1] = 0; //_vsnprintf sucks.
va_end (argptr); va_end (argptr);

View File

@ -448,19 +448,11 @@ static void resetD3D8(void)
return; return;
} }
/*clear the screen to black as soon as we start up, so there's no lingering framebuffer state*/ /*clear the screen to black as soon as we start up, so there's no lingering framebuffer state*/
IDirect3DDevice8_BeginScene(pD3DDev8); IDirect3DDevice8_BeginScene(pD3DDev8);
IDirect3DDevice8_Clear(pD3DDev8, 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); IDirect3DDevice8_Clear(pD3DDev8, 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
IDirect3DDevice8_EndScene(pD3DDev8); IDirect3DDevice8_EndScene(pD3DDev8);
IDirect3DDevice8_Present(pD3DDev8, NULL, NULL, NULL, NULL); IDirect3DDevice8_Present(pD3DDev8, NULL, NULL, NULL, NULL);
//IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_DITHERENABLE, FALSE); //IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_DITHERENABLE, FALSE);
//IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_SPECULARENABLE, FALSE); //IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_SPECULARENABLE, FALSE);
//IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE); //IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRENDERSTATE_TEXTUREPERSPECTIVE, TRUE);
@ -584,7 +576,9 @@ static qboolean initD3D8Device(HWND hWnd, rendererstate_t *info, unsigned int de
break; break;
} }
#ifndef _XBOX #ifdef _XBOX
cflags = 0;
#else
cflags = D3DCREATE_FPU_PRESERVE; cflags = D3DCREATE_FPU_PRESERVE;
#endif #endif
if ((caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && (caps.DevCaps & D3DDEVCAPS_PUREDEVICE)) if ((caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && (caps.DevCaps & D3DDEVCAPS_PUREDEVICE))
@ -662,8 +656,8 @@ static qboolean initD3D8Device(HWND hWnd, rendererstate_t *info, unsigned int de
static void initD3D8(HWND hWnd, rendererstate_t *info) static void initD3D8(HWND hWnd, rendererstate_t *info)
{ {
#ifdef _XBOX #ifdef _XBOX
LPDIRECT3D8 pDirect3DCreate8 = NULL; pD3D = Direct3DCreate8( D3D_SDK_VERSION );
pDirect3DCreate8 = Direct3DCreate8( D3D_SDK_VERSION ); initD3D8Device(NULL, info, 0, D3DDEVTYPE_HAL);
#else #else
int i; int i;
int numadaptors; int numadaptors;
@ -721,15 +715,27 @@ static void initD3D8(HWND hWnd, rendererstate_t *info)
static qboolean D3D8_VID_Init(rendererstate_t *info, unsigned char *palette) static qboolean D3D8_VID_Init(rendererstate_t *info, unsigned char *palette)
{ {
#ifdef _XBOX #ifdef _XBOX
vid_initializing = true;
initD3D8( NULL, info );
IDirect3DDevice8_Clear(pD3DDev8, 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 0, 255), 1.0f, 0);
IDirect3DDevice8_BeginScene(pD3DDev8);
IDirect3DDevice8_EndScene(pD3DDev8);
IDirect3DDevice8_Present(pD3DDev8, NULL, NULL, NULL, NULL);
D3D8_Set2D();
vid.pixelwidth = 640; vid.pixelwidth = 640;
vid.pixelheight = 480; vid.pixelheight = 480;
vid.width = 640; vid.width = 640;
vid.height = 480; vid.height = 480;
vid_initializing = false; vid_initializing = false;
IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRS_LIGHTING, FALSE); IDirect3DDevice8_SetRenderState(pD3DDev8, D3DRS_LIGHTING, FALSE);
return TRUE;
#else #else
DWORD width = info->width; DWORD width = info->width;
DWORD height = info->height; DWORD height = info->height;
@ -838,7 +844,6 @@ static qboolean D3D8_VID_Init(rendererstate_t *info, unsigned char *palette)
static void (D3D8_VID_DeInit) (void) static void (D3D8_VID_DeInit) (void)
{ {
#ifndef _XBOX
Image_Shutdown(); Image_Shutdown();
/*final shutdown, kill the video stuff*/ /*final shutdown, kill the video stuff*/
@ -847,7 +852,9 @@ static void (D3D8_VID_DeInit) (void)
D3D8BE_Reset(true); D3D8BE_Reset(true);
/*try and knock it back into windowed mode to avoid d3d bugs*/ /*try and knock it back into windowed mode to avoid d3d bugs*/
#ifndef _XBOX
d3dpp.Windowed = true; d3dpp.Windowed = true;
#endif
IDirect3DDevice8_Reset(pD3DDev8, &d3dpp); IDirect3DDevice8_Reset(pD3DDev8, &d3dpp);
IDirect3DDevice8_Release(pD3DDev8); IDirect3DDevice8_Release(pD3DDev8);
@ -858,16 +865,17 @@ static void (D3D8_VID_DeInit) (void)
IDirect3D8_Release(pD3D); IDirect3D8_Release(pD3D);
pD3D = NULL; pD3D = NULL;
} }
#ifndef _XBOX
if (mainwindow) if (mainwindow)
{ {
DestroyWindow(mainwindow); DestroyWindow(mainwindow);
mainwindow = NULL; mainwindow = NULL;
} }
#endif
// Cvar_Unhook(&v_gamma); // Cvar_Unhook(&v_gamma);
// Cvar_Unhook(&v_contrast); // Cvar_Unhook(&v_contrast);
// Cvar_Unhook(&v_brightness); // Cvar_Unhook(&v_brightness);
#endif
} }
qboolean D3D8_VID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps) qboolean D3D8_VID_ApplyGammaRamps (unsigned int gammarampsize, unsigned short *ramps)

Binary file not shown.

View File

@ -172,13 +172,15 @@
Optimization="3" Optimization="3"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="..\qclib;..\server;..\gl;..\common;..\client"
PreprocessorDefinitions="NDEBUG;_XBOX" PreprocessorDefinitions="NDEBUG;_XBOX"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="TRUE" BufferSecurityCheck="TRUE"
EnableFunctionLevelLinking="TRUE" EnableFunctionLevelLinking="TRUE"
EnableEnhancedInstructionSet="1" EnableEnhancedInstructionSet="1"
UsePrecompiledHeader="3" UsePrecompiledHeader="0"
PrecompiledHeaderThrough=""
PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch" PrecompiledHeaderFile="$(OutDir)/$(ProjectName).pch"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="FALSE" Detect64BitPortabilityProblems="FALSE"