From 27635a710da06ba3c8f99edacef8eee257a476cc Mon Sep 17 00:00:00 2001 From: Aaron M Date: Sat, 5 Oct 2019 14:15:44 +1300 Subject: [PATCH] Removed unnecssary code for cleanup Removing Sleep when launching game COULD cause issues, test before release version on a few games --- .vs/Dinput8Wrapper/v15/.suo | Bin 25088 -> 0 bytes Dinput8Wrapper.vcxproj | 4 -- Dinput8Wrapper.vcxproj.filters | 10 ----- DllMain.cpp | 30 ++------------ Game Files/FNF.cpp | 19 --------- Game Files/FNF.h | 21 ---------- Game Files/GRID.cpp | 69 --------------------------------- Game Files/GRID.h | 20 ---------- dinput8.def | 4 +- 9 files changed, 4 insertions(+), 173 deletions(-) delete mode 100644 .vs/Dinput8Wrapper/v15/.suo delete mode 100644 Game Files/FNF.cpp delete mode 100644 Game Files/FNF.h delete mode 100644 Game Files/GRID.cpp delete mode 100644 Game Files/GRID.h diff --git a/.vs/Dinput8Wrapper/v15/.suo b/.vs/Dinput8Wrapper/v15/.suo deleted file mode 100644 index 2a0225edbbc28dc84b72b508380cab87a44a3be8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25088 zcmeHPUu;`f89&ZwX*>FFEu}5}1g2Vl~e_Am(vG)=&G=>xDmj0cc_K7c?IEvO&_FP#tq2?_Rq5Ykx7?|1G!@%4>; zeeI-cocdUw@44rkd%pAU`_A`$=g;+PTW@~*_1$j^lRGNz6Sr=!7i$gS4ufB85i+g= zVYhDIzRf7c!`pT()B>kP4!@Fcia{}nXF*(ISK4+v#F~XZ$B?jePJi!jU%B*q#}1_W z*?ukQ2r%Zv1#tq{Q}7Ln8OuD(kvl}k0)95TIlkKaWdy3SD*VKo7a5eGAd-Mlv_%Y% ztd@Zx?2zbiJb?E#0K52)BkezQVmc+JfF&c+s6S!CfH{nif&o`GFY#|e#6tkP_?hQ7 z^~~1c`5r&i9ch{F1A2bj@MK#td_A5U03QNu1TYiSB@J{{7^mZKU z@-W~Lz@vbV0UiT%0bBq#;NyU;06Y1$)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Cf7)9^O|- z8sJ`(#q~HMsj(VW18p-%kK*YU7 - @@ -47,7 +46,6 @@ - @@ -72,7 +70,6 @@ - @@ -106,7 +103,6 @@ - diff --git a/Dinput8Wrapper.vcxproj.filters b/Dinput8Wrapper.vcxproj.filters index 4ca6799..f8b06b8 100644 --- a/Dinput8Wrapper.vcxproj.filters +++ b/Dinput8Wrapper.vcxproj.filters @@ -50,9 +50,6 @@ Game Files - - Game Files - Game Files @@ -118,7 +115,6 @@ Game Files - @@ -162,9 +158,6 @@ Game Files - - Game Files - Game Files @@ -241,9 +234,6 @@ Common Header Files - - Common Header Files - Common Header Files diff --git a/DllMain.cpp b/DllMain.cpp index 490afa7..49d1896 100644 --- a/DllMain.cpp +++ b/DllMain.cpp @@ -32,8 +32,6 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>. #include "Game Files/Daytona3.h" #include "Game Files/FordRacing.h" #include "Game Files/FordRacingOther.h" -#include "Game Files/FNF.h" -#include "Game Files/GRID.h" #include "Game Files/InitialD4.h" #include "Game Files/InitialD4Japan.h" #include "Game Files/InitialD5.h" @@ -795,19 +793,10 @@ HRESULT WINAPI DirectInputDirectInputCreateEx(HINSTANCE hinst, DWORD dwVersion, // DINPUT8 WRAPPER HRESULT WINAPI DirectInputDirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID* ppvOut, LPUNKNOWN punkOuter) { - /*wchar_t *settingsFilenameA = TEXT(".\\FFBPlugin.ini"); - int configGameIdA = GetPrivateProfileInt(TEXT("Settings"), TEXT("GameId"), 1, settingsFilenameA); - if (configGameIdA == 29) - { - return DIERR_OUTOFMEMORY; - } - else - {*/ LPVOID val; HRESULT res = originalDirectInputDirectInput8Create(hinst, dwVersion, riidltf, &val, punkOuter); *ppvOut = new DirectInputDeviceWrapper(val, (IID_IDirectInput8W == riidltf)); - return res; -// } + return res; } HRESULT WINAPI DirectInputDllRegisterServer(void) @@ -835,12 +824,6 @@ LPCDIDATAFORMAT WINAPI DirectInputGetdfDIJoystick() return originalGetdfDIJoystick(); } -__declspec(dllexport) void TPValues(float *values, int num); - -void TPValues(float *values, int num) -{ -} - // global variables SDL_Haptic* haptic; SDL_Haptic* haptic2 = NULL; @@ -903,7 +886,6 @@ const int SEGA_RALLY_3 = 6; const int FORD_RACING = 7; const int INITIAL_D_6 = 8; const int WMMT_5 = 9; -const int FNF_GAME = 10; const int MARIO_KART_GPDX = 11; const int OUTRUN_2Fake = 12; const int BG4_JP = 13; @@ -929,7 +911,6 @@ const int MAME_020664bit = 33; const int MAME_019964bit = 34; const int OUTRUN_2Real = 35; const int Button_Rumble64bit = 36; -const int GRID_ = 37; const int FORD_RACING_OTHER = 38; const int KO_Drive = 39; @@ -1683,7 +1664,7 @@ void TriggerSpringEffect(double strength) DWORD WINAPI FFBLoop(LPVOID lpParam) { hlp.log("In FFBLoop"); - Sleep(2500); + //Sleep(2500); NOT SURE IF THIS IS NECESSARY, IF CAUSES ISSUES THEN UNDO SDL_HapticStopAll(haptic); Initialize(0); hlp.log("Initialize() complete"); @@ -1716,12 +1697,6 @@ DWORD WINAPI FFBLoop(LPVOID lpParam) case DAYTONA_3: game = new Daytona3; break; - case FNF_GAME: - game = new FNF; - break; - case GRID_: - game = new GRID; - break; case FORD_RACING: game = new FordRacing; break; @@ -2671,6 +2646,7 @@ if (currentLibrary == lib::winmm) // this doesn't seem to really work...hmm...if i ALT+F4, then the program quits and haptic is still set. // try setting GameId to HEAVY (-5 or -6..can't remember) and then force quit. Wheel will stay heavy :/. if (haptic) { + SDL_HapticStopEffect(haptic, effects.effect_id); SDL_HapticStopEffect(haptic, effects.effect_left_id); SDL_HapticStopEffect(haptic, effects.effect_right_id); SDL_HapticStopEffect(haptic, effects.effect_friction_id); diff --git a/Game Files/FNF.cpp b/Game Files/FNF.cpp deleted file mode 100644 index 14ec72c..0000000 --- a/Game Files/FNF.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/*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 -#include "FNF.h" - -void FNF::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers) -{ -} \ No newline at end of file diff --git a/Game Files/FNF.h b/Game Files/FNF.h deleted file mode 100644 index 6611e87..0000000 --- a/Game Files/FNF.h +++ /dev/null @@ -1,21 +0,0 @@ -/*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/>. -*/ - -#pragma once -#include "../Common Files/Game.h" -class FNF : public Game { - int lastWasStop = 0; - - public: - void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); -}; \ No newline at end of file diff --git a/Game Files/GRID.cpp b/Game Files/GRID.cpp deleted file mode 100644 index 63b5164..0000000 --- a/Game Files/GRID.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*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 "GRID.h" -#include -#include - -static bool __stdcall Out32(int a2, DWORD BytesReturned) -{ - static char test[256]; - memset(test, 0, 256); - sprintf(test, "hex print: %08X", BytesReturned); - OutputDebugStringA(test); - return 0; -} - -static bool Hook(void * toHook, void * ourFunct, int len) { - if (len < 5) { - return false; - } - - DWORD curProtection; - VirtualProtect(toHook, len, PAGE_EXECUTE_READWRITE, &curProtection); - - memset(toHook, 0x90, len); - - DWORD relativeAddress = ((DWORD)ourFunct - (DWORD)toHook) - 5; - - *(BYTE*)toHook = 0xE9; - *(DWORD*)((DWORD)toHook + 1) = relativeAddress; - - DWORD temp; - VirtualProtect(toHook, len, curProtection, &temp); - - return true; -} - -static DWORD jmpBackAddy; - -void GRID::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectTriggers * triggers) -{ - bool init = false; - HMODULE hMod = GetModuleHandleA("inpout32.dll"); - if (hMod) - { - if (!init) - { - int hookLength = 6; - DWORD hookAddress = (DWORD)GetProcAddress(GetModuleHandle(L"inpout32.dll"), "Out32"); - if (hookAddress) - { - jmpBackAddy = hookAddress + hookLength; - Hook((void*)hookAddress, Out32, hookLength); - init = true; - } - - } - } -} \ No newline at end of file diff --git a/Game Files/GRID.h b/Game Files/GRID.h deleted file mode 100644 index aae01f8..0000000 --- a/Game Files/GRID.h +++ /dev/null @@ -1,20 +0,0 @@ -/*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/>. -*/ - -#pragma once -#include "../Common Files/Game.h" - -class GRID : public Game { -public: - void FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers); -}; diff --git a/dinput8.def b/dinput8.def index dabe8b0..9e400c3 100644 --- a/dinput8.def +++ b/dinput8.def @@ -653,6 +653,4 @@ EXPORTS sndPlaySoundA = _sndPlaySoundA sndPlaySoundW = _sndPlaySoundW WOWAppExit = _WOWAppExit - mmsystemGetVersion = _mmsystemGetVersion - - TPValues = TPValues \ No newline at end of file + mmsystemGetVersion = _mmsystemGetVersion \ No newline at end of file