diff --git a/Source/Render/DX7/DeviceOwnerDX7.cpp b/Source/Render/DX7/DeviceOwnerDX7.cpp index 04717783f..a45d902a6 100644 --- a/Source/Render/DX7/DeviceOwnerDX7.cpp +++ b/Source/Render/DX7/DeviceOwnerDX7.cpp @@ -1,7 +1,10 @@ #include "Render/DX7/DeviceOwnerDX7.h" #include "Client/Application/ApplicationWindow.h" #include "Render/DX7/DirectDrawEnumeration.h" +#include "Render/DX7/RenderSystemDX7.h" +#include "Render/DX7/TextureAllocationDX7.h" #include "Render/Textures/Surface.h" +#include "UI/GameSettings/GameSettingsUI.h" #include @@ -550,15 +553,13 @@ bool DeviceOwnerDX7::SupportsTextureDimensions(std::uint32_t width, std::uint32_ // OFFSET: 0x0056B890 // FUNCTION: fn_02324 -void DeviceOwnerDX7::PrepareErrorDialog() { - if (this->direct3D) { - this->direct3D->EvictManagedTextures(); - } +void CRenderSystemDX7::RestoreDisplayMode() { + this->m_device->RestoreDisplayMode(); } -// OFFSET: 0x0056B8B0 -// FUNCTION: fn_02325 -void DeviceOwnerDX7::RestoreDisplayMode() { +// OFFSET: 0x0054AA10 +// FUNCTION: fn_45502 +void DeviceOwnerDX7::PrepareErrorDialog() { if (this->draw) { if (this->backBuffer) { this->backBuffer->Unlock(nullptr); @@ -572,18 +573,30 @@ void DeviceOwnerDX7::RestoreDisplayMode() { } } +// OFFSET: 0x0056B8B0 +// FUNCTION: fn_02325 +void CRenderSystemDX7::PrepareErrorDialog() { + this->m_device->PrepareErrorDialog(); +} + // OFFSET: 0x0056BB90 // FUNCTION: fn_02327 IDirect3D7* DeviceOwnerDX7::Direct3D() { return this->direct3D; } -// OFFSET: 0x0056C4B0 -// FUNCTION: fn_02336 +// OFFSET: 0x0054AF00 +// FUNCTION: fn_45503 HRESULT DeviceOwnerDX7::RestoreAllSurfaces() { return this->draw->RestoreAllSurfaces(); } +// OFFSET: 0x0056C4B0 +// FUNCTION: fn_02336 +HRESULT CRenderSystemDX7::TestDevice() { + return this->m_device->RestoreAllSurfaces(); +} + // OFFSET: 0x0054A8D0 // FUNCTION: fn_45420 void DeviceOwnerDX7::SetDialogClipper(int enabled) { @@ -604,3 +617,15 @@ void DeviceOwnerDX7::SetDialogClipper(int enabled) { clipper->Release(); } } + +// OFFSET: 0x0054A930 +// FUNCTION: fn_45501 +void DeviceOwnerDX7::UpdateMipmapFiltering() { + if (g_textureFiltering != 0 && (this->caps.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPLINEAR)) { + g_textureAllocationDX7.descriptorFlags = DDSD_MIPMAPCOUNT; + g_textureAllocationDX7.surfaceCaps = DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; + } else { + g_textureAllocationDX7.descriptorFlags = 0; + g_textureAllocationDX7.surfaceCaps = 0; + } +} diff --git a/Source/Render/DX7/DeviceOwnerDX7.h b/Source/Render/DX7/DeviceOwnerDX7.h index fedc9d27c..87fbbbed8 100644 --- a/Source/Render/DX7/DeviceOwnerDX7.h +++ b/Source/Render/DX7/DeviceOwnerDX7.h @@ -28,9 +28,15 @@ public: bool SupportsTextureDimensions(std::uint32_t width, std::uint32_t height) const; void CaptureBackBuffer(); void RestoreBackBuffer(); - void PrepareErrorDialog(); - void RestoreDisplayMode(); - HRESULT RestoreAllSurfaces(); + void UpdateMipmapFiltering(); + __declspec(noinline) void PrepareErrorDialog(); + // INLINED + void RestoreDisplayMode() { + if (this->direct3D) { + this->direct3D->EvictManagedTextures(); + } + } + __declspec(noinline) HRESULT RestoreAllSurfaces(); void SetDialogClipper(int enabled); bool CalibrateTextureCoordinates(); diff --git a/Source/Render/DX7/RenderSystemDX7.cpp b/Source/Render/DX7/RenderSystemDX7.cpp index dbd743820..9da93df68 100644 --- a/Source/Render/DX7/RenderSystemDX7.cpp +++ b/Source/Render/DX7/RenderSystemDX7.cpp @@ -96,10 +96,7 @@ void CRenderSystemDX7::DestroySurface(CSurface* surface) { // OFFSET: 0x0056B880 // FUNCTION: fn_02323 void CRenderSystemDX7::UpdateOption() { - if (this->m_device) { - const bool trilinear = (this->m_device->caps.dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEARMIPLINEAR) != 0; - (void)trilinear; - } + this->m_device->UpdateMipmapFiltering(); } // OFFSET: 0x0056BBA0