mirror of
https://github.com/gwdevhub/gMod.git
synced 2026-07-18 00:19:32 +00:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user