work with reshade (#15)

* use directxtex for dds textures

* use d3dx sdk for wic texture loading until we figure out how to load volume/cube textures without it

* update d3d9 loading
This commit is contained in:
DubbleClick
2023-11-24 01:56:16 +01:00
committed by GitHub
parent 514aefa371
commit 69b06d94a2
13 changed files with 218 additions and 177 deletions
+7 -9
View File
@@ -11,17 +11,14 @@ TextureClient::TextureClient(IDirect3DDevice9* device)
void* cpy;
isDirectXExDevice = D3D9Device->QueryInterface(IID_IDirect3DTexture9, &cpy) == 0x01000001L;
Mutex = CreateMutex(nullptr, false, nullptr);
FontColour = D3DCOLOR_ARGB(255, 255, 0, 0);
TextureColour = D3DCOLOR_ARGB(255, 0, 255, 0);
mutex = CreateMutex(nullptr, false, nullptr);
}
TextureClient::~TextureClient()
{
Message("TextureClient::~TextureClient(): %p\n", this);
if (Mutex != nullptr) {
CloseHandle(Mutex);
if (mutex != nullptr) {
CloseHandle(mutex);
}
for (const auto& it : modded_textures) {
delete it.second;
@@ -119,7 +116,7 @@ int TextureClient::LockMutex()
if ((gl_ErrorState & (uMod_ERROR_FATAL | uMod_ERROR_MUTEX))) {
return RETURN_NO_MUTEX;
}
if (WAIT_OBJECT_0 != WaitForSingleObject(Mutex, 100)) {
if (WAIT_OBJECT_0 != WaitForSingleObject(mutex, 100)) {
return RETURN_MUTEX_LOCK; //waiting 100ms, to wait infinite pass INFINITE
}
return RETURN_OK;
@@ -127,13 +124,13 @@ int TextureClient::LockMutex()
int TextureClient::UnlockMutex()
{
if (ReleaseMutex(Mutex) == 0) {
if (ReleaseMutex(mutex) == 0) {
return RETURN_MUTEX_UNLOCK;
}
return RETURN_OK;
}
unsigned long TextureClient::AddFile(TpfEntry& entry)
unsigned long TextureClient::AddFile(TextureFileStruct& entry)
{
if (modded_textures.contains(entry.crc_hash)) {
return 0;
@@ -141,6 +138,7 @@ unsigned long TextureClient::AddFile(TpfEntry& entry)
TextureFileStruct* texture_file_struct = new TextureFileStruct();
texture_file_struct->data = std::move(entry.data);
texture_file_struct->crc_hash = entry.crc_hash;
texture_file_struct->is_wic_texture = entry.is_wic_texture;
modded_textures.emplace(entry.crc_hash, texture_file_struct);
should_update = true;
return texture_file_struct->data.size();