Jump to content
The simFlight Network Forums

Can't use more than the first 32 buttons of a VJoy device with 128 buttons


Recommended Posts

Good afternoon Pete,

I'm using a registered version of FSUIPC 4.974 (24th February 2018) for FSX (10.0.61637.0) in Windows 10 Enterprise 64 Bit OS.

I've a Joystick Thrustmaster "Top Gun Afterburner" (Device 0) wich work properly, and a programmable buttons pad "Stream Deck" that I set to command virtual buttons of a VJoy Device (Device 1) with 128 buttons.

The VJoy device work well as you can see below :

when I press the Stream Deck configured button that emulate the 35th button of the VJoy device :

image.png.91128c3e32da6b5bbc7cd678193157b0.png

Both devices are recognised by FSUIPC. This is the start of the FSUIPC4 log where both devices are acquired:

********* FSUIPC4, Version 4.974 (24th February 2018) by Pete Dowson *********
Windows 10 Enterprise 64 Bit reported as Build 17763, Release ID: 1809 (OS 10.0)
fsx.exe version = 10.0.61637.0
Reading options from "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC4.ini"
Running inside FSX on Windows 10
Module base=62560000
User Name="XXXXXXXXXXXXXX"
User Addr="XXXXXXXXXXXXXXX"
FSUIPC4 Key is provided
WIDEFS7 not user registered, or expired
      188 System time = 27/03/2019 00:44:13
      188 FLT path = "C:\Users\fabri\Documents\Fichiers Flight Simulator X\"
      188 ------ Module Version Check ------
      188        acontain.dll: 10.0.61637.0
      203             api.dll: 10.0.61637.0
      203        controls.dll: 10.0.61637.0
      203      fs-traffic.dll: 10.0.61637.0
      203             G3D.dll: 10.0.61637.0
      203        language.dll: 10.0.61637.0
      203            sim1.dll: 10.0.61637.0
      203        visualfx.dll: 10.0.61637.0
      203         weather.dll: 10.0.61637.0
      203          window.dll: 10.0.61637.0
      203 ----------------------------------
      250 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      250 FS path = "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\"
      563 ---------------------- Joystick Device Scan -----------------------
      563 Product= vJoy - Virtual Joystick
      563    Manufacturer= Shaul Eizikovich
      563    Serial Number= 2.1.8
      563    Vendor=1234, Product=BEAD (Version 2.24)
      563    GUIDs returned for product: VID_1234&PID_BEAD:
      563       GUID= {8BED5160-4C3E-11E9-8002-444553540000}
      563       Details: Btns=128, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X0,Y0,Z0
      563 Product= Top Gun Afterburner
      563    Manufacturer= THRUSTMASTER
      563    Vendor=044F, Product=B101 (Version 1.0)
      563    GUIDs returned for product: VID_044F&PID_B101:
      563       GUID= {940FFF40-4C03-11E9-8001-444553540000}
      563       Details: Btns=8, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R127,U0,V0,X127,Y127,Z255
      563 -------------------------------------------------------------------
      610 Device acquired for use:
      610    Joystick ID = 1 (Registry okay)
      610    1=vJoy Device
      610    1.GUID={8BED5160-4C3E-11E9-8002-444553540000}
      610 Device acquired for use:
      610    Joystick ID = 0 (Registry okay)
      610    0=Top Gun Afterburner
      610    0.GUID={940FFF40-4C03-11E9-8001-444553540000}
      610 -------------------------------------------------------------------
      657 LogOptions=60000000 00000001
      657 -------------------------------------------------------------------

 

So, I can easily set the Thrustmaster buttons and the 32 first buttons of the VJoy device in FSUIPC.

I've searching in the FSUIPC forum solutions for set the 96 other buttons of the VJoy device and I have seen your solution with the Lua's Library ( HidDemo.lua).
So, I've set (I think "properly") the Lua file and put it on the Modules folder.

My Lua file (VJoyAdapt.lua) is :

Vendor = 0x1234
Product = 0xBEAD
Device = 0  -- Multiple devices of the same name need increasing Device numbers.
Report = 0
Pollrate = 25


dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report)

if dev == 0 then
   ipc.log("---=== VJoyAdapt Lua Library : Could not open HID ===---")
   ipc.exit()
end
   
ipc.log("---=== VJoyAdapt Lua Library : HID correctly opened ===---")

buttons = {}
-- Up to 256 buttons = 8 x 32 bit words
prevbuttons = { 0, 0, 0, 0, 0, 0, 0, 0 }


function Poll(time)
-- We use "readlast" so the values we use are the most up-to-date
  CurrentData, n, discards = com.readlast(dev, rd)
-- Extract values we need
  if n ~= 0 then
-- Now handle the buttons : up to 256 of them!
        buttons[1], buttons[2], buttons[3], buttons[4],
        buttons[5], buttons[6], buttons[7], buttons[8] = 
            com.GetHidButtons(dev, CurrentData)
            
        -- check for changes   
        i = 1
        while i <= 8 do
            if buttons ~= prevbuttons then
                prevbuttons = buttons
                -- Send to FSUIPC as a set of 32 virtual buttons
                -- i.e. DWORD offsets 3340 onwards
                ipc.writeUD(0x3340 + ((i-1) * 4), buttons)
            end
            i = i + 1
    end
   end
end

------------------------------------------------------------------------

if init then
   -- Deal with initial values, if supplied (some joysticks don't)
   ipc.log("---=== VJoyAdapt Lua Library : Init seen ! ===---")
   Poll(0)
end

if Pollrate == 0 then
   -- Ouch. Mustn't divide by zero!
   Pollrate = 25 
end


event.timer(1000/Pollrate, "Poll")  -- poll values 'Pollrate' times per second

As you can see in the FSUIPC4.INI, both devices and the lua file are comitted :

[JoyNames]
AutoAssignLetters=Yes
0=Top Gun Afterburner
0.GUID={940FFF40-4C03-11E9-8001-444553540000}
1=vJoy Device
1.GUID={8BED5160-4C3E-11E9-8002-444553540000}
A=Top Gun Afterburner
A.GUID={940FFF40-4C03-11E9-8001-444553540000}
B=vJoy Device
B.GUID={8BED5160-4C3E-11E9-8002-444553540000}

[Axes]
PollInterval=10
RangeRepeatRate=10

[Buttons]
PollInterval=25
ButtonRepeat=20,10
2=PB,1,C66706,0     -{APU_GENERATOR_SWITCH_TOGGLE}-
3=PB,2,C66363,0     -{TOGGLE_ALTERNATOR1}-

(…)

[LuaFiles]
1=VJoyAdapt

But, in the FSUIPC Log, despite I activeted lua Log report, I Don't see if the Lua file is correctly load and the HID (my VJoy device) truely opened ; the rest of the FSUIPC log is :

      672 SimConnect_Open succeeded: waiting to check version okay
      672 Trying to use SimConnect Acc/SP2 Oct07
      672 Opened separate AI Traffic client okay
     6985 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
     6985 Initialising SimConnect data requests now
     6985 FSUIPC Menu entry added
     7125 C:\Users\fabri\Documents\Fichiers Flight Simulator X\Dernier vol.FLT
     7125 C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\A319CJ WT\pa319-v2524.AIR
    11282 *** EVENT: Cntrl= 66514 (0x000103d2), Param= 0 (0x00000000) ATC_MENU_CLOSE
    32032 Aircraft loaded: running normally now ...
    32047 User Aircraft ID 1 supplied, now being used
    32250 Aircraft="Airbus A319-115 CJ"
    32266 System time = 27/03/2019 00:44:45, Simulator time = 00:44:20 (23:44Z)
    34219 Starting everything now ...
    34735 KEYDOWN: VK=17, Waiting=0, Repeat=N, Shifts=2
    34735 .. Key not programmed -- passed on to FS
    34860 KEYDOWN: VK=190, Waiting=0, Repeat=N, Shifts=2
    34860 .. Key not programmed -- passed on to FS
    34860 *** EVENT: Cntrl= 65752 (0x000100d8), Param= 0 (0x00000000) PARKING_BRAKES
    34938 KEYUP: VK=190, Waiting=0
    35094 KEYUP: VK=17, Waiting=0
    35532 Advanced Weather Interface Enabled
    42063 *** Entered Buttons option page ***
    68203 *** Exiting Buttons option page ***
    75938 *** Entered Axes option page ***
    77563 *** Exiting Axes option page ***
    77594 *** Entered Keys option page ***
    79047 *** Exiting Keys option page ***
    89250 *** EVENT: Cntrl= 65732 (0x000100c4), Param= 0 (0x00000000) EXIT
    90625 === Closing session: waiting for DLLStop to be called ...
    94157 === DLLStop called ...
    94157 === Closing external processes we started ...
    95157 === About to kill any Lua plug-ins still running ...
    95313 === Closing global Lua thread
    96313 === About to kill my timers ...
    96516 === Restoring window procs ...
    96516 === Unloading libraries ...
    96516 === stopping other threads ...
    96516 === ... Memory checking ...
    96516 === ... Button scanning ...
    96625 === ... Axis scanning ...
    96719 === Releasing joystick devices ...
    96719 === Freeing macro memory
    96719 === Removing any offset overrides
    96735 === Clearing any displays left
    96735 === NOTE: not calling SimConnect_Close ...
    96735 === AI slots deleted!
    96735 === Freeing button memory ...
    96735 === Closing my Windows ...
    96735 === Freeing FS libraries ...
    97750 === Closing devices ...
    97750 === Closing the Log ... Bye Bye! ...
    97750 System time = 27/03/2019 00:45:51, Simulator time = 00:44:27 (23:44Z)
    97750 *** FSUIPC log file being closed
Minimum frame rate was 20.8 fps, Maximum was 28.7 fps
Minimum available memory recorded was 2821Mb
Average frame rate for running time of 7 secs = 23.9 fps
G3D fix: Passes 13716, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 73 aircraft
Memory managed: 8 Allocs, 8 Freed
********* FSUIPC Log file closed ***********

I've certainly missed a thing, but at this point, FSUIPC Don't build the 64th to 72th virtuals joysticks (for the 33th to 128th buttons of the VJoy device) that could allow me to set them in FSUIPC Buttons setting. And I search to fix it since several days, without success.

Thank you, Pete, for your help.

Fabrice A.

Edited by Fabrice
Link to comment
Share on other sites

2 hours ago, Fabrice said:

As you can see in the FSUIPC4.INI, both devices and the lua file are comitted :

...

[LuaFiles]
1=VJoyAdapt

You should really read the Lua Plug-Ins document supplied.

The [LuaFiles] section merely lists Lua files it finds in the Modules folder. It doesn't mean they get run. The only Lua plugins which get run automatically are:

ipcInit.lua -- run during FS initialisation, and
ipcReady.lua -- run when FS is ready to fly.

For any others you have three options:

1. Add an "ipc.runlua" command to an ipcReady.lua file, or
2. Assign a key or button to the "Lua <name>"  contorl in FSUIPC assignments, or
3. Add an [Auto] section to the INI file which contains one macro line: "1=Lua <name>"

Pete

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.