Don't use AntiHooking.dll or use D3DX9 on ARM64

This commit is contained in:
Cameron Gutman 2020-12-12 13:59:47 -06:00
parent 1231f3eeb1
commit 59a73817c8
6 changed files with 50 additions and 21 deletions

View file

@ -33,17 +33,22 @@ DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
win32 {
INCLUDEPATH += \
$$PWD/../libs/windows/include \
$$(DXSDK_DIR)/Include
INCLUDEPATH += $$PWD/../libs/windows/include
contains(QT_ARCH, i386) {
INCLUDEPATH += $$(DXSDK_DIR)/Include
LIBS += -L$$PWD/../libs/windows/lib/x86
LIBS += -L$$(DXSDK_DIR)/Lib/x86
LIBS += -L$$(DXSDK_DIR)/Lib/x86 -ld3dx9
DEFINES += HAS_D3DX9
}
contains(QT_ARCH, x86_64) {
INCLUDEPATH += $$(DXSDK_DIR)/Include
LIBS += -L$$PWD/../libs/windows/lib/x64
LIBS += -L$$(DXSDK_DIR)/Lib/x64
LIBS += -L$$(DXSDK_DIR)/Lib/x64 -ld3dx9
DEFINES += HAS_D3DX9
}
contains(QT_ARCH, arm64) {
LIBS += -L$$PWD/../libs/windows/lib/arm64
}
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib qwave.lib
@ -102,7 +107,7 @@ unix:!macx {
}
}
win32 {
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ld3dx9
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus
CONFIG += ffmpeg
}
win32:!winrt {
@ -353,11 +358,13 @@ INCLUDEPATH += $$PWD/../h264bitstream/h264bitstream
DEPENDPATH += $$PWD/../h264bitstream/h264bitstream
!winrt {
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/release/ -lAntiHooking
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/debug/ -lAntiHooking
contains(QT_ARCH, i386)|contains(QT_ARCH, x86_64) {
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/release/ -lAntiHooking
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../AntiHooking/debug/ -lAntiHooking
INCLUDEPATH += $$PWD/../AntiHooking
DEPENDPATH += $$PWD/../AntiHooking
INCLUDEPATH += $$PWD/../AntiHooking
DEPENDPATH += $$PWD/../AntiHooking
}
}
unix:!macx: {

View file

@ -289,9 +289,10 @@ int main(int argc, char *argv[])
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
#endif
#if defined(Q_OS_WIN32)
#if defined(Q_OS_WIN32) && defined(Q_PROCESSOR_X86)
// Force AntiHooking.dll to be statically imported and loaded
// by ntdll by calling a dummy function.
// by ntdll on x86/x64 platforms by calling a dummy function.
// AntiHooking.dll is not currently built for ARM64.
AntiHookingDummyImport();
#elif defined(Q_OS_LINUX)
// Force libssl.so to be directly linked to our binary, so

View file

@ -31,8 +31,10 @@ DXVA2Renderer::DXVA2Renderer() :
m_ProcService(nullptr),
m_Processor(nullptr),
m_FrameIndex(0),
#ifdef HAS_D3DX9
m_DebugOverlayFont(nullptr),
m_StatusOverlayFont(nullptr),
#endif
m_BlockingPresent(false)
{
RtlZeroMemory(m_DecSurfaces, sizeof(m_DecSurfaces));
@ -52,8 +54,11 @@ DXVA2Renderer::~DXVA2Renderer()
SAFE_COM_RELEASE(m_RenderTarget);
SAFE_COM_RELEASE(m_ProcService);
SAFE_COM_RELEASE(m_Processor);
#ifdef HAS_D3DX9
SAFE_COM_RELEASE(m_DebugOverlayFont);
SAFE_COM_RELEASE(m_StatusOverlayFont);
#endif
for (int i = 0; i < ARRAYSIZE(m_DecSurfaces); i++) {
SAFE_COM_RELEASE(m_DecSurfaces[i]);
@ -744,6 +749,7 @@ bool DXVA2Renderer::initialize(PDECODER_PARAMETERS params)
void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
{
#ifdef HAS_D3DX9
HRESULT hr;
switch (type)
@ -798,6 +804,9 @@ void DXVA2Renderer::notifyOverlayUpdated(Overlay::OverlayType type)
SDL_assert(false);
break;
}
#else
Q_UNUSED(type);
#endif
}
int DXVA2Renderer::getDecoderColorspace()
@ -1002,6 +1011,7 @@ void DXVA2Renderer::renderFrame(AVFrame *frame)
}
}
#ifdef HAS_D3DX9
if (m_DebugOverlayFont != nullptr) {
if (Session::get()->getOverlayManager().isOverlayEnabled(Overlay::OverlayDebug)) {
SDL_Color color = Session::get()->getOverlayManager().getOverlayColor(Overlay::OverlayDebug);
@ -1025,6 +1035,7 @@ void DXVA2Renderer::renderFrame(AVFrame *frame)
D3DCOLOR_ARGB(color.a, color.r, color.g, color.b));
}
}
#endif
hr = m_Device->EndScene();
if (FAILED(hr)) {

View file

@ -4,9 +4,12 @@
#include "pacer/pacer.h"
#include <d3d9.h>
#include <d3dx9.h>
#include <dxva2api.h>
#ifdef HAS_D3DX9
#include <d3dx9.h>
#endif
extern "C" {
#include <libavcodec/dxva2.h>
}
@ -63,7 +66,9 @@ private:
DXVA2_ValueRange m_SaturationRange;
DXVA2_VideoDesc m_Desc;
REFERENCE_TIME m_FrameIndex;
#ifdef HAS_D3DX9
LPD3DXFONT m_DebugOverlayFont;
LPD3DXFONT m_StatusOverlayFont;
#endif
bool m_BlockingPresent;
};

View file

@ -8,8 +8,11 @@ SUBDIRS = \
# Build the dependencies in parallel before the final app
app.depends = qmdnsengine moonlight-common-c h264bitstream
win32:!winrt {
SUBDIRS += AntiHooking
app.depends += AntiHooking
contains(QT_ARCH, i386)|contains(QT_ARCH, x86_64) {
# We don't build AntiHooking.dll for ARM64 (yet?)
SUBDIRS += AntiHooking
app.depends += AntiHooking
}
}
!winrt:win32|macx {
SUBDIRS += soundio

View file

@ -136,13 +136,15 @@ echo Copying DLL dependencies
copy %SOURCE_ROOT%\libs\windows\lib\%ARCH%\*.dll %DEPLOY_FOLDER%
if !ERRORLEVEL! NEQ 0 goto Error
echo Copying AntiHooking.dll
copy %BUILD_FOLDER%\AntiHooking\%BUILD_CONFIG%\AntiHooking.dll %DEPLOY_FOLDER%
if !ERRORLEVEL! NEQ 0 goto Error
if /I "%ARCH%" NEQ "ARM64" (
echo Copying AntiHooking.dll
copy %BUILD_FOLDER%\AntiHooking\%BUILD_CONFIG%\AntiHooking.dll %DEPLOY_FOLDER%
if !ERRORLEVEL! NEQ 0 goto Error
echo Copying d3dx9_43.dll from DirectX SDK
expand "%DXSDK_DIR%\Redist\Jun2010_d3dx9_43_%ARCH%.cab" -F:d3dx9_43.dll %DEPLOY_FOLDER%
if !ERRORLEVEL! NEQ 0 goto Error
echo Copying d3dx9_43.dll from DirectX SDK
expand "%DXSDK_DIR%\Redist\Jun2010_d3dx9_43_%ARCH%.cab" -F:d3dx9_43.dll %DEPLOY_FOLDER%
if !ERRORLEVEL! NEQ 0 goto Error
)
echo Copying GC mapping list
copy %SOURCE_ROOT%\app\SDL_GameControllerDB\gamecontrollerdb.txt %DEPLOY_FOLDER%