Homebrew Official HID to VPAD

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
i dont know what you will use it for, but most times for the setup of movement you have a secondary input method

like in splatoon your can aim with the gyroscope but you can also target your view with the right stick if i remember right (my wiiu is off since 4 weeks)

but if you have more time it should be possible to do

when you look at vpad_functions.h and see
typedef struct
{
...
char unknown1c[0x52 - 0x1c]; /* Contains accelerometer and gyroscope data somewhere */...
} VPADData;

so it should also be possible to fake the gyroscope data with mouse input

Im not a hack though. Só have no idea how to implement it. I was Hoping for a update.

The difference between gyro and right stick its because you cannot hold the gyro in position so the câmera would rotate. If you wanna turn 360 you have to turn the gamepad 360 too. Since the hid to map maps the right stick, even when game Motion control option is on, every slight move with the mouse causes the camera to Keep rotating to that direction like i had hold the right stick a little bit aside.

Maybe gyro wouldnt have this problem.
 
Last edited by splatu,

FunThomas

Well-Known Member
Member
Joined
Jan 10, 2016
Messages
652
Trophies
0
XP
2,016
Country
Gambia, The
I was Hoping for a update.

sorry but most people here are waiting for some one giving them things on a silver plate :)

but the most ppl here are developing in there valuable free time for some time it is ok but if you have a family & house its a problem

i will help as i can leading someone to the right way to go to make changes himself

so its nice that @Maschell made a working version with some controllers supported from the beginning and now with the sources available some who has more free time can extend the existing version
 

AdmiralToucan

Well-Known Member
Member
Joined
Feb 22, 2016
Messages
106
Trophies
0
Age
33
XP
144
Country
Canada
so for your controller all the dpad things were in byte 2 (i hope it was started at zero) so it should look like
setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_W], 0x02,HID_POKKEN_BUTTON_DPAD_W);

but you have to be a bit more clean when making the defines, when you see in log 01 for the up-right:

HID 00 00 01 80 80 80 80 00 (Up-Right)

if you make a 0x10 out of a 0x01 -> it wont work :)
#define HID_POKKEN_BUTTON_DPAD_NE 0x10

dont switch the lower and upper nibble (4 Bits)

when you look in controller_patcher.c for all the setConfigValue() you will see the different byte positions for each controller

HID 00 00 01 80 80 80 80 00 (Up-Right)
-The bold is byte 2, correct?

HID 04 00 0F 80 80 80 80 00 (A)
-For the A button, this would be byte 0 or byte 1?

#define HID_POKKEN_BUTTON_DPAD_NE 0x10
Does that mean I change this to a 0x01?

I never went to school for this stuff, so this is a learning experience for me. I tried compiling some changes and my d-pad seems to work except for neutral. It just spazzed out and keeps holding right.
 
Last edited by AdmiralToucan,

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
sorry but most people here are waiting for some one giving them things on a silver plate :)

but the most ppl here are developing in there valuable free time for some time it is ok but if you have a family & house its a problem

i will help as i can leading someone to the right way to go to make changes himself

so its nice that @Maschell made a working version with some controllers supported from the beginning and now with the sources available some who has more free time can extend the existing version

You are right. But i dont even know from where to start. Im just a player actually. Thank you! I hope somene extend it too, cause its a really great homebrew. Only the mouse rotating thing is a bit annoying.

:yay:
 

FunThomas

Well-Known Member
Member
Joined
Jan 10, 2016
Messages
652
Trophies
0
XP
2,016
Country
Gambia, The
I never went to school for this stuff, so this is a learning experience for me. I tried compiling some changes and my d-pad seems to work except for neutral. It just spazzed out and keeps holding right.

HID 00 00 01 80 80 80 80 00 (Up-Right)
-The bold is byte 2, correct? yes

HID 04 00 0F 80 80 80 80 00 (A)
-For the A button, this would be byte 0 or byte 1? 0

#define HID_POKKEN_BUTTON_DPAD_NE 0x10
Does that mean I change this to a 0x01? yes and for the other directions from byte 2

@AdmiralToucan: its no problem to ask and you are making good progress more than the other 90% of gbatemp here ;-)

if here at gbatemp were more ppl like you it would be more fun to answer questions :)
if you know the ppl will try for themselves and ask when they get stuck at the next stumble stone

thats better than the ppl only asking and waiting for the release

its easier to wait and download but if you try for yourself you expand your horizon and maybe have also some pleasure if you made it after some hours and its working
 
  • Like
Reactions: AdmiralToucan

AdmiralToucan

Well-Known Member
Member
Joined
Feb 22, 2016
Messages
106
Trophies
0
Age
33
XP
144
Country
Canada
Thank you very much for all your help. I compiled a brand new version with my changes and the buttons + d-pad seem to work except for neutral. If I do nothing, then my controller keeps going right and won't stop.

controller_patcher.h
Code:
#define HID_POKKEN_BUTTON_DPAD_N         0x00 
#define HID_POKKEN_BUTTON_DPAD_NE        0x01 
#define HID_POKKEN_BUTTON_DPAD_E         0x02 
#define HID_POKKEN_BUTTON_DPAD_SE        0x03
#define HID_POKKEN_BUTTON_DPAD_S         0x04
#define HID_POKKEN_BUTTON_DPAD_SW        0x05
#define HID_POKKEN_BUTTON_DPAD_W         0x06
#define HID_POKKEN_BUTTON_DPAD_NW        0x07
#define HID_POKKEN_BUTTON_DPAD_NEUTRAL   0x0F

controller_patcher.c
Code:
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_DPAD_MODE],                     CONTROLLER_PATCHER_VALUE_SET,CONTRPDM_Hat);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_DPAD_MASK],                     CONTROLLER_PATCHER_VALUE_SET,0x0F);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_N],            0x02,HID_POKKEN_BUTTON_DPAD_N);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_NE],           0x02,HID_POKKEN_BUTTON_DPAD_NE);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_E],            0x02,HID_POKKEN_BUTTON_DPAD_E);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_SE],           0x02,HID_POKKEN_BUTTON_DPAD_SE);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_S],            0x02,HID_POKKEN_BUTTON_DPAD_S);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_SW],           0x02,HID_POKKEN_BUTTON_DPAD_SW);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_W],            0x02,HID_POKKEN_BUTTON_DPAD_W);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_NW],           0x02,HID_POKKEN_BUTTON_DPAD_NW);
        setConfigValue((u8*)&config_controller[CONTRPD_POKKEN][CONTRPS_VPAD_BUTTON_DPAD_NEUTRAL],      0x02,HID_POKKEN_BUTTON_DPAD_NEUTRAL);
 

FunThomas

Well-Known Member
Member
Joined
Jan 10, 2016
Messages
652
Trophies
0
XP
2,016
Country
Gambia, The
Thank you very much for all your help. I compiled a brand new version with my changes and the buttons + d-pad seem to work except for neutral. If I do nothing, then my controller keeps going right and won't stop.

at the moment i dont know how to help :(

may its the mask which i dont understand for the p2600 Saitek controller ->
setConfigValue((u8*)&config_controller[CONTRPD_SP2600][CONTRPS_DPAD_MODE], CONTROLLER_PATCHER_VALUE_SET,CONTRPDM_Hat);
setConfigValue((u8*)&config_controller[CONTRPD_SP2600][CONTRPS_DPAD_MASK], CONTROLLER_PATCHER_VALUE_SET,0xF0);
with
#define HID_PS2_BUTTON_DPAD_N 0x00 // 5
#define HID_PS2_BUTTON_DPAD_NE 0x01 // 5
#define HID_PS2_BUTTON_DPAD_E 0x02 // 5
#define HID_PS2_BUTTON_DPAD_SE 0x03 // 5
#define HID_PS2_BUTTON_DPAD_S 0x04 // 5
#define HID_PS2_BUTTON_DPAD_SW 0x05 // 5
#define HID_PS2_BUTTON_DPAD_W 0x06 // 5
#define HID_PS2_BUTTON_DPAD_NW 0x07 // 5
#define HID_PS2_BUTTON_DPAD_NEUTRAL 0x0F // 5

so why is the mask 0xF0 instead of the neutral position 0x0F, maybe @Maschell can help us if he reads this or i can reach him on IRC

another point could be to use the
//log_printf("HID %02X %02X %02X %02X %02X %02X %02X %02X \n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]);

you can google for "c++ printf format" and you will see how its used (at the end before" is always \n for a newline in the output that it dont will be concatenated with the next log output)

maybe you could add at https://github.com/Maschell/control...13b483cfccab36cea39/controller_patcher.c#L725

log_printf("VPADButton: 0x%08X \n",cur_config);

and the logs can be compared to vpad_functions.h (should be all now displayed as 8 bytes format = %08X in printf)
#define VPAD_BUTTON_A 0x8000
...
#define VPAD_BUTTON_STICK_R 0x00020000
...

or a log somewhere else in the code to see whats happening
 

AdmiralToucan

Well-Known Member
Member
Joined
Feb 22, 2016
Messages
106
Trophies
0
Age
33
XP
144
Country
Canada
I tried playing with the values like changing 0x0F to 0xF0 and switching my neutral to byte 0, but it didn't work and I had the same problem. I think troubleshooting this might be a little above my head here, but I want to thank you again FunThomas. I wouldn't have made it this far without you and I learned a lot. If I can figure this out, then I'll try adding another controller too. I think I will compile a few more builds with changing values because it didn't do this earlier when all the values were wrong.

Thank you @Maschell for the amazing homebrew.

edit: Actually in define why does it say
Code:
#define HID_LIST_GC                     0x001
#define HID_LIST_KEYBOARD               0x002
#define HID_LIST_MOUSE                  0x004
#define HID_LIST_DS3                    0x008
#define HID_LIST_DS4                    0x010
#define HID_LIST_SP2600                 0x020
#define HID_LIST_PS2_ADAPTER            0x040
#define HID_LIST_POKKEN                 0x080
#define HID_LIST_PS2                    0x100
Where are those bytes coming from to define the controllers?
 
Last edited by AdmiralToucan,

Jackall4BDN

Haunter of Daydreams and Nightmares
Member
Joined
Nov 8, 2013
Messages
780
Trophies
0
Age
30
Location
Within your Mind
XP
704
Country
Gambia, The
edit: Actually in define why does it say
Code:
#define HID_LIST_GC                     0x001
#define HID_LIST_KEYBOARD               0x002
#define HID_LIST_MOUSE                  0x004
#define HID_LIST_DS3                    0x008
#define HID_LIST_DS4                    0x010
#define HID_LIST_SP2600                 0x020
#define HID_LIST_PS2_ADAPTER            0x040
#define HID_LIST_POKKEN                 0x080
#define HID_LIST_PS2                    0x100
Where are those bytes coming from to define the controllers?

They are just uniquely defined to set a pointer for their profile, there is no specialness to their values, it would just randomly continue with 0x200,400,800,1000 etc.

I AM curious tho how attaching two of the same controller is handled, is one just ignored or are both identified and mapped in seperate threads and if they are, why give controllers unique bits instead of just values?

- Quick and Dirty with TT -
 
Last edited by Jackall4BDN,

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
@FunThomas

since mapping the gyro and accelerometer seems a bit complex, could i somehow eliminate in the mouse emulating function the option for holding the right stick on a non-neutral position. It would only consider each individual mouse movements and set it on a neutral position right after. In other words, eliminate the camera rotating by itself behavior.

THank you.
 
Last edited by splatu,

FunThomas

Well-Known Member
Member
Joined
Jan 10, 2016
Messages
652
Trophies
0
XP
2,016
Country
Gambia, The
since mapping the gyro and accelerometer seems a bit complex, could i somehow eliminate in the mouse emulating function the option for holding the right stick on a non-neutral position. It would only consider each individual mouse movements and set it on a neutral position right after. In other words, eliminate the camera rotating by itself behavior.

i dont exactly know what you mean, but since you have 0 programming knowledge no one will do it only for you ;-)

since other people will have other special behavior, so there is a question how to enable and configure all these special cases of behavior

i dont know if some dev will have some time "soon" to make it configurable but its time consuming and debugging is also not that fast since we dont own all the supported controllers

i think in this thread are enough hints to start development and try for your own to change things but you will learn how time consuming it is
 
Last edited by FunThomas,

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
i dont exactly know what you mean, but since you have 0 programming knowledge no one will do it only for you ;-)

since other people will have other special behavior, so there is a question how to enable and configure all these special cases of behavior

i dont know if some dev will have some time "soon" to make it configurable but its time consuming and debugging is also not that fast since we dont own all the supported controllers

i think in this thread are enough hints to start development and try for your own to change things but you will learn how time consuming it is

Thomas,

Did you try the mouse aim mode in any game ?

I dont know if it happens only with me but when playing splatoon with mouse set to aim mode, every time you move it, its like you moved the gamepad right stick and hold it into a position, so the camera keeps rotating, until you move the mouse again.

Right know is something like this:

mouse moves -> (emulated) right stick moves and is kept held into that position.

Instead of:

mouse moves -> (emulated) stick moves and then returns to neutral, preventing the camera to keep rotating indefinitely.

Sorry but i cant be very clear in english.
 

FunThomas

Well-Known Member
Member
Joined
Jan 10, 2016
Messages
652
Trophies
0
XP
2,016
Country
Gambia, The
Did you try the mouse aim mode in any game ?

i tried it when beta testing from Maschell but i think it worked nice that time, now i understand what you mean

but as i can remember some different type of mouse behave different -> not all use the same interface

but since my wiiu is off since about 4 weeks, i dont see any need to change it for me :)

it would be a nice programming task to do it but too time consuming at the moment
 
Last edited by FunThomas,

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
i tried it when beta testing from Maschell but i think it worked nice that time, now i understand what you mean

but as i can remember some different type of mouse behave different -> not all use the same interface

but since my wiiu is off since about 4 weeks, i dont see any need to change it for me :)

it would be a nice programming task to do it but too time consuming at the moment

Maybe the nintendo zelda e3 presentation will make you turn it on again :bow:

I tried it with 5 different types, and the two ones who i can actually say that worked where both from Microsoft, although the rotating thing i told you.

is the function convertAnalogSticks the one i should be looking for the fix ?



By the way, when you have some free time can you just test your mouse (aim mode) on splatoon to check if it works perfectly. If it does, id rather buy a mouse same type/model as yours instead of having a stroke trying to fix the code. :wacko:
 
Last edited by splatu,

splatu

Member
Newcomer
Joined
Jun 4, 2016
Messages
22
Trophies
0
Age
35
XP
42
Country
Brazil
looks good if you wanna change it, you could enable the log and will see what changes

00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 05 FF 00 00 00 00 00 4 = X: 5 Y: -1
00 05 00 00 00 00 00 00 4 = X: 5 Y: 0
00 06 FF 00 00 00 00 00 4 = X: 6 Y: -1
00 06 00 00 00 00 00 00 4 = X: 6 Y: 0
00 05 00 00 00 00 00 00 4 = X: 5 Y: 0
00 06 FF 00 00 00 00 00 4 = X: 6 Y: -1
00 07 00 00 00 00 00 00 4 = X: 7 Y: 0
00 08 FE 00 00 00 00 00 4 = X: 8 Y: -2
00 0C FF 00 00 00 00 00 4 = X: 12 Y: -1
00 0D FD 00 00 00 00 00 4 = X: 13 Y: -3
00 0E FE 00 00 00 00 00 4 = X: 14 Y: -2
00 0C FF 00 00 00 00 00 4 = X: 12 Y: -1
00 09 FF 00 00 00 00 00 4 = X: 9 Y: -1
00 05 00 00 00 00 00 00 4 = X: 5 Y: 0
00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FB 00 00 00 00 00 00 4 = X: -5 Y: 0
00 FA 00 00 00 00 00 00 4 = X: -6 Y: 0
00 F9 00 00 00 00 00 00 4 = X: -7 Y: 0
00 F9 01 00 00 00 00 00 4 = X: -7 Y: 1
00 F8 00 00 00 00 00 00 4 = X: -8 Y: 0
00 F9 00 00 00 00 00 00 4 = X: -7 Y: 0
00 F9 00 00 00 00 00 00 4 = X: -7 Y: 0
00 FB 00 00 00 00 00 00 4 = X: -5 Y: 0
00 FB 00 00 00 00 00 00 4 = X: -5 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FE 01 00 00 00 00 00 4 = X: -2 Y: 1
00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 02 00 00 00 00 00 00 4 = X: 2 Y: 0
00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 03 FF 00 00 00 00 00 4 = X: 3 Y: -1
00 05 00 00 00 00 00 00 4 = X: 5 Y: 0
00 04 FF 00 00 00 00 00 4 = X: 4 Y: -1
00 04 00 00 00 00 00 00 4 = X: 4 Y: 0
00 03 00 00 00 00 00 00 4 = X: 3 Y: 0
00 02 00 00 00 00 00 00 4 = X: 2 Y: 0
00 FE 00 00 00 00 00 00 4 = X: -2 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FB 00 00 00 00 00 00 4 = X: -5 Y: 0
00 FB 00 00 00 00 00 00 4 = X: -5 Y: 0
00 FA 00 00 00 00 00 00 4 = X: -6 Y: 0
00 F9 00 00 00 00 00 00 4 = X: -7 Y: 0
00 FA 00 00 00 00 00 00 4 = X: -6 Y: 0
00 FA 00 00 00 00 00 00 4 = X: -6 Y: 0
00 FD 00 00 00 00 00 00 4 = X: -3 Y: 0
00 FE 00 00 00 00 00 00 4 = X: -2 Y: 0



Thats the output on aim mode when i moved it like 4 times. It seems ok. It always reseting the X Y values. I dont know. Maybe its only resetting the X and Y values when i make the next mouse movement and not after i finished the previous one. Makes any sense ?

The touch mode works 100% right. The cursor only moves when i.m moving the mouse.


Since i dont have any programming skills my main goal now is to find someone who gets a mouse that doesnt have this problem and buy one just like it. So if your mouse works perfectly please let me know its type/model.
 
Last edited by splatu,

Maschell

Well-Known Member
OP
Member
Joined
Jun 14, 2008
Messages
1,093
Trophies
2
XP
4,693
Country
Germany
Hey,
a little update about my progress of the last couple of days!
I finally got some motivation to work on this app again. I prepared everything to be fully configurable through config files, I "just" need to implement the loading + parsing of an config file.
I also implemented an option to remap buttons on the gamepad, this and can be combined with the HID device.
If everything is working without any bad surprises I will at least start some beta testing in the next 2-3 days. (I need people with PS3/PS4 and other pads).

Planned features:
- Implemented GC-Adapter, PS3, PS4 support.
- Other devices can be added by adding just a .ini file to the SD Card. (New mechanics that certain controller are using need to be implemeted)
- The button configuration of the pre-implemented controllers (+ keyboard) can be change through an file on the SD Card. (Using predefines variables with makes it much easier)
- The Gamepad button layout can be remapped through a config file.
- I will remove the built in support for the devices that are not listed above, but I will provide them as a config file. This way the app is cleaner and you guys have a few example config files.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    NinStar @ NinStar: CRAZY HAMBURGER