Skip to content

Commit 8f7fcd9

Browse files
committed
Added support for more aspect ratios
1 parent fe30a6f commit 8f7fcd9

6 files changed

Lines changed: 46 additions & 7 deletions

File tree

DInputWrapper/HOOKDirectInputDevice.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#include "dinput.h"
77
#include "HOOKDirectInputDevice.h"
88

9+
static int isConfigLoaded = 0;
10+
static float aspect = 1.77777777777777;
11+
912
HRESULT WINAPI HOOKDirectInputDevice::QueryInterface(REFIID iid, void ** ppvObject)
1013
{
1114
return actualDirectInputDevice->QueryInterface(iid, ppvObject);
@@ -76,7 +79,16 @@ HRESULT WINAPI HOOKDirectInputDevice::GetDeviceData(DWORD cbObjectData, LPDIDEVI
7679
for (i = 0; i < *pdwInOut; i++)
7780
{
7881
if (rgdod[i].dwOfs == DIMOFS_Y)
79-
rgdod[i].dwData *= 2;
82+
{
83+
/*
84+
Microsoft decided it would be funny to store signed values as DWORD here,
85+
which means that we'll be doing some ugly casting hacks to work around it.
86+
I'm sorry if you had to read this code. Blame 'Gates.
87+
*/
88+
89+
int value = *(int*)&rgdod[i].dwData;
90+
rgdod[i].dwData = value * aspect;
91+
}
8092
}
8193

8294
return res;
@@ -201,6 +213,21 @@ HRESULT WINAPI HOOKDirectInputDevice::WriteEffectToFile(LPCWSTR lpszFileName, DW
201213

202214
HOOKDirectInputDevice::HOOKDirectInputDevice(IDirectInputDevice8 *actual)
203215
{
216+
if (!isConfigLoaded)
217+
{
218+
FILE *f = NULL;
219+
errno_t err = fopen_s(&f, "sensitivity.txt", "r");
220+
221+
if (!err)
222+
{
223+
fscanf_s(f, "%f", &aspect);
224+
fclose(f);
225+
}
226+
227+
isConfigLoaded = 1;
228+
229+
}
230+
204231
actualDirectInputDevice = actual;
205232
dformat = 0;
206233
}

DInputWrapper/ReadMe.txt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,22 @@
33
========================================================================
44

55
Installation:
6-
Simply drop the dinput8.dll file into the .exe folder. If game fails
7-
to launch it's possible you need VCRedist 2015 installed. DO NOT COPY
8-
INTO SYSTEM FOLDER.
9-
6+
Drop the dinput8.dll file into the .exe game folder and create the
7+
sensitivity.txt file there, this file should contain your aspect ratio.
8+
On the archive there are sample files for common aspect ratios. Copy and
9+
rename any of them to sensitivity.txt if they match your current monitor
10+
aspect ratio.
11+
12+
If game fails to launch it's possible you need VCRedist 2015 installed.
13+
14+
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
15+
> DO NOT COPY dinput8.dll INTO YOUR SYSTEM FOLDER <
16+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
1018
Removal:
1119
Simply delete the dinput8.dll file from the .exe folder.
12-
13-
Code is protected by the GNU GENERAL PUBLIC LICENSE v2 general
20+
21+
Code is protected by the GNU GENERAL PUBLIC LICENSE v2 general
1422
license, and may not be distributed in any shape or form without the
1523
the aforementioned license accompanying it.
1624
There is ABSOLUTELY no warranty on this piece of software to the
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.777777777777778
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.333333333333333
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.333333333333333
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.37037037037037

0 commit comments

Comments
 (0)