Skip to content

Commit 3a9e705

Browse files
committed
Attempted fix of vJoy FFB thread..
1 parent 6f5659d commit 3a9e705

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

irFFB/fan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void Fan::createWindow(HINSTANCE hInst) {
8686

8787
manualWnd = slider(mainWnd, L"Manual fan speed:", 40, 234, L"0", L"100");
8888

89-
setManualSpeed(manualSpeed);
89+
setManualSpeed((int)manualSpeed);
9090
ShowWindow(mainWnd, SW_SHOWNORMAL);
9191
UpdateWindow(mainWnd);
9292
enumSerialPorts();

irFFB/vJoyInterface.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "stdafx.h"
44
#include "public.h"
55
#include "vjoyinterface.h"
6+
#include "irFFB.h"
67

78
#include <map>
89

@@ -109,8 +110,6 @@ extern "C" {
109110
{
110111
// Loop on read FFB data from vJoy
111112

112-
UINT IoCode = GET_FFB_DATA;
113-
UINT IoSize = FFB_DATA_MAX_SIZE + 8;
114113
ULONG bytes;
115114
BOOL gotdata;
116115
DWORD nBytesTranss = 1;
@@ -132,10 +131,9 @@ extern "C" {
132131
// This is an async (overlapped) transaction
133132
memset(&FfbOverlapped, 0, sizeof(OVERLAPPED));
134133
FfbOverlapped.hEvent = hIoctlEvent;
135-
if (DeviceIoControl(h, IoCode, NULL, 0, FfbDataPacket, IoSize, &bytes, &FfbOverlapped))
136-
continue;
137-
if (GetLastError() != ERROR_IO_PENDING)
138-
continue;
134+
if (!DeviceIoControl(h, GET_FFB_DATA, NULL, 0, FfbDataPacket, sizeof(FFB_DATA), &bytes, &FfbOverlapped))
135+
if (GetLastError() != ERROR_IO_PENDING)
136+
break;
139137

140138
// Wait until data ready
141139
nBytesTranss = 0;
@@ -154,6 +152,7 @@ extern "C" {
154152

155153
}
156154

155+
text(L"vJoy driver error %d, vJoy FFB thread exiting", GetLastError());
157156
return 0;
158157

159158
}

irFFB/vjoyinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ enum VjdStat /* Declares an enumeration data type */
4848
#define PFFB_EFF_CONST PFFB_EFF_REPORT
4949
#define Ffb_h_Eff_Const Ffb_h_Eff_Report
5050

51-
#define FFB_DATA_MAX_SIZE 64
51+
#define FFB_DATA_MAX_SIZE 128
5252

5353
// Device Axis/POVs/Buttons
5454
struct DEVCTRLS {

0 commit comments

Comments
 (0)