mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- removed remaining DirectDraw code and a few other things that are no longer being used.
This commit is contained in:
parent
2ed744963c
commit
29ad081368
13 changed files with 23 additions and 288 deletions
|
@ -1261,22 +1261,6 @@ void OpenGLSWFrameBuffer::Flip()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// OpenGLSWFrameBuffer :: PaintToWindow
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
bool OpenGLSWFrameBuffer::PaintToWindow()
|
||||
{
|
||||
Draw3DPart(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// OpenGLSWFrameBuffer :: Draw3DPart
|
||||
|
|
|
@ -67,8 +67,6 @@ public:
|
|||
void WipeCleanup() override;
|
||||
|
||||
#ifdef WIN32
|
||||
void Blank() override { }
|
||||
bool PaintToWindow() override;
|
||||
int GetTrueHeight() override { return TrueHeight; }
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1040,22 +1040,6 @@ void I_SetFPSLimit(int limit)
|
|||
{
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
||||
{
|
||||
vid_maxfps = TICRATE;
|
||||
}
|
||||
else if (vid_maxfps > 1000)
|
||||
{
|
||||
vid_maxfps = 1000;
|
||||
}
|
||||
else if (cl_capfps == 0)
|
||||
{
|
||||
I_SetFPSLimit(vid_maxfps);
|
||||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, vid_hidpi, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
CocoaVideo::UseHiDPI(self);
|
||||
|
|
|
@ -300,22 +300,6 @@ void I_SetFPSLimit(int limit)
|
|||
}
|
||||
#endif
|
||||
|
||||
CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
||||
{
|
||||
vid_maxfps = TICRATE;
|
||||
}
|
||||
else if (vid_maxfps > 1000)
|
||||
{
|
||||
vid_maxfps = 1000;
|
||||
}
|
||||
else if (cl_capfps == 0)
|
||||
{
|
||||
I_SetFPSLimit(vid_maxfps);
|
||||
}
|
||||
}
|
||||
|
||||
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
||||
|
||||
CUSTOM_CVAR(Bool, swtruecolor, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
||||
|
|
|
@ -86,6 +86,24 @@
|
|||
#include "r_videoscale.h"
|
||||
#include "i_time.h"
|
||||
|
||||
EXTERN_CVAR(Bool, cl_capfps)
|
||||
|
||||
CUSTOM_CVAR(Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
||||
{
|
||||
vid_maxfps = TICRATE;
|
||||
}
|
||||
else if (vid_maxfps > 1000)
|
||||
{
|
||||
vid_maxfps = 1000;
|
||||
}
|
||||
else if (cl_capfps == 0)
|
||||
{
|
||||
I_SetFPSLimit(vid_maxfps);
|
||||
}
|
||||
}
|
||||
|
||||
EXTERN_CVAR(Bool, r_blendmethod)
|
||||
|
||||
int active_con_scale();
|
||||
|
|
|
@ -884,17 +884,6 @@ int D3DFB::GetPageCount ()
|
|||
return 1;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: GetHR
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
HRESULT D3DFB::GetHR ()
|
||||
{
|
||||
return LastHR;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: IsFullscreen
|
||||
|
@ -1097,29 +1086,6 @@ void D3DFB::CopyNextFrontBuffer()
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: PaintToWindow
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
bool D3DFB::PaintToWindow ()
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
hr = D3DDevice->TestCooperativeLevel();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (hr != D3DERR_DEVICENOTRESET || !Reset())
|
||||
{
|
||||
Sleep (1);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Draw3DPart(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// D3DFB :: Draw3DPart
|
||||
|
@ -1402,10 +1368,6 @@ void D3DFB::NewRefreshRate ()
|
|||
}
|
||||
}
|
||||
|
||||
void D3DFB::Blank ()
|
||||
{
|
||||
}
|
||||
|
||||
void D3DFB::SetBlendingRect(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
BlendingRect.left = x1;
|
||||
|
|
|
@ -52,7 +52,6 @@ EXTERN_CVAR (Bool, ticker)
|
|||
EXTERN_CVAR (Bool, fullscreen)
|
||||
EXTERN_CVAR (Bool, swtruecolor)
|
||||
EXTERN_CVAR (Float, vid_winscale)
|
||||
EXTERN_CVAR (Bool, vid_forceddraw)
|
||||
EXTERN_CVAR (Bool, win_borderless)
|
||||
|
||||
CVAR(Int, win_x, -1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
@ -208,10 +207,8 @@ void I_CreateRenderer()
|
|||
Printf("Renderer: OpenGL\n");
|
||||
else if (currentcanvas == 1)
|
||||
Printf("Renderer: Software on OpenGL\n");
|
||||
else if (currentcanvas == 0 && vid_forceddraw == false)
|
||||
Printf("Renderer: Software on Direct3D\n");
|
||||
else if (currentcanvas == 0)
|
||||
Printf("Renderer: Software on DirectDraw\n");
|
||||
Printf("Renderer: Software on Direct3D\n");
|
||||
else
|
||||
Printf("Renderer: Unknown\n");
|
||||
if (Renderer == NULL)
|
||||
|
|
|
@ -456,10 +456,6 @@ LRESULT CALLBACK WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
if (screen != NULL && 0)
|
||||
{
|
||||
static_cast<BaseWinFB *> (screen)->PaintToWindow ();
|
||||
}
|
||||
return DefWindowProc (hWnd, message, wParam, lParam);
|
||||
|
||||
case WM_SETTINGCHANGE:
|
||||
|
|
|
@ -64,7 +64,7 @@ extern HWND Window;
|
|||
extern BOOL AppActive;
|
||||
|
||||
extern "C" {
|
||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
}
|
||||
|
||||
|
@ -1170,29 +1170,6 @@ bool Win32GLFrameBuffer::IsFullscreen()
|
|||
return m_Fullscreen;
|
||||
}
|
||||
|
||||
HRESULT Win32GLFrameBuffer::GetHR()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Win32GLFrameBuffer::Blank ()
|
||||
{
|
||||
}
|
||||
|
||||
bool Win32GLFrameBuffer::PaintToWindow ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Win32GLFrameBuffer::CreateResources ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Win32GLFrameBuffer::ReleaseResources ()
|
||||
{
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -36,15 +36,6 @@ public:
|
|||
Win32GLFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra);
|
||||
virtual ~Win32GLFrameBuffer();
|
||||
|
||||
|
||||
// unused but must be defined
|
||||
virtual void Blank ();
|
||||
virtual bool PaintToWindow ();
|
||||
virtual long/*HRESULT*/ GetHR(); // windows.h pollution prevention.
|
||||
|
||||
virtual bool CreateResources ();
|
||||
virtual void ReleaseResources ();
|
||||
|
||||
void SetVSync (bool vsync);
|
||||
void SwapBuffers();
|
||||
void NewRefreshRate ();
|
||||
|
|
|
@ -50,7 +50,6 @@ class Win32Video : public IVideo
|
|||
~Win32Video ();
|
||||
|
||||
bool InitD3D9();
|
||||
void InitDDraw();
|
||||
|
||||
EDisplayType GetDisplayType () { return DISPLAY_Both; }
|
||||
void SetWindowedScale (float scale);
|
||||
|
@ -61,7 +60,6 @@ class Win32Video : public IVideo
|
|||
bool NextMode (int *width, int *height, bool *letterbox);
|
||||
|
||||
bool GoFullscreen (bool yes);
|
||||
void BlankForGDI ();
|
||||
|
||||
void DumpAdapters ();
|
||||
void AddMode(int x, int y, int bits, int baseHeight, int doubling);
|
||||
|
@ -107,14 +105,9 @@ public:
|
|||
BaseWinFB(int width, int height, bool bgra) : DFrameBuffer(width, height, bgra), Windowed(true) {}
|
||||
|
||||
bool IsFullscreen () { return !Windowed; }
|
||||
virtual void Blank () = 0;
|
||||
virtual bool PaintToWindow () = 0;
|
||||
virtual long/*HRESULT*/ GetHR () = 0; // HRESULT is a long in Windows but this header should not be polluted with windows.h just for this single definition
|
||||
virtual void ScaleCoordsFromWindow(int16_t &x, int16_t &y);
|
||||
|
||||
protected:
|
||||
virtual bool CreateResources () = 0;
|
||||
virtual void ReleaseResources () = 0;
|
||||
virtual int GetTrueHeight() { return GetHeight(); }
|
||||
|
||||
bool Windowed;
|
||||
|
|
|
@ -38,8 +38,6 @@ public:
|
|||
void GetFlash (PalEntry &rgb, int &amount);
|
||||
int GetPageCount ();
|
||||
bool IsFullscreen ();
|
||||
void Blank ();
|
||||
bool PaintToWindow ();
|
||||
void SetVSync (bool vsync);
|
||||
void NewRefreshRate();
|
||||
void GetScreenshotBuffer(const uint8_t *&buffer, int &pitch, ESSType &color_type, float &gamma) override;
|
||||
|
@ -62,7 +60,6 @@ public:
|
|||
void WipeEndScreen();
|
||||
bool WipeDo(int ticks);
|
||||
void WipeCleanup();
|
||||
HRESULT GetHR ();
|
||||
virtual int GetTrueHeight() { return TrueHeight; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -103,37 +103,20 @@ extern bool VidResizing;
|
|||
EXTERN_CVAR (Bool, fullscreen)
|
||||
EXTERN_CVAR (Float, Gamma)
|
||||
EXTERN_CVAR (Bool, cl_capfps)
|
||||
EXTERN_CVAR(Int, vid_maxfps)
|
||||
|
||||
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
||||
|
||||
static HMODULE D3D9_dll;
|
||||
static HMODULE DDraw_dll;
|
||||
static UINT FPSLimitTimer;
|
||||
|
||||
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
||||
|
||||
IDirectDraw2 *DDraw;
|
||||
IDirect3D9 *D3D;
|
||||
IDirect3DDevice9 *D3Device;
|
||||
HANDLE FPSLimitEvent;
|
||||
|
||||
CVAR (Bool, vid_forceddraw, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR (Int, vid_adapter, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CUSTOM_CVAR (Int, vid_maxfps, 200, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
{
|
||||
if (vid_maxfps < TICRATE && vid_maxfps != 0)
|
||||
{
|
||||
vid_maxfps = TICRATE;
|
||||
}
|
||||
else if (vid_maxfps > 1000)
|
||||
{
|
||||
vid_maxfps = 1000;
|
||||
}
|
||||
else if (cl_capfps == 0)
|
||||
{
|
||||
I_SetFPSLimit(vid_maxfps);
|
||||
}
|
||||
}
|
||||
|
||||
#if VID_FILE_DEBUG
|
||||
FILE *dbg;
|
||||
|
@ -147,25 +130,13 @@ Win32Video::Win32Video (int parm)
|
|||
m_Adapter (D3DADAPTER_DEFAULT)
|
||||
{
|
||||
I_SetWndProc();
|
||||
if (!InitD3D9())
|
||||
{
|
||||
InitDDraw();
|
||||
}
|
||||
InitD3D9();
|
||||
}
|
||||
|
||||
Win32Video::~Win32Video ()
|
||||
{
|
||||
FreeModes ();
|
||||
|
||||
if (DDraw != NULL)
|
||||
{
|
||||
if (m_IsFullscreen)
|
||||
{
|
||||
DDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL);
|
||||
}
|
||||
DDraw->Release();
|
||||
DDraw = NULL;
|
||||
}
|
||||
if (D3D != NULL)
|
||||
{
|
||||
D3D->Release();
|
||||
|
@ -179,11 +150,6 @@ bool Win32Video::InitD3D9 ()
|
|||
{
|
||||
DIRECT3DCREATE9FUNC direct3d_create_9;
|
||||
|
||||
if (vid_forceddraw)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Load the Direct3D 9 library.
|
||||
if ((D3D9_dll = LoadLibraryA ("d3d9.dll")) == NULL)
|
||||
{
|
||||
|
@ -259,124 +225,12 @@ static HRESULT WINAPI EnumDDModesCB(LPDDSURFACEDESC desc, void *data)
|
|||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
void Win32Video::InitDDraw ()
|
||||
{
|
||||
DIRECTDRAWCREATEFUNC directdraw_create;
|
||||
LPDIRECTDRAW ddraw1;
|
||||
STARTLOG;
|
||||
|
||||
HRESULT dderr;
|
||||
|
||||
// Load the DirectDraw library.
|
||||
if ((DDraw_dll = LoadLibraryA ("ddraw.dll")) == NULL)
|
||||
{
|
||||
I_FatalError ("Could not load ddraw.dll");
|
||||
}
|
||||
|
||||
// Obtain an IDirectDraw interface.
|
||||
if ((directdraw_create = (DIRECTDRAWCREATEFUNC)GetProcAddress (DDraw_dll, "DirectDrawCreate")) == NULL)
|
||||
{
|
||||
I_FatalError ("The system file ddraw.dll is missing the DirectDrawCreate export");
|
||||
}
|
||||
|
||||
dderr = directdraw_create (NULL, &ddraw1, NULL);
|
||||
|
||||
if (FAILED(dderr))
|
||||
I_FatalError ("Could not create DirectDraw object: %08lx", dderr);
|
||||
|
||||
static const GUID IDIRECTDRAW2_GUID = { 0xB3A6F3E0, 0x2B43, 0x11CF, 0xA2, 0xDE, 0x00, 0xAA, 0x00, 0xB9, 0x33, 0x56 };
|
||||
|
||||
dderr = ddraw1->QueryInterface (IDIRECTDRAW2_GUID, (LPVOID*)&DDraw);
|
||||
if (FAILED(dderr))
|
||||
{
|
||||
ddraw1->Release ();
|
||||
DDraw = NULL;
|
||||
I_FatalError ("Could not initialize IDirectDraw2 interface: %08lx", dderr);
|
||||
}
|
||||
|
||||
// Okay, we have the IDirectDraw2 interface now, so we can release the
|
||||
// really old-fashioned IDirectDraw one.
|
||||
ddraw1->Release ();
|
||||
|
||||
DDraw->SetCooperativeLevel (Window, DDSCL_NORMAL);
|
||||
FreeModes ();
|
||||
dderr = DDraw->EnumDisplayModes (0, NULL, this, EnumDDModesCB);
|
||||
if (FAILED(dderr))
|
||||
{
|
||||
DDraw->Release ();
|
||||
DDraw = NULL;
|
||||
I_FatalError ("Could not enumerate display modes: %08lx", dderr);
|
||||
}
|
||||
if (m_Modes == NULL)
|
||||
{
|
||||
DDraw->Release ();
|
||||
DDraw = NULL;
|
||||
I_FatalError ("DirectDraw returned no display modes.\n\n"
|
||||
"If you started " GAMENAME " from a fullscreen DOS box, run it from "
|
||||
"a DOS window instead. If that does not work, you may need to reboot.");
|
||||
}
|
||||
if (Args->CheckParm ("-2"))
|
||||
{ // Force all modes to be pixel-doubled.
|
||||
ScaleModes(1);
|
||||
}
|
||||
else if (Args->CheckParm ("-4"))
|
||||
{ // Force all modes to be pixel-quadrupled.
|
||||
ScaleModes(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddLowResModes ();
|
||||
}
|
||||
AddLetterboxModes ();
|
||||
}
|
||||
|
||||
// Returns true if fullscreen, false otherwise
|
||||
bool Win32Video::GoFullscreen (bool yes)
|
||||
{
|
||||
static const char *const yestypes[2] = { "windowed", "fullscreen" };
|
||||
HRESULT hr[2];
|
||||
int count;
|
||||
|
||||
// FIXME: Do this right for D3D.
|
||||
if (D3D != NULL)
|
||||
{
|
||||
return yes;
|
||||
}
|
||||
|
||||
if (m_IsFullscreen == yes)
|
||||
return yes;
|
||||
|
||||
for (count = 0; count < 2; ++count)
|
||||
{
|
||||
LOG1 ("fullscreen: %d\n", yes);
|
||||
hr[count] = DDraw->SetCooperativeLevel (Window, !yes ? DDSCL_NORMAL :
|
||||
DDSCL_ALLOWMODEX | DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||
if (SUCCEEDED(hr[count]))
|
||||
{
|
||||
if (count != 0)
|
||||
{
|
||||
// Ack! Cannot print because the screen does not exist right now.
|
||||
// Printf ("Setting %s mode failed. Error %08lx\n",
|
||||
// yestypes[!yes], hr[0]);
|
||||
}
|
||||
m_IsFullscreen = yes;
|
||||
return yes;
|
||||
}
|
||||
yes = !yes;
|
||||
}
|
||||
|
||||
I_FatalError ("Could not set %s mode: %08lx\n"
|
||||
"Could not set %s mode: %08lx\n",
|
||||
yestypes[yes], hr[0], yestypes[!yes], hr[1]);
|
||||
|
||||
// Appease the compiler, even though we never return if we get here.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Flips to the GDI surface and clears it
|
||||
void Win32Video::BlankForGDI ()
|
||||
{
|
||||
static_cast<BaseWinFB *> (screen)->Blank ();
|
||||
return yes;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
Loading…
Reference in a new issue