Skip to content

Commit

Permalink
Added check for Windows version before initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
araghon007 committed Apr 10, 2019
1 parent adc94c9 commit b68ed39
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Source/WindowsGamingInput/Private/WindowsGamingInputBPLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,24 @@ BOOL CALLBACK InitHandleFunction(

#pragma endregion

bool CompatibilityCheck() {
OSVERSIONINFOEX info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFO)& info);

if (info.dwMajorVersion >= 10) {
return true;
}
else {
return false;
}
}

UWindowsGamingInputBPLibrary::UWindowsGamingInputBPLibrary(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{

InitializeGamepad();
if (CompatibilityCheck()) InitializeGamepad();
}

bool UWindowsGamingInputBPLibrary::ApplyVibration(int ControllerIndex, float LeftTrigger, float RightTrigger, float LeftMotor, float RightMotor)
Expand All @@ -306,17 +319,6 @@ bool UWindowsGamingInputBPLibrary::ApplyVibration(int ControllerIndex, float Lef
}

bool UWindowsGamingInputBPLibrary::Compatibility() {
OSVERSIONINFOEX info;
ZeroMemory(&info, sizeof(OSVERSIONINFOEX));
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
GetVersionEx((LPOSVERSIONINFO)& info);

if (info.dwMajorVersion >= 10) {
return true;
}
else {
return false;
}
return CompatibilityCheck();
}


0 comments on commit b68ed39

Please sign in to comment.