Compare commits
2 commits
master
...
no-dinput-
Author | SHA1 | Date | |
---|---|---|---|
|
59f8827ae4 | ||
|
a17b23a5f9 |
3 changed files with 59 additions and 5 deletions
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
|
@ -83,7 +83,8 @@ jobs:
|
|||
|
||||
cp "${{ steps.build-releasexp.outputs.releasexp }}" cnc-ddraw-releasexp
|
||||
|
||||
7z a -tzip -mm=Deflate -mfb=258 -mpass=15 "./cnc-ddraw-experimental/cnc-ddraw-experimental-release.zip" "./cnc-ddraw-releasexp/*"
|
||||
cp "${{ steps.build-releasexp.outputs.releasexp-pdb }}" cnc-ddraw-experimental
|
||||
7z a -tzip -mm=Deflate -mfb=258 -mpass=15 "./cnc-ddraw-experimental/cnc-ddraw-experimental-release.zip" "./cnc-ddraw-releasexp/ddraw.dll"
|
||||
fi
|
||||
|
||||
if [[ -f "${{ steps.build-debug.outputs.debug }}" ]]; then
|
||||
|
|
|
@ -46,10 +46,16 @@ outputs:
|
|||
release:
|
||||
description: 'Full path to ddraw.dll built with Release configuration'
|
||||
value: ${{ steps.build-release.outputs.ddraw-dll }}
|
||||
release-pdb:
|
||||
description: 'Full path to ddraw.pdb built with Release configuration'
|
||||
value: ${{ steps.build-release.outputs.ddraw-pdb }}
|
||||
|
||||
releasexp:
|
||||
description: 'Full path to ddraw.dll built with ReleaseXP configuration'
|
||||
value: ${{ steps.build-releasexp.outputs.ddraw-dll }}
|
||||
releasexp-pdb:
|
||||
description: 'Full path to ddraw.pdb built with ReleaseXP configuration'
|
||||
value: ${{ steps.build-releasexp.outputs.ddraw-pdb }}
|
||||
|
||||
debug:
|
||||
description: 'Full path to ddraw.dll built with Debug configuration'
|
||||
|
@ -119,6 +125,7 @@ runs:
|
|||
"${{ steps.msbuild.outputs.exe }}" "$GITHUB_ACTION_PATH/cnc-ddraw.sln" -p:Configuration=Release -p:Platform=x86 -p:PlatformToolset=v142
|
||||
#
|
||||
echo "ddraw-dll=$(cygpath --windows "$GITHUB_ACTION_PATH/bin/Release/ddraw.dll")" >> $GITHUB_OUTPUT
|
||||
echo "ddraw-pdb=$(cygpath --windows "$GITHUB_ACTION_PATH/bin/Release/ddraw.pdb")" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
@ -137,6 +144,7 @@ runs:
|
|||
"${{ steps.msbuild.outputs.exe }}" "$GITHUB_ACTION_PATH/cnc-ddraw.sln" -p:Configuration=ReleaseXP -p:Platform=x86 -p:PlatformToolset=v141_xp
|
||||
#
|
||||
echo "ddraw-dll=$(cygpath --windows "$GITHUB_ACTION_PATH/bin/ReleaseXP/ddraw.dll")" >> $GITHUB_OUTPUT
|
||||
echo "ddraw-pdb=$(cygpath --windows "$GITHUB_ACTION_PATH/bin/ReleaseXP/ddraw.pdb")" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <windows.h>
|
||||
#include <initguid.h>
|
||||
#include "directinput.h"
|
||||
#include "winapi_hooks.h"
|
||||
#include "debug.h"
|
||||
#include "hook.h"
|
||||
#include "dd.h"
|
||||
|
@ -88,16 +89,60 @@ static HRESULT WINAPI fake_did_GetDeviceData(
|
|||
|
||||
HRESULT result = real_did_GetDeviceData(This, cbObjectData, rgdod, pdwInOut, dwFlags);
|
||||
|
||||
if (SUCCEEDED(result) && This == g_mouse_device && !g_mouse_locked && !g_config.devmode)
|
||||
if (SUCCEEDED(result) && This == g_mouse_device)
|
||||
{
|
||||
if (pdwInOut)
|
||||
if (pdwInOut && rgdod && *pdwInOut > 0 && cbObjectData > 0)
|
||||
{
|
||||
if (rgdod && *pdwInOut > 0 && cbObjectData > 0)
|
||||
if (!g_mouse_locked && !g_config.devmode)
|
||||
{
|
||||
memset(rgdod, 0, *pdwInOut * cbObjectData);
|
||||
*pdwInOut = 0;
|
||||
}
|
||||
else if (g_ddraw.width && g_ddraw.height)
|
||||
{
|
||||
POINT pt;
|
||||
fake_GetCursorPos(&pt);
|
||||
fake_SetCursorPos((g_ddraw.width / 2), (g_ddraw.height / 2));
|
||||
|
||||
*pdwInOut = 0;
|
||||
static int x, y;
|
||||
x += pt.x - (g_ddraw.width / 2);
|
||||
y += pt.y - (g_ddraw.height / 2);
|
||||
|
||||
if (cbObjectData == sizeof(DIDEVICEOBJECTDATA_DX3))
|
||||
{
|
||||
LPDIDEVICEOBJECTDATA_DX3 rgdod16 = (LPDIDEVICEOBJECTDATA_DX3)rgdod;
|
||||
|
||||
for (int i = 0; i < *pdwInOut; i++)
|
||||
{
|
||||
if (rgdod16[i].dwOfs == DIMOFS_X)
|
||||
{
|
||||
rgdod16[i].dwData = x;
|
||||
x = 0;
|
||||
}
|
||||
else if (rgdod16[i].dwOfs == DIMOFS_Y)
|
||||
{
|
||||
rgdod16[i].dwData = y;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (cbObjectData == sizeof(DIDEVICEOBJECTDATA))
|
||||
{
|
||||
for (int i = 0; i < *pdwInOut; i++)
|
||||
{
|
||||
if (rgdod[i].dwOfs == DIMOFS_X)
|
||||
{
|
||||
rgdod[i].dwData = x;
|
||||
x = 0;
|
||||
}
|
||||
else if (rgdod[i].dwOfs == DIMOFS_Y)
|
||||
{
|
||||
rgdod[i].dwData = y;
|
||||
y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue