1
0
mirror of synced 2024-11-23 22:40:57 +01:00

Removed unnecssary code for cleanup

Removing Sleep when launching game COULD cause issues, test before release version on a few games
This commit is contained in:
Aaron M 2019-10-05 14:15:44 +13:00
parent e10bc8c048
commit 27635a710d
9 changed files with 4 additions and 173 deletions

Binary file not shown.

View File

@ -21,7 +21,6 @@
<ItemGroup>
<ClInclude Include="Game Files\FordRacingOther.h" />
<ClInclude Include="Game Files\ButtonRumble64bit.h" />
<ClInclude Include="Game Files\GRID.h" />
<ClInclude Include="Game Files\KODrive.h" />
<ClInclude Include="Game Files\OutRun2Real.h" />
<ClInclude Include="Game Files\Mame019964bit.h" />
@ -47,7 +46,6 @@
<ItemGroup>
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
<ClCompile Include="Game Files\OutRun2Real.cpp" />
<ClCompile Include="Game Files\Mame019964bit.cpp" />
@ -72,7 +70,6 @@
<ClCompile Include="Game Files\SegaRally3.cpp" />
<ClCompile Include="Game Files\SegaRacingClassic.cpp" />
<ClCompile Include="Game Files\FordRacing.cpp" />
<ClCompile Include="Game Files\FNF.cpp" />
<ClCompile Include="Game Files\MarioKartGPDX.cpp" />
<ClCompile Include="Game Files\SonicSegaAllStarsRacing.cpp" />
<ClCompile Include="Game Files\TestGame.cpp" />
@ -106,7 +103,6 @@
<ClInclude Include="Game Files\SegaRally3.h" />
<ClInclude Include="Game Files\SegaRacingClassic.h" />
<ClInclude Include="Game Files\FordRacing.h" />
<ClInclude Include="Game Files\FNF.h" />
<ClInclude Include="Game Files\MarioKartGPDX.h" />
<ClInclude Include="Game Files\SonicSegaAllStarsRacing.h" />
<ClInclude Include="Game Files\TestGame.h" />

View File

@ -50,9 +50,6 @@
<ClCompile Include="Game Files\MarioKartGPDX.cpp">
<Filter>Game Files</Filter>
</ClCompile>
<ClCompile Include="Game Files\FNF.cpp">
<Filter>Game Files</Filter>
</ClCompile>
<ClCompile Include="Game Files\BG4JP.cpp">
<Filter>Game Files</Filter>
</ClCompile>
@ -118,7 +115,6 @@
<Filter>Game Files</Filter>
</ClCompile>
<ClCompile Include="Game Files\ButtonRumble64bit.cpp" />
<ClCompile Include="Game Files\GRID.cpp" />
<ClCompile Include="Game Files\FordRacingOther.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
</ItemGroup>
@ -162,9 +158,6 @@
<ClInclude Include="Game Files\MarioKartGPDX.h">
<Filter>Game Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\FNF.h">
<Filter>Game Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\BG4JP.h">
<Filter>Game Files</Filter>
</ClInclude>
@ -241,9 +234,6 @@
<ClInclude Include="Game Files\ButtonRumble64bit.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\GRID.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\FordRacingOther.h">
<Filter>Common Header Files</Filter>
</ClInclude>

View File

@ -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);

View File

@ -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 <string>
#include "FNF.h"
void FNF::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTriggers* triggers)
{
}

View File

@ -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);
};

View File

@ -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 <Windows.h>
#include <string>
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;
}
}
}
}

View File

@ -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);
};

View File

@ -653,6 +653,4 @@ EXPORTS
sndPlaySoundA = _sndPlaySoundA
sndPlaySoundW = _sndPlaySoundW
WOWAppExit = _WOWAppExit
mmsystemGetVersion = _mmsystemGetVersion
TPValues = TPValues
mmsystemGetVersion = _mmsystemGetVersion