TRX/lib/ddraw/DllMain.cpp

37 lines
742 B
C++
Raw Normal View History

2021-11-12 20:03:04 +01:00
#include "DirectDraw.hpp"
#include <glrage/GLRage.hpp>
#include <glrage_util/ErrorUtils.hpp>
#include <glrage_util/Logger.hpp>
#include <string>
namespace glrage {
namespace ddraw {
2021-11-14 23:42:18 +01:00
extern "C" {
HRESULT __declspec(dllexport) WINAPI DirectDrawCreate(
2021-11-12 20:03:04 +01:00
GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnknown FAR* pUnkOuter)
{
LOG_TRACE("%p, %p, %p", lpGUID, lplpDD, pUnkOuter);
Context& context = GLRage::getContext();
context.init();
context.attach();
ErrorUtils::setHWnd(context.getHWnd());
try {
*lplpDD = new DirectDraw();
} catch (const std::exception& ex) {
ErrorUtils::warning(ex);
return DDERR_GENERIC;
}
return DD_OK;
}
2021-11-14 23:42:18 +01:00
}
2021-11-12 20:03:04 +01:00
} // namespace ddraw
2021-11-14 23:42:18 +01:00
} // namespace glrage