Fix lots of issues
This commit is contained in:
parent
2335620c7a
commit
073f313edb
119
DllMain.cpp
119
DllMain.cpp
@ -931,6 +931,7 @@ int ResetFFBStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ResetFFBStre
|
||||
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);
|
||||
|
||||
extern void DefaultConfigValues();
|
||||
extern void CustomFFBStrengthSetup();
|
||||
@ -939,6 +940,7 @@ char chainedDLL[256];
|
||||
static char FFBStrength1[256];
|
||||
static wchar_t FFBStrength2[256];
|
||||
|
||||
SDL_Event e;
|
||||
HRESULT hr;
|
||||
CComPtr<ISpVoice> cpVoice;
|
||||
|
||||
@ -1928,16 +1930,6 @@ void TriggerSpringEffect(double strength)
|
||||
TriggerSpringEffectWithDefaultOption(strength, false);
|
||||
}
|
||||
|
||||
void changeVolume()
|
||||
{
|
||||
INPUT ip = { 0 };
|
||||
ip.type = INPUT_KEYBOARD;
|
||||
ip.ki.wVk = VK_VOLUME_MUTE;
|
||||
SendInput(1, &ip, sizeof(INPUT));
|
||||
ip.ki.dwFlags = KEYEVENTF_KEYUP;
|
||||
SendInput(1, &ip, sizeof(INPUT));
|
||||
}
|
||||
|
||||
int WorkaroundToFixRumble(void* ptr)
|
||||
{
|
||||
SDL_Event e;
|
||||
@ -1968,11 +1960,9 @@ DWORD WINAPI AdjustFFBStrengthLoop(LPVOID lpParam)
|
||||
Sleep(3000);
|
||||
CustomFFBStrengthSetup();
|
||||
|
||||
SDL_Event e;
|
||||
|
||||
while (true)
|
||||
{
|
||||
while (SDL_WaitEvent(&e) != 0)
|
||||
if ((InputDeviceWheelEnable != 1) && (configGameId == 1) || (configGameId == 9) || (configGameId == 12) || (configGameId == 28) || (configGameId == 29) || (configGameId == 35)) while (SDL_WaitEvent(&e) != 0)
|
||||
{
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
@ -2066,6 +2056,100 @@ DWORD WINAPI AdjustFFBStrengthLoop(LPVOID lpParam)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.type == SDL_JOYBUTTONDOWN)
|
||||
{
|
||||
if (e.jbutton.which == joystick_index1)
|
||||
{
|
||||
if (e.jbutton.button == IncreaseFFBStrength)
|
||||
{
|
||||
if (AlternativeFFB == 1)
|
||||
{
|
||||
if ((configAlternativeMaxForceRight >= 0) && (configAlternativeMaxForceRight < 100))
|
||||
{
|
||||
configAlternativeMaxForceRight += StepFFBStrength;
|
||||
configAlternativeMaxForceRight = max(0, min(100, configAlternativeMaxForceRight));
|
||||
}
|
||||
if ((configAlternativeMaxForceLeft <= 0) && (configAlternativeMaxForceLeft > -100))
|
||||
{
|
||||
configAlternativeMaxForceLeft -= StepFFBStrength;
|
||||
configAlternativeMaxForceLeft = max(-100, min(0, configAlternativeMaxForceLeft));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((configMaxForce >= 0) && (configMaxForce < 100))
|
||||
{
|
||||
configMaxForce += StepFFBStrength;
|
||||
configMaxForce = max(0, min(100, configMaxForce));
|
||||
}
|
||||
}
|
||||
WritePersistentMaxForce();
|
||||
}
|
||||
|
||||
if (e.jbutton.button == DecreaseFFBStrength)
|
||||
{
|
||||
if (AlternativeFFB == 1)
|
||||
{
|
||||
if ((configAlternativeMaxForceRight > 0) && (configAlternativeMaxForceRight <= 100))
|
||||
{
|
||||
configAlternativeMaxForceRight -= StepFFBStrength;
|
||||
configAlternativeMaxForceRight = max(0, min(100, configAlternativeMaxForceRight));
|
||||
}
|
||||
if ((configAlternativeMaxForceLeft < 0) && (configAlternativeMaxForceLeft >= -100))
|
||||
{
|
||||
configAlternativeMaxForceLeft += StepFFBStrength;
|
||||
configAlternativeMaxForceLeft = max(-100, min(0, configAlternativeMaxForceLeft));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((configMaxForce > 0) && (configMaxForce <= 100))
|
||||
{
|
||||
configMaxForce -= StepFFBStrength;
|
||||
configMaxForce = max(0, min(100, configMaxForce));
|
||||
}
|
||||
}
|
||||
WritePersistentMaxForce();
|
||||
}
|
||||
|
||||
if (e.jbutton.button == ResetFFBStrength)
|
||||
{
|
||||
DefaultConfigValues();
|
||||
WritePersistentMaxForce();
|
||||
}
|
||||
|
||||
if (EnableFFBStrengthTextToSpeech == 1)
|
||||
{
|
||||
if ((e.jbutton.button == IncreaseFFBStrength) || (e.jbutton.button == DecreaseFFBStrength) || (e.jbutton.button == ResetFFBStrength))
|
||||
{
|
||||
if (AlternativeFFB == 1)
|
||||
{
|
||||
sprintf(FFBStrength1, "Max Force: %d", configAlternativeMaxForceRight);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(FFBStrength1, "Max Force: %d", configMaxForce);
|
||||
}
|
||||
|
||||
hr = ::CoInitialize(nullptr);
|
||||
hr = cpVoice.CoCreateInstance(CLSID_SpVoice);
|
||||
mbstowcs(FFBStrength2, FFBStrength1, strlen(FFBStrength1) + 1);
|
||||
LPWSTR ptr = FFBStrength2;
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = cpVoice->SetRate(3);
|
||||
hr = cpVoice->SetOutput(NULL, TRUE);
|
||||
hr = cpVoice->Speak(ptr, SPF_PURGEBEFORESPEAK, NULL);
|
||||
::CoUninitialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sleep(16);
|
||||
}
|
||||
}
|
||||
@ -2083,7 +2167,7 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
|
||||
hlp.log("Initialize() complete");
|
||||
if (EnableRumble == 1)
|
||||
{
|
||||
if (EnableFFBStrengthDynamicAdjustment != 1)
|
||||
if ((EnableFFBStrengthDynamicAdjustment != 1) && (InputDeviceWheelEnable != 1))
|
||||
{
|
||||
if ((configGameId != 1) && (configGameId != 9) && (configGameId != 12) && (configGameId != 26) && (configGameId != 28) && (configGameId != 29) && (configGameId != 30) && (configGameId != 31) && (configGameId != 35))
|
||||
{
|
||||
@ -2397,13 +2481,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
|
||||
{
|
||||
gl_cgGLDll = LoadLibraryA("cgGL.dll");
|
||||
}
|
||||
if (configGameId == 26)
|
||||
{
|
||||
if (AutoCloseWindowError == 1)
|
||||
{
|
||||
changeVolume();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ extern int joystick_index2;
|
||||
extern SDL_Joystick* GameController2;
|
||||
extern SDL_Haptic* ControllerHaptic2;
|
||||
extern SDL_Haptic* haptic2;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||
|
@ -22,7 +22,7 @@ static bool init = false;
|
||||
static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||
static int ChangeGearsViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("ChangeGearsViaPlugin"), 0, settingsFilename);
|
||||
|
@ -36,7 +36,6 @@ extern void SmashingDriveInputsEnabled(Helpers* helpers);
|
||||
extern void ATVTrackInputsEnabled(Helpers* helpers);
|
||||
extern void FasterThanSpeedInputsEnabled(Helpers* helpers);
|
||||
extern void MaximumSpeedInputsEnabled(Helpers* helpers);
|
||||
extern void changeVolume();
|
||||
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
@ -507,11 +506,9 @@ static DWORD WINAPI MaximumSpeedRunningLoop(LPVOID lpParam)
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD WINAPI VolumeMuteThread(LPVOID lpParam)
|
||||
static DWORD WINAPI CloseErrorThread(LPVOID lpParam)
|
||||
{
|
||||
SendMessage(hWnd, WM_CLOSE, NULL, NULL);
|
||||
Sleep(1500);
|
||||
changeVolume();
|
||||
VolumeMute = true;
|
||||
return 0;
|
||||
}
|
||||
@ -554,7 +551,7 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
hWnd = FindWindowA(0, ("padDemul"));
|
||||
if (hWnd > NULL)
|
||||
{
|
||||
CreateThread(NULL, 0, VolumeMuteThread, NULL, 0, NULL);
|
||||
CreateThread(NULL, 0, CloseErrorThread, NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -694,10 +691,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectNascarRacing;
|
||||
ForceSpringStrength = ForceSpringStrengthNascarRacing;
|
||||
|
||||
NascarRunning = true;
|
||||
WindowSearch = true;
|
||||
romnameDemul = "Nascar";
|
||||
|
||||
sprintf(romnameDemul, "%s", Nascar);
|
||||
NascarRunning = true;
|
||||
WindowSearch = true;
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring2))
|
||||
@ -713,10 +710,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectInitialDDemul;
|
||||
ForceSpringStrength = ForceSpringStrengthInitialDDemul;
|
||||
|
||||
InitialDRunning = true;
|
||||
WindowSearch = true;
|
||||
romnameDemul = "Initial D Arcade Stage";
|
||||
|
||||
sprintf(romnameDemul, "%s", InitialDArcadeStage);
|
||||
InitialDRunning = true;
|
||||
WindowSearch = true;
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring3))
|
||||
@ -732,10 +729,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectSmashingDrive;
|
||||
ForceSpringStrength = ForceSpringStrengthSmashingDrive;
|
||||
|
||||
SmashingDriveRunning = true;
|
||||
WindowSearch = true;
|
||||
romnameDemul = "Smashing Drive";
|
||||
|
||||
sprintf(romnameDemul, "%s", SmashingDrive);
|
||||
SmashingDriveRunning = true;
|
||||
WindowSearch = true;
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring4))
|
||||
@ -751,10 +748,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectMaximumSpeed;
|
||||
ForceSpringStrength = ForceSpringStrengthMaximumSpeed;
|
||||
|
||||
romnameDemul = "Maximum Speed";
|
||||
|
||||
MaximumSpeedRunning = true;
|
||||
WindowSearch = true;
|
||||
|
||||
sprintf(romnameDemul, "%s", MaximumSpeed);
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring5))
|
||||
@ -770,10 +767,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectFasterSpeed;
|
||||
ForceSpringStrength = ForceSpringStrengthFasterSpeed;
|
||||
|
||||
romnameDemul = "Faster Than Speed";
|
||||
|
||||
FasterThanSpeedRunning = true;
|
||||
WindowSearch = true;
|
||||
|
||||
sprintf(romnameDemul, "%s", FasterThanSpeed);
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)substring6))
|
||||
@ -789,10 +786,10 @@ void Demul::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers
|
||||
EnableForceSpringEffect = EnableForceSpringEffectATVTrack;
|
||||
ForceSpringStrength = ForceSpringStrengthATVTrack;
|
||||
|
||||
romnameDemul = "ATV Track";
|
||||
|
||||
ATVTrackRunning = true;
|
||||
WindowSearch = true;
|
||||
|
||||
sprintf(romnameDemul, "%s", ATVTrack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ static bool brakepressed;
|
||||
static bool emergencystopA;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
static int SteeringValue;
|
||||
static int BrakeValue;
|
||||
|
@ -15,7 +15,7 @@ static bool shiftdownA;
|
||||
static bool coinA;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
extern INT_PTR SteeringAddress;
|
||||
extern INT_PTR AcclAddress;
|
||||
|
@ -15,7 +15,7 @@ static bool shiftdownA;
|
||||
static bool coinA;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
extern INT_PTR SteeringAddress;
|
||||
extern INT_PTR AcclAddress;
|
||||
|
@ -14,7 +14,7 @@ static bool shiftdownA;
|
||||
static bool coinA;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
extern INT_PTR SteeringAddress;
|
||||
extern INT_PTR AcclAddress;
|
||||
|
@ -15,7 +15,7 @@ static bool shiftdownA;
|
||||
static bool coinA;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
extern INT_PTR SteeringAddress;
|
||||
extern INT_PTR AcclAddress;
|
||||
|
@ -16,7 +16,7 @@ static bool acclpressed;
|
||||
static bool brakepressed;
|
||||
static bool Inputsinit = false;
|
||||
static bool InputFind = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
extern INT_PTR SteeringAddress;
|
||||
extern INT_PTR AcclAddress;
|
||||
|
@ -28,7 +28,6 @@ extern HINSTANCE gl_cgGLDll;
|
||||
static bool HealthA = false;
|
||||
static bool HealthB = false;
|
||||
static bool init = false;
|
||||
SDL_Event e;
|
||||
|
||||
static int ThreadLoop()
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
static bool init = false;
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
static int ShowButtonNumbersForSetup = GetPrivateProfileInt(TEXT("Settings"), TEXT("ShowButtonNumbersForSetup"), 0, settingsFilename);
|
||||
|
@ -18,7 +18,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
static EffectTriggers *myTriggers;
|
||||
static EffectConstants *myConstants;
|
||||
static Helpers *myHelpers;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
static bool init = false;
|
||||
static int SpeedStrength;
|
||||
static wchar_t *settingsFilename = TEXT(".\\FFBPlugin.ini");
|
||||
|
@ -34,7 +34,7 @@ static bool leverleftA;
|
||||
static bool leverrightA;
|
||||
static bool stophack;
|
||||
static bool init = false;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
|
||||
static void MEMwrite(void *adr, void *ptr, int size)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
static EffectTriggers* myTriggers;
|
||||
static EffectConstants* myConstants;
|
||||
static Helpers* myHelpers;
|
||||
static SDL_Event e;
|
||||
extern SDL_Event e;
|
||||
static UINT8 oldgear = 0;
|
||||
static bool init = false;
|
||||
static bool gameFfbStarted = false;
|
||||
|
Loading…
Reference in New Issue
Block a user