1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Merge branch 'ticket/30'

closes #30
This commit is contained in:
rarified
2021-12-03 15:12:44 -07:00
14 changed files with 88 additions and 1840 deletions

View File

@ -54,6 +54,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsConfig.h"
#include "hsWindows.h"
#include <functional>
#include <memory>
#include <ddraw.h>
#include <d3d9.h>
@ -61,7 +64,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsDXTDirectXCodec.h"
#include "plMipmap.h"
#include "hsCodecManager.h"
#include "../plPipeline/hsGDDrawDllLoad.h"
namespace {
typedef HRESULT(WINAPI * DIRECTDRAWCREATEEX)( GUID*, VOID**, REFIID, IUnknown* );
@ -138,26 +140,20 @@ hsBool hsDXTDirectXCodec::IInitialize()
{
fFlags |= kInitialized;
// if( hsGDDrawDllLoad::GetDDrawDll() == nil )
// return false;
DIRECTDRAWCREATEEX DirectDrawCreateEx = 0;
DIRECTDRAWCREATEEX DirectDrawCreateEx = nil;
// Initialize DirectDraw
HRESULT hr;
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress( hsGDDrawDllLoad::GetD3DDll(), "DirectDrawCreateEx" );
if( DirectDrawCreateEx == nil )
std::unique_ptr<HINSTANCE__, std::function<BOOL(HMODULE)>> ddraw(LoadLibraryA("ddraw.dll"), FreeLibrary);
DirectDrawCreateEx = (DIRECTDRAWCREATEEX)GetProcAddress(ddraw.get(), "DirectDrawCreateEx");
if (!DirectDrawCreateEx)
return false;
/// Using EMULATIONONLY here usually fails--using NULL forces the
/// use of the standard display driver, which DOES work.
if (FAILED(hr = DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
if (FAILED(DirectDrawCreateEx((GUID FAR *)NULL/*DDCREATE_EMULATIONONLY*/, (VOID**)&fDirectDraw, IID_IDirectDraw7, NULL)))
return false;
if (FAILED(hr = fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL)))
return false;
return true;
return SUCCEEDED(fDirectDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL));
}
//// CreateCompressedMipmap ///////////////////////////////////////////////////