It is currently April 26th, 2024, 3:40 pm

XBOX ONE Wireless Controller battery percentage

Get 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

Post by dgrace »

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

Re: XBOX ONE Wireless Controller battery percentage

Post by StArL0rd84 »

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
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
jsmorley
Developer
Posts: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: XBOX ONE Wireless Controller battery percentage

Post by jsmorley »

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

Post by dgrace »

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: 22630
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: XBOX ONE Wireless Controller battery percentage

Post by jsmorley »

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: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

Post by StArL0rd84 »

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:
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
Thurion
Posts: 5
Joined: December 28th, 2015, 6:20 pm

Re: XBOX ONE Wireless Controller battery percentage

Post by Thurion »

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: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

Post by StArL0rd84 »

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.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
Thurion
Posts: 5
Joined: December 28th, 2015, 6:20 pm

Re: XBOX ONE Wireless Controller battery percentage

Post by Thurion »

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: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: XBOX ONE Wireless Controller battery percentage

Post by StArL0rd84 »

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.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))