GameCube Analog L and R Coding Question

Discussion in 'Wii U - Hacking & Backup Loaders' started by CJB100, Jul 4, 2016.

  1. CJB100
    OP

    CJB100 Programmer, Media Producer, Hardware Repair

    Member
    489
    332
    May 8, 2016
    United States
    USA
    So I'm attempting to program an easy to use library for vWii, and hopefully get that finished up within the next few months. I have most of the Wiimote and Wii Expansion functions programmed, and a lot of screen controls. I'm starting GameCube controls, and its pretty similar to classic controller except for L and R analog presses.

    It appears L and R are measured in a range of 0 to 210? Can anyone (preferably a dev for obvious reasons) confirm? It is very hard to find good info on the devkitpro libraries and 210 doesn't seem like a... well, "program-y" number. I'd expect something more like 256.
     
  2. zeron88

    zeron88 Member

    Newcomer
    43
    34
    May 19, 2016
    Gambia, The
    While I can't do that myself since I don't have an exploit for vWii, why not make a small program using the library that renders a bar with a outline. The outline ist static and the bar fills with the GC L and R input - If you do [input] / 210 * 100 and press it all the down, it should fill the outline if it is a 0 to 210 range.

    Sorry if it sounds stupid, not very experienced with programming. Probably an easier way...
     
    CJB100 likes this.
  3. CJB100
    OP

    CJB100 Programmer, Media Producer, Hardware Repair

    Member
    489
    332
    May 8, 2016
    United States
    USA
    No, it's actually a really good suggestion. But wouldn't help I'm afraid.

    The issue is analog controls tend to degrade slowly over time. For instance, the functions for analog stick magnitude (harshness of a stick push) are in range of 0 to 1, but usually stops at between .8 and .9 even when the stick is fully pressed. This does not mean my function is incorrect, as new controllers with less used analog sticks almost always reach the full 1 when pushed in a cardinal direction. It's just that my test controllers are old.

    L and R could be suffering from the same issue, but my L and R both stop at 208 and 210 respectively. L is used far less than R in most games, so you'd expect to see L degraded far less than R if degradation is to blame. It seems more likely that the range is actually 0 to 210, but I can't be absolutely certain without a brand new first party GameCube controller, or someone confirming for me.
     
  4. zeron88

    zeron88 Member

    Newcomer
    43
    34
    May 19, 2016
    Gambia, The
    Well then, how about this?

    I have a defective GC aftermarket controller lying around, but the LR triggers are functional. Maybe it's possible to short the contacts and therefore get the range?
    If yes, I'd happily tear the thing apart for research.
     
    Last edited by zeron88, Jul 4, 2016
    CJB100 likes this.
  5. The Real Jdbye

    The Real Jdbye Always Remember 30/07/08

    Member
    GBAtemp Patron
    The Real Jdbye is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    12,108
    5,178
    Mar 17, 2010
    Norway
    Alola
    I'm not sure what you mean by "short the contacts" but there's no guarantee a 3rd party controller will even use the same analog range as the official controllers.
     
    CJB100 likes this.
  6. zeron88

    zeron88 Member

    Newcomer
    43
    34
    May 19, 2016
    Gambia, The
    I meant bridging the 2 contacts of the analog slider. Can't do it anyway because the thing is completely broken by now.
     
  7. The Real Jdbye

    The Real Jdbye Always Remember 30/07/08

    Member
    GBAtemp Patron
    The Real Jdbye is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    12,108
    5,178
    Mar 17, 2010
    Norway
    Alola
    That would just give you 255, since it's bypassing the slider completely.
     
    CJB100 likes this.
  8. CJB100
    OP

    CJB100 Programmer, Media Producer, Hardware Repair

    Member
    489
    332
    May 8, 2016
    United States
    USA
    I appreciate the effort guys! I will keep searching online and let you know if I find anything.
     
    NexoCube likes this.
  9. NexoCube

    NexoCube stop using piracy :(

    Member
    1,184
    587
    Nov 3, 2015
    France
    Stack Pointer
    - Log on your GC Controller
    - Use the functions to read controller (Like HIDRead or VPADRead for Wii U)
    - Prints out the results !

    Code:
    printf(buf, 256, "Pad Pressed = 0x%08X", result_of_read)
    - Then translate it to decimal then you have your number :)

    — Posts automatically merged - Please don't double post! —

    http://www.codemii.com/2008/08/24/tutorial-3-controller-input/
     
    Last edited by NexoCube, Jul 5, 2016
    CJB100 likes this.
  10. CJB100
    OP

    CJB100 Programmer, Media Producer, Hardware Repair

    Member
    489
    332
    May 8, 2016
    United States
    USA
    Wouldn't this still wind up with the same issue as stated in my second post? We would have to make the assumption that my GameCube analog triggers have not degraded and are actually giving correct results.

    I do appreciate the effort though! Thank you!
     
  11. ARVI80

    ARVI80 GBAtemp Regular

    Member
    177
    90
    Feb 25, 2016
    UK
    The shoulder triggers sliding potentiometers use values from 0 to 255.

    The control stick and C-stick use two potentiometers that induce values from 0 to 255 with 128 considered to be the center. (0,0) input would be diagonally down and left 225°. Values 106 to 150 are considered to be neutral inputs and behave just like 128.

    Hope that helps :D
     
    Last edited by ARVI80, Jul 5, 2016