-
Notifications
You must be signed in to change notification settings - Fork 24
/
DllMain.cpp
3588 lines (3342 loc) · 146 KB
/
DllMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*This file is part of FFB Arcade Plugin.
FFB Arcade Plugin 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.
FFB Arcade Plugin 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 FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
*/
#include <Windows.h>
#include <math.h>
#include <dinput.h>
#include <stdio.h>
#include <tchar.h>
#include "SDL.h"
#include <iostream>
#include <fstream>
#include <cstdio>
#include <string>
#include <chrono>
#include <thread>
#include "IDirectInputDevice.h"
#include <d3d11.h>
#include <sapi.h>
#include <atlcomcli.h>
#include <TlHelp32.h>
#include "Config/PersistentValues.h"
// include all game header files here.
#include "Game Files/TestGame.h"
#include "Game Files/AliensExtermination.h"
#include "Game Files/Batman.h"
#include "Game Files/BG4JP.h"
#include "Game Files/ChaseHQ2.h"
#include "Game Files/CrazyTaxi.h"
#include "Game Files/CruisnBlast.h"
#include "Game Files/D1GP.h"
#include "Game Files/Daytona3.h"
#include "Game Files/Daytona3NSE.h"
#include "Game Files/DeadHeat.h"
#include "Game Files/DeadHeatRiders.h"
#include "Game Files/DirtyDrivin.h"
#include "Game Files/FnF.h"
#include "Game Files/FnFDrift.h"
#include "Game Files/FnFSuperCars.h"
#include "Game Files/FordRacing.h"
#include "Game Files/FordRacingOther.h"
#include "Game Files/GaelcoTuningRace.h"
#include "Game Files/GRIDReal.h"
#include "Game Files/GRIDCustom.h"
#include "Game Files/GoldenGun.h"
#include "Game Files/Hummer.h"
#include "Game Files/HummerExtreme.h"
#include "Game Files/InitialD0v131.h"
#include "Game Files/InitialD0v211.h"
#include "Game Files/InitialD0v230.h"
#include "Game Files/InitialD4.h"
#include "Game Files/InitialD4Japan.h"
#include "Game Files/InitialD5.h"
#include "Game Files/InitialD6.h"
#include "Game Files/InitialD7.h"
#include "Game Files/InitialD8.h"
#include "Game Files/IDTAv231.h"
#include "Game Files/MarioKartGPDXCustom.h"
#include "Game Files/MarioKartGPDX1.10Custom.h"
#include "Game Files/MarioKartGPDX1.10Real.h"
#include "Game Files/MarioKartGPDX1.18Custom.h"
#include "Game Files/MarioKartGPDX1.18Real.h"
#include "Game Files/MarioKartGPDXUSACustom.h"
#include "Game Files/MarioKartGPDXUSAReal.h"
#include "Game Files/MAMESupermodel.h"
#include "Game Files/OutRun2Fake.h"
#include "Game Files/OutRun2Real.h"
#include "Game Files/SegaRaceTV.h"
#include "Game Files/SegaRacingClassic.h"
#include "Game Files/SegaRally3.h"
#include "Game Files/SegaRally3Other.h"
#include "Game Files/Showdown.h"
#include "Game Files/SnoCross.h"
#include "Game Files/WackyRaces.h"
#include "Game Files/WastelandRacers2071.h"
#include "Game Files/WMMT3.h"
#include "Game Files/WMMT5.h"
#include "Game Files/WMMT5DX.h"
#include "Game Files/WMMT5DX+.h"
#include "Game Files/WMMT6.h"
#include "Game Files/WMMT6R.h"
#include "Game Files/WMMT6RR.h"
#include "Game Files/Machstorm.h"
#include "Game Files/AfterburnerClimax.h"
#include "Game Files/PokkenTournament.h"
#include "Game Files/SonicSegaAllStarsRacing.h"
#include "Game Files/SpringEffect.h"
#include "Game Files/M2Emulator.h"
#include "Game Files/GTIClub3.h"
#include "Game Files/Demul.h"
#include "Game Files/ButtonRumble.h"
#include "Game Files/RingRiders.h"
#include "Game Files/RoadFighters3D.h"
#include "Game Files/LGI3D.h"
#include "Game Files/LGI.h"
#include "Game Files/KODrive.h"
#include "Game Files/HOTD4.h"
#include "Game Files/Rambo.h"
#include "Game Files/R-Tuned.h"
#include "Game Files/SWDC2018.h"
#include "Game Files/TokyoCop.h"
#include "Game Files/Transformers.h"
#include "Game Files/H2Overdrive.h"
#include "Game Files/StormRacerG.h"
#include "Game Files/ArcticThunder.h"
// typedefs
typedef unsigned char U8;
typedef unsigned int U32;
// DINPUT8 FUNCTION DEFINITIONS
typedef HRESULT(WINAPI* pfnDirectInputDirectInput8Create)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter);
typedef HRESULT(WINAPI* pfnDirectInputDllRegisterServer)(void);
typedef HRESULT(WINAPI* pfnDirectInputDllUnregisterServer)(void);
typedef HRESULT(WINAPI* pfnDirectInputDllCanUnloadNow)(void);
typedef HRESULT(WINAPI* pfnDirectInputDllGetClassObject)(REFCLSID rclsid, REFIID riid, LPVOID* ppv);
typedef LPCDIDATAFORMAT(WINAPI* pfnDirectInputGetdfDIJoystick)();
// DINPUT FUNCTION DEFINITIONS
typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateA)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter);
typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateW)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW* ppDI, LPUNKNOWN punkOuter);
typedef HRESULT(WINAPI* pfnDirectInputDirectInputCreateEx)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter);
// DINPUT8 REAL FUNCTIONS
pfnDirectInputDirectInput8Create originalDirectInputDirectInput8Create = NULL;
pfnDirectInputDllRegisterServer originalDirectInputDllRegisterServer = NULL;
pfnDirectInputDllUnregisterServer originalDirectInputDllUnregisterServer = NULL;
pfnDirectInputDllCanUnloadNow originalDirectInputDllCanUnloadNow = NULL;
pfnDirectInputDllGetClassObject originalDirectInputDllGetClassObject = NULL;
pfnDirectInputGetdfDIJoystick originalGetdfDIJoystick = NULL;
// DINPUT REAL FUNCTIONS
pfnDirectInputDirectInputCreateA originalDirectInputDirectInputCreateA = NULL;
pfnDirectInputDirectInputCreateW originalDirectInputDirectInputCreateW = NULL;
pfnDirectInputDirectInputCreateEx originalDirectInputDirectInputCreateEx = NULL;
// DX11 REAL FUNCTIONS
extern "C"
{
FARPROC originalCreateDirect3D11DeviceFromDXGIDevice;
FARPROC originalCreateDirect3D11SurfaceFromDXGISurface;
FARPROC originalD3D11CoreCreateDevice;
FARPROC originalD3D11CoreCreateLayeredDevice;
FARPROC originalD3D11CoreGetLayeredDeviceSize;
FARPROC originalD3D11CoreRegisterLayers;
FARPROC originalD3D11CreateDevice;
FARPROC originalD3D11CreateDeviceAndSwapChain;
FARPROC originalD3D11CreateDeviceForD3D12;
FARPROC originalD3D11On12CreateDevice;
FARPROC originalD3DKMTCloseAdapter;
FARPROC originalD3DKMTCreateAllocation;
FARPROC originalD3DKMTCreateContext;
FARPROC originalD3DKMTCreateDevice;
FARPROC originalD3DKMTCreateSynchronizationObject;
FARPROC originalD3DKMTDestroyAllocation;
FARPROC originalD3DKMTDestroyContext;
FARPROC originalD3DKMTDestroyDevice;
FARPROC originalD3DKMTDestroySynchronizationObject;
FARPROC originalD3DKMTEscape;
FARPROC originalD3DKMTGetContextSchedulingPriority;
FARPROC originalD3DKMTGetDeviceState;
FARPROC originalD3DKMTGetDisplayModeList;
FARPROC originalD3DKMTGetMultisampleMethodList;
FARPROC originalD3DKMTGetRuntimeData;
FARPROC originalD3DKMTGetSharedPrimaryHandle;
FARPROC originalD3DKMTLock;
FARPROC originalD3DKMTOpenAdapterFromHdc;
FARPROC originalD3DKMTOpenResource;
FARPROC originalD3DKMTPresent;
FARPROC originalD3DKMTQueryAdapterInfo;
FARPROC originalD3DKMTQueryAllocationResidency;
FARPROC originalD3DKMTQueryResourceInfo;
FARPROC originalD3DKMTRender;
FARPROC originalD3DKMTSetAllocationPriority;
FARPROC originalD3DKMTSetContextSchedulingPriority;
FARPROC originalD3DKMTSetDisplayMode;
FARPROC originalD3DKMTSetDisplayPrivateDriverFormat;
FARPROC originalD3DKMTSetGammaRamp;
FARPROC originalD3DKMTSetVidPnSourceOwner;
FARPROC originalD3DKMTSignalSynchronizationObject;
FARPROC originalD3DKMTUnlock;
FARPROC originalD3DKMTWaitForSynchronizationObject;
FARPROC originalD3DKMTWaitForVerticalBlankEvent;
FARPROC originalD3DPerformance_BeginEvent;
FARPROC originalD3DPerformance_EndEvent;
FARPROC originalD3DPerformance_GetStatus;
FARPROC originalD3DPerformance_SetMarker;
FARPROC originalEnableFeatureLevelUpgrade;
FARPROC originalOpenAdapter10;
FARPROC originalOpenAdapter10_2;
}
// XINPUT1_3 REAL FUNCTIONS
extern "C"
{
FARPROC originalXInputGetState;
FARPROC originalXInputSetState;
FARPROC originalXInputGetCapabilities;
FARPROC originalXInputEnable;
FARPROC originalXInputGetDSoundAudioDeviceGuids;
FARPROC originalXInputGetBatteryInformation;
FARPROC originalXInputGetKeystroke;
FARPROC originalXInputGetStateEx;
FARPROC originalXInputWaitForGuideButton;
FARPROC originalXInputCancelGuideButtonWait;
FARPROC originalXInputPowerOffController;
}
// D3D9 REAL FUNCTIONS
extern "C"
{
FARPROC originalDirect3DShaderValidatorCreate9;
FARPROC originalPSGPError;
FARPROC originalPSGPSampleTexture;
FARPROC originalD3DPERF_BeginEvent;
FARPROC originalD3DPERF_EndEvent;
FARPROC originalD3DPERF_GetStatus;
FARPROC originalD3DPERF_QueryRepeatFrame;
FARPROC originalD3DPERF_SetMarker;
FARPROC originalD3DPERF_SetOptions;
FARPROC originalD3DPERF_SetRegion;
FARPROC originalDebugSetLevel;
FARPROC originalDebugSetMute;
FARPROC originalDirect3D9EnableMaximizedWindowedModeShim;
FARPROC originalDirect3DCreate9;
FARPROC originalDirect3DCreate9Ex;
}
// WINMM REAL FUNCTIONS
extern "C"
{
FARPROC originalPlaySoundW;
FARPROC originaltimeSetEvent;
FARPROC originaltimeKillEvent;
FARPROC originalmidiOutMessage;
FARPROC originaltimeBeginPeriod;
FARPROC originaltimeGetTime;
FARPROC originalNotifyCallbackData;
FARPROC originalWOW32DriverCallback;
FARPROC originalWOW32ResolveMultiMediaHandle;
FARPROC originalaux32Message;
FARPROC originaljoy32Message;
FARPROC originalmid32Message;
FARPROC originalmod32Message;
FARPROC originalmxd32Message;
FARPROC originaltid32Message;
FARPROC originalwid32Message;
FARPROC originalwod32Message;
FARPROC originalmci32Message;
FARPROC originalCloseDriver;
FARPROC originalDefDriverProc;
FARPROC originalDriverCallback;
FARPROC originalDrvGetModuleHandle;
FARPROC originalGetDriverModuleHandle;
FARPROC originalOpenDriver;
FARPROC originalPlaySound;
FARPROC originalOrdinal2;
FARPROC originalSendDriverMessage;
FARPROC originalauxGetDevCapsA;
FARPROC originalauxGetDevCapsW;
FARPROC originalauxGetNumDevs;
FARPROC originalauxGetVolume;
FARPROC originalauxOutMessage;
FARPROC originalauxSetVolume;
FARPROC originaljoyConfigChanged;
FARPROC originaljoyGetDevCapsA;
FARPROC originaljoyGetDevCapsW;
FARPROC originaljoyGetNumDevs;
FARPROC originaljoyGetPosEx;
FARPROC originaljoyGetPos;
FARPROC originaljoyGetThreshold;
FARPROC originaljoyReleaseCapture;
FARPROC originaljoySetCapture;
FARPROC originaljoySetThreshold;
FARPROC originalmidiConnect;
FARPROC originalmidiDisconnect;
FARPROC originalmidiInAddBuffer;
FARPROC originalmidiInClose;
FARPROC originalmidiInGetDevCapsA;
FARPROC originalmidiInGetDevCapsW;
FARPROC originalmidiInGetErrorTextA;
FARPROC originalmidiInGetErrorTextW;
FARPROC originalmidiInGetID;
FARPROC originalmidiInGetNumDevs;
FARPROC originalmidiInMessage;
FARPROC originalmidiInOpen;
FARPROC originalmidiInPrepareHeader;
FARPROC originalmidiInReset;
FARPROC originalmidiInStart;
FARPROC originalmidiInStop;
FARPROC originalmidiInUnprepareHeader;
FARPROC originalmidiOutCacheDrumPatches;
FARPROC originalmidiOutCachePatches;
FARPROC originalmidiOutClose;
FARPROC originalmidiOutGetDevCapsA;
FARPROC originalmidiOutGetDevCapsW;
FARPROC originalmidiOutGetErrorTextA;
FARPROC originalmidiOutGetErrorTextW;
FARPROC originalmidiOutGetID;
FARPROC originalmidiOutGetNumDevs;
FARPROC originalmidiOutGetVolume;
FARPROC originalmidiOutLongMsg;
FARPROC originalmidiOutOpen;
FARPROC originalmidiOutPrepareHeader;
FARPROC originalmidiOutReset;
FARPROC originalmidiOutSetVolume;
FARPROC originalmidiOutShortMsg;
FARPROC originalmidiOutUnprepareHeader;
FARPROC originalmidiStreamClose;
FARPROC originalmidiStreamOpen;
FARPROC originalmidiStreamOut;
FARPROC originalmidiStreamPause;
FARPROC originalmidiStreamPosition;
FARPROC originalmidiStreamProperty;
FARPROC originalmidiStreamRestart;
FARPROC originalmidiStreamStop;
FARPROC originalmixerClose;
FARPROC originalmixerGetControlDetailsA;
FARPROC originalmixerGetControlDetailsW;
FARPROC originalmixerGetDevCapsA;
FARPROC originalmixerGetDevCapsW;
FARPROC originalmixerGetID;
FARPROC originalmixerGetLineControlsA;
FARPROC originalmixerGetLineControlsW;
FARPROC originalmixerGetLineInfoA;
FARPROC originalmixerGetLineInfoW;
FARPROC originalmixerGetNumDevs;
FARPROC originalmixerMessage;
FARPROC originalmixerOpen;
FARPROC originalmixerSetControlDetails;
FARPROC originalmmDrvInstall;
FARPROC originalmmGetCurrentTask;
FARPROC originalmmTaskBlock;
FARPROC originalmmTaskCreate;
FARPROC originalmmTaskSignal;
FARPROC originalmmTaskYield;
FARPROC originalmmioAdvance;
FARPROC originalmmioAscend;
FARPROC originalmmioClose;
FARPROC originalmmioCreateChunk;
FARPROC originalmmioDescend;
FARPROC originalmmioFlush;
FARPROC originalmmioGetInfo;
FARPROC originalmmioInstallIOProcA;
FARPROC originalmmioInstallIOProcW;
FARPROC originalmmioOpenA;
FARPROC originalmmioOpenW;
FARPROC originalmmioRead;
FARPROC originalmmioRenameA;
FARPROC originalmmioRenameW;
FARPROC originalmmioSeek;
FARPROC originalmmioSendMessage;
FARPROC originalmmioSetBuffer;
FARPROC originalmmioSetInfo;
FARPROC originalmmioStringToFOURCCA;
FARPROC originalmmioStringToFOURCCW;
FARPROC originalmmioWrite;
FARPROC originaltimeEndPeriod;
FARPROC originaltimeGetDevCaps;
FARPROC originaltimeGetSystemTime;
FARPROC originalwaveInAddBuffer;
FARPROC originalwaveInClose;
FARPROC originalwaveInGetDevCapsA;
FARPROC originalwaveInGetDevCapsW;
FARPROC originalwaveInGetErrorTextA;
FARPROC originalwaveInGetErrorTextW;
FARPROC originalwaveInGetID;
FARPROC originalwaveInGetNumDevs;
FARPROC originalwaveInGetPosition;
FARPROC originalwaveInMessage;
FARPROC originalwaveInOpen;
FARPROC originalwaveInPrepareHeader;
FARPROC originalwaveInReset;
FARPROC originalwaveInStart;
FARPROC originalwaveInStop;
FARPROC originalwaveInUnprepareHeader;
FARPROC originalwaveOutBreakLoop;
FARPROC originalwaveOutClose;
FARPROC originalwaveOutGetDevCapsA;
FARPROC originalwaveOutGetDevCapsW;
FARPROC originalwaveOutGetErrorTextA;
FARPROC originalwaveOutGetErrorTextW;
FARPROC originalwaveOutGetID;
FARPROC originalwaveOutGetNumDevs;
FARPROC originalwaveOutGetPitch;
FARPROC originalwaveOutGetPlaybackRate;
FARPROC originalwaveOutGetPosition;
FARPROC originalwaveOutGetVolume;
FARPROC originalwaveOutMessage;
FARPROC originalwaveOutOpen;
FARPROC originalwaveOutPause;
FARPROC originalwaveOutPrepareHeader;
FARPROC originalwaveOutReset;
FARPROC originalwaveOutRestart;
FARPROC originalwaveOutSetPitch;
FARPROC originalwaveOutSetPlaybackRate;
FARPROC originalwaveOutSetVolume;
FARPROC originalwaveOutUnprepareHeader;
FARPROC originalwaveOutWrite;
FARPROC originalmciExecute;
FARPROC originalmciGetErrorStringA;
FARPROC originalmciGetErrorStringW;
FARPROC originalmciSendCommandA;
FARPROC originalmciSendCommandW;
FARPROC originalmciSendStringA;
FARPROC originalmciSendStringW;
FARPROC originalmciFreeCommandResource;
FARPROC originalmciLoadCommandResource;
FARPROC originalmciDriverNotify;
FARPROC originalmciDriverYield;
FARPROC originalmciGetCreatorTask;
FARPROC originalmciGetDeviceIDA;
FARPROC originalmciGetDeviceIDFromElementIDA;
FARPROC originalmciGetDeviceIDFromElementIDW;
FARPROC originalmciGetDeviceIDW;
FARPROC originalmciGetDriverData;
FARPROC originalmciGetYieldProc;
FARPROC originalmciSetDriverData;
FARPROC originalmciSetYieldProc;
FARPROC originalPlaySoundA;
FARPROC originalsndPlaySoundA;
FARPROC originalsndPlaySoundW;
FARPROC originalWOWAppExit;
FARPROC originalmmsystemGetVersion;
}
// OpenGL32 REAL FUNCTIONS
extern "C"
{
FARPROC originalwglUseFontOutlinesA;
FARPROC originalwglUseFontOutlinesW;
FARPROC originalwglDescribeLayerPlane;
FARPROC originalwglSetLayerPaletteEntries;
FARPROC originalwglGetLayerPaletteEntries;
FARPROC originalwglRealizeLayerPalette;
FARPROC originalwglSwapLayerBuffers;
FARPROC originalwglMakeCurrent;
FARPROC originalGlmfInitPlayback;
FARPROC originalGlmfBeginGlsBlock;
FARPROC originalGlmfPlayGlsRecord;
FARPROC originalGlmfEndGlsBlock;
FARPROC originalGlmfEndPlayback;
FARPROC originalGlmfCloseMetaFile;
FARPROC originalwglSwapMultipleBuffers;
FARPROC originalwglCreateLayerContext;
FARPROC originalwglCreateContext;
FARPROC originalwglDeleteContext;
FARPROC originalwglGetCurrentContext;
FARPROC originalwglGetCurrentDC;
FARPROC originalwglUseFontBitmapsA;
FARPROC originalwglUseFontBitmapsW;
FARPROC originalwglShareLists;
FARPROC originalwglGetDefaultProcAddress;
FARPROC originalwglGetProcAddress;
FARPROC originalwglCopyContext;
FARPROC originalglDebugEntry;
FARPROC originalwglGetPixelFormat;
FARPROC originalwglSetPixelFormat;
FARPROC originalwglChoosePixelFormat;
FARPROC originalwglDescribePixelFormat;
FARPROC originalwglSwapBuffers;
FARPROC originalglNewList;
FARPROC originalglEndList;
FARPROC originalglCallList;
FARPROC originalglCallLists;
FARPROC originalglBegin;
FARPROC originalglColor3b;
FARPROC originalglColor3bv;
FARPROC originalglColor3d;
FARPROC originalglColor3dv;
FARPROC originalglColor3f;
FARPROC originalglColor3fv;
FARPROC originalglColor3i;
FARPROC originalglColor3iv;
FARPROC originalglColor3s;
FARPROC originalglColor3sv;
FARPROC originalglColor3ub;
FARPROC originalglColor3ubv;
FARPROC originalglColor3ui;
FARPROC originalglColor3uiv;
FARPROC originalglColor3us;
FARPROC originalglColor3usv;
FARPROC originalglColor4b;
FARPROC originalglColor4bv;
FARPROC originalglColor4d;
FARPROC originalglColor4dv;
FARPROC originalglColor4f;
FARPROC originalglColor4fv;
FARPROC originalglColor4i;
FARPROC originalglColor4iv;
FARPROC originalglColor4s;
FARPROC originalglColor4sv;
FARPROC originalglColor4ub;
FARPROC originalglColor4ubv;
FARPROC originalglColor4ui;
FARPROC originalglColor4uiv;
FARPROC originalglColor4us;
FARPROC originalglColor4usv;
FARPROC originalglEdgeFlag;
FARPROC originalglEdgeFlagv;
FARPROC originalglEnd;
FARPROC originalglIndexd;
FARPROC originalglIndexdv;
FARPROC originalglIndexf;
FARPROC originalglIndexfv;
FARPROC originalglIndexi;
FARPROC originalglIndexiv;
FARPROC originalglIndexs;
FARPROC originalglIndexsv;
FARPROC originalglNormal3b;
FARPROC originalglNormal3bv;
FARPROC originalglNormal3d;
FARPROC originalglNormal3dv;
FARPROC originalglNormal3f;
FARPROC originalglNormal3fv;
FARPROC originalglNormal3i;
FARPROC originalglNormal3iv;
FARPROC originalglNormal3s;
FARPROC originalglNormal3sv;
FARPROC originalglTexCoord1d;
FARPROC originalglTexCoord1dv;
FARPROC originalglTexCoord1f;
FARPROC originalglTexCoord1fv;
FARPROC originalglTexCoord1i;
FARPROC originalglTexCoord1iv;
FARPROC originalglTexCoord1s;
FARPROC originalglTexCoord1sv;
FARPROC originalglTexCoord2d;
FARPROC originalglTexCoord2dv;
FARPROC originalglTexCoord2f;
FARPROC originalglTexCoord2fv;
FARPROC originalglTexCoord2i;
FARPROC originalglTexCoord2iv;
FARPROC originalglTexCoord2s;
FARPROC originalglTexCoord2sv;
FARPROC originalglTexCoord3d;
FARPROC originalglTexCoord3dv;
FARPROC originalglTexCoord3f;
FARPROC originalglTexCoord3fv;
FARPROC originalglTexCoord3i;
FARPROC originalglTexCoord3iv;
FARPROC originalglTexCoord3s;
FARPROC originalglTexCoord3sv;
FARPROC originalglTexCoord4d;
FARPROC originalglTexCoord4dv;
FARPROC originalglTexCoord4f;
FARPROC originalglTexCoord4fv;
FARPROC originalglTexCoord4i;
FARPROC originalglTexCoord4iv;
FARPROC originalglTexCoord4s;
FARPROC originalglTexCoord4sv;
FARPROC originalglVertex2d;
FARPROC originalglVertex2dv;
FARPROC originalglVertex2f;
FARPROC originalglVertex2fv;
FARPROC originalglVertex2i;
FARPROC originalglVertex2iv;
FARPROC originalglVertex2s;
FARPROC originalglVertex2sv;
FARPROC originalglVertex3d;
FARPROC originalglVertex3dv;
FARPROC originalglVertex3f;
FARPROC originalglVertex3fv;
FARPROC originalglVertex3i;
FARPROC originalglVertex3iv;
FARPROC originalglVertex3s;
FARPROC originalglVertex3sv;
FARPROC originalglVertex4d;
FARPROC originalglVertex4dv;
FARPROC originalglVertex4f;
FARPROC originalglVertex4fv;
FARPROC originalglVertex4i;
FARPROC originalglVertex4iv;
FARPROC originalglVertex4s;
FARPROC originalglVertex4sv;
FARPROC originalglMaterialf;
FARPROC originalglMaterialfv;
FARPROC originalglMateriali;
FARPROC originalglMaterialiv;
FARPROC originalglDisable;
FARPROC originalglEnable;
FARPROC originalglPopAttrib;
FARPROC originalglPushAttrib;
FARPROC originalglEvalCoord1d;
FARPROC originalglEvalCoord1dv;
FARPROC originalglEvalCoord1f;
FARPROC originalglEvalCoord1fv;
FARPROC originalglEvalCoord2d;
FARPROC originalglEvalCoord2dv;
FARPROC originalglEvalCoord2f;
FARPROC originalglEvalCoord2fv;
FARPROC originalglEvalPoint1;
FARPROC originalglEvalPoint2;
FARPROC originalglLoadIdentity;
FARPROC originalglLoadMatrixf;
FARPROC originalglLoadMatrixd;
FARPROC originalglMatrixMode;
FARPROC originalglMultMatrixf;
FARPROC originalglMultMatrixd;
FARPROC originalglPopMatrix;
FARPROC originalglPushMatrix;
FARPROC originalglRotated;
FARPROC originalglRotatef;
FARPROC originalglScaled;
FARPROC originalglScalef;
FARPROC originalglTranslated;
FARPROC originalglTranslatef;
FARPROC originalglArrayElement;
FARPROC originalglBindTexture;
FARPROC originalglColorPointer;
FARPROC originalglDisableClientState;
FARPROC originalglDrawArrays;
FARPROC originalglDrawElements;
FARPROC originalglEdgeFlagPointer;
FARPROC originalglEnableClientState;
FARPROC originalglIndexPointer;
FARPROC originalglIndexub;
FARPROC originalglIndexubv;
FARPROC originalglInterleavedArrays;
FARPROC originalglNormalPointer;
FARPROC originalglPolygonOffset;
FARPROC originalglTexCoordPointer;
FARPROC originalglVertexPointer;
FARPROC originalglGetPointerv;
FARPROC originalglPopClientAttrib;
FARPROC originalglPushClientAttrib;
FARPROC originalglClear;
FARPROC originalglClearAccum;
FARPROC originalglClearIndex;
FARPROC originalglClearColor;
FARPROC originalglClearStencil;
FARPROC originalglClearDepth;
FARPROC originalglBitmap;
FARPROC originalglTexImage1D;
FARPROC originalglTexImage2D;
FARPROC originalglCopyPixels;
FARPROC originalglReadPixels;
FARPROC originalglDrawPixels;
FARPROC originalglRectd;
FARPROC originalglRectdv;
FARPROC originalglRectf;
FARPROC originalglRectfv;
FARPROC originalglRecti;
FARPROC originalglRectiv;
FARPROC originalglRects;
FARPROC originalglRectsv;
FARPROC originalglDeleteLists;
FARPROC originalglGenLists;
FARPROC originalglListBase;
FARPROC originalglRasterPos2d;
FARPROC originalglRasterPos2dv;
FARPROC originalglRasterPos2f;
FARPROC originalglRasterPos2fv;
FARPROC originalglRasterPos2i;
FARPROC originalglRasterPos2iv;
FARPROC originalglRasterPos2s;
FARPROC originalglRasterPos2sv;
FARPROC originalglRasterPos3d;
FARPROC originalglRasterPos3dv;
FARPROC originalglRasterPos3f;
FARPROC originalglRasterPos3fv;
FARPROC originalglRasterPos3i;
FARPROC originalglRasterPos3iv;
FARPROC originalglRasterPos3s;
FARPROC originalglRasterPos3sv;
FARPROC originalglRasterPos4d;
FARPROC originalglRasterPos4dv;
FARPROC originalglRasterPos4f;
FARPROC originalglRasterPos4fv;
FARPROC originalglRasterPos4i;
FARPROC originalglRasterPos4iv;
FARPROC originalglRasterPos4s;
FARPROC originalglRasterPos4sv;
FARPROC originalglClipPlane;
FARPROC originalglColorMaterial;
FARPROC originalglCullFace;
FARPROC originalglFogf;
FARPROC originalglFogfv;
FARPROC originalglFogi;
FARPROC originalglFogiv;
FARPROC originalglFrontFace;
FARPROC originalglHint;
FARPROC originalglLightf;
FARPROC originalglLightfv;
FARPROC originalglLighti;
FARPROC originalglLightiv;
FARPROC originalglLightModelf;
FARPROC originalglLightModelfv;
FARPROC originalglLightModeli;
FARPROC originalglLightModeliv;
FARPROC originalglLineStipple;
FARPROC originalglLineWidth;
FARPROC originalglPointSize;
FARPROC originalglPolygonMode;
FARPROC originalglPolygonStipple;
FARPROC originalglScissor;
FARPROC originalglFinish;
FARPROC originalglShadeModel;
FARPROC originalglTexParameterf;
FARPROC originalglTexParameterfv;
FARPROC originalglTexParameteri;
FARPROC originalglTexParameteriv;
FARPROC originalglTexEnvf;
FARPROC originalglTexEnvfv;
FARPROC originalglTexEnvi;
FARPROC originalglTexEnviv;
FARPROC originalglTexGend;
FARPROC originalglTexGendv;
FARPROC originalglTexGenf;
FARPROC originalglTexGenfv;
FARPROC originalglTexGeni;
FARPROC originalglTexGeniv;
FARPROC originalglFeedbackBuffer;
FARPROC originalglSelectBuffer;
FARPROC originalglRenderMode;
FARPROC originalglInitNames;
FARPROC originalglLoadName;
FARPROC originalglPassThrough;
FARPROC originalglPopName;
FARPROC originalglPushName;
FARPROC originalglDrawBuffer;
FARPROC originalglStencilMask;
FARPROC originalglColorMask;
FARPROC originalglDepthMask;
FARPROC originalglIndexMask;
FARPROC originalglAccum;
FARPROC originalglFlush;
FARPROC originalglMap1d;
FARPROC originalglMap1f;
FARPROC originalglMap2d;
FARPROC originalglMap2f;
FARPROC originalglMapGrid1d;
FARPROC originalglMapGrid1f;
FARPROC originalglMapGrid2d;
FARPROC originalglMapGrid2f;
FARPROC originalglEvalMesh1;
FARPROC originalglEvalMesh2;
FARPROC originalglAlphaFunc;
FARPROC originalglBlendFunc;
FARPROC originalglLogicOp;
FARPROC originalglStencilFunc;
FARPROC originalglStencilOp;
FARPROC originalglDepthFunc;
FARPROC originalglPixelZoom;
FARPROC originalglPixelTransferf;
FARPROC originalglPixelTransferi;
FARPROC originalglPixelStoref;
FARPROC originalglPixelStorei;
FARPROC originalglPixelMapfv;
FARPROC originalglPixelMapuiv;
FARPROC originalglPixelMapusv;
FARPROC originalglReadBuffer;
FARPROC originalglGetBooleanv;
FARPROC originalglGetClipPlane;
FARPROC originalglGetDoublev;
FARPROC originalglGetError;
FARPROC originalglGetFloatv;
FARPROC originalglGetIntegerv;
FARPROC originalglGetLightfv;
FARPROC originalglGetLightiv;
FARPROC originalglGetMapdv;
FARPROC originalglGetMapfv;
FARPROC originalglGetMapiv;
FARPROC originalglGetMaterialfv;
FARPROC originalglGetMaterialiv;
FARPROC originalglGetPixelMapfv;
FARPROC originalglGetPixelMapuiv;
FARPROC originalglGetPixelMapusv;
FARPROC originalglGetPolygonStipple;
FARPROC originalglGetString;
FARPROC originalglGetTexEnvfv;
FARPROC originalglGetTexEnviv;
FARPROC originalglGetTexGendv;
FARPROC originalglGetTexGenfv;
FARPROC originalglGetTexGeniv;
FARPROC originalglGetTexImage;
FARPROC originalglGetTexParameterfv;
FARPROC originalglGetTexParameteriv;
FARPROC originalglGetTexLevelParameterfv;
FARPROC originalglGetTexLevelParameteriv;
FARPROC originalglIsEnabled;
FARPROC originalglIsList;
FARPROC originalglDepthRange;
FARPROC originalglFrustum;
FARPROC originalglOrtho;
FARPROC originalglViewport;
FARPROC originalglAreTexturesResident;
FARPROC originalglCopyTexImage1D;
FARPROC originalglCopyTexImage2D;
FARPROC originalglCopyTexSubImage1D;
FARPROC originalglCopyTexSubImage2D;
FARPROC originalglDeleteTextures;
FARPROC originalglGenTextures;
FARPROC originalglIsTexture;
FARPROC originalglPrioritizeTextures;
FARPROC originalglTexSubImage1D;
FARPROC originalglTexSubImage2D;
}
// SUPPORT FOR WRAPPING DIFFERENT LIBRARIES
enum lib
{
unknown = 0,
dinput8,
d3d11,
xinput1_3,
d3d9,
opengl32,
winmm,
dinput
};
lib currentLibrary = lib::unknown;
// DINPUT WRAPPER
HRESULT WINAPI DirectInputDirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA* ppDI, LPUNKNOWN punkOuter)
{
HRESULT res = originalDirectInputDirectInputCreateA(hinst, dwVersion, ppDI, punkOuter);
return res;
}
HRESULT WINAPI DirectInputDirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW* ppDI, LPUNKNOWN punkOuter)
{
HRESULT res = originalDirectInputDirectInputCreateW(hinst, dwVersion, ppDI, punkOuter);
return res;
}
HRESULT WINAPI DirectInputDirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter)
{
HRESULT res = originalDirectInputDirectInputCreateEx(hinst, dwVersion, riidltf, ppvOut, punkOuter);
return res;
}
// DINPUT8 WRAPPER
HRESULT WINAPI DirectInputDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter)
{
LPVOID val;
HRESULT res = originalDirectInputDirectInput8Create(hinst, dwVersion, riidltf, &val, punkOuter);
*ppvOut = new DirectInputDeviceWrapper(val, (IID_IDirectInput8W == riidltf));
return res;
}
HRESULT WINAPI DirectInputDllRegisterServer(void)
{
return originalDirectInputDllRegisterServer();
}
HRESULT WINAPI DirectInputDllUnregisterServer(void)
{
return originalDirectInputDllUnregisterServer();
}
HRESULT WINAPI DirectInputDllCanUnloadNow(void)
{
return originalDirectInputDllCanUnloadNow();
}
HRESULT WINAPI DirectInputDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return originalDirectInputDllGetClassObject(rclsid, riid, ppv);
}
LPCDIDATAFORMAT WINAPI DirectInputGetdfDIJoystick()
{
return originalGetdfDIJoystick();
}
void MEMwrite(void* adr, void* ptr, int size)
{
DWORD OldProtection;
VirtualProtect(adr, size, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy(adr, ptr, size);
VirtualProtect(adr, size, OldProtection, &OldProtection);
}
extern DWORD WINAPI ThreadForOutputs(LPVOID lpParam);
// global variables
SDL_Haptic* haptic;
SDL_Haptic* haptic2 = NULL;
SDL_Haptic* haptic3 = NULL;
EffectCollection effects;
EffectConstants effectConst;
Helpers hlp;
EffectTriggers t;
bool CustomStrength = false;
bool WaitForGame = false;
bool keepRunning = true;
float wheel = 0.0f;
SDL_Joystick* GameController = NULL;
SDL_Haptic* ControllerHaptic = NULL;
SDL_Joystick* GameController2 = NULL;
SDL_Haptic* ControllerHaptic2 = NULL;
SDL_Joystick* GameController3 = NULL;
SDL_Haptic* ControllerHaptic3 = NULL;
HINSTANCE gl_hOriginalDll = NULL;
HINSTANCE gl_hjgtDll = NULL;
HINSTANCE gl_cgGLDll = NULL;
HINSTANCE gl_hlibavs = NULL;
extern HINSTANCE ProcDLL;
int joystick_index1;
int joystick1Index = -1;
int joystick_index2 = -1;
int joystick_index3 = -1;
static DWORD GameProcessID;
LPCSTR CustomAlternativeMaxForceLeft;
LPCSTR CustomAlternativeMaxForceRight;
LPCSTR CustomMaxForce;
// settings
wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
int configMinForce = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForce"), 0, settingsFilename);
int configMaxForce = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForce"), 100, settingsFilename);
int enableLogging = GetPrivateProfileInt(TEXT("Settings"), TEXT("Logging"), 0, settingsFilename);
int PowerMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("PowerMode"), 0, settingsFilename);
int EnableRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableRumble"), 0, settingsFilename);
int EnableRumbleTriggers = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableRumbleTriggers"), 0, settingsFilename);
int ReverseRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseRumble"), 0, settingsFilename);
int SingleRumbleMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("SingleRumbleMotor"), 0, settingsFilename);
int EnableDamper = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableDamper"), 0, settingsFilename);
int DamperStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("DamperStrength"), 100, settingsFilename);
wchar_t* deviceGUIDString = new wchar_t[256];
int DeviceGUID = GetPrivateProfileString(TEXT("Settings"), TEXT("DeviceGUID"), NULL, deviceGUIDString, 256, settingsFilename);
int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
int configGameId = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 0, settingsFilename);
int configDefaultCentering = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultCentering"), 0, settingsFilename);
int configDefaultFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("DefaultFriction"), 0, settingsFilename);
int BeepWhenHook = GetPrivateProfileInt(TEXT("Settings"), TEXT("BeepWhenHook"), 0, settingsFilename);
int AlternativeFFB = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeFFB"), 0, settingsFilename);
int configAlternativeMinForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeft"), 0, settingsFilename);
int configAlternativeMaxForceLeft = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeft"), 100, settingsFilename);
int configAlternativeMinForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRight"), 0, settingsFilename);
int configAlternativeMaxForceRight = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRight"), 100, settingsFilename);
int ForceShowDeviceGUIDMessageBox = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceShowDeviceGUIDMessageBox"), 0, settingsFilename);
int configMinForceDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDevice2"), 0, settingsFilename);
int configMaxForceDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDevice2"), 100, settingsFilename);
int EnableRumbleDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableRumbleDevice2"), 0, settingsFilename);
int ReverseRumbleDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseRumbleDevice2"), 0, settingsFilename);
int AlternativeFFBDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeFFBDevice2"), 0, settingsFilename);
int configAlternativeMinForceLeftDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDevice2"), 0, settingsFilename);
int configAlternativeMaxForceLeftDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftDevice2"), 100, settingsFilename);
int configAlternativeMinForceRightDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightDevice2"), 0, settingsFilename);
int configAlternativeMaxForceRightDevice2 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightDevice2"), 100, settingsFilename);
int configMinForceDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MinForceDevice3"), 0, settingsFilename);
int configMaxForceDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("MaxForceDevice3"), 100, settingsFilename);
int EnableRumbleDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableRumbleDevice3"), 0, settingsFilename);
int ReverseRumbleDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("ReverseRumbleDevice3"), 0, settingsFilename);
int AlternativeFFBDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeFFBDevice3"), 0, settingsFilename);
int configAlternativeMinForceLeftDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceLeftDevice3"), 0, settingsFilename);
int configAlternativeMaxForceLeftDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceLeftDevice3"), 100, settingsFilename);
int configAlternativeMinForceRightDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMinForceRightDevice3"), 0, settingsFilename);
int configAlternativeMaxForceRightDevice3 = GetPrivateProfileInt(TEXT("Settings"), TEXT("AlternativeMaxForceRightDevice3"), 100, settingsFilename);
int SinePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("SinePeriod"), 0, settingsFilename);
int SineFadePeriod = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineFadePeriod"), 0, settingsFilename);
int SineStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("SineStrength"), 0, settingsFilename);
int RumbleStrengthLeftMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrengthLeftMotor"), 0, settingsFilename);
int RumbleStrengthRightMotor = GetPrivateProfileInt(TEXT("Settings"), TEXT("RumbleStrengthRightMotor"), 0, settingsFilename);
int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
int AutoCloseWindowError = GetPrivateProfileInt(TEXT("Settings"), TEXT("AutoCloseWindowError"), 0, settingsFilename);
int EnableFFBStrengthDynamicAdjustment = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthDynamicAdjustment"), 0, settingsFilename);
int IncreaseFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("IncreaseFFBStrength"), NULL, settingsFilename);
int DecreaseFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("DecreaseFFBStrength"), NULL, settingsFilename);
int ResetFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFFBStrength"), NULL, settingsFilename);
int StepFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("StepFFBStrength"), 5, settingsFilename);
int EnableFFBStrengthPersistence = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthPersistence"), 0, settingsFilename);
int EnableFFBStrengthTextToSpeech = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableFFBStrengthTextToSpeech"), 0, settingsFilename);
int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
int IgnoreFirstMatchingGUID = GetPrivateProfileInt(TEXT("Settings"), TEXT("IgnoreFirstMatchingGUID"), 0, settingsFilename);
int DoubleSine = GetPrivateProfileInt(TEXT("Settings"), TEXT("DoubleSine"), 0, settingsFilename);
int DoubleConstant = GetPrivateProfileInt(TEXT("Settings"), TEXT("DoubleConstant"), 0, settingsFilename);
int DoubleSpring = GetPrivateProfileInt(TEXT("Settings"), TEXT("DoubleSpring"), 0, settingsFilename);
int DoubleFriction = GetPrivateProfileInt(TEXT("Settings"), TEXT("DoubleFriction"), 0, settingsFilename);
int FFBOrRumble = GetPrivateProfileInt(TEXT("Settings"), TEXT("FFBOrRumble"), 0, settingsFilename);
int StartDelay = GetPrivateProfileInt(TEXT("Settings"), TEXT("StartDelay"), 0, settingsFilename);
extern void DefaultConfigValues();
extern void CustomFFBStrengthSetup();
char chainedDLL[256];
static char FFBStrength1[256];
static wchar_t FFBStrength2[256];
SDL_Event e;
HRESULT hr;
CComPtr<ISpVoice> cpVoice;
const int TEST_GAME_CONST = -1;
const int TEST_GAME_SINE = -2;