rodecomp/Source/Render/DX9/D3DX9Runtime.cpp
ragnarok-clanker a47d20f8be Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
2026-10-25 07:42:41 +00:00

25 lines
1.3 KiB
C++

#include "Render/DX9/D3DX9Runtime.h"
#include <system_error>
D3DX9Runtime::D3DX9Runtime() : m_module(LoadLibraryA("D3DX9_43.dll")) {
if (!this->m_module) {
throw std::system_error(GetLastError(), std::system_category(), "D3DX9_43.dll");
}
this->filterTexture = reinterpret_cast<decltype(this->filterTexture)>(GetProcAddress(this->m_module, "D3DXFilterTexture"));
this->loadSurfaceFromMemory = reinterpret_cast<decltype(this->loadSurfaceFromMemory)>(GetProcAddress(this->m_module, "D3DXLoadSurfaceFromMemory"));
this->loadSurfaceFromSurface = reinterpret_cast<decltype(this->loadSurfaceFromSurface)>(GetProcAddress(this->m_module, "D3DXLoadSurfaceFromSurface"));
this->perspectiveFovLH = reinterpret_cast<decltype(this->perspectiveFovLH)>(GetProcAddress(this->m_module, "D3DXMatrixPerspectiveFovLH"));
this->saveSurfaceToFileA = reinterpret_cast<decltype(this->saveSurfaceToFileA)>(GetProcAddress(this->m_module, "D3DXSaveSurfaceToFileA"));
if (!this->filterTexture || !this->loadSurfaceFromMemory || !this->loadSurfaceFromSurface || !this->perspectiveFovLH || !this->saveSurfaceToFileA) {
FreeLibrary(this->m_module);
throw std::system_error(ERROR_PROC_NOT_FOUND, std::system_category(), "D3DX9_43 exports");
}
}
D3DX9Runtime::~D3DX9Runtime() {
FreeLibrary(this->m_module);
}