It is currently August 22nd, 2019, 4:49 pm

New Plugin: XInput

Share and get help with Plugins and Addons
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan

Re: New Plugin: XInput

dgrace » May 11th, 2016, 11:15 pm

StArL0rd84 wrote:Looks promising.
now the value stays at 1, and not triggered by the left stick. YAY :D
I forget what 4 values it spits out though, and what they mean. :P
(Does the value of 1 mean the battery is at 25% ?)

25%
50%
75%
100%

BTW, your new example skin and all the new features is freakin' awesome!
Gj
Actually the skin is the same as my old one; I never really updated it after the first pass, but thanks! I think you must have had an old DLL. The value of 1 means 100%. It'll return 0, 0.33, 0.75 or 1.0 depending on what the system reports. (empty, low, medium, full) I figured just in case they change the API at some point to return an actual percentage it wouldn't require changing the skins if I did it this way.

dave
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: New Plugin: XInput

StArL0rd84 » May 12th, 2016, 1:45 pm

Many thanks.
I think i got it now.
Used substitute to generate percentage for a bar meter.
Substitute=,"0.33":"25","0.75":"50","1.0":"100"
But the value is a 1 not 1.0.
Anyways, ill test it further.
Tnx again.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan

Re: New Plugin: XInput

dgrace » May 12th, 2016, 11:27 pm

StArL0rd84 wrote:Many thanks.
I think i got it now.
Used substitute to generate percentage for a bar meter.
Substitute=,"0.33":"25","0.75":"50","1.0":"100"
But the value is a 1 not 1.0.
Anyways, ill test it further.
Tnx again.
I'm not really up on Rainmeter syntax, but wouldn't "(value) * 100" be easier? ;)

dave
AlanMW
Posts: 3
Joined: June 12th, 2016, 12:19 pm

Re: New Plugin: XInput

AlanMW » June 12th, 2016, 12:23 pm

StArL0rd84 wrote:Found Xinput on Github
Is this it? https://github.com/speps/XInputDotNet
AlanMW
Posts: 3
Joined: June 12th, 2016, 12:19 pm

Re: New Plugin: XInput

AlanMW » June 12th, 2016, 12:27 pm

AlanMW wrote:Is this it? https://github.com/speps/XInputDotNet

Nope, this is definitely it: https://github.com/dcgrace/XInput
BobDaGecko
Posts: 1
Joined: March 31st, 2019, 9:24 pm

Re: New Plugin: XInput

BobDaGecko » April 1st, 2019, 2:43 am

So I downloaded u/realFinch's GameHub 2 GameHub 2 and wanted to use a gamepad with it. He had already built in gamepad funtionallity but I wanted to change it to be able to use the joysticks. I opened the input code and tried changing it to have left joystick functionality based off of the XInput Plugin's Skin. I was able to get down and left to work on the left joystick but it up and right do not. I also noticed the joystick has to be all the way in the specified direction for the joystick to recognize what direction you want to go instead of only needing to push it down a bit to go down etc. I also noticed his code for using the bumpers to go to another layout within the skin is not working. Need some help on how to get those to things to work.

Original Code:

Code: Select all

[Control]
Measure=Plugin
Plugin=ActionTimer
Group=Animation
DynamicVariables=1
ActionList1=DisableKeyboard
ActionList2=DisableGamepad
ActionList3=EnableKeyboard
ActionList4=EnableGamepad
DisableKeyboard=[!CommandMeasure UP Stop][!CommandMeasure DOWN Stop][!CommandMeasure LEFT Stop][!CommandMeasure RIGHT Stop][!CommandMeasure ENTER Stop][!CommandMeasure ESCAPE Stop]
DisableGamepad=[!DisableMeasureGroup Gamepad]
EnableKeyboard=[!CommandMeasure UP Start][!CommandMeasure DOWN Start][!CommandMeasure LEFT Start][!CommandMeasure RIGHT Start][!CommandMeasure ENTER Start][!CommandMeasure ESCAPE Start]
EnableGamepad=[!EnableMeasureGroup Gamepad]

[UP]
Measure=Plugin
Plugin=HotKey
HotKey=UP
KeyDownAction=[!CommandMeasure Animation "input('up')"]
Group=Input | Keyboard

[DOWN]
Measure=Plugin
Plugin=HotKey
HotKey=DOWN
KeyDownAction=[!CommandMeasure Animation "input('down')"]
Group=Input | Keyboard

[RIGHT]
Measure=Plugin
Plugin=HotKey
HotKey=RIGHT
KeyDownAction=[!CommandMeasure Animation "input('right')"]
Group=Input | Keyboard

[LEFT]
Measure=Plugin
Plugin=HotKey
HotKey=LEFT
KeyDownAction=[!CommandMeasure Animation "input('left')"]
Group=Input | Keyboard

[ENTER]
Measure=Plugin
Plugin=HotKey
HotKey=ENTER
KeyDownAction=[!CommandMeasure Animation "input('enter')"]
Group=Input | Keyboard

[ESCAPE]
Measure=Plugin
Plugin=HotKey
HotKey=ESCAPE
KeyDownAction=[!CommandMeasure Animation "input('back')"]
Group=Input | Keyboard


[measureXInput_0_Dpad_U]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_U
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('up')"]
Group=Input | Gamepad

[measureXInput_0_Dpad_D]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_D
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('down')"]
Group=Input | Gamepad

[measureXInput_0_Dpad_L]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_L
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('left')"]
Group=Input | Gamepad

[measureXInput_0_Dpad_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_R
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('right')"]
Group=Input | Gamepad

[measureXInput_0_Face_D]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_D
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('enter')"]
Group=Input | Gamepad

[measureXInput_0_Face_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_R
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('back')"]
Group=Input | Gamepad
What I am currently working on:

Code: Select all

[Control]
Measure=Plugin
Plugin=ActionTimer
Group=Animation
DynamicVariables=1
ActionList1=DisableKeyboard
ActionList2=DisableGamepad
ActionList3=EnableKeyboard
ActionList4=EnableGamepad
DisableKeyboard=[!CommandMeasure UP Stop][!CommandMeasure DOWN Stop][!CommandMeasure LEFT Stop][!CommandMeasure RIGHT Stop][!CommandMeasure ENTER Stop][!CommandMeasure ESCAPE Stop]
DisableGamepad=[!DisableMeasureGroup Gamepad]
EnableKeyboard=[!CommandMeasure UP Start][!CommandMeasure DOWN Start][!CommandMeasure LEFT Start][!CommandMeasure RIGHT Start][!CommandMeasure ENTER Start][!CommandMeasure ESCAPE Start]
EnableGamepad=[!EnableMeasureGroup Gamepad]

[UP]
Measure=Plugin
Plugin=HotKey
HotKey=UP
KeyDownAction=[!CommandMeasure Animation "input('up')"]
Group=Input | Keyboard

[DOWN]
Measure=Plugin
Plugin=HotKey
HotKey=DOWN
KeyDownAction=[!CommandMeasure Animation "input('down')"]
Group=Input | Keyboard

[RIGHT]
Measure=Plugin
Plugin=HotKey
HotKey=RIGHT
KeyDownAction=[!CommandMeasure Animation "input('right')"]
Group=Input | Keyboard

[LEFT]
Measure=Plugin
Plugin=HotKey
HotKey=LEFT
KeyDownAction=[!CommandMeasure Animation "input('left')"]
Group=Input | Keyboard

[ENTER]
Measure=Plugin
Plugin=HotKey
HotKey=ENTER
KeyDownAction=[!CommandMeasure Animation "input('enter')"]
Group=Input | Keyboard

[ESCAPE]
Measure=Plugin
Plugin=HotKey
HotKey=ESCAPE
KeyDownAction=[!CommandMeasure Animation "input('back')"]
Group=Input | Keyboard


[measureXInput_0_JoyL_Y]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_Y
MinValue=-1.0
MaxValue=1.0
[b]IfEqualValue=[/b] [u]up doesn't work with "-1" or "1"[/u]
IfEqualAction=[!CommandMeasure Animation "input('up')"]
Group=Input | Gamepad

[measureXInput_0_JoyL_Y]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_Y
MinValue=-1.0
MaxValue=1.0
[b]IfEqualValue=-1[/b] [u]down works with "-1"[/u]
IfEqualAction=[!CommandMeasure Animation "input('down')"]
Group=Input | Gamepad

[measureXInput_0_JoyL_X] [b]*Left and Right will mirror up and down accordingly*[/b]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_X
MinValue=-1.0
MaxValue=1.0
IfEqualValue=-1
IfEqualAction=[!CommandMeasure Animation "input('left')"]
Group=Input | Gamepad

[measureXInput_0_Dpad_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_R
IfEqualValue=1 
IfEqualAction=[!CommandMeasure Animation "input('right')"]
Group=Input | Gamepad

[measureXInput_0_Face_D]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_D
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('enter')"]
Group=Input | Gamepad

[measureXInput_0_Face_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_R
IfEqualValue=1
IfEqualAction=[!CommandMeasure Animation "input('back')"]
Group=Input | Gamepad
Bumper code (just flat out doesn't work author doesn't know why):

Code: Select all

[Rainmeter]
RightMouseUpAction=!Execute [!SkinCustomMenu]
ContextTitle=Layout manager
ContextAction=[!ActivateConfig "#ROOTCONFIG#\Configuration\PageManager" "list.ini"][!CommandMeasure "Animation" "exit()"]
ContextTitle2=---
ContextTitle3=List file.inc
ContextAction3=["#@#User\#List#"][!CommandMeasure Animation exit()]
ContextTitle4=Layout file.inc
ContextAction4=["#@#User\#filelayout#"][!CommandMeasure Animation exit()]
ContextTitle5=---
ContextTitle6=Rainmeter Menu
ContextAction6=[!SkinMenu]

[Variables]
Display=0
@Include=#@#Settings.inc
@Include2=config.inc
@Include3=#@#User\#list#
@Include4=#@#Layout\#layout#

[ScriptRefresher]
Measure=Script
ScriptFile=#@#Script\Refresher.lua
UpdateDivider=-1
Refreshed=0

[PageHandling]
Measure=Script
ScriptFile=PageHandling.lua
UpdateDivider=-1

[MeasureDelay]
Measure=Calc
Formula=([MeasureDelay]+1)
DynamicVariables=1

[TAB]
Measure=Plugin
Plugin=HotKey
HotKey=TAB
KeyDownAction=[!CommandMeasure PageHandling "input('next')"]
Group=Input | Keyboard

[b][measureXInput_0_LTrig2]
Measure=Plugin
Plugin=XInput
Device=0
Channel=LTrig2
IfEqualValue=1
IfEqualAction=[!CommandMeasure PageHandling "input('previous')"]
Group=Input | Gamepad

[measureXInput_0_RTrig2]
Measure=Plugin
Plugin=XInput
Device=0
Channel=RTrig2
IfEqualValue=1
IfEqualAction=[!CommandMeasure PageHandling "input('next')"]
Group=Input | Gamepad[/b]
Last edited by eclectic-tech on April 1st, 2019, 1:08 pm, edited 1 time in total.
Reason: Please use code tags. It is the </> symbol.