Esempio n. 1
0
extern "C" HRESULT WINAPI DirectDrawCreate(
    _In_   GUID FAR *lpGUID,
    _Out_  LPDIRECTDRAW FAR *lplpDD,
    _In_   IUnknown FAR *pUnkOuter
)
{
    //static decltype(DirectDrawCreate)* ddraw_proc = (decltype(DirectDrawCreate)*)GetProcAddress(ddraw._module, "DirectDrawCreate");
    //return ddraw_proc(lpGUID, lplpDD, pUnkOuter);

#if LOGGER
    std::ostringstream str;
    str << __FUNCTION__;
    str << " " << (lpGUID == nullptr ? "NULL" : tostr_IID(*lpGUID));
    LogText(str.str());
#endif

    if (lplpDD == nullptr)
    {
#if LOGGER
        str.str("\tDDERR_INVALIDPARAMS");
        LogText(str.str());
#endif

        return DDERR_INVALIDPARAMS;
    }

    DeviceResources* deviceResources = new DeviceResources();

    if (FAILED(deviceResources->Initialize()))
    {
        delete deviceResources;

#if LOGGER
        str.str("\tDDERR_NODIRECTDRAWHW");
        LogText(str.str());
#endif

        return DDERR_NODIRECTDRAWHW;
    }

    *lplpDD = new DirectDraw(deviceResources);

#if LOGGER
    str.str("");
    str << "\tDD_OK\t" << *lplpDD;
    LogText(str.str());
#endif

    return DD_OK;
}
Esempio n. 2
0
extern "C" HRESULT WINAPI DirectDrawCreateEx(
    _In_   GUID FAR *lpGUID,
    _Out_  LPVOID *lplpDD,
    _In_   REFIID iid,
    _In_   IUnknown FAR *pUnkOuter
)
{
    static decltype(DirectDrawCreateEx)* ddraw_proc = (decltype(DirectDrawCreateEx)*)GetProcAddress(ddraw._module, "DirectDrawCreateEx");

#if LOGGER
    std::ostringstream str;
    str << __FUNCTION__;
    str << " " << (lpGUID == nullptr ? "NULL" : tostr_IID(*lpGUID));
    LogText(str.str());
#endif

    return ddraw_proc(lpGUID, lplpDD, iid, pUnkOuter);
}
Esempio n. 3
0
HRESULT MipmapSurface::QueryInterface(
	REFIID riid,
	LPVOID* obp
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	str << " " << tostr_IID(riid);
	LogText(str.str());
#endif

#if LOGGER
	str.str("\tE_NOINTERFACE");
	LogText(str.str());
#endif

	return E_NOINTERFACE;
}
HRESULT TextureSurface::QueryInterface(
	REFIID riid,
	LPVOID* obp
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	if (riid == IID_IDirect3DTexture)
	{
		str << " IDirect3DTexture";
	}
	else
	{
		str << " " << tostr_IID(riid);
	}

	LogText(str.str());
#endif

	if (riid == IID_IDirect3DTexture)
	{
		*obp = this->_d3dTexture;
		this->_d3dTexture->AddRef();

#if LOGGER
		str.str("");
		str << "\tDirect3DTexture\t" << *obp;
		LogText(str.str());
#endif

		return S_OK;
	}

#if LOGGER
	str.str("\tE_NOINTERFACE");
	LogText(str.str());
#endif

	return E_NOINTERFACE;
}
HRESULT BackbufferSurface::QueryInterface(
	REFIID riid,
	LPVOID* obp
	)
{
#if LOGGER
	std::ostringstream str;
	str << this << " " << __FUNCTION__;

	if (riid == IID_IDirect3DHALDevice)
	{
		str << " IDirect3DHALDevice";
	}
	else
	{
		str << " " << tostr_IID(riid);
	}

	LogText(str.str());
#endif

	if (riid == IID_IDirect3DHALDevice)
	{
		*obp = new Direct3DDevice(this->_deviceResources);

#if LOGGER
		str.str("");
		str << "\tDirect3DDevice\t" << *obp;
		LogText(str.str());
#endif

		return S_OK;
	}

#if LOGGER
	str.str("\tE_NOINTERFACE");
	LogText(str.str());
#endif

	return E_NOINTERFACE;
}
HRESULT Direct3DExecuteBuffer::QueryInterface(
	REFIID riid,
	LPVOID* obp
	)
{
	std::ostringstream str;
	str << this << " " << __FUNCTION__;
	str << " " << tostr_IID(riid);

	LogText(str.str());

	*obp = nullptr;

	HRESULT hr = this->_original->QueryInterface(riid, obp);

	if (SUCCEEDED(hr))
	{
	}

	return hr;
}