Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ois for openSUSE:Factory checked in at 2026-04-20 16:13:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ois (Old) and /work/SRC/openSUSE:Factory/.ois.new.11940 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ois" Mon Apr 20 16:13:09 2026 rev:6 rq:1347680 version:1.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ois/ois.changes 2021-06-19 23:05:08.283865444 +0200 +++ /work/SRC/openSUSE:Factory/.ois.new.11940/ois.changes 2026-04-20 16:13:16.690069124 +0200 @@ -1,0 +2,14 @@ +Thu Apr 16 16:17:29 UTC 2026 - Carsten Ziepke <[email protected]> + +- Update to version 1.6.0 + * Fix typos + * don't wrap not moved linux mouse + * Add rudimentary XInput vibration support + * Fix Win32 build without XInput support + * Linux: scan all /dev/input/event* files for joysticks + * Update CMakeLists.txt + * Support Unicode character set + * Update README.md + * Require CMake 3.10 or newer + +------------------------------------------------------------------- Old: ---- OIS-1.5.1.tar.gz New: ---- OIS-1.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ois.spec ++++++ --- /var/tmp/diff_new_pack.BfbzUg/_old 2026-04-20 16:13:17.286094013 +0200 +++ /var/tmp/diff_new_pack.BfbzUg/_new 2026-04-20 16:13:17.290094180 +0200 @@ -1,7 +1,7 @@ # # spec file for package ois # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2026 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,9 +16,9 @@ # -%define sover 1_5_0 +%define sover 1_6_0 Name: ois -Version: 1.5.1 +Version: 1.6.0 Release: 0 Summary: Object Oriented Input System License: Zlib @@ -61,11 +61,7 @@ %build %cmake \ -%if 0%{?sle_version} == 150200 - -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} \ -%endif -DOIS_BUILD_SHARED_LIBS=ON -%cmake_build %install %cmake_install ++++++ OIS-1.5.1.tar.gz -> OIS-1.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/CMakeLists.txt new/OIS-1.6.0/CMakeLists.txt --- old/OIS-1.5.1/CMakeLists.txt 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/CMakeLists.txt 2026-02-27 11:57:49.000000000 +0100 @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) project(OIS) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CmakeModules) @@ -10,8 +10,8 @@ endif() set(OIS_MAJOR_VERSION 1) -set(OIS_MINOR_VERSION 5) -set(OIS_PATCH_VERSION 1) +set(OIS_MINOR_VERSION 6) +set(OIS_PATCH_VERSION 0) set(OIS_VERSION ${OIS_MAJOR_VERSION}.${OIS_MINOR_VERSION}.${OIS_PATCH_VERSION}) set(OIS_COMPATIBILITY_VERSION ${OIS_MAJOR_VERSION}.${OIS_MINOR_VERSION}.0) @@ -72,38 +72,61 @@ if (WIN32) option(OIS_WIN32_XINPUT_SUPPORT "Add support XInput." ON) - if(CMAKE_CROSSCOMPILING) - MESSAGE(STATUS "Cross-compiling ... search libraries instead of WindowsSDK") - find_library(DINPUT8_LIBRARY NAMES libdinput8.a dinput8.lib) - find_library(XINPUT8_LIBRARY NAMES libxinput.a) - find_library(DXGUID_LIBRARY NAMES libdxguid.a) - if (NOT DINPUT8_LIBRARY) - MESSAGE(FATAL_ERROR " could not locate dinput8 DirectX library") + if ("${CMAKE_CXX_PLATFORM_ID}" STREQUAL "MinGW") + # Directly specify the MinGW DirectX library paths + set(DINPUT8_LIBRARY "$ENV{MSYSTEM_PREFIX}/lib/libdinput8.a") + set(XINPUT8_LIBRARY "$ENV{MSYSTEM_PREFIX}/lib/libxinput.a") + set(DXGUID_LIBRARY "$ENV{MSYSTEM_PREFIX}/lib/libdxguid.a") + + if (NOT EXISTS ${DINPUT8_LIBRARY}) + MESSAGE(FATAL_ERROR "Could not locate dinput8 DirectX library") endif() - if (NOT XINPUT8_LIBRARY) - MESSAGE(FATAL_ERROR " could not locate xinput DirectX library") + if (NOT EXISTS ${XINPUT8_LIBRARY}) + MESSAGE(FATAL_ERROR "Could not locate xinput DirectX library") endif() - if (NOT DXGUID_LIBRARY) - MESSAGE(FATAL_ERROR " could not locate dxguid DirectX library") + if (NOT EXISTS ${DXGUID_LIBRARY}) + MESSAGE(FATAL_ERROR "Could not locate dxguid DirectX library") endif() - MESSAGE(STATUS " using " ${DINPUT8_LIBRARY} ", " ${XINPUT8_LIBRARY} " and " ${DXGUID_LIBRARY}) - else() - find_package(WindowsSDK) - # I'm assuming that this will be set under all normal circumstances - # if not, the user can set it themselves - if(WINDOWSSDK_FOUND) - set(OIS_WIN32_DXSDK_DIR ${WINDOWSSDK_PREFERRED_DIR} CACHE PATH "Location of the DirectX SDK on your system.") - else() - set(OIS_WIN32_DXSDK_DIR "$ENV{DXSDK_DIR}" CACHE PATH "Location of the DirectX SDK on your system.") + + MESSAGE(STATUS "Using ${DINPUT8_LIBRARY}, ${XINPUT8_LIBRARY} and ${DXGUID_LIBRARY}") + + if(BUILD_SHARED_LIBS) + add_definitions(-DOIS_DYNAMIC_LIB) endif() - if("${OIS_WIN32_DXSDK_DIR}" STREQUAL "") - MESSAGE(FATAL_ERROR "Could not locate DirectX SDK on this system") + else() + # Existing code for non-MinGW platforms + if(CMAKE_CROSSCOMPILING) + MESSAGE(STATUS "Cross-compiling ... search libraries instead of WindowsSDK") + find_library(DINPUT8_LIBRARY NAMES libdinput8.a dinput8.lib) + find_library(XINPUT8_LIBRARY NAMES libxinput.a) + find_library(DXGUID_LIBRARY NAMES libdxguid.a) + if (NOT DINPUT8_LIBRARY) + MESSAGE(FATAL_ERROR "Could not locate dinput8 DirectX library") + endif() + if (NOT XINPUT8_LIBRARY) + MESSAGE(FATAL_ERROR "Could not locate xinput DirectX library") + endif() + if (NOT DXGUID_LIBRARY) + MESSAGE(FATAL_ERROR "Could not locate dxguid DirectX library") + endif() + MESSAGE(STATUS "Using ${DINPUT8_LIBRARY}, ${XINPUT8_LIBRARY} and ${DXGUID_LIBRARY}") else() - MESSAGE(STATUS "Found DirectX SDK at ${OIS_WIN32_DXSDK_DIR}") - endif() + find_package(WindowsSDK) + if(WINDOWSSDK_FOUND) + set(OIS_WIN32_DXSDK_DIR ${WINDOWSSDK_PREFERRED_DIR} CACHE PATH "Location of the DirectX SDK on your system.") + else() + set(OIS_WIN32_DXSDK_DIR "$ENV{DXSDK_DIR}" CACHE PATH "Location of the DirectX SDK on your system.") + endif() + + if("${OIS_WIN32_DXSDK_DIR}" STREQUAL "") + MESSAGE(FATAL_ERROR "Could not locate DirectX SDK on this system") + else() + MESSAGE(STATUS "Found DirectX SDK at ${OIS_WIN32_DXSDK_DIR}") + endif() - include_directories("${OIS_WIN32_DXSDK_DIR}/Include") + include_directories("${OIS_WIN32_DXSDK_DIR}/Include") + endif() endif() if(BUILD_SHARED_LIBS) @@ -170,25 +193,31 @@ endif() if (WIN32) - if (CMAKE_CL_64) - set(DIRECTX_ARCH x64) + if ("${CMAKE_CXX_PLATFORM_ID}" STREQUAL "MinGW") + # Directly specify the MinGW DirectX library paths + link_directories("$ENV{MSYSTEM_PREFIX}/lib") + target_link_libraries(OIS "$ENV{MSYSTEM_PREFIX}/lib/libdinput8.a" "$ENV{MSYSTEM_PREFIX}/lib/libxinput.a" "$ENV{MSYSTEM_PREFIX}/lib/libdxguid.a") else() - set(DIRECTX_ARCH x86) - endif() + if (CMAKE_CL_64) + set(DIRECTX_ARCH x64) + else() + set(DIRECTX_ARCH x86) + endif() - if (WINDOWSSDK_FOUND) - target_link_libraries(OIS "dinput8.lib" "dxguid.lib") - elseif(CMAKE_CROSSCOMPILING) - target_link_libraries(OIS "${DINPUT8_LIBRARY}" "${XINPUT8_LIBRARY}" "${DXGUID_LIBRARY}") - else() - target_link_libraries(OIS "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dinput8.lib" "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dxguid.lib") + if (WINDOWSSDK_FOUND) + target_link_libraries(OIS "dinput8.lib" "dxguid.lib") + elseif(CMAKE_CROSSCOMPILING) + target_link_libraries(OIS "${DINPUT8_LIBRARY}" "${XINPUT8_LIBRARY}" "${DXGUID_LIBRARY}") + else() + target_link_libraries(OIS "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dinput8.lib" "${DXSDK_DIR}/Lib/${DIRECTX_ARCH}/dxguid.lib") + endif() endif() endif() + if(UNIX) if (NOT APPLE) - add_dependencies(OIS X11) target_link_libraries(OIS X11) endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/README.md new/OIS-1.6.0/README.md --- old/OIS-1.5.1/README.md 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/README.md 2026-02-27 11:57:49.000000000 +0100 @@ -9,7 +9,7 @@ [](https://repology.org/metapackage/ois) Cross Platform Object Oriented Input Lib System. Meant to be very robust and -compatiable with many systems and operating systems. +compatible with many systems and operating systems. ### Linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/docs/index.md new/OIS-1.6.0/docs/index.md --- old/OIS-1.5.1/docs/index.md 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/docs/index.md 2026-02-27 11:57:49.000000000 +0100 @@ -7,9 +7,9 @@ [](http://makeapullrequest.com) Cross Platform Object Oriented Input Lib System. Meant to be very robust and -compatiable with many systems and operating systems. +compatible with many systems and operating systems. - - [Doxygen doumentation](doxygen/html/) + - [Doxygen documentation](doxygen/html/) - [News](./news) ### Linux diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/includes/win32/Win32ForceFeedback.h new/OIS-1.6.0/includes/win32/Win32ForceFeedback.h --- old/OIS-1.5.1/includes/win32/Win32ForceFeedback.h 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/includes/win32/Win32ForceFeedback.h 2026-02-27 11:57:49.000000000 +0100 @@ -38,6 +38,7 @@ public: Win32ForceFeedback(IDirectInputDevice8* pDIJoy, const DIDEVCAPS* pDIJoyCaps); + Win32ForceFeedback(unsigned int xInputIndex); ~Win32ForceFeedback(); /** @copydoc ForceFeedback::upload */ @@ -83,6 +84,11 @@ void _updateConditionalEffect(const Effect* effect); void _updateCustomEffect(const Effect* effect); + //XInput-specific methods + bool _isXInput(); + void _setXInputVibration(unsigned short leftPower, unsigned short rightPower); + void _updateXInputConstantEffect(const Effect* effect); + //Sets the common properties to all effects void _setCommonProperties(DIEFFECT* diEffect, DWORD* rgdwAxes, LONG* rglDirection, DIENVELOPE* diEnvelope, DWORD struct_size, LPVOID struct_type, const Effect* effect, const Envelope* envelope); //Actually do the upload @@ -102,6 +108,11 @@ // Joystick capabilities. const DIDEVCAPS* mpDIJoyCaps; + // An index specifying XInput device index. It will be -1 if device is DInput device. + int mXInputIndex; + // Internally setting master gain for XInput devices. + float mXInputMasterGain; + // Number of axis supporting FF. short mFFAxes; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/extras/LIRC/OISLIRCFactoryCreator.cpp new/OIS-1.6.0/src/extras/LIRC/OISLIRCFactoryCreator.cpp --- old/OIS-1.5.1/src/extras/LIRC/OISLIRCFactoryCreator.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/extras/LIRC/OISLIRCFactoryCreator.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -335,7 +335,7 @@ if(mUnusedRemotes.size() > 0) { std::vector<std::string>::iterator remote = mUnusedRemotes.end(); - if(vendor == "") + if(!vendor.length()) remote = mUnusedRemotes.begin(); else remote = std::find(mUnusedRemotes.begin(), mUnusedRemotes.end(), vendor); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/linux/LinuxInputManager.cpp new/OIS-1.6.0/src/linux/LinuxInputManager.cpp --- old/OIS-1.5.1/src/linux/LinuxInputManager.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/linux/LinuxInputManager.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -187,7 +187,7 @@ case OISJoyStick: { for(JoyStickInfoList::iterator i = unusedJoyStickList.begin(); i != unusedJoyStickList.end(); ++i) { - if(vendor == "" || i->vendor == vendor) + if(!vendor.length() || i->vendor == vendor) { obj = new LinuxJoyStick(this, bufferMode, *i); unusedJoyStickList.erase(i); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/linux/LinuxJoyStickEvents.cpp new/OIS-1.6.0/src/linux/LinuxJoyStickEvents.cpp --- old/OIS-1.5.1/src/linux/LinuxJoyStickEvents.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/linux/LinuxJoyStickEvents.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -34,6 +34,7 @@ #include "OISException.h" #include <fcntl.h> //Needed to Open a file descriptor +#include <dirent.h> #include <cassert> #include <linux/input.h> @@ -245,42 +246,53 @@ //Search through all of the event devices.. and identify which ones are joysticks //xxx move this to InputManager, as it can also scan all other events - for(int i = 0; i < 64; ++i) + DIR* dir; + struct dirent* ent; + const std::string PATH("/dev/input/"); + const std::string EVENT_FILE_NAME("event"); + + if((dir = opendir(PATH.c_str())) != NULL) { - stringstream s; - s << "/dev/input/event" << i; - int fd = open(s.str().c_str(), O_RDWR | O_NONBLOCK); - if(fd == -1) - continue; + while((ent = readdir(dir)) != NULL) + { + std::string entry(ent->d_name); + if(entry.rfind(EVENT_FILE_NAME, 0) == 0) + { + int fd = open((PATH + entry).c_str(), O_RDWR | O_NONBLOCK); + if(fd == -1) + continue; #ifdef OIS_LINUX_JOY_DEBUG - cout << "Opening " << s.str() << "..." << endl; + cout << "Opening " << path + entry << "..." << endl; #endif - try - { - JoyStickInfo js; - if(EventUtils::isJoyStick(fd, js)) - { - joys.push_back(js); + try + { + JoyStickInfo js; + if(EventUtils::isJoyStick(fd, js)) + { + joys.push_back(js); #ifdef OIS_LINUX_JOY_DEBUG - cout << "=> Joystick added to list." << endl; + cout << "=> Joystick added to list." << endl; #endif - } - else - { + } + else + { #ifdef OIS_LINUX_JOY_DEBUG - cout << "=> Not a joystick." << endl; + cout << "=> Not a joystick." << endl; #endif - close(fd); - } - } - catch(...) - { + close(fd); + } + } + catch(...) + { #ifdef OIS_LINUX_JOY_DEBUG - cout << "Exception caught!!" << endl; + cout << "Exception caught!!" << endl; #endif - close(fd); + close(fd); + } + } } + closedir(dir); } return joys; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/linux/LinuxMouse.cpp new/OIS-1.6.0/src/linux/LinuxMouse.cpp --- old/OIS-1.5.1/src/linux/LinuxMouse.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/linux/LinuxMouse.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -203,7 +203,7 @@ if(mouseFocusLost == false) { //Keep mouse in window (fudge factor) - if(event.xmotion.x < 100 || event.xmotion.x > mState.width - 100 || event.xmotion.y < 100 || event.xmotion.y > mState.height - 100) + if( (event.xmotion.x < 100 || event.xmotion.x > mState.width - 100 || event.xmotion.y < 100 || event.xmotion.y > mState.height - 100) && (dx!=0 || dy!=0) ) { oldXMouseX = mState.width >> 1; //center x oldXMouseY = mState.height >> 1; //center y diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/win32/Win32ForceFeedback.cpp new/OIS-1.6.0/src/win32/Win32ForceFeedback.cpp --- old/OIS-1.5.1/src/win32/Win32ForceFeedback.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/win32/Win32ForceFeedback.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -53,11 +53,39 @@ << "FFMinTimeResolution : " << mpDIJoyCaps->dwFFMinTimeResolution << " mu-s," << "" << endl; #endif + + //Device is DInput device, unassign XInput index + mXInputIndex = -1; +} + +//--------------------------------------------------------------// +Win32ForceFeedback::Win32ForceFeedback(unsigned int xInputIndex) +{ + mXInputIndex = xInputIndex; + mJoyStick = nullptr; + + //XInput device contains basically a single axis + _addFFAxis(); + + //XInput device supports just a simple vibration with variable power + _addEffectTypes(Effect::EForce::ConstantForce, Effect::Constant); + + // Set default master gain + setMasterGain(1.0f); } //--------------------------------------------------------------// Win32ForceFeedback::~Win32ForceFeedback() { +#ifdef OIS_WIN32_XINPUT_SUPPORT + //Just stop the vibration, if device is XInput + if(_isXInput()) + { + _setXInputVibration(0, 0); + return; + } +#endif + //Get the effect - if it exists for(EffectList::iterator i = mEffectList.begin(); i != mEffectList.end(); ++i) { @@ -81,6 +109,12 @@ //--------------------------------------------------------------// unsigned short Win32ForceFeedback::getFFMemoryLoad() { +#ifdef OIS_WIN32_XINPUT_SUPPORT + //XInput - unsupported + if(_isXInput()) + return 0; +#endif + DIPROPDWORD dipdw; // DIPROPDWORD contains a DIPROPHEADER structure. dipdw.diph.dwSize = sizeof(DIPROPDWORD); dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); @@ -103,14 +137,22 @@ //--------------------------------------------------------------// void Win32ForceFeedback::upload(const Effect* effect) { +#ifdef OIS_WIN32_XINPUT_SUPPORT + if(_isXInput()) + { + //Only constant effect is supported by XInput devices + if(effect->force == OIS::Effect::ConstantForce) + _updateXInputConstantEffect(effect); + return; + } +#endif + switch(effect->force) { case OIS::Effect::ConstantForce: _updateConstantEffect(effect); break; case OIS::Effect::RampForce: _updateRampEffect(effect); break; case OIS::Effect::PeriodicForce: _updatePeriodicEffect(effect); break; - case OIS::Effect::ConditionalForce: - _updateConditionalEffect(effect); - break; + case OIS::Effect::ConditionalForce: _updateConditionalEffect(effect); break; //case OIS::Effect::CustomForce: _updateCustomEffect(effect); break; default: OIS_EXCEPT(E_NotImplemented, "Requested Force not Implemented yet, sorry!"); } @@ -126,6 +168,16 @@ //--------------------------------------------------------------// void Win32ForceFeedback::remove(const Effect* eff) { +#ifdef OIS_WIN32_XINPUT_SUPPORT + //Since XInput supports only one effect type, removing any effect + //results in stopping vibration right away. + if(_isXInput()) + { + _setXInputVibration(0, 0); + return; + } +#endif + //Get the effect - if it exists EffectList::iterator i = mEffectList.find(eff->_handle); if(i != mEffectList.end()) @@ -150,6 +202,14 @@ //--------------------------------------------------------------// void Win32ForceFeedback::setMasterGain(float level) { +#ifdef OIS_WIN32_XINPUT_SUPPORT + if(_isXInput()) + { + mXInputMasterGain = max(min(level, 1.0f), 0.0f); + return; + } +#endif + //Between 0 - 10,000 int gain_level = (int)(10000.0f * level); @@ -181,6 +241,12 @@ //--------------------------------------------------------------// void Win32ForceFeedback::setAutoCenterMode(bool auto_on) { +#ifdef OIS_WIN32_XINPUT_SUPPORT + //XInput - unsupported + if(_isXInput()) + return; +#endif + DIPROPDWORD DIPropAutoCenter; DIPropAutoCenter.diph.dwSize = sizeof(DIPropAutoCenter); DIPropAutoCenter.diph.dwHeaderSize = sizeof(DIPROPHEADER); @@ -436,6 +502,76 @@ } //--------------------------------------------------------------// +bool Win32ForceFeedback::_isXInput() +{ + return (!mJoyStick && mXInputIndex >= 0); +} + +//--------------------------------------------------------------// +void Win32ForceFeedback::_setXInputVibration(unsigned short leftPower, unsigned short rightPower) +{ +#ifdef OIS_WIN32_XINPUT_SUPPORT + XINPUT_STATE state; + if(XInputGetState(mXInputIndex, &state) == ERROR_DEVICE_NOT_CONNECTED) + return; + + XINPUT_VIBRATION vibration; + ZeroMemory(&vibration, sizeof(XINPUT_VIBRATION)); + + vibration.wLeftMotorSpeed = leftPower; + vibration.wRightMotorSpeed = rightPower; + + if(XInputSetState((DWORD)mXInputIndex, &vibration) != ERROR_SUCCESS) + OIS_EXCEPT(E_General, "Error updating XInput device vibration!"); +#endif +} + +//--------------------------------------------------------------// +void Win32ForceFeedback::_updateXInputConstantEffect(const Effect* effect) +{ + ConstantEffect* eff = static_cast<ConstantEffect*>(effect->getForceEffect()); + + // Determine left/right motor power ratio by using effect direction. + + float rightMult = 0.0f; + float leftMult = 0.0f; + + switch (effect->direction) + { + case Effect::EDirection::North: + case Effect::EDirection::South: + rightMult = leftMult = 1.0f; + break; + + case Effect::EDirection::East: + rightMult = 1.0f; + break; + + case Effect::EDirection::West: + leftMult = 1.0f; + break; + + case Effect::EDirection::NorthEast: + case Effect::EDirection::SouthEast: + leftMult = 0.5f; + rightMult = 1.0f; + break; + + case Effect::EDirection::NorthWest: + case Effect::EDirection::SouthWest: + leftMult = 1.0f; + rightMult = 0.5f; + break; + } + + // Get OIS level range (-10k - 10k) into XInput level range (0 - 65536) + auto leftLevel = (unsigned short)abs((float)eff->level * leftMult * mXInputMasterGain * 6.5536f); + auto rightLevel = (unsigned short)abs((float)eff->level * rightMult * mXInputMasterGain * 6.5536f); + + _setXInputVibration(leftLevel, rightLevel); +} + +//--------------------------------------------------------------// void Win32ForceFeedback::_addEffectSupport(LPCDIEFFECTINFO pdei) { #if(OIS_WIN32_JOYFF_DEBUG > 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/win32/Win32InputManager.cpp new/OIS-1.6.0/src/win32/Win32InputManager.cpp --- old/OIS-1.5.1/src/win32/Win32InputManager.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/win32/Win32InputManager.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -151,7 +151,16 @@ jsInfo.isXInput = false; jsInfo.productGuid = lpddi->guidProduct; jsInfo.deviceID = lpddi->guidInstance; +#ifdef UNICODE + int length = WideCharToMultiByte(CP_ACP, 0, lpddi->tszInstanceName, -1, nullptr, 0, nullptr, nullptr) - 1; + if (length > 0) + { + jsInfo.vendor.resize(length); + WideCharToMultiByte(CP_ACP, 0, lpddi->tszInstanceName, -1, &(*jsInfo.vendor.begin()), length + 1, nullptr, nullptr); + } +#else jsInfo.vendor = lpddi->tszInstanceName; +#endif jsInfo.devId = _this_->joySticks; _this_->joySticks++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/OIS-1.5.1/src/win32/Win32JoyStick.cpp new/OIS-1.6.0/src/win32/Win32JoyStick.cpp --- old/OIS-1.5.1/src/win32/Win32JoyStick.cpp 2021-05-13 21:09:42.000000000 +0200 +++ new/OIS-1.6.0/src/win32/Win32JoyStick.cpp 2026-02-27 11:57:49.000000000 +0100 @@ -75,6 +75,7 @@ mFfDevice(nullptr), _AxisNumber(0) { + memset(&mDIJoyCaps, 0, sizeof(DIDEVCAPS)); } //--------------------------------------------------------------------------------------------------// @@ -148,10 +149,13 @@ mState.mButtons.resize(XINPUT_TRANSLATED_BUTTON_COUNT); mState.mAxes.resize(XINPUT_TRANSLATED_AXIS_COUNT); + + //Make dummy force feedback device + this->mFfDevice = new Win32ForceFeedback(mJoyInfo.xInputDev); } else { - // Get joystick capabilities. + //Get joystick capabilities mDIJoyCaps.dwSize = sizeof(DIDEVCAPS); if(FAILED(mJoyStick->GetCapabilities(&mDIJoyCaps))) OIS_EXCEPT(E_General, "Win32JoyStick::_enumerate >> Failed to get capabilities");
