diff --git a/src/d2dx/Detours.cpp b/src/d2dx/Detours.cpp index 48ea289..d153778 100644 --- a/src/d2dx/Detours.cpp +++ b/src/d2dx/Detours.cpp @@ -747,7 +747,7 @@ void d2dx::AttachDetours() _Use_decl_annotations_ void d2dx::AttachLateDetours( IGameHelper* gameHelper, - IFeatureFlags* supportFeature) + ID2DXContext* d2dxContext) { if (hasLateDetoured) { @@ -793,7 +793,7 @@ void d2dx::AttachLateDetours( DetourAttach(&(PVOID&)D2Win_DrawText_Real, D2Win_DrawText_Hooked); //DetourAttach(&(PVOID&)D2Win_DrawTextEx_Real, D2Win_DrawTextEx_Hooked); - if (supportFeature->IsFeatureEnabled(Feature::TextMotionPrediction)) + if (d2dxContext->IsFeatureEnabled(Feature::TextMotionPrediction)) { assert(D2Win_DrawFramedText_Real); DetourAttach(&(PVOID&)D2Win_DrawFramedText_Real, D2Win_DrawFramedText_Hooked); @@ -802,19 +802,19 @@ void d2dx::AttachLateDetours( DetourAttach(&(PVOID&)D2Win_DrawRectangledText_Real, D2Win_DrawRectangledText_Hooked); } - if (supportFeature->IsFeatureEnabled(Feature::UnitMotionPrediction)) + if (d2dxContext->IsFeatureEnabled(Feature::UnitMotionPrediction)) { assert(D2Client_DrawUnit_Real); DetourAttach(&(PVOID&)D2Client_DrawUnit_Real, (gameHelper->GetVersion() == GameVersion::Lod109d || - gameHelper->GetVersion() == GameVersion::Lod110 || - gameHelper->GetVersion() == GameVersion::Lod114d) ? D2Client_DrawUnit_ESI_Hooked : D2Client_DrawUnit_Stack_Hooked); + gameHelper->GetVersion() == GameVersion::Lod110 || + gameHelper->GetVersion() == GameVersion::Lod114d) ? D2Client_DrawUnit_ESI_Hooked : D2Client_DrawUnit_Stack_Hooked); assert(D2Client_DrawMissile_Real); DetourAttach(&(PVOID&)D2Client_DrawMissile_Real, D2Client_DrawMissile_ESI_Hooked); } - if (supportFeature->IsFeatureEnabled(Feature::WeatherMotionPrediction)) + if (d2dxContext->IsFeatureEnabled(Feature::WeatherMotionPrediction)) { assert(D2Client_DrawWeatherParticles_Real); DetourAttach(&(PVOID&)D2Client_DrawWeatherParticles_Real, @@ -830,7 +830,7 @@ void d2dx::AttachLateDetours( } void d2dx::DetachDetours() -{ +{ if (!hasDetoured) { return; diff --git a/src/d2dx/Detours.h b/src/d2dx/Detours.h index d659ed2..193177c 100644 --- a/src/d2dx/Detours.h +++ b/src/d2dx/Detours.h @@ -21,13 +21,13 @@ namespace d2dx { struct IGameHelper; - struct IFeatureFlags; - + struct ID2DXContext; + void AttachDetours(); void AttachLateDetours( _In_ IGameHelper* gameHelper, - _In_ IFeatureFlags* supportFeature); + _In_ ID2DXContext* d2dxContext); void DetachDetours(); } diff --git a/src/d2dx/ID2DXContext.h b/src/d2dx/ID2DXContext.h index 4170709..113e3f1 100644 --- a/src/d2dx/ID2DXContext.h +++ b/src/d2dx/ID2DXContext.h @@ -21,16 +21,21 @@ #include "IGlide3x.h" #include "IWin32InterceptionHandler.h" #include "ID2InterceptionHandler.h" -#include "IFeatureFlags.h" #include "Options.h" namespace d2dx { + enum class Feature + { + UnitMotionPrediction = 1, + WeatherMotionPrediction = 2, + TextMotionPrediction = 4, + }; + struct ID2DXContext abstract : public IGlide3x, public IWin32InterceptionHandler, - public ID2InterceptionHandler, - public IFeatureFlags + public ID2InterceptionHandler { virtual ~ID2DXContext() noexcept {} @@ -44,5 +49,8 @@ namespace d2dx virtual void DisableBuiltinResMod() = 0; virtual Options& GetOptions() = 0; + + virtual bool IsFeatureEnabled( + _In_ Feature feature) = 0; }; } diff --git a/src/d2dx/IFeatureFlags.h b/src/d2dx/IFeatureFlags.h deleted file mode 100644 index ec2df1e..0000000 --- a/src/d2dx/IFeatureFlags.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - This file is part of D2DX. - - Copyright (C) 2021 Bolrog - - D2DX is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - D2DX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with D2DX. If not, see . -*/ -#pragma once - -namespace d2dx -{ - enum class Feature - { - UnitMotionPrediction = 1, - WeatherMotionPrediction = 2, - TextMotionPrediction = 4, - }; - - struct IFeatureFlags abstract - { - virtual bool IsFeatureEnabled( - _In_ Feature feature) = 0; - }; -} diff --git a/src/d2dx/d2dx.vcxproj b/src/d2dx/d2dx.vcxproj index 1bfa173..003d97f 100644 --- a/src/d2dx/d2dx.vcxproj +++ b/src/d2dx/d2dx.vcxproj @@ -146,7 +146,6 @@ - diff --git a/src/d2dx/d2dx.vcxproj.filters b/src/d2dx/d2dx.vcxproj.filters index 9b77a56..52f7655 100644 --- a/src/d2dx/d2dx.vcxproj.filters +++ b/src/d2dx/d2dx.vcxproj.filters @@ -143,7 +143,6 @@ thirdparty\pocketlzma -