Added ddraw dll and sdl2.

This commit is contained in:
Justin Marshall
2020-06-01 22:36:07 -07:00
parent acef90427c
commit a529937ee5
109 changed files with 44210 additions and 34 deletions
@@ -0,0 +1,245 @@
#include "DirectDrawWrapper.h"
/*******************
**IUnknown methods**
********************/
// Retrieves pointers to the supported interfaces on an object.
HRESULT __stdcall IDirectDrawClipperWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppvObj)
{
debugMessage(1, "IDirectDrawClipperWrapper::QueryInterface", "Partially Implemented");
// Provide the directdraw interface for all versions up to 7
if(riid == IID_IDirectDrawClipper)
{
// Set pointer to this interface
ppvObj = (LPVOID *)this;
// Increment reference count
AddRef();
// Return success
return S_OK;
}
// Interface not supported
return E_NOINTERFACE;
}
// Increments the reference count for an interface on an object.
ULONG __stdcall IDirectDrawClipperWrapper::AddRef()
{
debugMessage(1, "IDirectDrawClipperWrapper::AddRef", "Partially Implemented");
// Increment reference count
ReferenceCount++;
// Return current reference count
return ReferenceCount;
}
// Decrements the reference count for an interface on an object.
ULONG __stdcall IDirectDrawClipperWrapper::Release()
{
debugMessage(1, "IDirectDrawClipperWrapper::Release", "Partially Implemented");
// Decrement reference count
ReferenceCount--;
// If reference count reaches 0 then free object
if(ReferenceCount == 0)
{
// Free objects here, skip for now
}
// Return new reference count
return ReferenceCount;
}
/*****************************
**IDirectDrawClipper methods**
******************************/
// Retrieves a copy of the clip list that is associated with a DirectDrawClipper
// object. To select a subset of the clip list, you can pass a rectangle that clips
// the clip list.
HRESULT __stdcall IDirectDrawClipperWrapper::GetClipList(LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize)
{
// ***Unimplemented***
debugMessage(0, "IDirectDrawClipperWrapper::GetClipList", "Not Implemented");
if(lpClipList == NULL)
{
if(lpRect == NULL) {
// lpdwSize = memory required to hold entire clip list
}
else
{
// lpdwSize = memory required to clip list in region lpRect
}
}
else
{
if(lpRect == NULL) {
// lpClipList = RGNDATA structure that receives the resulting copy of the entire clip list.
}
else
{
// lpClipList = RGNDATA structure that receives the resulting copy of the clip list in region lpRect
}
}
return DDERR_GENERIC;
/*
DDERR_GENERIC
DDERR_INVALIDCLIPLIST
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_NOCLIPLIST
DDERR_REGIONTOOSMALL
*/
}
// Retrieves the window handle that was previously associated with this
// DirectDrawClipper object by the IDirectDrawClipper::SetHWnd method.
HRESULT __stdcall IDirectDrawClipperWrapper::GetHWnd(HWND FAR *lphWnd)
{
debugMessage(1, "IDirectDrawClipperWrapper::GetHWnd", "Partially Implemented");
// lphWnd cannot be null
if(lphWnd == NULL) return DDERR_INVALIDPARAMS;
// Set lphWnd to associated window handle
*lphWnd = hWnd;
// Success
return DD_OK;
}
// Initializes a DirectDrawClipper object that was created by using the
// CoCreateInstance COM function.
HRESULT __stdcall IDirectDrawClipperWrapper::Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags)
{
debugMessage(1, "IDirectDrawClipperWrapper::Initialize", "Partially Implemented");
if(lpDD == NULL)
{
// An independent DirectDrawClipper object is initialized; a call of this
// type is equivalent to using the DirectDrawCreateClipper function.
}
else
{
// Call constructor
}
// Overload to already init
return DDERR_ALREADYINITIALIZED;
/*
DDERR_ALREADYINITIALIZED
DDERR_INVALIDPARAMS
*/
}
// Retrieves the status of the clip list if a window handle is associated
// with a DirectDrawClipper object.
HRESULT __stdcall IDirectDrawClipperWrapper::IsClipListChanged(BOOL FAR *lpbChanged)
{
// ***Unimplemented***
debugMessage(0, "IDirectDrawClipperWrapper::Initialize", "Not Implemented");
// lpbChanged cannot be null
if(lpbChanged == NULL) return DDERR_INVALIDPARAMS;
// lpbChanged is TRUE if the clip list has changed, and FALSE otherwise.
return DDERR_GENERIC;
/*
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
*/
}
// Sets or deletes the clip list that is used by the IDirectDrawSurface7::Blt,
// IDirectDrawSurface7::BltBatch, and IDirectDrawSurface7::UpdateOverlay methods
// on surfaces to which the parent DirectDrawClipper object is attached.
HRESULT __stdcall IDirectDrawClipperWrapper::SetClipList(LPRGNDATA lpClipList, DWORD dwFlags)
{
// ***Unimplemented***
debugMessage(0, "IDirectDrawClipperWrapper::SetClipList", "Not Implemented");
//You cannot set the clip list if a window handle is already associated
// with the DirectDrawClipper objet.
if(hasHwnd)
{
return DDERR_CLIPPERISUSINGHWND;
}
// ******NOTE: If you call IDirectDrawSurface7::BltFast on a surface with an attached
// clipper, it returns DDERR_UNSUPPORTED.
if(lpClipList == NULL)
{
// Delete associated clip list if it exists
}
else
{
// Set clip list to lpClipList
}
return DDERR_GENERIC;
/*
DDERR_INVALIDCLIPLIST
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY
*/
}
// Sets the window handle that the clipper object uses to obtain clipping information
HRESULT __stdcall IDirectDrawClipperWrapper::SetHWnd(DWORD dwFlags, HWND in_hWnd)
{
debugMessage(1, "IDirectDrawClipperWrapper::SetHWnd", "Partially Implemented");
hasHwnd = true;
hWnd = in_hWnd;
// Load clip list from window
return DD_OK;
/*
DDERR_INVALIDCLIPLIST
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY
*/
}
// Default constructor
IDirectDrawClipperWrapper::IDirectDrawClipperWrapper()
{
// Init variables
hasHwnd = false;
hWnd = NULL;
ReferenceCount = 0;
// Add reference
AddRef();
debugMessage(2, "IDirectDrawClipperWrapper::IDirectDrawClipperWrapper", "Created");
}
// Default destructor
IDirectDrawClipperWrapper::~IDirectDrawClipperWrapper()
{
// Release reference
Release();
debugMessage(2, "IDirectDrawClipperWrapper::~IDirectDrawClipperWrapper", "Destroyed");
}
// Initialize wrapper function
HRESULT IDirectDrawClipperWrapper::WrapperInitialize(DWORD dwFlags)
{
debugMessage(2, "IDirectDrawClipperWrapper::WrapperInitialize", "Initialized");
return DD_OK;
}
@@ -0,0 +1,288 @@
#include "DirectDrawWrapper.h"
/*******************
**IUnknown methods**
********************/
// Retrieves pointers to the supported interfaces on an object.
HRESULT __stdcall IDirectDrawPaletteWrapper::QueryInterface(REFIID riid, LPVOID FAR * ppvObj)
{
debugMessage(1, "IDirectDrawPaletteWrapper::QueryInterface", "Partially Implemented");
// Provide the directdraw interface for all versions up to 7
if(riid == IID_IDirectDrawPalette)
{
// Set pointer to this interface
ppvObj = (LPVOID *)this;
// Increment reference count
AddRef();
// Return success
return S_OK;
}
// Interface not supported
return E_NOINTERFACE;
}
// Increments the reference count for an interface on an object.
ULONG __stdcall IDirectDrawPaletteWrapper::AddRef()
{
debugMessage(1, "IDirectDrawPaletteWrapper::AddRef", "Partially Implemented");
// Increment reference count
ReferenceCount++;
// Return current reference count
return ReferenceCount;
}
// Decrements the reference count for an interface on an object.
ULONG __stdcall IDirectDrawPaletteWrapper::Release()
{
debugMessage(1, "IDirectDrawPaletteWrapper::Release", "Partially Implemented");
// Decrement reference count
ReferenceCount--;
// If reference count reaches 0 then free object
if(ReferenceCount == 0)
{
// Free objects
if(rawPalette != NULL) delete rawPalette;
if(rgbPalette != NULL) delete rgbPalette;
}
// Return new reference count
return ReferenceCount;
}
/*****************************
**IDirectDrawPalette methods**
******************************/
// Retrieves the capabilities of the palette object.
HRESULT __stdcall IDirectDrawPaletteWrapper::GetCaps(LPDWORD lpdwCaps)
{
debugMessage(1, "IDirectDrawPaletteWrapper::GetCaps", "Partially Implemented");
// lpdwCaps cannot be null
if(lpdwCaps == NULL) return DDERR_INVALIDPARAMS;
// set return data to current palette caps
*lpdwCaps = paletteCaps;
return DD_OK;
}
// Retrieves palette values from a DirectDrawPalette object.
HRESULT __stdcall IDirectDrawPaletteWrapper::GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries)
{
// lpEntries cannot be null and dwFlags must be 0
if(lpEntries == NULL) return DDERR_INVALIDPARAMS;
// Copy raw palette entries to lpEntries(size dwNumEntries) starting at dwBase
memcpy(lpEntries, &(rawPalette[dwBase]), sizeof(PALETTEENTRY) * min(dwNumEntries, entryCount - dwBase));
/*
// NOTE: Debugging disabled for performance
debugMessage(2, "IDirectDrawPaletteWrapper::GetEntries", "Retrieved Palette Entries");
char message[2048] = "\0";
sprintf_s(message, 2048, "dwBase: %d, dwNumEntries: %d", dwBase, dwNumEntries);
debugMessage(2, "IDirectDrawPaletteWrapper::GetEntries", message);
*/
// dwNumEntries is the number of palette entries that can fit in the array that lpEntries
// specifies. The colors of the palette entries are returned in sequence, from the value
// of the dwStartingEntry parameter through the value of the dwCount parameter minus 1.
// (These parameters are set by IDirectDrawPalette::SetEntries.)
return DD_OK;
}
// Initializes the DirectDrawPalette object.
HRESULT __stdcall IDirectDrawPaletteWrapper::Initialize(LPDIRECTDRAW lpDDW, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable)
{
debugMessage(1, "IDirectDrawPaletteWrapper::Initialize", "Partially Implemented");
// This method always returns already initialized
return DDERR_ALREADYINITIALIZED;
}
// Changes entries in a DirectDrawPalette object immediately.
HRESULT __stdcall IDirectDrawPaletteWrapper::SetEntries(DWORD dwFlags, DWORD dwStartingEntry, DWORD dwCount, LPPALETTEENTRY lpEntries)
{
// lpEntries cannot be null and dwFlags must be 0
if(lpEntries == NULL) return DDERR_INVALIDPARAMS;
// Copy raw palette entries from dwStartingEntry and of count dwCount
memcpy(&(rawPalette[dwStartingEntry]), lpEntries, sizeof(PALETTEENTRY) * min(dwCount, entryCount - dwStartingEntry));
// Translate new raw pallete entries to RGB(make sure not to go off the end of the memory)
for(int i = dwStartingEntry; i < min(dwStartingEntry + dwCount, entryCount - dwStartingEntry); i++)
{
// Translate the raw palette to ARGB
if(hasAlpha)
{
// Include peFlags as 8bit alpha
rgbPalette[i] = rawPalette[i].peFlags << 24;
rgbPalette[i] |= rawPalette[i].peRed << 16;
rgbPalette[i] |= rawPalette[i].peGreen << 8;
rgbPalette[i] |= rawPalette[i].peBlue;
}
else
{
// Alpha is always 255
rgbPalette[i] = 0xFF000000;
rgbPalette[i] |= rawPalette[i].peRed << 16;
rgbPalette[i] |= rawPalette[i].peGreen << 8;
rgbPalette[i] |= rawPalette[i].peBlue;
}
}
/*
// NOTE: Debugging disabled for performance
debugMessage(2, "IDirectDrawPaletteWrapper::SetEntries", "Set Palette Entries");
char message[2048] = "\0";
sprintf_s(message, 2048, "dwStartingEntry: %d, dwCount: %d", dwStartingEntry, dwCount);
debugMessage(2, "IDirectDrawPaletteWrapper::SetEntries", message); */
return DD_OK;
}
// Default constructor
IDirectDrawPaletteWrapper::IDirectDrawPaletteWrapper()
{
// Init vars
rgbPalette = NULL;
rawPalette = NULL;
ReferenceCount = 0;
paletteCaps = 0;
entryCount = 0;
hasAlpha = false;
// Create with flags
AddRef();
debugMessage(2, "IDirectDrawPaletteWrapper::IDirectDrawPaletteWrapper", "Created");
}
// Default destructor
IDirectDrawPaletteWrapper::~IDirectDrawPaletteWrapper()
{
// Free used memory
if(rgbPalette != NULL)
{
delete rgbPalette;
rgbPalette = NULL;
}
if(rawPalette != NULL)
{
delete rawPalette;
rawPalette = NULL;
}
// Clean up
Release();
debugMessage(2, "IDirectDrawPaletteWrapper::~IDirectDrawPaletteWrapper", "Destroyed");
}
// Initialize wrapper function
HRESULT IDirectDrawPaletteWrapper::WrapperInitialize(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette)
{
// Save palette caps
paletteCaps = dwFlags;
// Default to 256 entries
entryCount = 256;
// Create palette of requested bit size
if(dwFlags & DDPCAPS_1BIT)
{
entryCount = 2;
}
else if(dwFlags & DDPCAPS_2BIT)
{
entryCount = 4;
}
else if(dwFlags & DDPCAPS_4BIT)
{
entryCount = 16;
}
else if(dwFlags & DDPCAPS_8BIT || dwFlags & DDPCAPS_ALLOW256)
{
entryCount = 256;
}
// Allocate raw ddraw palette
rawPalette = new PALETTEENTRY[entryCount];
// Memory failed to allocate, return out of memory
if(rawPalette == NULL)
{
debugMessage(0, "IDirectDrawPaletteWrapper::WrapperInitialize", "Failed to allocate raw palette memory");
return DDERR_OUTOFMEMORY;
}
// Copy inital palette into raw palette
memcpy(rawPalette, lpDDColorArray, sizeof(PALETTEENTRY) * entryCount);
// Check flags for alpha
if(dwFlags & DDPCAPS_ALPHA)
{
hasAlpha = true;
}
else
{
hasAlpha = false;
}
// Allocate rgb palette
rgbPalette = new UINT32[entryCount];
// Memory failed to allocate, return out of memory
if(rgbPalette == NULL)
{
debugMessage(0, "IDirectDrawPaletteWrapper::WrapperInitialize", "Failed to allocate RGB palette memory");
return DDERR_OUTOFMEMORY;
}
// For all entries
for(int i = 0; i < entryCount; i++)
{
// Translate the raw palette to ARGB
if(hasAlpha)
{
// Include peFlags as 8bit alpha
rgbPalette[i] = rawPalette[i].peFlags << 24;
rgbPalette[i] |= rawPalette[i].peRed << 16;
rgbPalette[i] |= rawPalette[i].peGreen << 8;
rgbPalette[i] |= rawPalette[i].peBlue;
}
else
{
// Alpha is always 255
rgbPalette[i] = 0xFF000000;
rgbPalette[i] |= rawPalette[i].peRed << 16;
rgbPalette[i] |= rawPalette[i].peGreen << 8;
rgbPalette[i] |= rawPalette[i].peBlue;
}
}
char message[2048] = "\0";
sprintf_s(message, 2048, "Initialized");
if(dwFlags & DDPCAPS_1BIT) strcat_s(message, 2048, ", DDPCAPS_1BIT");
if(dwFlags & DDPCAPS_2BIT) strcat_s(message, 2048, ", DDPCAPS_2BIT");
if(dwFlags & DDPCAPS_4BIT) strcat_s(message, 2048, ", DDPCAPS_4BIT");
if(dwFlags & DDPCAPS_8BIT) strcat_s(message, 2048, ", DDPCAPS_8BIT");
if(dwFlags & DDPCAPS_8BITENTRIES) strcat_s(message, 2048, ", DDPCAPS_8BITENTRIES");
if(dwFlags & DDPCAPS_ALPHA) strcat_s(message, 2048, ", DDPCAPS_ALPHA");
if(dwFlags & DDPCAPS_ALLOW256) strcat_s(message, 2048, ", DDPCAPS_ALLOW256");
if(dwFlags & DDPCAPS_INITIALIZE) strcat_s(message, 2048, ", DDPCAPS_INITIALIZE");
if(dwFlags & DDPCAPS_PRIMARYSURFACE) strcat_s(message, 2048, ", DDPCAPS_PRIMARYSURFACE");
if(dwFlags & DDPCAPS_PRIMARYSURFACELEFT) strcat_s(message, 2048, ", DDPCAPS_PRIMARYSURFACELEFT");
if(dwFlags & DDPCAPS_VSYNC) strcat_s(message, 2048, ", DDPCAPS_VSYNC");
debugMessage(2, "IDirectDrawPaletteWrapper::WrapperInitialize", message);
// Success
return DD_OK;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+382
View File
@@ -0,0 +1,382 @@
#define VC_EXTRALEAN
#include <Windows.h>
#include <initguid.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <stdio.h>
#include <ddraw.h>
#ifndef H_DDW
#define H_DDW
// Global function def
void debugMessage(int, char*, char*);
// Forward class declarations
class FAR IDirectDrawWrapper;
class FAR IDirectDrawPaletteWrapper;
class FAR IDirectDrawClipperWrapper;
class FAR IDirectDrawSurfaceWrapper;
class FAR IDirectDrawColorControlWrapper;
class FAR IDirectDrawGammaControlWrapper;
// Custom vertex format
const DWORD D3DFVF_TLVERTEX = D3DFVF_XYZRHW | D3DFVF_TEX1;
// Custom vertex
struct TLVERTEX
{
float x;
float y;
float z;
float rhw;
float u;
float v;
};
/*
* IDirectDrawWrapper Class
*/
class FAR IDirectDrawWrapper : public IDirectDraw
{
// Implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDraw methods ***/
HRESULT __stdcall Compact();
HRESULT __stdcall CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter);
HRESULT __stdcall CreatePalette(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette, IUnknown FAR *pUnkOuter);
HRESULT __stdcall CreateSurface(LPDDSURFACEDESC lpDDSurfaceDes, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, IUnknown FAR *pUnkOuter);
HRESULT __stdcall DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface, LPDIRECTDRAWSURFACE FAR *lplpDupDDSurface);
HRESULT __stdcall EnumDisplayModes(DWORD dwFlags, LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK lpEnumModesCallback);
HRESULT __stdcall EnumSurfaces(DWORD dwFlags, LPDDSURFACEDESC lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
HRESULT __stdcall FlipToGDISurface();
HRESULT __stdcall GetCaps(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps);
HRESULT __stdcall GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc);
HRESULT __stdcall GetFourCCCodes(LPDWORD lpNumCodes, LPDWORD lpCodes);
HRESULT __stdcall GetGDISurface(LPDIRECTDRAWSURFACE FAR *lplpGDIDDSSurface);
HRESULT __stdcall GetMonitorFrequency(LPDWORD lpdwFrequency);
HRESULT __stdcall GetScanLine(LPDWORD lpdwScanLine);
HRESULT __stdcall GetVerticalBlankStatus(LPBOOL lpbIsInVB);
HRESULT __stdcall Initialize(GUID FAR *lpGUID);
HRESULT __stdcall RestoreDisplayMode();
HRESULT __stdcall SetCooperativeLevel(HWND hWnd, DWORD dwFlags);
HRESULT __stdcall SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP);
// HRESULT __stdcall SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags);
HRESULT __stdcall WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent);
/*** Added in the v2 interface ***/
HRESULT __stdcall GetAvailableVideoMem(LPDDSCAPS2 lpDDSCaps2, LPDWORD lpdwTotal, LPDWORD lpdwFree);
/*** Added in the V4 Interface ***/
HRESULT __stdcall EvaluateMode(DWORD dwFlags, DWORD *pSecondsUntilTimeout);
HRESULT __stdcall GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2 lpdddi, DWORD dwFlags);
HRESULT __stdcall GetSurfaceFromDC(HDC hdc, LPDIRECTDRAWSURFACE7 *lpDDS);
HRESULT __stdcall RestoreAllSurfaces();
HRESULT __stdcall StartModeTest(LPSIZE lpModesToTest, DWORD dwNumEntries, DWORD dwFlags);
HRESULT __stdcall TestCooperativeLevel();
// Constructor/destructor
IDirectDrawWrapper();
~IDirectDrawWrapper();
// Helper functions
HRESULT WrapperInitialize(WNDPROC wp, HMODULE hMod);
HRESULT Present();
BOOL MenuKey(WPARAM vKey);
void DoSnapshot();
void ToggleFullscreen();
// Display window handle
HWND hWnd;
WNDPROC lpPrevWndFunc;
WNDPROC WndProc;
HMODULE hModule;
// Current display mode
bool isWindowed;
// Application display mode
DWORD displayModeWidth;
DWORD displayModeHeight;
// Display resolution
UINT displayWidth;
UINT displayHeight;
// Saved display resolutions for fullscreen and windowed
UINT displayWidthWindowed;
UINT displayHeightWindowed;
UINT displayWidthFullscreen;
UINT displayHeightFullscreen;
// Custom functions and variables
private:
// Helper function to set window mode to match display mode
void AdjustWindow();
bool CreateD3DDevice();
bool CreateSurfaceTexture();
bool ReinitDevice();
bool CheckD3DFailure(HRESULT hr, char *location, char *message);
IDirectDrawSurfaceWrapper *lpAttachedSurface;
// Reference count
ULONG ReferenceCount;
// Direct3D9 Objects
LPDIRECT3D9 d3d9Object;
LPDIRECT3DDEVICE9 d3d9Device;
D3DPRESENT_PARAMETERS presParams;
LPDIRECT3DTEXTURE9 surfaceTexture;
LPDIRECT3DVERTEXBUFFER9 vertexBuffer;
LPD3DXSPRITE d3dSprite;
LPDIRECT3DTEXTURE9 menuTexture;
int curMenuFrame;
int menuLocations[5];
RECT menuSprites[18];
// Flags and settings
BOOL inMenu;
int curMenu;
int menuWindowedResolution;
int windowedResolutionCount;
POINT* windowedResolutions;
int menuFullscreenResolution;
int fullscreenResolutionCount;
POINT* fullscreenResolutions;
UINT* fullscreenRefreshes;
bool menuWindowed;
bool menuvSync;
// Last window position
POINT lastPosition;
// Vsync enabled
bool vSync;
// Refresh rate for fullscreen
UINT refreshRate;
};
/*
* IDirectDrawPalette Wrapper
*/
class FAR IDirectDrawPaletteWrapper : public IDirectDrawPalette
{
// Implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDrawPalette methods ***/
HRESULT __stdcall GetCaps(LPDWORD lpdwCaps);
HRESULT __stdcall GetEntries(DWORD dwFlags, DWORD dwBase, DWORD dwNumEntries, LPPALETTEENTRY lpEntries);
HRESULT __stdcall Initialize(LPDIRECTDRAW lpDDW, DWORD dwFlags, LPPALETTEENTRY lpDDColorTable);
HRESULT __stdcall SetEntries(DWORD dwFlags,DWORD dwStartingEntry,DWORD dwCount, LPPALETTEENTRY lpEntries);
// Constructor/destructor
IDirectDrawPaletteWrapper();
~IDirectDrawPaletteWrapper();
// Helper functions
HRESULT WrapperInitialize(DWORD dwFlags, LPPALETTEENTRY lpDDColorArray, LPDIRECTDRAWPALETTE FAR *lplpDDPalette);
// Rgb translated palette
UINT32 *rgbPalette;
// Raw palette data
LPPALETTEENTRY rawPalette;
// Custom functions and variables
private:
// Reference count
ULONG ReferenceCount;
// Palette flags
DWORD paletteCaps;
// Number of palette entries
int entryCount;
// Raw palette has alpha data
bool hasAlpha;
};
/*
* IDirectDrawClipper Wrapper
*/
class FAR IDirectDrawClipperWrapper : public IDirectDrawClipper
{
// Implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDrawClipper methods ***/
HRESULT __stdcall GetClipList(LPRECT lpRect, LPRGNDATA lpClipList, LPDWORD lpdwSize);
HRESULT __stdcall GetHWnd(HWND FAR *lphWnd);
HRESULT __stdcall Initialize(LPDIRECTDRAW lpDD, DWORD dwFlags);
HRESULT __stdcall IsClipListChanged(BOOL FAR *lpbChanged);
HRESULT __stdcall SetClipList(LPRGNDATA lpClipList, DWORD dwFlags);
HRESULT __stdcall SetHWnd(DWORD dwFlags, HWND hWnd);
// Constructor/destructor
IDirectDrawClipperWrapper();
~IDirectDrawClipperWrapper();
// Helper functions
HRESULT WrapperInitialize(DWORD dwFlags);
// Custom functions and variables
private:
// Reference count
ULONG ReferenceCount;
// Associated hwnd
bool hasHwnd;
HWND hWnd;
};
/*
* IDirectDrawSurface Wrapper
*/
class FAR IDirectDrawSurfaceWrapper : public IDirectDrawSurface
{
// Implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDrawSurface methods ***/
HRESULT __stdcall AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSurface);
HRESULT __stdcall AddOverlayDirtyRect(LPRECT lpRect);
HRESULT __stdcall Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx);
HRESULT __stdcall BltBatch(LPDDBLTBATCH lpDDBltBatch, DWORD dwCount, DWORD dwFlags);
HRESULT __stdcall BltFast(DWORD dwX, DWORD dwY, LPDIRECTDRAWSURFACE lpDDSrcSurface, LPRECT lpSrcRect, DWORD dwFlags);
HRESULT __stdcall DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
HRESULT __stdcall EnumAttachedSurfaces(LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
HRESULT __stdcall EnumOverlayZOrders(DWORD dwFlags, LPVOID lpContext, LPDDENUMSURFACESCALLBACK lpfnCallback);
HRESULT __stdcall Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride, DWORD dwFlags);
HRESULT __stdcall GetAttachedSurface(LPDDSCAPS lpDDSCaps, LPDIRECTDRAWSURFACE FAR *lplpDDAttachedSurface);
HRESULT __stdcall GetBltStatus(DWORD dwFlags);
HRESULT __stdcall GetCaps(LPDDSCAPS lpDDSCaps);
HRESULT __stdcall GetClipper(LPDIRECTDRAWCLIPPER FAR *lplpDDClipper);
HRESULT __stdcall GetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey);
HRESULT __stdcall GetDC(HDC FAR *lphDC);
HRESULT __stdcall GetFlipStatus(DWORD dwFlags);
HRESULT __stdcall GetOverlayPosition(LPLONG lplX, LPLONG lplY);
HRESULT __stdcall GetPalette(LPDIRECTDRAWPALETTE FAR *lplpDDPalette);
HRESULT __stdcall GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat);
HRESULT __stdcall GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc);
HRESULT __stdcall Initialize(LPDIRECTDRAW lpDD, LPDDSURFACEDESC lpDDSurfaceDesc);
HRESULT __stdcall IsLost();
HRESULT __stdcall Lock(LPRECT lpDestRect, LPDDSURFACEDESC lpDDSurfaceDesc, DWORD dwFlags, HANDLE hEvent);
HRESULT __stdcall ReleaseDC(HDC hDC);
HRESULT __stdcall Restore();
HRESULT __stdcall SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper);
HRESULT __stdcall SetColorKey(DWORD dwFlags, LPDDCOLORKEY lpDDColorKey);
HRESULT __stdcall SetOverlayPosition(LONG lX, LONG lY);
HRESULT __stdcall SetPalette(LPDIRECTDRAWPALETTE lpDDPalette);
HRESULT __stdcall Unlock(LPVOID lpRect);
HRESULT __stdcall Unlock(LPRECT lpRect);
HRESULT __stdcall UpdateOverlay(LPRECT lpSrcRect, LPDIRECTDRAWSURFACE lpDDDestSurface, LPRECT lpDestRect, DWORD dwFlags, LPDDOVERLAYFX lpDDOverlayFx);
HRESULT __stdcall UpdateOverlayDisplay(DWORD dwFlags);
HRESULT __stdcall UpdateOverlayZOrder(DWORD dwFlags, LPDIRECTDRAWSURFACE lpDDSReference);
/*** Added in the v2 interface ***/
HRESULT __stdcall GetDDInterface(LPVOID FAR *lplpDD);
HRESULT __stdcall PageLock(DWORD dwFlags);
HRESULT __stdcall PageUnlock(DWORD dwFlags);
/*** Added in the v3 interface ***/
HRESULT __stdcall SetSurfaceDesc(LPDDSURFACEDESC2 lpDDsd2, DWORD dwFlags);
/*** Added in the v4 interface ***/
HRESULT __stdcall ChangeUniquenessValue();
HRESULT __stdcall FreePrivateData(REFGUID guidTag);
HRESULT __stdcall GetPrivateData(REFGUID guidTag, LPVOID lpBuffer, LPDWORD lpcbBufferSize);
HRESULT __stdcall GetUniquenessValue(LPDWORD lpValue);
HRESULT __stdcall SetPrivateData(REFGUID guidTag, LPVOID lpData, DWORD cbSize, DWORD dwFlags);
/*** Texture7 methods ***/
HRESULT __stdcall SetPriority(DWORD dwPriority);
HRESULT __stdcall GetPriority(LPDWORD lpdwPriority);
HRESULT __stdcall SetLOD(LPDWORD lpdwMaxLOD);
HRESULT __stdcall GetLOD(DWORD dwMaxLOD);
// Constructor/destructor
IDirectDrawSurfaceWrapper(IDirectDrawWrapper* parent);
~IDirectDrawSurfaceWrapper();
// Helper functions
HRESULT WrapperInitialize(LPDDSURFACEDESC lpDDSurfaceDesc, DWORD displayModeWidth, DWORD displayModeHeight, DWORD displayWidth, DWORD displayHeight);
BOOL ReInitialize(DWORD displayWidth, DWORD displayHeight);
// RGB video memory
UINT32 *rgbVideoMem;
//Custom functions and variables
private:
// Reference count
ULONG ReferenceCount;
// Directdraw object that created this surface
IDirectDrawWrapper *ddrawParent;
// Associated palette
IDirectDrawPaletteWrapper *attachedPalette;
// Surface description
DDSURFACEDESC surfaceDesc;
LONG surfaceWidth;
LONG surfaceHeight;
// Color keys(DDCKEY_DESTBLT, DDCKEY_DESTOVERLAY, DDCKEY_SRCBLT, DDCKEY_SRCOVERLAY)
DDCOLORKEY colorKeys[4];
LONG overlayX, overlayY;
// Virtual video memory
BYTE *rawVideoMem;
};
/*
* IDirectDrawColorControl
*/
class FAR IDirectDrawColorControlWrapper : public IDirectDrawColorControl
{
//implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDrawColorControl methods ***/
HRESULT __stdcall GetColorControls(LPDDCOLORCONTROL lpColorControl);
HRESULT __stdcall SetColorControls(LPDDCOLORCONTROL lpColorControl);
// Constructor/destructor
IDirectDrawColorControlWrapper();
~IDirectDrawColorControlWrapper();
// Custom functions and variables
private:
};
/*
* IDirectDrawGammaControl
*/
class FAR IDirectDrawGammaControlWrapper : public IDirectDrawGammaControl
{
// Implemented interfaces
public:
/*** IUnknown methods ***/
HRESULT __stdcall QueryInterface(REFIID riid, LPVOID FAR * ppvObj);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
/*** IDirectDrawGammaControl methods ***/
HRESULT __stdcall GetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData);
HRESULT __stdcall SetGammaRamp(DWORD dwFlags, LPDDGAMMARAMP lpRampData);
// Constructor/destructor
IDirectDrawGammaControlWrapper();
~IDirectDrawGammaControlWrapper();
// Custom functions and variables
private:
};
#endif
+299
View File
@@ -0,0 +1,299 @@
#pragma comment(linker, "/EXPORT:DirectDrawCreate=_DirectDrawCreate@12")
#include "DirectDrawWrapper.h"
#include "resource.h"
//#include "detours.h"
#include <stdio.h>
#include <math.h>
// Main thread ddrawwrapper object
IDirectDrawWrapper *lpDD = NULL;
// Original setcursorpos function pointer
static BOOL (WINAPI *TrueSetCursorPos)(int,int) = SetCursorPos;
static HMODULE (WINAPI *TrueLoadLibraryA)(LPCSTR) = GetModuleHandleA;
// Are we in the settings menu
BOOL inMenu;
// Dll start time
DWORD start_time;
// The level of debug to display
int debugLevel;
//debug display mode (-1 = none, 0 = console, 1 = file)
int debugDisplay;
//the debug file handle
FILE *debugFile;
// Dll hmodule
HMODULE hMod;
/* Helper function for throwing debug/error messages
*
* int level - Debug level
* char *location - Message location
* char *message - Message
*/
void debugMessage(int level, char *location, char *message)
{
// If above the current level then skip totally
if(level > debugLevel) return;
// Calculate HMS
DWORD cur_time = GetTickCount() - start_time;
long hours = (long)floor((double)cur_time / (double)3600000.0);
cur_time -= (hours * 3600000);
int minutes = (int)floor((double)cur_time / (double)60000.0);
cur_time -= (minutes * 60000);
double seconds = (double)cur_time / (double)1000.0;
// Build error message
char text[4096] = "\0";
if(level == 0)
{
sprintf_s(text, 4096, "%d:%d:%#.1f ERR %s %s\n", hours, minutes, seconds, location, message);
}
else if(level == 1)
{
sprintf_s(text, 4096, "%d:%d:%#.1f WRN %s %s\n", hours, minutes, seconds, location, message);
}
else if(level == 2)
{
sprintf_s(text, 4096, "%d:%d:%#.1f INF %s %s\n", hours, minutes, seconds, location, message);
}
// Output and flush
printf_s(text);
fflush(stdout);
}
// Override function for cursor position
BOOL WINAPI OverrideSetCursorPos(int X, int Y)
{
// If ddraw object exists and windowed mode
if(lpDD != NULL && lpDD->isWindowed)
{
// X,Y are relative to client area within the code
// Get client area location
POINT cpos;
cpos.x = 0;
cpos.y = 0;
ClientToScreen(lpDD->hWnd, &cpos);
// Calculate correct cursor offset and move
BOOL res = TrueSetCursorPos(cpos.x + X, cpos.y + Y);
return res;
}
return TrueSetCursorPos(X, Y);
}
// Override function for load library
/*HMODULE WINAPI OverrideLoadLibraryA(LPCSTR lpModuleName)
{
printf_s("%s\n", lpModuleName);
return TrueLoadLibraryA(lpModuleName);
}*/
// Pretty standard winproc
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
// On syskey down
case WM_SYSKEYDOWN:
// ALT+ENTER trap keydown
if (wParam == VK_RETURN)
{
return 0;
}
break;
// On syskey up
case WM_SYSKEYUP:
// ALT+ENTER trap keyup
if (wParam == VK_RETURN)
{
// If DDW exists
if(lpDD != NULL)
{
lpDD->ToggleFullscreen();
}
return 0;
}
break;
// On keydown
case WM_KEYDOWN:
// Overload printscreen(save a snapshot of the current screen
if(wParam == VK_SNAPSHOT)
{
return 0;
}
// Always pass ~ to menu
if(wParam == VK_OEM_3)
{
return 0;
}
// Everything gets passed if we are in the menu
if(inMenu)
{
return 0;
}
break;
// On keyup
case WM_KEYUP:
// Overload printscreen(save a snapshot of the current screen)
if(!inMenu && wParam == VK_SNAPSHOT)
{
lpDD->DoSnapshot();
return 0;
}
// Always pass ~ to menu
if(wParam == VK_OEM_3)
{
// Pass to menu and set inMenu to result
inMenu = lpDD->MenuKey(VK_OEM_3);
return 0;
}
// Everything gets passed if we are in the menu
if(inMenu)
{
// Pass to menu and set inMenu to result
inMenu = lpDD->MenuKey(wParam);
return 0;
}
break;
// On destroy window
case WM_DESTROY:
// Restore the orignal window proc if we have it
if(lpDD->lpPrevWndFunc != NULL)
{
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)lpDD->lpPrevWndFunc);
}
break;
}
// Call original windiow proc by default
return CallWindowProc(lpDD->lpPrevWndFunc, hwnd, message, wParam, lParam);
}
// Main dll entry
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
LONG error;
switch (ul_reason_for_call)
{
// Initial process attach
case DLL_PROCESS_ATTACH:
// Store module handle
hMod = hModule;
// Set default variables
debugLevel = 0;
debugDisplay = -1;
// Set time start
start_time = GetTickCount();
// Not in menu to start
inMenu = false;
// Retrieve command line arguments
LPWSTR *szArgList;
int argCount;
szArgList = CommandLineToArgvW(GetCommandLine(), &argCount);
// If arguments
if(szArgList != NULL)
{
for(int i = 0; i < argCount; i++)
{
// If debug
if(wcscmp(szArgList[i], L"/ddrawdebug") == 0) {
debugDisplay = 0;
debugLevel = 2;
// Create the debug console
AllocConsole();
// Redirect stdout to console
freopen( "CONOUT$", "wb", stdout);
break;
}
// If ddrawlog
else if(wcscmp(szArgList[i], L"/ddrawlog") == 0) {
debugDisplay = 1;
debugLevel = 2;
// Redireect stdout to file
char curPath[MAX_PATH];
char filename[MAX_PATH];
GetCurrentDirectoryA(MAX_PATH, curPath);
sprintf_s(filename, MAX_PATH, "%s\\ddraw_debug.log", curPath);
freopen_s(&debugFile, filename, "wb", stdout);
break;
}
}
}
LocalFree(szArgList);
// Hook setcursorpos
//DetourRestoreAfterWith();
//DetourTransactionBegin();
//DetourUpdateThread(GetCurrentThread());
//DetourAttach(&(PVOID&)TrueSetCursorPos, OverrideSetCursorPos);
////DetourAttach(&(PVOID&)TrueLoadLibraryA, OverrideLoadLibraryA);
//error = DetourTransactionCommit();
//if (error == NO_ERROR) {
// debugMessage(2, "DllMain(DLL_PROCESS_ATTACH)", "Successfully detoured SetCursorPos");
//}
//else {
// debugMessage(1, "DllMain(DLL_PROCESS_ATTACH)", "Failed to detour SetCursorPos");
//}
break;
case DLL_THREAD_ATTACH:
// Do nothing on thread attach
break;
case DLL_THREAD_DETACH:
// Do nothing on thread detach
break;
case DLL_PROCESS_DETACH:
// Delete DirectDrawWrapper object
delete lpDD;
// Detach function hook
//DetourTransactionBegin();
//DetourUpdateThread(GetCurrentThread());
//DetourDetach(&(PVOID&)TrueSetCursorPos, OverrideSetCursorPos);
//error = DetourTransactionCommit();
//cleanup debug console or file if exists
if(debugDisplay == 0)
{
FreeConsole();
}
else if(debugDisplay == 1)
{
fclose(debugFile);
}
break;
}
return TRUE;
}
// Emulated direct draw create
extern HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter)
{
// Create directdraw object
lpDD = new IDirectDrawWrapper();
if(lpDD == NULL)
{
debugMessage(0, "DirectDrawCreate", "Failed to create IDirectDrawWrapper.");
return DDERR_OUTOFMEMORY; // Simulate OOM error
}
// Initialize the ddraw object with new wndproc
HRESULT hr = lpDD->WrapperInitialize(&WndProc, hMod);
// If error then return error(message will have been taken care of already)
if(hr != DD_OK) return hr;
// Set return pointer to the newly created DirectDrawWrapper interface
*lplpDD = (LPDIRECTDRAW)lpDD;
// Return success
return DD_OK;
}
+38
View File
@@ -0,0 +1,38 @@
#include "resource.h"
#include <windows.h>
SPRITEDATA RCDATA diablo_sprites.png
VS_VERSION_INFO VERSIONINFO
//FILEVERSION 1,0,0,0
//PRODUCTVERSION 1,0,0,0
FILEVERSION 6,1,7600,16385
PRODUCTVERSION 6,1,7600,16385
FILEFLAGSMASK VS_FF_PRERELEASE
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US,Unicode CP */
BEGIN
VALUE "CompanyName", "StrangeBytes.com"
VALUE "FileDescription", "Microsoft DirectDraw"
//VALUE "FileVersion", "1.0B\0"
VALUE "FileVersion", "6.1.7600.16385"
VALUE "InternalName", "ddrawwrapper"
//VALUE "OriginalFilename", "ddraw.dll"
VALUE "OriginalFilename", "DDraw.dll"
VALUE "ProductName", "DiabloDirectDrawPatch"
VALUE "LegalCopyright", "StrangeBytes.com"
//VALUE "ProductVersion", "1.0B\0"
VALUE "ProductVersion", "6.1.7600.16385"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x04B0
END
END
END
+121
View File
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{99418D1A-5BE9-4905-9002-B66A5979640B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>ddrawwrapper</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>ddraw</TargetName>
<IncludePath>$(DXSDK_DIR)\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)\Lib\$(PlatformShortName)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>ddraw</TargetName>
<IncludePath>$(DXSDK_DIR)\Include\;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)\Lib\$(PlatformShortName)\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;DDRAWWRAPPER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<AdditionalIncludeDirectories>D:\projects\RedAlert\code\dxsdk\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>D:\projects\RedAlert\ddraw.dll</OutputFile>
<AdditionalLibraryDirectories>D:\projects\RedAlert\code\dxsdk\Lib\x86</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;DDRAWWRAPPER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>D:\projects\RedAlert\code\dxsdk\Include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>kernel32.lib;user32.lib;d3d9.lib;d3dx9.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>D:\projects\RedAlert\ddraw.dll</OutputFile>
<AdditionalLibraryDirectories>D:\projects\RedAlert\code\dxsdk\Lib\x86</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ddraw.cpp" />
<ClCompile Include="DirectDrawClipperWrapper.cpp" />
<ClCompile Include="DirectDrawPaletteWrapper.cpp" />
<ClCompile Include="DirectDrawSurfaceWrapper.cpp" />
<ClCompile Include="DirectDrawWrapper.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="ddraw.h" />
<ClInclude Include="DirectDrawWrapper.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ddraw.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ddraw.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DirectDrawWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DirectDrawSurfaceWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DirectDrawPaletteWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DirectDrawClipperWrapper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DirectDrawWrapper.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ddraw.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ddraw.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

+1
View File
@@ -0,0 +1 @@
#define SPRITEDATA 300