From 4b02a40bc9c94f4706c11366e7f1920e28590d4f Mon Sep 17 00:00:00 2001 From: narzoul Date: Sat, 27 May 2017 22:14:48 +0200 Subject: [PATCH] Hooked the IDirectDrawGammaControl interface --- DDrawCompat/Common/CompatQueryInterface.h | 1 + DDrawCompat/DDraw/DirectDrawGammaControl.cpp | 8 ++++++++ DDrawCompat/DDraw/DirectDrawGammaControl.h | 15 +++++++++++++++ DDrawCompat/DDraw/Hooks.cpp | 7 ++++++- .../Visitors/DirectDrawGammaControlVtblVisitor.h | 16 ++++++++++++++++ DDrawCompat/DDrawCompat.vcxproj | 3 +++ DDrawCompat/DDrawCompat.vcxproj.filters | 9 +++++++++ 7 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 DDrawCompat/DDraw/DirectDrawGammaControl.cpp create mode 100644 DDrawCompat/DDraw/DirectDrawGammaControl.h create mode 100644 DDrawCompat/DDraw/Visitors/DirectDrawGammaControlVtblVisitor.h diff --git a/DDrawCompat/Common/CompatQueryInterface.h b/DDrawCompat/Common/CompatQueryInterface.h index 8483241..9398082 100644 --- a/DDrawCompat/Common/CompatQueryInterface.h +++ b/DDrawCompat/Common/CompatQueryInterface.h @@ -40,6 +40,7 @@ namespace Compat DEFINE_BASE_INTF(IDirectDrawSurface3, IDirectDrawSurface); DEFINE_BASE_INTF(IDirectDrawSurface4, IDirectDrawSurface); DEFINE_BASE_INTF(IDirectDrawSurface7, IDirectDrawSurface); + DEFINE_BASE_INTF(IDirectDrawGammaControl, IDirectDrawSurface); DEFINE_BASE_INTF(IDirect3D, IDirectDraw); DEFINE_BASE_INTF(IDirect3D2, IDirectDraw); diff --git a/DDrawCompat/DDraw/DirectDrawGammaControl.cpp b/DDrawCompat/DDraw/DirectDrawGammaControl.cpp new file mode 100644 index 0000000..09f8762 --- /dev/null +++ b/DDrawCompat/DDraw/DirectDrawGammaControl.cpp @@ -0,0 +1,8 @@ +#include "DDraw/DirectDrawGammaControl.h" + +namespace DDraw +{ + void DirectDrawGammaControl::setCompatVtable(IDirectDrawGammaControlVtbl& /*vtable*/) + { + } +} diff --git a/DDrawCompat/DDraw/DirectDrawGammaControl.h b/DDrawCompat/DDraw/DirectDrawGammaControl.h new file mode 100644 index 0000000..aa53078 --- /dev/null +++ b/DDrawCompat/DDraw/DirectDrawGammaControl.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Common/CompatVtable.h" +#include "DDraw/Visitors/DirectDrawGammaControlVtblVisitor.h" + +namespace DDraw +{ + class DirectDrawGammaControl : public CompatVtable + { + public: + static void setCompatVtable(IDirectDrawGammaControlVtbl& vtable); + }; +} + +SET_COMPAT_VTABLE(IDirectDrawGammaControlVtbl, DDraw::DirectDrawGammaControl); diff --git a/DDrawCompat/DDraw/Hooks.cpp b/DDrawCompat/DDraw/Hooks.cpp index a9a4515..b21a36b 100644 --- a/DDrawCompat/DDraw/Hooks.cpp +++ b/DDrawCompat/DDraw/Hooks.cpp @@ -8,6 +8,7 @@ #include "DDraw/ActivateAppHandler.h" #include "DDraw/DirectDraw.h" #include "DDraw/DirectDrawClipper.h" +#include "DDraw/DirectDrawGammaControl.h" #include "DDraw/DirectDrawPalette.h" #include "DDraw/DirectDrawSurface.h" #include "DDraw/Hooks.h" @@ -81,6 +82,7 @@ namespace hookVtable(surface); hookVtable(surface); hookVtable(surface); + hookVtable(surface); } else { @@ -91,7 +93,10 @@ namespace template void hookVtable(const CompatPtr& intf) { - CompatVtable>::hookVtable(intf.get()->lpVtbl); + if (intf) + { + CompatVtable>::hookVtable(intf.get()->lpVtbl); + } } } diff --git a/DDrawCompat/DDraw/Visitors/DirectDrawGammaControlVtblVisitor.h b/DDrawCompat/DDraw/Visitors/DirectDrawGammaControlVtblVisitor.h new file mode 100644 index 0000000..32f8c46 --- /dev/null +++ b/DDrawCompat/DDraw/Visitors/DirectDrawGammaControlVtblVisitor.h @@ -0,0 +1,16 @@ +#pragma once + +#include "Common/VtableVisitor.h" + +template <> +struct VtableForEach +{ + template + static void forEach(Visitor& visitor) + { + VtableForEach::forEach(visitor); + + DD_VISIT(GetGammaRamp); + DD_VISIT(SetGammaRamp); + } +}; diff --git a/DDrawCompat/DDrawCompat.vcxproj b/DDrawCompat/DDrawCompat.vcxproj index aa04093..277984c 100644 --- a/DDrawCompat/DDrawCompat.vcxproj +++ b/DDrawCompat/DDrawCompat.vcxproj @@ -183,6 +183,7 @@ + @@ -197,6 +198,7 @@ + @@ -248,6 +250,7 @@ + diff --git a/DDrawCompat/DDrawCompat.vcxproj.filters b/DDrawCompat/DDrawCompat.vcxproj.filters index 2f2d03b..5ce1577 100644 --- a/DDrawCompat/DDrawCompat.vcxproj.filters +++ b/DDrawCompat/DDrawCompat.vcxproj.filters @@ -306,6 +306,12 @@ Header Files\Win32 + + Header Files\DDraw\Visitors + + + Header Files\DDraw + @@ -467,6 +473,9 @@ Source Files\Win32 + + Source Files\DDraw +