njz3 / vJoy

Virtual Joystick
http://vjoystick.sourceforge.net
MIT License
302 stars 39 forks source link

Fix gain packet & packet helper class #3

Closed cyberluke closed 3 months ago

cyberluke commented 2 years ago

C++ library issue: Gain packet is always zero [FIXED]

C# wrapper issue: Ffb_h_Packet incorrectly truncates packet data from 10 bytes to 2 bytes [FIXED]

cyberluke commented 2 years ago

Added a secondary API to solve big performance impact under C# managed code.

Normally in C++ you copy data from pointer and continue in separate thread unblocking the receiving callback - as can be seen in one Sourceforge.net hosted VJoy C++ implementation.

But in C# the issue is that you cannot work like that with nested integer pointers. After discussion with my colleague, he point me out that even C++ developers think that using nested pointers is not the best practice for high performance throughput (which packet data definitely is).

In FAQ, you mention that if people have issues with slow FFB response, they should update their computer. This could be true a few years back, but I don't think the app is that demanding for todays computers and I believe the proposed changes present a solution for this user group as well.

So before, when using async processing in C#, the delay was constantly increasing with ingame FFB packets and latency was often around 50-200ms.

Now after this change, it looks like 0ms latency in C# solved

Additionaly FYI, Ramp effect has been fixed in my another PR and has been merged to SlimDX master last week.

cyberluke commented 2 years ago

Right now I have compiled this VJoy kernel driver and the last thing that needs to be fixed is HID reporting of FFB capabilities. I believe that could be the issue why some app behave differently using vjoy than direct connection. I think it sends incorrect range of force feedback. I already compared this using enumEffects in SlimDX and see that my real FFB device returns completely different parameters than what VJoy reports. Also it is flight stick, not driving wheel.

njz3 commented 1 year ago

Just discovering your work on vjoy (being off for a while). Sure I can merge your code.

cyberluke commented 1 year ago

I don't have a capacity for the next 2-3 months, but here is a working video of whole solution: https://www.youtube.com/watch?v=pIR5bgpmE7E

cyberluke commented 1 year ago

By the way I have big issues compiling this under Windows XP.

The worst habit of opensource developers is to hijack / rewrite / rape the Visual Studio solution file over and over. I am even not able to find a working commit in a timeline that would compile on Windows XP. That's why I stopped working on vJoy at the moment.

And you make a similar mistake as your predecessor: You constantly keep updating SLN files with latest Windows SDK while breaking compatibility. You should keep old SLN files and create some structured folder architecture. Open source development should have a higher purpose than current commercial development.

Visual Studio C++ and their SLN upgrade process is not compatible with how GIT works.

Thank you!

njz3 commented 1 year ago

Sure, we have time to merge. I have seen that there are only conflicts related to project files, which should not be that hard to fix. I just fixed the bug for Windows 11 compatibility (and probably future Windows versions), so I guess the life of vJoy has been extended by several years now...

cyberluke commented 1 year ago

BTW: Here is pull request for SlimDX that solves Ramp effect Force Feedback: https://github.com/SlimDX/slimdx/pull/515 (already merged)

njz3 commented 1 year ago

By the way I have big issues compiling this under Windows XP.

The worst habit of opensource developers is to hijack / rewrite / rape the Visual Studio solution file over and over. I am even not able to find a working commit in a timeline that would compile on Windows XP. That's why I stopped working on vJoy at the moment.

And you make a similar mistake as your predecessor: You constantly keep updating SLN files with latest Windows SDK while breaking compatibility. You should keep old SLN files and create some structured folder architecture. Open source development should have a higher purpose than current commercial development.

Visual Studio C++ and their SLN upgrade process is not compatible with how GIT works.

Thank you!

Then I did a bad thing again. I moved everything to VS2022 and minimum Windows 10 and x64 version to hint the bug for Windows 11.

cyberluke commented 1 year ago

Project such as yours has a long history - from Sourceforge to Github.

I have multi-boot machine Win XP, Win7, Win10.

Here are some of my personal commits for vJoy: https://github.com/cyberluke/vJoy

I was not able to compile it even under Win7 x64 due to Visual Studio project configuration. I spent around 30 hours of clean time only with that.

vJoy has a big impact on retrogaming and I become active in retrogaming community since COVID lockdowns. Right now someone from USA is shipping me MSDN CDs and books about Windows Kernel Driver development, so I can learn and understand why vJoy does not compile.

njz3 commented 1 year ago

Small clarification as you are clearly misthinking something: vjoy is not my project, it was lead by Shaul until a few years ago when he gave up for personnal reasons. What I can only confirm is that maintaining vJoy is a very time consuming hobby, and nobody will pay you the huge number of hours spent working late in the night for such hobby project. I spent the last 3 days of my vacations to find the Windows 11 loading bug because it would allow my vJoyIOFeeder app to work on Windows 11. I would prefer spending this time playing with my kids... That is good for everybody if your are willing to pursue the project and maintain it. Nobody has time for that.

cyberluke commented 1 year ago

I understand. I think you have more skills with kernel driver development. For me it would be easier to fund someone like you to solve compiling vJoy for Win XP. That could be a win win :-D

njz3 commented 1 year ago

I understand. I think you have more skills with kernel driver development. For me it would be easier to fund someone like you to solve compiling vJoy for Win XP. That could be a win win :-D

I have to decline. A good thing I suggest is that you start to play with WinDbg and kernel debugging tools (KDNET) for a few days, then you will be at practically the same level of knowledge as me and you probably can take the lead of the project. That's something you can capitalize and monetize as coding in the windows kernel is very rare on this planet. It will never be my case (my daily job is not development).

cyberluke commented 3 months ago

Hi, I'm back. Thank you very much for merging my PR!

I'm now testing ACCFFB https://github.com/Jabbah/irFFB/releases/tag/v0.2-beta that is using vJoy. I will need to help them to update to your vJoy fork to get better FFB in ACC game. (Assetto Corsa Competizione)