Homebrew [Android] IRdA - InputRedirection client for Android

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
Allrighty mate. I did. Thanks!.


One last question buddy. I was reading your codes and i encountered some confusion.


You previously mentioned that you used the int parameter as containers for your axes.
The values 0 and 1 for Cpad, 2 and 3 for Cstk. In the code, the increment stops when i hits 2 leaving one of the axes assigned at 3 not obtained for use in clampaxis.
58104dad3d.png

Or Did I overlooked something mate concerning the clamping for the cstk?

I don't fully understand what you mean, so I'll try to explain this again, but differently.

The axis function parameter is only used for getting the AxisConfig for a corresponding axis (CPad/CStick/DPAD - X/Y).

The i(terator) only goes to 2 because AxisConfig contains pairs of values (for negative axis and for positive axis, neutral axis is sent as zero, and is hardcoded this way). Also, for a very slight performance increase for veeeeeery low-end or underclocked devices (like my tablet) using "return 0;" instead of "continue;" for some reason showed a slight performance increase. It makes no sense, but whatever.

The rest should be interpretable with a bit of logic.
 
  • Like
Reactions: chirogan

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
Thanks. I got it now.

anyway, i imported the codes to Android Studio and got everything to work with a few tweaks.
the only thing left for me is to test the app until handlejoystick via debugger but i was greeted with the error. been trying to look for a workaround as to where the difference in the manifest happened.

upload_2018-3-24_16-39-16.png
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
Thanks. I got it now.

anyway, i imported the codes to Android Studio and got everything to work with a few tweaks.
the only thing left for me is to test the app until handlejoystick via debugger but i was greeted with the error. been trying to look for a workaround as to where the difference in the manifest happened.

View attachment 118557

I guess AndroidManifest.xml got corrupted/overwritten by something while importing, because if it complains about the (only) activity's android:name being corrupted then it means it got changed from ".MainActivity" to something else.
 

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
I guess AndroidManifest.xml got corrupted/overwritten by something while importing, because if it complains about the (only) activity's android:name being corrupted then it means it got changed from ".MainActivity" to something else.
I managed to find out the error in manifest and finally made it to work. Android Studio does not accept uppercase letters in package name and it took me a while to realize that. everything works fine i was able to run the app on my actual android phone in debug mode.
could you help me debug the app? i'm clueless right now on where to actually look for the error (at least in my phone..) where and which process would you like me to set the breakpoint in the debugger?
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
I managed to find out the error in manifest and finally made it to work. Android Studio does not accept uppercase letters in package name and it took me a while to realize that. everything works fine i was able to run the app on my actual android phone in debug mode.
could you help me debug the app? i'm clueless right now on where to actually look for the error (at least in my phone..) where and which process would you like me to set the breakpoint in the debugger?

In CitroPad function HandleJoystick, set breakpoint on the line where dpos.dx is set (CStick X is the only affected axis, right?) and observe the variables, the return value, and the value(s) written.
 

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
In CitroPad function HandleJoystick, set breakpoint on the line where dpos.dx is set (CStick X is the only affected axis, right?) and observe the variables, the return value, and the value(s) written.

Can you look at the variables of the debug report mate?
 

Attachments

  • debug.txt
    119 KB · Views: 275

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
Sorry, I can't interpret this. Besides, all sticks seem to be zero which is not what we want.
oh i see, These are the values when it is fully swung on the upper right corner of the C-Stick. thats when the switching happens. it is in the middle of positive x and positive y axes at full swing.

upload_2018-3-25_16-51-30.png


does this help in anyway? :)

Edit:
X-Axis at full swing in positive x Axis
x Axis.png


and

Y-Axis at full swing at Positive Y axis.
Y-Axis.png
 
Last edited by chirogan,

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
oh i see, These are the values when it is fully swung on the upper right corner of the C-Stick. thats when the switching happens. it is in the middle of positive x and positive y axes at full swing.

View attachment 118666

does this help in anyway? :)

Edit:
X-Axis at full swing in positive x Axis
View attachment 118670

and

Y-Axis at full swing at Positive Y axis.
View attachment 118669

I just can't notice where the overflow could be happening still, the values sent seem to be good... The only thing I can think of is CitroPad.Pack where the CStick values are rotated a bit to accomodate for the physical layout. Try capping it, maybe your phone's "float unit" must have an inaccuracy when converting, resulting in an overflow/underflow.
 

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
I just can't notice where the overflow could be happening still, the values sent seem to be good... The only thing I can think of is CitroPad.Pack where the CStick values are rotated a bit to accomodate for the physical layout. Try capping it, maybe your phone's "float unit" must have an inaccuracy when converting, resulting in an overflow/underflow.

Well. Its too much of a search. If it only occurs to me, maybe i was just unlucky.

I think i doesnt directly relate to my controller. I have 3 PS3 controllers lying around here. One of them is almost brandnew as it was a spare that just came out of the box recently. Connecting them yielded the same bug and result. Unless it is the same for all ps3 controllers. What kind of controller do you have if you dont mind me asking?

I remember seeing a part of the code setting a max value which if im not mistaken was set to prevent overflow?. Everything seems fine and yet the behavior seem to come from an overflow. Unless someone confirms that they have the same bug as mine, and as it does not occur to you, i think this is an isolated case for me.:hateit:
Thanks for your hardwork btw. This is a nice app and kudos to your work/s. :yay3ds:
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
Well. Its too much of a search. If it only occurs to me, maybe i was just unlucky.

I think i doesnt directly relate to my controller. I have 3 PS3 controllers lying around here. One of them is almost brandnew as it was a spare that just came out of the box recently. Connecting them yielded the same bug and result. Unless it is the same for all ps3 controllers. What kind of controller do you have if you dont mind me asking?

I remember seeing a part of the code setting a max value which if im not mistaken was set to prevent overflow?. Everything seems fine and yet the behavior seem to come from an overflow. Unless someone confirms that they have the same bug as mine, and as it does not occur to you, i think this is an isolated case for me.:hateit:
Thanks for your hardwork btw. This is a nice app and kudos to your work/s. :yay3ds:

Does it *only* occur with CStick X axis? What Android version? Custom ROM? Custom kernel? Any specific hardware device name which requires patches to work? I just can't think of *any* reason this wouldn't work. I have tested *all* devices which can communicate via USB, and they no longer have this bug for any of my axes (there used to be the same bug, but I somehow magically fixed it by tweaking constants and reorganizing code, and it magically started working for me). I'm out of ideas as for why this occurs to you :sad:
 

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
Does it *only* occur with CStick X axis? What Android version? Custom ROM? Custom kernel? Any specific hardware device name which requires patches to work? I just can't think of *any* reason this wouldn't work. I have tested *all* devices which can communicate via USB, and they no longer have this bug for any of my axes (there used to be the same bug, but I somehow magically fixed it by tweaking constants and reorganizing code, and it magically started working for me). I'm out of ideas as for why this occurs to you :sad:
I will visit a friend over the holidays who apparently has the same interests as mine and i will check it in another android. Im using Android Nougat with the latest build and yep, i did a hard reset and flashed a full stock rom for testing the controller. What i havent tried is to test it on another device. I'll let you know if it yielded the same result. Not specifically the C-stck X axis. I just saw that the x axis is inverted. But like what you said, the mapped keys are read according to the input of the physical keys. Unless the point mapping function is sign sensitive.
Anyway, i will try another android mate. It will try reupdating my luma as well. Or overwriting boot.firm etc. Haha. I will let you know in the coming days.

Edit: just checked. Theres no problem with my phone. The inputs sent are correct ( -1 to 1 ) both x and y axis of both sticks. Both of them behave the same.. So im going to check my 3ds next. XD. If not, and try it on another set of systems ( other android, other 3ds but same controller)
 
Last edited by chirogan,
  • Like
Reactions: Sono

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
I will visit a friend over the holidays who apparently has the same interests as mine and i will check it in another android. Im using Android Nougat with the latest build and yep, i did a hard reset and flashed a full stock rom for testing the controller. What i havent tried is to test it on another device. I'll let you know if it yielded the same result. Not specifically the C-stck X axis. I just saw that the x axis is inverted. But like what you said, the mapped keys are read according to the input of the physical keys. Unless the point mapping function is sign sensitive.
Anyway, i will try another android mate. It will try reupdating my luma as well. Or overwriting boot.firm etc. Haha. I will let you know in the coming days.

Edit: just checked. Theres no problem with my phone. The inputs sent are correct ( -1 to 1 ) both x and y axis of both sticks. Both of them behave the same.. So im going to check my 3ds next. XD. If not, and try it on another set of systems ( other android, other 3ds but same controller)

Okay. I went apeshit and clamped all possible values. CStick diagonal up (up-left and up-right) doesn't work properly (Home Menu bug?), but other than that it must be definitely 100% fixed now :angry: There's no way you happen to be so unlucky that you got a weird software/hardware combo which causes an overflow/underflow to happen.

https://puu.sh/zQOgT/94065d7127.apk
 
  • Like
Reactions: Zense and chirogan

chirogan

The Engineer
Member
Joined
Feb 28, 2018
Messages
378
Trophies
0
XP
380
Country
Philippines
Okay. I went apeshit and clamped all possible values. CStick diagonal up (up-left and up-right) doesn't work properly (Home Menu bug?), but other than that it must be definitely 100% fixed now :angry: There's no way you happen to be so unlucky that you got a weird software/hardware combo which causes an overflow/underflow to happen.

https://puu.sh/zQOgT/94065d7127.apk
Mate, i could confirm to you by 101% that all bugs regarding controls are fixed. You did it and you did really well. This is fully functional now.

I cant thank you enough for keeping up with me all this time. Kudos! :bow:

P.S. looking good in your new pic. :yay:
 
  • Like
Reactions: Zense and Sono

Zense

Well-Known Member
Member
Joined
Apr 20, 2008
Messages
1,976
Trophies
2
XP
3,942
Country
Italy
Okay. I went apeshit and clamped all possible values. CStick diagonal up (up-left and up-right) doesn't work properly (Home Menu bug?), but other than that it must be definitely 100% fixed now :angry: There's no way you happen to be so unlucky that you got a weird software/hardware combo which causes an overflow/underflow to happen.

https://puu.sh/zQOgT/94065d7127.apk
Hey the link seems to be down? Is it possible to have this reuploaded somewhere? I take it this one is more recent than the one on the [email protected] I'll tag you as well in case you have it stored somewhere.

I'm trying to get a tutorial up on how to do single system multiplayer in retroarch using input redirect and this seems like the best alternative for android.
 

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
Hey the link seems to be down? Is it possible to have this reuploaded somewhere? I take it this one is more recent than the one on the [email protected] I'll tag you as well in case you have it stored somewhere.

I'm trying to get a tutorial up on how to do single system multiplayer in retroarch using input redirect and this seems like the best alternative for android.

Oh my, this is ancient :blink:

If I can build the source code then I'll reupload the apk, but no guarantees :(
 
  • Like
Reactions: Zense

Zense

Well-Known Member
Member
Joined
Apr 20, 2008
Messages
1,976
Trophies
2
XP
3,942
Country
Italy
Oh my, this is ancient :blink:

If I can build the source code then I'll reupload the apk, but no guarantees :(
Haha yeah sorry for bumping, but this is still one of the best apps to get input redirection for 3DS done since it's the only one on android that supprorts mapping the cpad and cstick, which is very important for this usage scenario :)
 
Last edited by Zense,
  • Like
Reactions: Sono

Sono

cripple piss
OP
Developer
Joined
Oct 16, 2015
Messages
2,654
Trophies
2
Location
rehabilitation center
XP
8,219
Country
Hungary
Haha yeah sorry for bumping, but this is still one of the best apps to get input redirection for 3DS done since it's the only one on android that supprorts mapping the cpad and cstick, which is very important for this usage scenario :)

Well I'm still sorry it only works with hardware input (it's been over-requested that I add touch controls), but glad to hear someone still would have an use for it :)

Pretty darn cool, especially for an earlier OS than the standard.
*cries in Apple-centric family*

man I would love an input redirection iphone app

I actually chose this Android version because I can't go all the way down to 2.3.6 due to the lack of proper joystick support, but the tablet I used in the demo video runs Android 4.0.4 (which originally came with Android 2.2.2!), so it obviously had to be low :P

I'm not sure about iOS though because I don't know how to plug a wired controller into it (I don't have an USB-to-Lightning adapter), and I'm not sure how I would distribute it because you can't just install anything on it easily. Besides, afaik you need a dev license for coding, which is sad.
 
  • Like
Reactions: Zense

Zense

Well-Known Member
Member
Joined
Apr 20, 2008
Messages
1,976
Trophies
2
XP
3,942
Country
Italy
Well I'm still sorry it only works with hardware input (it's been over-requested that I add touch controls), but glad to hear someone still would have an use for it :)



I actually chose this Android version because I can't go all the way down to 2.3.6 due to the lack of proper joystick support, but the tablet I used in the demo video runs Android 4.0.4 (which originally came with Android 2.2.2!), so it obviously had to be low :P

I'm not sure about iOS though because I don't know how to plug a wired controller into it (I don't have an USB-to-Lightning adapter), and I'm not sure how I would distribute it because you can't just install anything on it easily. Besides, afaik you need a dev license for coding, which is sad.
Yeah touch is something I'm not interested in since retroarch 3DS doesn't use it for games anyways :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    K3N1 @ K3N1: https://youtube.com/shorts/PArWUK0WyDQ?feature=share