From 9879734d528c7dd523af6f056064077b498c8539 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Mon, 18 Mar 2019 15:54:29 -0300 Subject: [PATCH] I don't care about DirectDraw Neither SDL 1.2 --- src/hardware/r_opengl/ogl_win.c | 598 -------------------------------- src/sdl12/hwsym_sdl.c | 39 --- src/sdl12/i_video.c | 161 ++------- src/sdl12/ogl_sdl.c | 317 ----------------- src/sdl12/ogl_sdl.h | 30 -- src/win32/CMakeLists.txt | 5 - src/win32/win_dll.c | 93 +---- src/win32/win_dll.h | 5 - src/win32/win_vid.c | 99 +----- src/win32ce/win_dll.c | 48 +-- src/win32ce/win_dll.h | 5 - src/win32ce/win_vid.c | 95 +---- 12 files changed, 36 insertions(+), 1459 deletions(-) delete mode 100644 src/hardware/r_opengl/ogl_win.c delete mode 100644 src/sdl12/ogl_sdl.c delete mode 100644 src/sdl12/ogl_sdl.h diff --git a/src/hardware/r_opengl/ogl_win.c b/src/hardware/r_opengl/ogl_win.c deleted file mode 100644 index 7460413c..00000000 --- a/src/hardware/r_opengl/ogl_win.c +++ /dev/null @@ -1,598 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// 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. -// -//----------------------------------------------------------------------------- -/// \file -/// \brief Windows specific part of the OpenGL API for Doom Legacy -/// -/// TODO: -/// - check if windowed mode works -/// - support different pixel formats - - -#if defined (_WIN32) - -//#define WIN32_LEAN_AND_MEAN -#define RPC_NO_WINDOWS_H -#include -#include -#undef GETTEXT -#include "r_opengl.h" - - -// ************************************************************************** -// GLOBALS -// ************************************************************************** - -#ifdef DEBUG_TO_FILE -static unsigned long nb_frames = 0; -static clock_t my_clock; -#endif - -static HDC hDC = NULL; // the window's device context -static HGLRC hGLRC = NULL; // the OpenGL rendering context -static HWND hWnd = NULL; -static BOOL WasFullScreen = FALSE; -static void UnSetRes(void); - -#ifdef USE_WGL_SWAP -PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL; -#endif - -PFNglClear pglClear; -PFNglGetIntegerv pglGetIntegerv; -PFNglGetString pglGetString; - -#define MAX_VIDEO_MODES 32 -static vmode_t video_modes[MAX_VIDEO_MODES]; -INT32 oglflags = 0; - -// ************************************************************************** -// FUNCTIONS -// ************************************************************************** - -// -----------------+ -// APIENTRY DllMain : DLL Entry Point, -// : open/close debug log -// Returns : -// -----------------+ -BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module - DWORD fdwReason, // reason for calling function - LPVOID lpvReserved) // reserved -{ - // Perform actions based on the reason for calling. - UNREFERENCED_PARAMETER(lpvReserved); - switch (fdwReason) - { - case DLL_PROCESS_ATTACH: - // Initialize once for each new process. - // Return FALSE to fail DLL load. -#ifdef DEBUG_TO_FILE - gllogstream = fopen("ogllog.txt", "wt"); - if (gllogstream == NULL) - return FALSE; -#endif - DisableThreadLibraryCalls(hinstDLL); - break; - - case DLL_THREAD_ATTACH: - // Do thread-specific initialization. - break; - - case DLL_THREAD_DETACH: - // Do thread-specific cleanup. - break; - - case DLL_PROCESS_DETACH: - // Perform any necessary cleanup. -#ifdef DEBUG_TO_FILE - if (gllogstream) - { - fclose(gllogstream); - gllogstream = NULL; - } -#endif - break; - } - - return TRUE; // Successful DLL_PROCESS_ATTACH. -} - -#ifdef STATIC_OPENGL -#define pwglGetProcAddress wglGetProcAddress; -#define pwglCreateContext wglCreateContext; -#define pwglDeleteContext wglDeleteContext; -#define pwglMakeCurrent wglMakeCurrent; -#else -static HMODULE OGL32, GLU32; -typedef void *(WINAPI *PFNwglGetProcAddress) (const char *); -static PFNwglGetProcAddress pwglGetProcAddress; -typedef HGLRC (WINAPI *PFNwglCreateContext) (HDC hdc); -static PFNwglCreateContext pwglCreateContext; -typedef BOOL (WINAPI *PFNwglDeleteContext) (HGLRC hglrc); -static PFNwglDeleteContext pwglDeleteContext; -typedef BOOL (WINAPI *PFNwglMakeCurrent) (HDC hdc, HGLRC hglrc); -static PFNwglMakeCurrent pwglMakeCurrent; -#endif - -#ifndef STATIC_OPENGL -void *GetGLFunc(const char *proc) -{ - void *func = NULL; - if (strncmp(proc, "glu", 3) == 0) - { - if (GLU32) - func = GetProcAddress(GLU32, proc); - else - return NULL; - } - if (pwglGetProcAddress) - func = pwglGetProcAddress(proc); - if (!func) - func = GetProcAddress(OGL32, proc); - return func; -} -#endif - -boolean LoadGL(void) -{ -#ifndef STATIC_OPENGL - OGL32 = LoadLibrary("OPENGL32.DLL"); - - if (!OGL32) - return 0; - - GLU32 = LoadLibrary("GLU32.DLL"); - - pwglGetProcAddress = GetGLFunc("wglGetProcAddress"); - pwglCreateContext = GetGLFunc("wglCreateContext"); - pwglDeleteContext = GetGLFunc("wglDeleteContext"); - pwglMakeCurrent = GetGLFunc("wglMakeCurrent"); -#endif - return SetupGLfunc(); -} - -// -----------------+ -// SetupPixelFormat : Set the device context's pixel format -// Note : Because we currently use only the desktop's BPP format, all the -// : video modes in Doom Legacy OpenGL are of the same BPP, thus the -// : PixelFormat is set only once. -// : Setting the pixel format more than once on the same window -// : doesn't work. (ultimately for different pixel formats, we -// : should close the window, and re-create it) -// -----------------+ -int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits) -{ - static DWORD iLastPFD = 0; - INT32 nPixelFormat; - PIXELFORMATDESCRIPTOR pfd = - { - sizeof (PIXELFORMATDESCRIPTOR), // size - 1, // version - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, - PFD_TYPE_RGBA, // color type - 32 /*WantColorBits*/, // cColorBits : prefered color depth - 0, 0, // cRedBits, cRedShift - 0, 0, // cGreenBits, cGreenShift - 0, 0, // cBlueBits, cBlueShift - 0, 0, // cAlphaBits, cAlphaShift - 0, // cAccumBits - 0, 0, 0, 0, // cAccum Red/Green/Blue/Alpha Bits - 0, // cDepthBits (0,16,24,32) - 0, // cStencilBits - 0, // cAuxBuffers - PFD_MAIN_PLANE, // iLayerType - 0, // reserved, must be zero - 0, 0, 0, // dwLayerMask, dwVisibleMask, dwDamageMask - }; - - DWORD iPFD = (WantColorBits<<16) | (WantStencilBits<<8) | WantDepthBits; - - pfd.cDepthBits = (BYTE)WantDepthBits; - pfd.cStencilBits = (BYTE)WantStencilBits; - - if (iLastPFD) - { - DBG_Printf("WARNING : SetPixelFormat() called twise not supported by all drivers !\n"); - } - - // set the pixel format only if different than the current - if (iPFD == iLastPFD) - return 2; - else - iLastPFD = iPFD; - - DBG_Printf("SetupPixelFormat() - %d ColorBits - %d StencilBits - %d DepthBits\n", - WantColorBits, WantStencilBits, WantDepthBits); - - nPixelFormat = ChoosePixelFormat(hDC, &pfd); - - if (nPixelFormat == 0) - DBG_Printf("ChoosePixelFormat() FAILED\n"); - - if (SetPixelFormat(hDC, nPixelFormat, &pfd) == 0) - { - DBG_Printf("SetPixelFormat() FAILED\n"); - return 0; - } - - return 1; -} - - -// -----------------+ -// SetRes : Set a display mode -// Notes : pcurrentmode is actually not used -// -----------------+ -static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode) -{ - LPCSTR renderer; - BOOL WantFullScreen = !(lvid->u.windowed); //(lvid->u.windowed ? 0 : CDS_FULLSCREEN); - - UNREFERENCED_PARAMETER(pcurrentmode); - DBG_Printf ("SetMode(): %dx%d %d bits (%s)\n", - lvid->width, lvid->height, lvid->bpp*8, - WantFullScreen ? "fullscreen" : "windowed"); - - hWnd = lvid->WndParent; - - // BP : why flush texture ? - // if important flush also the first one (white texture) and restore it ! - Flush(); // Flush textures. - -// TODO: if not fullscreen, skip display stuff and just resize viewport stuff ... - - // Exit previous mode - //if (hGLRC) //Hurdler: TODO: check if this is valid - // UnSetRes(); - if (WasFullScreen) - ChangeDisplaySettings(NULL, CDS_FULLSCREEN); //switch in and out of fullscreen - - // Change display settings. - if (WantFullScreen) - { - DEVMODE dm; - ZeroMemory(&dm, sizeof (dm)); - dm.dmSize = sizeof (dm); - dm.dmPelsWidth = lvid->width; - dm.dmPelsHeight = lvid->height; - dm.dmBitsPerPel = lvid->bpp*8; - dm.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL; - if (ChangeDisplaySettings(&dm, CDS_TEST) != DISP_CHANGE_SUCCESSFUL) - return -2; - if (ChangeDisplaySettings(&dm, CDS_FULLSCREEN) !=DISP_CHANGE_SUCCESSFUL) - return -3; - - SetWindowLong(hWnd, GWL_STYLE, WS_POPUP|WS_VISIBLE); - // faB : book says to put these, surely for windowed mode - //WS_CLIPCHILDREN|WS_CLIPSIBLINGS); - SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, lvid->width, lvid->height, SWP_NOACTIVATE|SWP_NOZORDER); - } - else - { - RECT bounds; - INT32 x, y; - INT32 w = lvid->width, h = lvid->height; - GetWindowRect(hWnd, &bounds); - bounds.right = bounds.left+w; - bounds.bottom = bounds.top+h; - AdjustWindowRectEx(&bounds, GetWindowLong(hWnd, GWL_STYLE), (GetMenu(hWnd) != NULL), 0); - w = bounds.right-bounds.left; - h = bounds.bottom-bounds.top; - x = (GetSystemMetrics(SM_CXSCREEN)-w)/2; - y = (GetSystemMetrics(SM_CYSCREEN)-h)/2; - SetWindowPos(hWnd, NULL, x, y, w, h, SWP_NOACTIVATE|SWP_NOZORDER); - } - - if (!hDC) - hDC = GetDC(hWnd); - if (!hDC) - { - DBG_Printf("GetDC() FAILED\n"); - return 0; - } - - { - INT32 res; - - // Set res. - res = SetupPixelFormat(lvid->bpp*8, 0, 16); - - if (res == 0) - return 0; - else if (res == 1) - { - // Exit previous mode - if (hGLRC) - UnSetRes(); - hGLRC = pwglCreateContext(hDC); - if (!hGLRC) - { - DBG_Printf("pwglCreateContext() FAILED\n"); - return 0; - } - if (!pwglMakeCurrent(hDC, hGLRC)) - { - DBG_Printf("wglMakeCurrent() FAILED\n"); - return 0; - } - } - } - - gl_extensions = pglGetString(GL_EXTENSIONS); - // Get info and extensions. - //BP: why don't we make it earlier ? - //Hurdler: we cannot do that before intialising gl context - renderer = (LPCSTR)pglGetString(GL_RENDERER); - DBG_Printf("Vendor : %s\n", pglGetString(GL_VENDOR)); - DBG_Printf("Renderer : %s\n", renderer); - DBG_Printf("Version : %s\n", pglGetString(GL_VERSION)); - DBG_Printf("Extensions : %s\n", gl_extensions); - - // BP: disable advenced feature that don't work on somes hardware - // Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04 - if (strstr(renderer, "810")) oglflags |= GLF_NOZBUFREAD; - DBG_Printf("oglflags : 0x%X\n", oglflags); - -#ifdef USE_PALETTED_TEXTURE - if (isExtAvailable("GL_EXT_paletted_texture",gl_extensions)) - glColorTableEXT = GetGLFunc("glColorTableEXT"); - else - glColorTableEXT = NULL; -#endif - -#ifdef USE_WGL_SWAP - if (isExtAvailable("WGL_EXT_swap_control",gl_extensions)) - wglSwapIntervalEXT = GetGLFunc("wglSwapIntervalEXT"); - else - wglSwapIntervalEXT = NULL; -#endif - - if (isExtAvailable("GL_EXT_texture_filter_anisotropic",gl_extensions)) - pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy); - else - maximumAnisotropy = 0; - - screen_depth = (GLbyte)(lvid->bpp*8); - if (screen_depth > 16) - textureformatGL = GL_RGBA; - else - textureformatGL = GL_RGB5_A1; - - SetModelView(lvid->width, lvid->height); - SetStates(); - // we need to clear the depth buffer. Very important!!! - pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - - lvid->buffer = NULL; // unless we use the software view - lvid->direct = NULL; // direct access to video memory, old DOS crap - - WasFullScreen = WantFullScreen; - - return 1; // on renvoie une valeur pour dire que cela s'est bien pass� -} - - -// -----------------+ -// UnSetRes : Restore the original display mode -// -----------------+ -static void UnSetRes(void) -{ - DBG_Printf("UnSetRes()\n"); - - pwglMakeCurrent(hDC, NULL); - pwglDeleteContext(hGLRC); - hGLRC = NULL; - if (WasFullScreen) - ChangeDisplaySettings(NULL, CDS_FULLSCREEN); -} - - -// -----------------+ -// GetModeList : Return the list of available display modes. -// Returns : pvidmodes - points to list of detected OpenGL video modes -// : numvidmodes - number of detected OpenGL video modes -// -----------------+ -EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes) -{ - INT32 i; - -#if 1 - INT32 iMode; -/* - faB test code - - Commented out because there might be a problem with combo (Voodoo2 + other card), - we need to get the 3D card's display modes only. -*/ - (*pvidmodes) = &video_modes[0]; - - // Get list of device modes - for (i = 0,iMode = 0; iMode < MAX_VIDEO_MODES; i++) - { - DEVMODE Tmp; - ZeroMemory(&Tmp, sizeof (Tmp)); - Tmp.dmSize = sizeof (Tmp); - if (!EnumDisplaySettings(NULL, i, &Tmp)) - break; - - // add video mode - if (Tmp.dmBitsPerPel == 16 && - (iMode == 0 || ! - (Tmp.dmPelsWidth == video_modes[iMode-1].width && - Tmp.dmPelsHeight == video_modes[iMode-1].height) - ) - ) - { - video_modes[iMode].pnext = &video_modes[iMode+1]; - video_modes[iMode].windowed = 0; // fullscreen is the default - video_modes[iMode].misc = 0; - video_modes[iMode].name = malloc(12 * sizeof (CHAR)); - sprintf(video_modes[iMode].name, "%dx%d", (INT32)Tmp.dmPelsWidth, (INT32)Tmp.dmPelsHeight); - DBG_Printf ("Mode: %s\n", video_modes[iMode].name); - video_modes[iMode].width = Tmp.dmPelsWidth; - video_modes[iMode].height = Tmp.dmPelsHeight; - video_modes[iMode].bytesperpixel = Tmp.dmBitsPerPel/8; - video_modes[iMode].rowbytes = Tmp.dmPelsWidth * video_modes[iMode].bytesperpixel; - video_modes[iMode].pextradata = NULL; - video_modes[iMode].setmode = SetRes; - iMode++; - } - } - (*numvidmodes) = iMode; -#else - - // classic video modes (fullscreen/windowed) - // Added some. Tails - INT32 res[][2] = { - { 320, 200}, - { 320, 240}, - { 400, 300}, - { 512, 384}, - { 640, 400}, - { 640, 480}, - { 800, 600}, - { 960, 600}, - {1024, 768}, - {1152, 864}, - {1280, 800}, - {1280, 960}, - {1280,1024}, - {1600,1000}, - {1680,1050}, - {1920,1200}, -}; - - HDC bpphdc; - INT32 iBitsPerPel; - - DBG_Printf ("HWRAPI GetModeList()\n"); - - bpphdc = GetDC(NULL); // on obtient le bpp actuel - iBitsPerPel = GetDeviceCaps(bpphdc, BITSPIXEL); - - ReleaseDC(NULL, bpphdc); - - (*pvidmodes) = &video_modes[0]; - (*numvidmodes) = sizeof (res) / sizeof (res[0]); - for (i = 0; i < (*numvidmodes); i++) - { - video_modes[i].pnext = &video_modes[i+1]; - video_modes[i].windowed = 0; // fullscreen is the default - video_modes[i].misc = 0; - video_modes[i].name = malloc(12 * sizeof (CHAR)); - sprintf(video_modes[i].name, "%dx%d", res[i][0], res[i][1]); - DBG_Printf ("Mode: %s\n", video_modes[i].name); - video_modes[i].width = res[i][0]; - video_modes[i].height = res[i][1]; - video_modes[i].bytesperpixel = iBitsPerPel/8; - video_modes[i].rowbytes = res[i][0] * video_modes[i].bytesperpixel; - video_modes[i].pextradata = NULL; - video_modes[i].setmode = SetRes; - } -#endif - video_modes[(*numvidmodes)-1].pnext = NULL; -} - - -// -----------------+ -// Shutdown : Shutdown OpenGL, restore the display mode -// -----------------+ -EXPORT void HWRAPI(Shutdown) (void) -{ -#ifdef DEBUG_TO_FILE - long nb_centiemes; - - DBG_Printf ("HWRAPI Shutdown()\n"); - nb_centiemes = ((clock()-my_clock)*100)/CLOCKS_PER_SEC; - DBG_Printf("Nb frames: %li; Nb sec: %2.2f -> %2.1f fps\n", - nb_frames, nb_centiemes/100.0f, (100*nb_frames)/(double)nb_centiemes); -#endif - - Flush(); - - // Exit previous mode - if (hGLRC) - UnSetRes(); - - if (hDC) - { - ReleaseDC(hWnd, hDC); - hDC = NULL; - } - FreeLibrary(GLU32); - FreeLibrary(OGL32); - DBG_Printf ("HWRAPI Shutdown(DONE)\n"); -} - -// -----------------+ -// FinishUpdate : Swap front and back buffers -// -----------------+ -EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl) -{ -#ifdef USE_WGL_SWAP - static INT32 oldwaitvbl = 0; -#else - UNREFERENCED_PARAMETER(waitvbl); -#endif - // DBG_Printf ("FinishUpdate()\n"); -#ifdef DEBUG_TO_FILE - if ((++nb_frames)==2) // on ne commence pas � la premi�re frame - my_clock = clock(); -#endif - -#ifdef USE_WGL_SWAP - if (oldwaitvbl != waitvbl && wglSwapIntervalEXT) - wglSwapIntervalEXT(waitvbl); - oldwaitvbl = waitvbl; -#endif - - SwapBuffers(hDC); -} - - -// -----------------+ -// SetPalette : Set the color lookup table for paletted textures -// : in OpenGL, we store values for conversion of paletted graphics when -// : they are downloaded to the 3D card. -// -----------------+ -EXPORT void HWRAPI(SetPalette) (RGBA_t *pal, RGBA_t *gamma) -{ - INT32 i; - - for (i = 0; i < 256; i++) - { - myPaletteData[i].s.red = (UINT8)MIN((pal[i].s.red*gamma->s.red)/127, 255); - myPaletteData[i].s.green = (UINT8)MIN((pal[i].s.green*gamma->s.green)/127, 255); - myPaletteData[i].s.blue = (UINT8)MIN((pal[i].s.blue*gamma->s.blue)/127, 255); - myPaletteData[i].s.alpha = pal[i].s.alpha; - } -#ifdef USE_PALETTED_TEXTURE - if (glColorTableEXT) - { - for (i = 0; i < 256; i++) - { - palette_tex[3*i+0] = pal[i].s.red; - palette_tex[3*i+1] = pal[i].s.green; - palette_tex[3*i+2] = pal[i].s.blue; - } - glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex); - } -#endif - // on a chang� de palette, il faut recharger toutes les textures - Flush(); -} - -#endif diff --git a/src/sdl12/hwsym_sdl.c b/src/sdl12/hwsym_sdl.c index 49340138..b6f6313f 100644 --- a/src/sdl12/hwsym_sdl.c +++ b/src/sdl12/hwsym_sdl.c @@ -49,14 +49,6 @@ #define _CREATE_DLL_ // necessary for Unix AND Windows -#ifdef HWRENDER -#include "../hardware/hw_drv.h" -#include "ogl_sdl.h" -#ifdef STATIC_OPENGL -#include "../hardware/r_opengl/r_opengl.h" -#endif -#endif - #ifdef HW3SOUND #include "../hardware/hw3dsdrv.h" #endif @@ -79,39 +71,8 @@ void *hwSym(const char *funcName,void *handle) { void *funcPointer = NULL; -#ifdef HWRENDER - if (0 == strcmp("SetPalette", funcName)) - funcPointer = &OglSdlSetPalette; - GETFUNC(Init); - GETFUNC(Draw2DLine); - GETFUNC(DrawPolygon); - GETFUNC(SetBlend); - GETFUNC(ClearBuffer); - GETFUNC(SetTexture); - GETFUNC(ReadRect); - GETFUNC(GClipRect); - GETFUNC(ClearMipMapCache); - GETFUNC(SetSpecialState); - GETFUNC(GetTextureUsed); - GETFUNC(DrawMD2); - GETFUNC(DrawMD2i); - GETFUNC(SetTransform); - GETFUNC(GetRenderVersion); -#ifdef SHUFFLE - GETFUNC(PostImgRedraw); -#endif //SHUFFLE - GETFUNC(FlushScreenTextures); - GETFUNC(StartScreenWipe); - GETFUNC(EndScreenWipe); - GETFUNC(DoScreenWipe); - GETFUNC(DrawIntermissionBG); - GETFUNC(MakeScreenTexture); - GETFUNC(MakeScreenFinalTexture); - GETFUNC(DrawScreenFinalTexture); -#else //HWRENDER if (0 == strcmp("FinishUpdate", funcName)) return funcPointer; //&FinishUpdate; -#endif //!HWRENDER #ifdef STATIC3DS GETFUNC(Startup); GETFUNC(AddSfx); diff --git a/src/sdl12/i_video.c b/src/sdl12/i_video.c index 349e06cb..253a8d06 100644 --- a/src/sdl12/i_video.c +++ b/src/sdl12/i_video.c @@ -104,13 +104,6 @@ #include "../console.h" #include "../command.h" #include "sdlmain.h" -#ifdef HWRENDER -#include "../hardware/hw_main.h" -#include "../hardware/hw_drv.h" -// For dynamic referencing of HW rendering functions -#include "hwsym_sdl.h" -#include "ogl_sdl.h" -#endif #ifdef REMOTE_DEBUGGING #ifdef _WII @@ -169,9 +162,7 @@ static SDL_bool disable_mouse = SDL_FALSE; static INT32 firstEntry = 0; // SDL vars -#ifndef HWRENDER //[segabor] !!! I had problem compiling this source with gcc 3.3 static SDL_Surface *vidSurface = NULL; -#endif static SDL_Surface *bufSurface = NULL; static SDL_Surface *icoSurface = NULL; static SDL_Color localPalette[256]; @@ -664,11 +655,7 @@ static void VID_Command_ModeList_f(void) { #if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X) INT32 i; -#ifdef HWRENDER - if (rendermode == render_opengl) - modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN); - else -#endif + modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface if (modeList == (SDL_Rect **)0 && cv_fullscreen.value) @@ -1277,11 +1264,7 @@ void I_UpdateNoBlit(void) { if (!vidSurface) return; -#ifdef HWRENDER - if (rendermode != render_soft) - OglSdlFinishUpdate(cv_vidwait.value); - else -#endif + if (vidSurface->flags&SDL_DOUBLEBUF) SDL_Flip(vidSurface); else if (exposevideo) @@ -1492,12 +1475,6 @@ void I_FinishUpdate(void) else I_OutputMsg("%s\n",SDL_GetError()); } -#ifdef HWRENDER - else - { - OglSdlFinishUpdate(cv_vidwait.value); - } -#endif exposevideo = SDL_FALSE; } @@ -1644,11 +1621,6 @@ void VID_PrepareModeList(void) firstEntry = 0; -#ifdef HWRENDER - if (rendermode == render_opengl) - modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN); - else -#endif modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface if (disable_fullscreen?0:cv_fullscreen.value) // only fullscreen needs preparation @@ -1784,23 +1756,6 @@ INT32 VID_SetMode(INT32 modeNum) I_Error("Could not set vidmode: %s\n",SDL_GetError()); } } -#ifdef HWRENDER - else // (render_soft != rendermode) - { - if (!OglSdlSurface(vid.width, vid.height, true)) - { - cv_fullscreen.value = 0; - modeNum = VID_GetModeForSize(vid.width,vid.height); - vid.width = windowedModes[modeNum][0]; - vid.height = windowedModes[modeNum][1]; - if (!OglSdlSurface(vid.width, vid.height,false)) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - } - - realwidth = (Uint16)vid.width; - realheight = (Uint16)vid.height; - } -#endif } else //(cv_fullscreen.value) { @@ -1813,15 +1768,6 @@ INT32 VID_SetMode(INT32 modeNum) if (!vidSurface) I_Error("Could not set vidmode: %s\n",SDL_GetError()); } -#ifdef HWRENDER - else //(render_soft != rendermode) - { - if (!OglSdlSurface(vid.width, vid.height, false)) - I_Error("Could not set vidmode: %s\n",SDL_GetError()); - realwidth = (Uint16)vid.width; - realheight = (Uint16)vid.height; - } -#endif } vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h); @@ -1948,92 +1894,31 @@ void I_StartupGraphics(void) //DisableAero(); //also disable Aero on Vista #endif -#ifdef HWRENDER - if (M_CheckParm("-opengl") || rendermode == render_opengl) - { - rendermode = render_opengl; - HWD.pfnInit = hwSym("Init",NULL); - HWD.pfnFinishUpdate = NULL; - HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL); - HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL); - HWD.pfnSetBlend = hwSym("SetBlend",NULL); - HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL); - HWD.pfnSetTexture = hwSym("SetTexture",NULL); - HWD.pfnReadRect = hwSym("ReadRect",NULL); - HWD.pfnGClipRect = hwSym("GClipRect",NULL); - HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL); - HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL); - HWD.pfnSetPalette = hwSym("SetPalette",NULL); - HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL); - HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL); - HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL); - HWD.pfnSetTransform = hwSym("SetTransform",NULL); - HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL); -#ifdef SHUFFLE - HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL); -#endif - HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL); - HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL); - HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL); - HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL); - HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL); - HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL); - // check gl renderer lib - if (HWD.pfnGetRenderVersion() != VERSION) - I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n")); -#if 1 //#ifdef _WIN32_WCE - vid.width = BASEVIDWIDTH; - vid.height = BASEVIDHEIGHT; -#else - vid.width = 640; // hack to make voodoo cards work in 640x480 - vid.height = 480; -#endif - if (HWD.pfnInit(I_Error)) // let load the OpenGL library - { - /* - * We want at least 1 bit R, G, and B, - * and at least 16 bpp. Why 1 bit? May be more? - */ - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN))) - if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN))) - rendermode = render_soft; - } - else - rendermode = render_soft; - } -#else rendermode = render_soft; //force software mode when there no HWRENDER code -#endif - if (render_soft == rendermode) - { #if defined(_WII) - vid.width = 640; - vid.height = 480; + vid.width = 640; + vid.height = 480; #elif defined(_PS3) - vid.width = 720; - vid.height = 480; + vid.width = 720; + vid.height = 480; #else - vid.width = BASEVIDWIDTH; - vid.height = BASEVIDHEIGHT; + vid.width = BASEVIDWIDTH; + vid.height = BASEVIDHEIGHT; #endif - SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); - if (!vidSurface) - { - CONS_Printf(M_GetText("Could not set vidmode: %s\n") ,SDL_GetError()); - vid.rowbytes = 0; - graphics_started = true; - return; - } - vid.rowbytes = vid.width * vid.bpp; - vid.direct = SDLGetDirect(); - vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); - if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); - else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n")); + SDLSetMode(vid.width, vid.height, BitsPerPixel, surfaceFlagsW); + if (!vidSurface) + { + CONS_Printf(M_GetText("Could not set vidmode: %s\n") ,SDL_GetError()); + vid.rowbytes = 0; + graphics_started = true; + return; } + vid.rowbytes = vid.width * vid.bpp; + vid.direct = SDLGetDirect(); + vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS); + if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS); + else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n")); + if (M_CheckParm("-nomousegrab")) mousegrabok = SDL_FALSE; #ifdef _DEBUG @@ -2089,10 +1974,6 @@ void I_ShutdownGraphics(void) #endif graphics_started = false; CONS_Printf("%s", M_GetText("shut down\n")); -#ifdef HWRENDER - if (GLUhandle) - hwClose(GLUhandle); -#endif #ifndef _arch_dreamcast SDL_QuitSubSystem(SDL_INIT_VIDEO); #endif diff --git a/src/sdl12/ogl_sdl.c b/src/sdl12/ogl_sdl.c deleted file mode 100644 index eb7e9996..00000000 --- a/src/sdl12/ogl_sdl.c +++ /dev/null @@ -1,317 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// 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. -// -//----------------------------------------------------------------------------- -/// \file -/// \brief SDL specific part of the OpenGL API for SRB2 - -#ifdef _MSC_VER -#pragma warning(disable : 4214 4244) -#endif - -#ifdef HAVE_SDL - -#include "SDL.h" - -#ifdef _MSC_VER -#pragma warning(default : 4214 4244) -#endif - -#include "../doomdef.h" - -#ifdef HWRENDER -#include "../hardware/r_opengl/r_opengl.h" -#include "ogl_sdl.h" -#include "../i_system.h" -#include "hwsym_sdl.h" -#include "../m_argv.h" - -#ifdef DEBUG_TO_FILE -#include -#if defined (_WIN32) && !defined (__CYGWIN__) -#include -#else -#include -#endif -#include -#include -#endif - -#ifdef USE_WGL_SWAP -PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL; -#else -typedef int (*PFNGLXSWAPINTERVALPROC) (int); -PFNGLXSWAPINTERVALPROC glXSwapIntervalSGIEXT = NULL; -#endif - -#ifndef STATIC_OPENGL -PFNglClear pglClear; -PFNglGetIntegerv pglGetIntegerv; -PFNglGetString pglGetString; -#endif - -#ifdef _PSP -static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/; -static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN; -#else -static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/; -static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN; -#endif - -/** \brief SDL video display surface -*/ -SDL_Surface *vidSurface = NULL; -INT32 oglflags = 0; -void *GLUhandle = NULL; - -#ifndef STATIC_OPENGL -void *GetGLFunc(const char *proc) -{ - if (strncmp(proc, "glu", 3) == 0) - { - if (GLUhandle) - return hwSym(proc, GLUhandle); - else - return NULL; - } - return SDL_GL_GetProcAddress(proc); -} -#endif - -boolean LoadGL(void) -{ -#ifndef STATIC_OPENGL - const char *OGLLibname = NULL; - const char *GLULibname = NULL; - - if (M_CheckParm ("-OGLlib") && M_IsNextParm()) - OGLLibname = M_GetNextParm(); - - if (SDL_GL_LoadLibrary(OGLLibname) != 0) - { - I_OutputMsg("Could not load OpenGL Library: %s\n" - "Falling back to Software mode.\n", SDL_GetError()); - if (!M_CheckParm ("-OGLlib")) - I_OutputMsg("If you know what is the OpenGL library's name, use -OGLlib\n"); - return 0; - } - -#if 0 - GLULibname = "/proc/self/exe"; -#elif defined (_WIN32) - GLULibname = "GLU32.DLL"; -#elif defined (__MACH__) - GLULibname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"; -#elif defined (macintos) - GLULibname = "OpenGLLibrary"; -#elif defined (__unix__) - GLULibname = "libGLU.so.1"; -#elif defined (__HAIKU__) - GLULibname = "libGLU.so"; -#else - GLULibname = NULL; -#endif - - if (M_CheckParm ("-GLUlib") && M_IsNextParm()) - GLULibname = M_GetNextParm(); - - if (GLULibname) - { - GLUhandle = hwOpen(GLULibname); - if (GLUhandle) - return SetupGLfunc(); - else - { - I_OutputMsg("Could not load GLU Library: %s\n", GLULibname); - if (!M_CheckParm ("-GLUlib")) - I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n"); - } - } - else - { - I_OutputMsg("Could not load GLU Library\n"); - I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n"); - } -#endif - return SetupGLfunc(); -} - -/** \brief The OglSdlSurface function - - \param w width - \param h height - \param isFullscreen if true, go fullscreen - - \return if true, changed video mode -*/ -boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen) -{ - INT32 cbpp; - Uint32 OGLFlags; - const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL; - - cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; - - if (vidSurface) - { - //Alam: SDL_Video system free vidSurface for me -#ifdef VOODOOSAFESWITCHING - SDL_QuitSubSystem(SDL_INIT_VIDEO); - SDL_InitSubSystem(SDL_INIT_VIDEO); -#endif - } - - if (isFullscreen) - OGLFlags = FOGLFlags; - else - OGLFlags = WOGLFlags; - - cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags); - if (cbpp < 16) - return true; //Alam: Let just say we did, ok? - - vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags); - if (!vidSurface) - return false; - - glvendor = pglGetString(GL_VENDOR); - // Get info and extensions. - //BP: why don't we make it earlier ? - //Hurdler: we cannot do that before intialising gl context - glrenderer = pglGetString(GL_RENDERER); - glversion = pglGetString(GL_VERSION); - gl_extensions = pglGetString(GL_EXTENSIONS); - - DBG_Printf("Vendor : %s\n", glvendor); - DBG_Printf("Renderer : %s\n", glrenderer); - DBG_Printf("Version : %s\n", glversion); - DBG_Printf("Extensions : %s\n", gl_extensions); - oglflags = 0; - -#ifdef _WIN32 - // BP: disable advenced feature that don't work on somes hardware - // Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04 - if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD; -#elif defined (unix) || defined (UNIXCOMMON) - // disable advanced features not working on somes hardware - if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV; - if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV; -#endif - DBG_Printf("oglflags : 0x%X\n", oglflags ); - -#ifdef USE_PALETTED_TEXTURE - if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions)) - glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT"); - else - glColorTableEXT = NULL; -#endif - -#ifdef USE_WGL_SWAP - if (isExtAvailable("WGL_EXT_swap_control", gl_extensions)) - wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT"); - else - wglSwapIntervalEXT = NULL; -#else - if (isExtAvailable("GLX_SGI_swap_control", gl_extensions)) - glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI"); - else - glXSwapIntervalSGIEXT = NULL; -#endif - -#ifndef KOS_GL_COMPATIBILITY - if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions)) - pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy); - else -#endif - maximumAnisotropy = 0; - - SetupGLFunc13(); - - granisotropicmode_cons_t[1].value = maximumAnisotropy; - - SetModelView(w, h); - SetStates(); - pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - - HWR_Startup(); -#ifdef KOS_GL_COMPATIBILITY - textureformatGL = GL_ARGB4444; -#else - textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1; -#endif - - return true; -} - -/** \brief The OglSdlFinishUpdate function - - \param vidwait wait for video sync - - \return void -*/ -void OglSdlFinishUpdate(boolean waitvbl) -{ - static boolean oldwaitvbl = false; - if (oldwaitvbl != waitvbl) - { -#ifdef USE_WGL_SWAP - if (wglSwapIntervalEXT) - wglSwapIntervalEXT(waitvbl); -#else - if (glXSwapIntervalSGIEXT) - glXSwapIntervalSGIEXT(waitvbl); -#endif - } - oldwaitvbl = waitvbl; - - SDL_GL_SwapBuffers(); -} - -EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma) -{ - INT32 i = -1; - UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green, - bluegamma = pgamma->s.blue; - -#if 0 // changing the gamma to 127 is a bad idea - i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma)); -#endif - if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool - for (i = 0; i < 256; i++) - { - myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255); - myPaletteData[i].s.green = (UINT8)MIN((palette[i].s.green * greengamma)/127, 255); - myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255); - myPaletteData[i].s.alpha = palette[i].s.alpha; - } -#ifdef USE_PALETTED_TEXTURE - if (glColorTableEXT) - { - for (i = 0; i < 256; i++) - { - palette_tex[(3*i)+0] = palette[i].s.red; - palette_tex[(3*i)+1] = palette[i].s.green; - palette_tex[(3*i)+2] = palette[i].s.blue; - } - glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex); - } -#endif - // on a chang�de palette, il faut recharger toutes les textures - // jaja, und noch viel mehr ;-) - Flush(); -} - -#endif //HWRENDER -#endif //SDL diff --git a/src/sdl12/ogl_sdl.h b/src/sdl12/ogl_sdl.h deleted file mode 100644 index 43c28fa4..00000000 --- a/src/sdl12/ogl_sdl.h +++ /dev/null @@ -1,30 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// Copyright (C) 1998-2000 by DooM Legacy Team. -// -// 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. -//----------------------------------------------------------------------------- -/// \file -/// \brief SDL specific part of the OpenGL API for SRB2 - -#include "../v_video.h" - -extern SDL_Surface *vidSurface; -extern void *GLUhandle; - -boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen); - -void OglSdlFinishUpdate(boolean vidwait); - -#ifdef _CREATE_DLL_ -EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma); -#endif diff --git a/src/win32/CMakeLists.txt b/src/win32/CMakeLists.txt index 39b01588..71ce88d0 100644 --- a/src/win32/CMakeLists.txt +++ b/src/win32/CMakeLists.txt @@ -1,10 +1,5 @@ file(GLOB SRB2_WIN_SOURCES *.c *.h *.rc) -if(${SRB2_CONFIG_HWRENDER}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS}) - set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS}) -endif() - add_executable(SRB2DD EXCLUDE_FROM_ALL WIN32 ${SRB2_WIN_SOURCES} ) diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c index 71eda043..77ddc6e3 100644 --- a/src/win32/win_dll.c +++ b/src/win32/win_dll.c @@ -17,9 +17,6 @@ /// \brief load and initialise the 3D driver DLL #include "../doomdef.h" -#ifdef HWRENDER -#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes -#endif #ifdef HW3SOUND #include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes @@ -30,7 +27,7 @@ #include "win_dll.h" #include "win_main.h" // I_ShowLastError() -#if defined(HWRENDER) || defined(HW3SOUND) +#if defined(HW3SOUND) typedef struct loadfunc_s { LPCSTR fnName; LPVOID fnPointer; @@ -84,94 +81,6 @@ static VOID UnloadDLL (HMODULE* pModule) } #endif -// ========================================================================== -// STANDARD 3D DRIVER DLL FOR DOOM LEGACY -// ========================================================================== - -// note : the 3D driver loading should be put somewhere else.. - -#ifdef HWRENDER -static HMODULE hwdModule = NULL; - -static loadfunc_t hwdFuncTable[] = { -#ifdef _X86_ - {"Init@4", &hwdriver.pfnInit}, - {"Shutdown@0", &hwdriver.pfnShutdown}, - {"GetModeList@8", &hwdriver.pfnGetModeList}, - {"SetPalette@8", &hwdriver.pfnSetPalette}, - {"FinishUpdate@4", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine@12", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon@16", &hwdriver.pfnDrawPolygon}, - {"SetBlend@4", &hwdriver.pfnSetBlend}, - {"ClearBuffer@12", &hwdriver.pfnClearBuffer}, - {"SetTexture@4", &hwdriver.pfnSetTexture}, - {"ReadRect@24", &hwdriver.pfnReadRect}, - {"GClipRect@20", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState@8", &hwdriver.pfnSetSpecialState}, - {"DrawMD2@16", &hwdriver.pfnDrawMD2}, - {"DrawMD2i@36", &hwdriver.pfnDrawMD2i}, - {"SetTransform@4", &hwdriver.pfnSetTransform}, - {"GetTextureUsed@0", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion@0", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures@0",&hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture@8", &hwdriver.pfnDrawScreenFinalTexture}, -#else - {"Init", &hwdriver.pfnInit}, - {"Shutdown", &hwdriver.pfnShutdown}, - {"GetModeList", &hwdriver.pfnGetModeList}, - {"SetPalette", &hwdriver.pfnSetPalette}, - {"FinishUpdate", &hwdriver.pfnFinishUpdate}, - {"Draw2DLine", &hwdriver.pfnDraw2DLine}, - {"DrawPolygon", &hwdriver.pfnDrawPolygon}, - {"SetBlend", &hwdriver.pfnSetBlend}, - {"ClearBuffer", &hwdriver.pfnClearBuffer}, - {"SetTexture", &hwdriver.pfnSetTexture}, - {"ReadRect", &hwdriver.pfnReadRect}, - {"GClipRect", &hwdriver.pfnGClipRect}, - {"ClearMipMapCache", &hwdriver.pfnClearMipMapCache}, - {"SetSpecialState", &hwdriver.pfnSetSpecialState}, - {"DrawMD2", &hwdriver.pfnDrawMD2}, - {"DrawMD2i", &hwdriver.pfnDrawMD2i}, - {"SetTransform", &hwdriver.pfnSetTransform}, - {"GetTextureUsed", &hwdriver.pfnGetTextureUsed}, - {"GetRenderVersion", &hwdriver.pfnGetRenderVersion}, -#ifdef SHUFFLE - {"PostImgRedraw", &hwdriver.pfnPostImgRedraw}, -#endif - {"FlushScreenTextures", &hwdriver.pfnFlushScreenTextures}, - {"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, - {"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, - {"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, - {"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG}, - {"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture}, - {"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture}, - {"DrawScreenFinalTexture", &hwdriver.pfnDrawScreenFinalTexture}, -#endif - {NULL,NULL} -}; - -BOOL Init3DDriver (LPCSTR dllName) -{ - hwdModule = LoadDLL(dllName, hwdFuncTable); - return (hwdModule != NULL); -} - -VOID Shutdown3DDriver (VOID) -{ - UnloadDLL(&hwdModule); -} -#endif - #ifdef HW3SOUND static HMODULE hwsModule = NULL; diff --git a/src/win32/win_dll.h b/src/win32/win_dll.h index b4b25958..f69a8c21 100644 --- a/src/win32/win_dll.h +++ b/src/win32/win_dll.h @@ -20,11 +20,6 @@ #define RPC_NO_WINDOWS_H #include -#ifdef HWRENDER -BOOL Init3DDriver (LPCSTR dllName); -VOID Shutdown3DDriver (VOID); -#endif - #ifdef HW3SOUND BOOL Init3DSDriver(LPCSTR dllName); VOID Shutdown3DSDriver(VOID); diff --git a/src/win32/win_vid.c b/src/win32/win_vid.c index cca7810b..1a072aba 100644 --- a/src/win32/win_vid.c +++ b/src/win32/win_vid.c @@ -36,12 +36,6 @@ #include "../command.h" #include "../screen.h" -#ifdef HWRENDER -#include "win_dll.h" // loading the render DLL -#include "../hardware/hw_drv.h" // calling driver init & shutdown -#include "../hardware/hw_main.h" // calling HWR module init & shutdown -#endif - // ------- // Globals // ------- @@ -222,12 +216,7 @@ void I_StartupGraphics(void) if (graphics_started) return; -#ifdef HWRENDER - else if (M_CheckParm("-opengl")) - rendermode = render_opengl; - else -#endif - rendermode = render_soft; + rendermode = render_soft; if (dedicated) rendermode = render_none; @@ -245,10 +234,6 @@ void I_StartupGraphics(void) // ------------------ void I_ShutdownGraphics(void) { -#ifdef HWRENDER - const rendermode_t oldrendermode = rendermode; -#endif - // This is BAD because it makes the I_Error box screw up! // rendermode = render_none; @@ -273,15 +258,6 @@ void I_ShutdownGraphics(void) bmiMain = NULL; } -#ifdef HWRENDER - if (oldrendermode != render_soft) - { - HWR_Shutdown(); // free stuff from the hardware renderer - HWD.pfnShutdown(); // close 3d card display - Shutdown3DDriver(); // free the driver DLL - } -#endif - // free the last video mode screen buffers if (vid.buffer) { @@ -289,10 +265,7 @@ void I_ShutdownGraphics(void) vid.buffer = NULL; } -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - CloseDirectDraw(); + CloseDirectDraw(); graphics_started = false; } @@ -378,11 +351,6 @@ void I_FinishUpdate(void) DIB_RGB_COLORS); } else -#ifdef HWRENDER - if (rendermode != render_soft) - HWD.pfnFinishUpdate(cv_vidwait.value); - else -#endif { // DIRECT DRAW // copy virtual screen to real screen @@ -484,9 +452,6 @@ void I_SetPalette(RGBA_t *palette) } } else -#ifdef HWRENDER - if (rendermode == render_soft) -#endif { PALETTEENTRY mainpal[256]; @@ -678,56 +643,14 @@ static VOID VID_Init(VOID) bDIBMode = TRUE; bAppFullScreen = FALSE; -#ifdef HWRENDER - // initialize the appropriate display device - if (rendermode != render_soft) + if (!bWinParm) { - const char *drvname = NULL; - - switch (rendermode) - { - case render_opengl: - drvname = "r_opengl.dll"; - break; - default: - I_Error("Unknown hardware render mode"); - } - - // load the DLL - if (drvname && Init3DDriver(drvname)) - { - int hwdversion = HWD.pfnGetRenderVersion(); - if (hwdversion != VERSION) - CONS_Alert(CONS_WARNING, M_GetText("This r_opengl version is not supported, use it at your own risk!\n")); - - // perform initialisations - HWD.pfnInit(I_Error); - // get available display modes for the device - HWD.pfnGetModeList(&pvidmodes, &numvidmodes); - } - else - { - switch (rendermode) - { - case render_opengl: - I_Error("Error initializing OpenGL"); - default: - break; - } - rendermode = render_soft; - } + if (!CreateDirectDrawInstance()) + bWinParm = TRUE; + else // get available display modes for the device + VID_GetExtraModes(); } - if (rendermode == render_soft) -#endif - if (!bWinParm) - { - if (!CreateDirectDrawInstance()) - bWinParm = TRUE; - else // get available display modes for the device - VID_GetExtraModes(); - } - // the game boots in 320x200 standard VGA, but // we need a highcolor mode to run the game in highcolor if (highcolor && !numvidmodes) @@ -925,14 +848,6 @@ INT32 VID_SetMode(INT32 modenum) // we switch to fullscreen bAppFullScreen = TRUE; bDIBMode = FALSE; -#ifdef HWRENDER - if (rendermode != render_soft) - { - // purge all patch graphics stored in software format - //Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100); - HWR_Startup(); - } -#endif } I_RestartSysMouse(); diff --git a/src/win32ce/win_dll.c b/src/win32ce/win_dll.c index 8b88f84d..2bda7126 100644 --- a/src/win32ce/win_dll.c +++ b/src/win32ce/win_dll.c @@ -17,9 +17,6 @@ /// \brief load and initialise the 3D driver DLL #include "../doomdef.h" -#ifdef HWRENDER -#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes -#endif #ifdef HW3SOUND #include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes @@ -28,7 +25,7 @@ #include "win_dll.h" #include "win_main.h" // I_GetLastErrorMsgBox() -#if defined(HWRENDER) || defined(HW3SOUND) +#if defined(HW3SOUND) typedef struct loadfunc_s { LPCSTR fnName; LPVOID fnPointer; @@ -82,49 +79,6 @@ static inline VOID UnloadDLL (HMODULE* pModule) } #endif -// ========================================================================== -// STANDARD 3D DRIVER DLL FOR DOOM LEGACY -// ========================================================================== - -// note : the 3D driver loading should be put somewhere else.. - -#ifdef HWRENDER -static HMODULE hwdModule = NULL; - -static loadfunc_t hwdFuncTable[] = { - {"_Init@4", &hwdriver.pfnInit}, - {"_Shutdown@0", &hwdriver.pfnShutdown}, - {"_GetModeList@8", &hwdriver.pfnGetModeList}, - {"_SetPalette@8", &hwdriver.pfnSetPalette}, - {"_FinishUpdate@4", &hwdriver.pfnFinishUpdate}, - {"_Draw2DLine@12", &hwdriver.pfnDraw2DLine}, - {"_DrawPolygon@16", &hwdriver.pfnDrawPolygon}, - {"_SetBlend@4", &hwdriver.pfnSetBlend}, - {"_ClearBuffer@12", &hwdriver.pfnClearBuffer}, - {"_SetTexture@4", &hwdriver.pfnSetTexture}, - {"_ReadRect@24", &hwdriver.pfnReadRect}, - {"_GClipRect@20", &hwdriver.pfnGClipRect}, - {"_ClearMipMapCache@0",&hwdriver.pfnClearMipMapCache}, - {"_SetSpecialState@8", &hwdriver.pfnSetSpecialState}, - {"_DrawMD2@16", &hwdriver.pfnDrawMD2}, - {"_SetTransform@4", &hwdriver.pfnSetTransform}, - {"_GetTextureUsed@0", &hwdriver.pfnGetTextureUsed}, - {"_GetRenderVersion@0",&hwdriver.pfnGetRenderVersion}, - {NULL,NULL} -}; - -BOOL Init3DDriver (LPCSTR dllName) -{ - hwdModule = LoadDLL(dllName, hwdFuncTable); - return (hwdModule != NULL); -} - -VOID Shutdown3DDriver (VOID) -{ - UnloadDLL(&hwdModule); -} -#endif - #ifdef HW3SOUND static HMODULE hwsModule = NULL; diff --git a/src/win32ce/win_dll.h b/src/win32ce/win_dll.h index b4b25958..f69a8c21 100644 --- a/src/win32ce/win_dll.h +++ b/src/win32ce/win_dll.h @@ -20,11 +20,6 @@ #define RPC_NO_WINDOWS_H #include -#ifdef HWRENDER -BOOL Init3DDriver (LPCSTR dllName); -VOID Shutdown3DDriver (VOID); -#endif - #ifdef HW3SOUND BOOL Init3DSDriver(LPCSTR dllName); VOID Shutdown3DSDriver(VOID); diff --git a/src/win32ce/win_vid.c b/src/win32ce/win_vid.c index b9c2e131..ddbd953b 100644 --- a/src/win32ce/win_vid.c +++ b/src/win32ce/win_vid.c @@ -34,12 +34,6 @@ #include "../command.h" #include "../screen.h" -#ifdef HWRENDER -#include "win_dll.h" // loading the render DLL -#include "../hardware/hw_drv.h" // calling driver init & shutdown -#include "../hardware/hw_main.h" // calling HWR module init & shutdown -#endif - // ------- // Globals // ------- @@ -110,13 +104,6 @@ void I_StartupGraphics(void) if (graphics_started) return; -#ifdef HWRENDER - if (M_CheckParm("-opengl")) - rendermode = render_opengl; - else - rendermode = render_soft; -#endif - if (dedicated) rendermode = render_none; else @@ -152,15 +139,6 @@ void I_ShutdownGraphics(void) bmiMain = NULL; } -#ifdef HWRENDER - if (rendermode != render_soft) - { - HWR_Shutdown(); // free stuff from the hardware renderer - HWD.pfnShutdown(); // close 3d card display - Shutdown3DDriver(); // free the driver DLL - } -#endif - // free the last video mode screen buffers if (vid.buffer) { @@ -168,10 +146,7 @@ void I_ShutdownGraphics(void) vid.buffer = NULL; } -#ifdef HWRENDER - if (rendermode == render_soft) -#endif - CloseDirectDraw(); + CloseDirectDraw(); graphics_started = false; } @@ -209,11 +184,6 @@ void I_FinishUpdate(void) DIB_RGB_COLORS); } else -#ifdef HWRENDER - if (rendermode != render_soft) - HWD.pfnFinishUpdate(cv_vidwait.value); - else -#endif { // DIRECT DRAW // copy virtual screen to real screen @@ -292,9 +262,6 @@ void I_SetPalette(RGBA_t *palette) } } else -#ifdef HWRENDER - if (rendermode == render_soft) -#endif { PALETTEENTRY mainpal[256]; @@ -455,56 +422,14 @@ static void VID_Init(void) bDIBMode = TRUE; bAppFullScreen = FALSE; -#ifdef HWRENDER - // initialize the appropriate display device - if (rendermode != render_soft) + if (!bWinParm) { - const char *drvname = NULL; - - switch (rendermode) - { - case render_opengl: - drvname = "r_opengl.dll"; - break; - default: - I_Error("Unknown hardware render mode"); - } - - // load the DLL - if (drvname && Init3DDriver(drvname)) - { - int hwdversion = HWD.pfnGetRenderVersion(); - if (hwdversion != VERSION) - CONS_Printf("WARNING: This r_opengl version is not supported, use it at your own risk.\n"); - - // perform initialisations - HWD.pfnInit(I_Error); - // get available display modes for the device - HWD.pfnGetModeList(&pvidmodes, &numvidmodes); - } - else - { - switch (rendermode) - { - case render_opengl: - I_Error("Error initializing OpenGL"); - default: - break; - } - rendermode = render_soft; - } + if (!CreateDirectDrawInstance()) + I_Error("Error initializing DirectDraw"); + // get available display modes for the device + VID_GetExtraModes(); } - if (rendermode == render_soft) -#endif - if (!bWinParm) - { - if (!CreateDirectDrawInstance()) - I_Error("Error initializing DirectDraw"); - // get available display modes for the device - VID_GetExtraModes(); - } - // the game boots in 320x200 standard VGA, but // we need a highcolor mode to run the game in highcolor if (highcolor && !numvidmodes) @@ -702,14 +627,6 @@ INT32 VID_SetMode(INT32 modenum) // we switch to fullscreen bAppFullScreen = TRUE; bDIBMode = FALSE; -#ifdef HWRENDER - if (rendermode != render_soft) - { - // purge all patch graphics stored in software format - //Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100); - HWR_Startup(); - } -#endif } I_RestartSysMouse();