1
0
mirror of synced 2025-02-17 18:59:24 +01:00

Use ExitProcess over TerminateProcess

This commit is contained in:
Aaron M 2020-01-05 22:21:12 +13:00
parent 3fe164e996
commit aa9e32b59a
6 changed files with 29 additions and 26 deletions

View File

@ -173,6 +173,7 @@ FeedbackLength=80
PowerMode=0
EnableForceSpringEffect=0
ForceSpringStrength=70
EscapeKeyExitViaPlugin=0
[InitialD 4]
GameId=16

View File

@ -2934,6 +2934,24 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
hlp.log((char*)processName.c_str());
keepRunning = false;
if (haptic > 0)
{
SDL_HapticStopAll(haptic);
SDL_HapticClose(haptic); // release the haptic device / clean-up.
}
if (haptic2 > 0)
{
SDL_HapticStopAll(haptic2);
SDL_HapticClose(haptic2);
}
if (haptic3 > 0)
{
SDL_HapticStopAll(haptic3);
SDL_HapticClose(haptic3);
}
if (gl_hOriginalDll)
{
FreeLibrary(gl_hOriginalDll);
@ -2964,7 +2982,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
if (EnableRumble == 1)
{
SDL_JoystickRumble(GameController, 0, 0, 0);
}
}
}
if (GameController2)
@ -2974,28 +2992,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
SDL_JoystickRumble(GameController2, 0, 0, 0);
}
}
// 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_constant_id);
SDL_HapticStopEffect(haptic, effects.effect_friction_id);
SDL_HapticStopEffect(haptic, effects.effect_leftright_id);
SDL_HapticStopEffect(haptic, effects.effect_sine_id);
SDL_HapticStopEffect(haptic, effects.effect_spring_id);
SDL_HapticStopEffect(haptic, effects.effect_vibration_id);
SDL_HapticStopAll(haptic);
SDL_HapticClose(haptic); // release the haptic device / clean-up.
}
if (haptic2)
{
SDL_HapticStopEffect(haptic2, effects.effect_sine_id_device2);
SDL_HapticStopAll(haptic2);
SDL_HapticClose(haptic2);
}
break;
}

View File

@ -62,7 +62,7 @@ void AliensExtermination::FFBLoop(EffectConstants* constants, Helpers* helpers,
{
if (hWnd > NULL)
{
TerminateProcess(GetCurrentProcess(), 0);
ExitProcess(0);
}
}
if (!init)

View File

@ -125,7 +125,7 @@ void Daytona3::FFBLoop(EffectConstants *constants, Helpers *helpers, EffectTrigg
{
//SendMessage(hWnd, WM_CLOSE, NULL, NULL);
system("taskkill /f /im InpWrapper.exe");
TerminateProcess(GetCurrentProcess(), 0);
ExitProcess(0);
}
}

View File

@ -18,9 +18,15 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
void InitialD0::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0);
}
UINT8 ff = helpers->ReadByte(0x168317F, true);
UINT8 static oldff = 0;
UINT8 newff = ff;

View File

@ -27,7 +27,7 @@ static bool init = false;
static bool __stdcall ExitHook(UINT uExitCode)
{
TerminateProcess(GetCurrentProcess(), 0);
ExitProcess(0);
return 0;
}