* remove d3dx9.dll dependency (still requires dx legacy sdk for development, but not for end users)

* fix

* Fix to allow gMod to be loaded as "d3d9.dll"
Don't check for d3d9 functions when checking dll's, its not that deep.
Fix to allow gMod to load "d3d9.dll" using the default method rather than defaulting to system directory

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

* fix jons commit

* 1.5.7

* create warning message

* pass correct pointer type, shouldn't matter but lets see

* use Warning instead of Message for failed actions

* need to use d3dpool_managed...

* use specialised methods

* actually do something in the Direct3DCreate9Ex method?

* spaces

* test loading WIC textures with modified WICTextureLoader9.cpp

* include

* Hook into GetProcAddress instead of d3d9 dll

* extern "C" the Direct3DCreate9/Ex functions

* turn on debug messages

* add back in creating of our replacement textures, woopsies

* add messages back in, not loading yet, debug later

* remove SingleTexture stuff

* dont rely on d3dx anymore :)

* Tidied up assertion error box
Added logic to use gmod as d3d9.dll or gmod.dll
Added check to avoid recursive calls to create d3d9

* Remove unused func
This commit is contained in:
DubbleClick
2023-11-30 16:57:09 +01:00
committed by GitHub
parent a1cadde802
commit ae2c93fc32
15 changed files with 272 additions and 450 deletions
+7 -41
View File
@@ -37,24 +37,18 @@ int TextureClient::MergeUpdate()
Message("MergeUpdate(): %p\n", this);
const auto single_texture = GetSingleTexture();
for (const auto pTexture : OriginalTextures) {
if (pTexture->CrossRef_D3Dtex == nullptr || pTexture->CrossRef_D3Dtex == single_texture) {
UnswitchTextures(pTexture); //this we can do always, so we unswitch the single texture
if (pTexture->CrossRef_D3Dtex == nullptr) {
LookUpToMod(pTexture);
}
}
const auto single_volume_texture = GetSingleVolumeTexture();
for (const auto pTexture : OriginalVolumeTextures) {
if (pTexture->CrossRef_D3Dtex == nullptr || pTexture->CrossRef_D3Dtex == single_volume_texture) {
UnswitchTextures(pTexture); //this we can do always, so we unswitch the single texture
if (pTexture->CrossRef_D3Dtex == nullptr) {
LookUpToMod(pTexture);
}
}
const auto single_cube_texture = GetSingleCubeTexture();
for (const auto pTexture : OriginalCubeTextures) {
if (pTexture->CrossRef_D3Dtex == nullptr || pTexture->CrossRef_D3Dtex == single_cube_texture) {
UnswitchTextures(pTexture); //this we can do always, so we unswitch the single texture
if (pTexture->CrossRef_D3Dtex == nullptr) {
LookUpToMod(pTexture);
}
}
@@ -62,55 +56,27 @@ int TextureClient::MergeUpdate()
return UnlockMutex();
}
uMod_IDirect3DTexture9* TextureClient::GetSingleTexture()
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->GetSingleTexture();
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->GetSingleTexture();
}
uMod_IDirect3DVolumeTexture9* TextureClient::GetSingleVolumeTexture()
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->GetSingleVolumeTexture();
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->GetSingleVolumeTexture();
}
uMod_IDirect3DCubeTexture9* TextureClient::GetSingleCubeTexture()
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->GetSingleCubeTexture();
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->GetSingleCubeTexture();
}
int TextureClient::SetLastCreatedTexture(uMod_IDirect3DTexture9* texture)
void TextureClient::SetLastCreatedTexture(uMod_IDirect3DTexture9* texture)
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->SetLastCreatedTexture(texture);
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->SetLastCreatedTexture(texture);
}
int TextureClient::SetLastCreatedVolumeTexture(uMod_IDirect3DVolumeTexture9* texture)
void TextureClient::SetLastCreatedVolumeTexture(uMod_IDirect3DVolumeTexture9* texture)
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->SetLastCreatedVolumeTexture(texture);
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->SetLastCreatedVolumeTexture(texture);
}
int TextureClient::SetLastCreatedCubeTexture(uMod_IDirect3DCubeTexture9* texture)
void TextureClient::SetLastCreatedCubeTexture(uMod_IDirect3DCubeTexture9* texture)
{
if (isDirectXExDevice)
return static_cast<uMod_IDirect3DDevice9Ex*>(D3D9Device)->SetLastCreatedCubeTexture(texture);
//this texture must no be added twice
return static_cast<uMod_IDirect3DDevice9*>(D3D9Device)->SetLastCreatedCubeTexture(texture);
}
int TextureClient::LockMutex()
{
if ((gl_ErrorState & (uMod_ERROR_FATAL | uMod_ERROR_MUTEX))) {
@@ -151,7 +117,7 @@ void TextureClient::LoadModsFromFile(const char* source)
std::ifstream file(source);
if (!file.is_open()) {
Message("LoadModsFromFile: failed to open modlist.txt for reading; aborting!!!");
Warning("LoadModsFromFile: failed to open modlist.txt for reading; aborting!!!");
return;
}
Message("Initialize: found modlist.txt. Reading\n");