Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes thrown error when exiting in DirectDraw build. #479

Merged
merged 1 commit into from Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions common/drawmisc.cpp
Expand Up @@ -10,9 +10,6 @@ HWND MainWindow; // Handle to programs main window
unsigned char CurrentPalette[768] = {255};
unsigned char PaletteTable[1024] = {0};

bool SystemToVideoBlits = false; // Does hardware support system mem to video mem blits?
bool VideoToSystemBlits = false; // Does hardware support video mem to system mem blits?
bool SystemToSystemBlits = false; // Does hardware support system mem to system mem blits?
bool OverlappedVideoBlits = true; // Can video driver blit overlapped regions?
bool AllowHardwareBlitFills = true;

Expand Down
30 changes: 1 addition & 29 deletions common/video_ddraw.cpp
Expand Up @@ -44,8 +44,7 @@
#include "misc.h"
#include <cstdio>

LPDIRECTDRAW DirectDrawObject = NULL; // Pointer to the direct draw object
LPDIRECTDRAW2 DirectDraw2Interface = NULL; // Pointer to direct draw 2 interface
LPDIRECTDRAW DirectDrawObject = NULL; // Pointer to the direct draw object

PALETTEENTRY PaletteEntries[256]; // 256 windows palette entries
LPDIRECTDRAWPALETTE PalettePtr; // Pointer to direct draw palette object
Expand Down Expand Up @@ -688,33 +687,6 @@ bool Set_Video_Mode(int w, int h, int bits_per_pixel)

Check_Overlapped_Blit_Capability();

/*
** Find out if DirectX 2 extensions are available
*/
result = DirectDrawObject->QueryInterface(IID_IDirectDraw2, (LPVOID*)&DirectDraw2Interface);
SystemToVideoBlits = FALSE;
VideoToSystemBlits = FALSE;
SystemToSystemBlits = FALSE;
if (result != DD_OK) {
DirectDraw2Interface = NULL;
} else {
DDCAPS capabilities;
DDCAPS emulated_capabilities;

memset((char*)&capabilities, 0, sizeof(capabilities));
memset((char*)&emulated_capabilities, 0, sizeof(emulated_capabilities));
capabilities.dwSize = sizeof(capabilities);
emulated_capabilities.dwSize = sizeof(emulated_capabilities);

DirectDrawObject->GetCaps(&capabilities, &emulated_capabilities);

if (capabilities.dwCaps & DDCAPS_CANBLTSYSMEM) {
SystemToVideoBlits = (capabilities.dwSVBCaps & DDCAPS_BLT) ? TRUE : FALSE;
VideoToSystemBlits = (capabilities.dwVSBCaps & DDCAPS_BLT) ? TRUE : FALSE;
SystemToSystemBlits = (capabilities.dwSSBCaps & DDCAPS_BLT) ? TRUE : FALSE;
}
}

/*
** In legacy DirectDraw mode we clip the cursor for the duration of the session.
*/
Expand Down