It is currently October 18th, 2019, 6:59 am

XBOX ONE Wireless Controller battery percentage

Help with creating, editing & fixing problems with skins
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan

Re: XBOX ONE Wireless Controller battery percentage

dgrace » November 29th, 2015, 11:16 pm

Cheers - thanks!
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

StArL0rd84 » December 5th, 2015, 5:05 pm

jsmorley wrote:This is compiled and linked using VS2013, running under Windows10. I have no possible way to test the plugin, but If you make changes to the code and need me to re-compile it for you, I'm happy to do that.
I made the change to the code to enable the battery function. Could you re-compile it for me?
I don't know what files you need so i made a rar file from the whole folder, and the file size is too big (5mb) so i uploaded the file to mediafire.
https://www.mediafire.com/?bo6xop70bi25q77

Michael
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
User avatar
jsmorley
Developer
Posts: 19577
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: XBOX ONE Wireless Controller battery percentage

jsmorley » December 5th, 2015, 7:56 pm

StArL0rd84 wrote:I made the change to the code to enable the battery function. Could you re-compile it for me?
I don't know what files you need so i made a rar file from the whole folder, and the file size is too big (5mb) so i uploaded the file to mediafire.
https://www.mediafire.com/?bo6xop70bi25q77

Michael
I'm getting:

Code: Select all

1>------ Build started: Project: XInput, Configuration: Debug Win32 ------
1>  XInput.cpp
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(300): error C2065: 'XINPUT_BATTERY_INFORMATION' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(300): error C2146: syntax error : missing ';' before identifier 'batInfo'
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(300): error C2065: 'batInfo' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(303): error C2065: 'BATTERY_DEVTYPE_GAMEPAD' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(303): error C2065: 'batInfo' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(304): error C2065: 'batInfo' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(304): error C2228: left of '.BatteryType' must have class/struct/union
1>          type is 'unknown-type'
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(304): error C2065: 'BATTERY_TYPE_UNKNOWN' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(303): error C3861: 'XInputGetBatteryInformation': identifier not found
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(306): error C2065: 'batInfo' : undeclared identifier
1>c:\rainmeter-plugin-sdk\c++\xinput\xinput.cpp(306): error C2228: left of '.BatteryLevel' must have class/struct/union
1>          type is 'unknown-type'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I think Xinput.h is missing or something?
User avatar
dgrace
Developer
Posts: 265
Joined: June 28th, 2014, 8:32 am
Location: Tokyo, Japan

Re: XBOX ONE Wireless Controller battery percentage

dgrace » December 5th, 2015, 11:37 pm

Those look like the same errors I get when building from Win7. Apparently the newer versions of the Windows SDK are supposed to include those functions in their XInput stuff, but looks like you're in the same boat as me. Whenever I upgrade I'll give it another shot.

Thanks anyway jsmorley!

dave
User avatar
jsmorley
Developer
Posts: 19577
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: XBOX ONE Wireless Controller battery percentage

jsmorley » December 6th, 2015, 12:03 am

dgrace wrote:Those look like the same errors I get when building from Win7. Apparently the newer versions of the Windows SDK are supposed to include those functions in their XInput stuff, but looks like you're in the same boat as me. Whenever I upgrade I'll give it another shot.

Thanks anyway jsmorley!

dave
Ah, maybe that explains it. He has a "version" of the entire Rainmeter Plugin SDK included in his bag-o-tricks, and the code and project files are both pointing to that. Let me point things at the latest API and see if that doesn't fix it.

Edit: Nope, sorry. Still get those errors. Guess you will have to look at it when you can dgrace.
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

StArL0rd84 » December 7th, 2015, 2:39 pm

jsmorley wrote:Ah, maybe that explains it. He has a "version" of the entire Rainmeter Plugin SDK included in his bag-o-tricks, and the code and project files are both pointing to that. Let me point things at the latest API and see if that doesn't fix it.

Edit: Nope, sorry. Still get those errors. Guess you will have to look at it when you can dgrace.
Thanks for looking at it Jsmorley.

I will keep tuned in to this thread dgrace.

see you in the future :welcome:
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
Thurion
Posts: 5
Joined: December 28th, 2015, 6:20 pm

Re: XBOX ONE Wireless Controller battery percentage

Thurion » December 28th, 2015, 6:31 pm

I downloaded dgrace's code from his Github repository and changed it to Windows 10, because that's what I use. I was able to compile the DLL and it seems to work with my Xbox 360 wireless controller. But because I never created a skin, I don't have anything except the compiled files.
Here is the entire VS 2015 solution with dgrace's code and the Rainmeter API:
https://dl.dropboxusercontent.com/u/22856750/Rainmeter/XInput-master.7z

@dgrace: You could add a sub-module and link to the Rainmeter API repository :)
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

StArL0rd84 » January 2nd, 2016, 3:35 pm

Thurion wrote: I was able to compile the DLL and it seems to work with my Xbox 360 wireless controller. But because I never created a skin, I don't have anything except the compiled files.
Thanks Thurion.
I copied the DLL into the plugins folder for rainmeter, but my battery skin only returns a zero.
Am i doing it wrong? Wrong channel?

[measureXInput_Battery]
Measure=Plugin
Plugin=XInput
Channel=BATTERY_PAD

[meterBattery]
Meter=STRING
MeasureName=measureXInput_Battery
MeterStyle=styleTitle
X=100
Y=12

EDIT 1: Ok now it returns a 1. hmm i thought it would return text saying something like, empty, low, medium & high.
The battery should be fully charged now, so maybe 1 means high?

EDIT 2: Now i now why it suddenly returned a 1. I moved one of the sticks.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))
Thurion
Posts: 5
Joined: December 28th, 2015, 6:20 pm

Re: XBOX ONE Wireless Controller battery percentage

Thurion » January 2nd, 2016, 4:19 pm

I tested it with a bar instead of a value after I ran into the same problem. Maybe rainmeter doesn't use floatsing-point numbers in text?

According to the code it should return one of these values:
  • 0.0
  • 0.33
  • 0.75
  • 1.0
User avatar
StArL0rd84
Posts: 336
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

StArL0rd84 » January 6th, 2016, 4:28 pm

Yeah it would seem so.
I am gonna try to to run down the battery, to see what values Rainmeter ACTUALLY spits out ;P

Tried a bar meter as well. didn't work.
How did you do your bar meter? Could you post it here?
Last edited by StArL0rd84 on January 6th, 2016, 4:32 pm, edited 1 time in total.
(#WorkTime# = 1 ? #Work# : ([mEnergyLoss:%] > 100 ? #SleepMode# : #Rainmeter#))