Page 2 of 10 FirstFirst 12345678910 LastLast
Results 21 to 40 of 183

Thread: Cube64-DX - Ameliored GC controller to N64 adapter.

  1. #21
    Master Baiter ASSEMbler Extreme
    Never Logs Out
    APE's Avatar

    Join Date
    Dec 2005
    Location
    Caleefornya
    Posts
    5,163
    Blog Entries
    1
    I wouldn't mind building these but every time someone says "PIC" I re-realize I don't have any programmers and get all Sad Panda-y.
    http://www.assemblergames.com/forums...ad.php?t=31524
    My feedback thread, since it seems somewhat difficult for people to find.

  2. #22
    Combat Soldier
    link83's Avatar

    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    503
    Quote Originally Posted by DarthCloud View Post
    168 step for N64???

    A don't know the actual resolution of the hardware in the controller but what is contained in the buttons status packets send by the N64 controllr is Two's complement data on 8bits for each axis (-128 to 127)

    The game cube use 8bits also for each axis in the packets but it's an unsigned value (0 to 255) centered on 0x80. So it's a direct translation without any resolution lost.
    As far as I understand it, although the data is 8bits for each axis and could theoretically give 256 steps (-128 to 127) the actual analog sticks resolution is only 168 steps :rolleyes: Its discussed in this thread:-
    http://nfggames.com/forum2/index.php?topic=3574.0

    168 steps seems to be the upper limit, theres a video on youtube by micro which shows the N64 analog sticks resolution in real time:-
    http://www.youtube.com/watch?v=sGbzKzpL9gY

    If you try and use 256 steps (eg 1:1) the controls in certain games mess up, like Blast Corps as you can hopefully see in the above video.

    In the thread I linked above micro used the following equation to get 168 steps from 256 steps:-

    256*4=1024
    1024*21/128=168 steps

    There is also one more thing I recently noticed which confirms micro's discovery. I thought that if 168 steps is the actual N64 analog sticks resolution then surely emulator authors have to take this into account...and in fact they do! If you load up Project64 with the N-Rage input plugin and select 'Configure Controller Plugin' then you can see that the default analog sticks range is set to 66%, and considering that most analog sticks have a resolution of 256 steps you can work out that 66% of 256 equals 168.96 steps - almost exactly what micro said was the upper limit.

    I really appreciate your hard work DarthCloud, cant wait to try using a Wavebird on the N64 :-)
    Last edited by link83; 03-31-2011 at 08:07 AM.

  3. #23
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by link83 View Post
    As far as I understand it, although the data is 8bits for each axis and could theoretically give 256 steps (-128 to 127) the actual analog sticks resolution is only 168 steps :rolleyes: Its discussed in this thread:-
    http://nfggames.com/forum2/index.php?topic=3574.0

    168 steps seems to be the upper limit, theres a video on youtube by micro which shows the N64 analog sticks resolution in real time:-
    http://www.youtube.com/watch?v=sGbzKzpL9gY

    If you try and use 256 steps (eg 1:1) the controls in certain games mess up, like Blast Corps as you can hopefully see in the above video.

    In the thread I linked above micro used the following equation to get 168 steps from 256 steps:-

    256*4=1024
    1024*21/128=168 steps

    There is also one more thing I recently noticed which confirms micro's discovery. I thought that if 168 steps is the actual N64 analog sticks resolution then surely emulator authors have to take this into account...and in fact they do! If you load up Project64 with the N-Rage input plugin and select 'Configure Controller Plugin' then you can see that the default analog sticks range is set to 66%, and considering that most analog sticks have a resolution of 256 steps you can work out that 66% of 256 equals 168.96 steps - almost exactly what micro said was the upper limit.

    I really appreciate your hard work DarthCloud, cant wait to try using a Wavebird on the N64 :-)
    Thank for the information!!!

    I tried Turok 1 and yes the adapter does suffer from this bug.

    So bug open, will likely fix this tonight!

    And Blast Corps ordered ;)

  4. #24
    Combat Soldier
    link83's Avatar

    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    503
    Quote Originally Posted by DarthCloud View Post
    Thank for the information!!!

    I tried Turok 1 and yes the adapter does suffer from this bug.

    So bug open, will likely fix this tonight!

    And Blast Corps ordered ;)
    Glad I could help :-)

    I should mention that I added the first line of the equation I showed, since I think micro's code actually reads 1024 steps directly from the replacement analog sticks potentiometer - but of course thats not possible for this since the GameCube data only gives you 256 steps. There might be an even shorter equation to give 168 steps from 256 steps? :confused:
    <EDIT> In fact you could use the following equation instead:-

    256*21/32=168 steps

    Dont know why I didnt think of that before! I'm not that great at maths, so there still might be an even shorter/better way?

    Also, I dont see this mentioned a lot, but there is plenty of really interesting/useful information in Nintendo's patents, for instance here are some patents for the N64 controller, and on page 20 of the first link it shows the N64 controller data layout:-
    http://www.google.com/patents?id=Xjo...bstract&zoom=4
    http://www.google.com/patents?id=jIE...bstract&zoom=4
    http://www.google.com/patents?id=mVg...bstract&zoom=4
    http://www.google.com/patents?id=bhQ...bstract&zoom=4
    http://www.google.com/patents?id=7wc...bstract&zoom=4

    N64 Analog Stick:-
    http://www.google.com/patents?id=NH4...bstract&zoom=4
    http://www.google.com/patents?id=rVU...bstract&zoom=4

    N64 Controller Pak:-
    http://www.google.com/patents?id=gqs...bstract&zoom=4
    http://www.google.com/patents?id=GW0...bstract&zoom=4

    N64 Rumble Pak:-
    http://www.google.com/patents?id=4rw...bstract&zoom=4

    Some info about the GameCube Controller interface?:-
    http://www.google.com/patents?id=VH4...bstract&zoom=4

    GameCube Wavebird Controller:-
    http://www.google.com/patents?id=sYU...bstract&zoom=4

    There are many more patents available, and many have different/extra information, so it might be worth searching through google patents?
    Last edited by link83; 03-31-2011 at 11:57 AM.

  5. #25
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by link83 View Post
    Glad I could help :-)

    I should mention that I added the first line of the equation I showed, since I think micro's code actually reads 1024 steps directly from the replacement analog sticks potentiometer - but of course thats not possible for this since the GameCube data only gives you 256 steps. There might be an even shorter equation to give 168 steps from 256 steps? :confused:
    <EDIT> In fact you could use the following equation instead:-

    256*21/32=168 steps

    Dont know why I didnt think of that before! I'm not that great at maths, so there still might be an even shorter/better way?
    Keep it mind I must implement this on a micro with limited instruction, no multiplication, no divide, not even a proper shift left/right instruction. ;)

    I will also need to work on 16bit on a 8bit micro.

    It will look something like this

    (GC_Value*16+GC_Value*4+GC_Value) / 32

    Why this way? Cause multiplying and dividing with nice binary number allow to only shift the number to the left to multiply and shift then to the right to divide.

    divide 0b0100 by 2? shift right => 0b0010
    multiply 0b0100 by 2? shift left => 0b1000

    Since the pic only have a rotation command that put back to the LSB the bit kick out of the MSB I will need to used some mask to clear it. And since I need to work on 16bit I will need to copy the kick out bit of the LSByte to the first bit of the MSByte.

    I already see the headache coming ;)

  6. #26
    Combat Soldier
    link83's Avatar

    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    503
    I see, so will you have to use 160 steps instead of 168 steps?

    Good luck with the coding :nod:

  7. #27
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by link83 View Post
    I see, so will you have to use 160 steps instead of 168 steps?

    Good luck with the coding :nod:
    No I will still get a resolution of -84 to 83 (168 step)

  8. #28
    Combat Soldier
    link83's Avatar

    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    503
    Quote Originally Posted by DarthCloud View Post
    No I will still get a resolution of -84 to 83 (168 step)
    Oh good, I just thought when I saw this equation:-
    Quote Originally Posted by DarthCloud View Post
    (GC_Value*16+GC_Value*4+GC_Value) / 32
    That it would only give 160 steps :redface:

    I look forward to building the adaptor :thumbsup:

  9. #29
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by link83 View Post
    Oh good, I just thought when I saw this equation:-

    That it would only give 160 steps :redface:

    I look forward to building the adaptor :thumbsup:
    Finaly fixed it, but it was a bit harder since the GameCube too do not used the full 8bit range, it use only ~[24, 232].

    I must admit this quite challenged my ASM writing skill ;) It's working great! Games like Cruis'n USA that was very sensitive with the adapter feel like normal with this fix :).

    I guess the code could be optimise, but I don't see how currently ;) anyway it's working.

    ;; GameCube axis value range between ~[24, 232] so an aprocimate resolution of 208.
    ;; N64 axis value range between ~[-84, 84] so an aproxiamte resolution of 168.
    ;; Most N64 game will accep a direct mapping of the gamecube value and this will either
    ;; change nothing or add an added precition. However some game don't expect value over
    ;; 84 and get confused like Blast Corps. This function adapt the GameCube input into
    ;; the usual N64 value range by doing the following equation:
    ;; ((GC_Value-24)*26/32)-84

    ifdef __12F683

    gc_axis_to_n64_range
    clrf gc_value_x2 ; Clear register.
    clrf gc_value_x2+1
    clrf gc_value_x8
    clrf gc_value_x8+1
    clrf gc_value_x16
    clrf gc_value_x16+1

    movwf gc_value_x16 ; Save gc value.

    bcf STATUS, C ; Bit shifft left to multiply by 2.
    rlf gc_value_x16, f
    rlf gc_value_x16+1, f

    movf gc_value_x16, w ; Save this result.
    movwf gc_value_x2
    movf gc_value_x16+1, w
    movwf gc_value_x2+1

    bcf STATUS, C ; 2 other bit shift left to multiply by 8 in total.
    rlf gc_value_x16, f
    rlf gc_value_x16+1, f

    bcf STATUS, C
    rlf gc_value_x16, f
    rlf gc_value_x16+1, f

    movf gc_value_x16, w ; Save this result.
    movwf gc_value_x8
    movf gc_value_x16+1, w
    movwf gc_value_x8+1

    bcf STATUS, C ; Bit shift left again to multiply by 16 in total.
    rlf gc_value_x16, f
    rlf gc_value_x16+1, f

    movf gc_value_x16, w ; Add gc_value_x16 to gc_value_x2.
    addwf gc_value_x2, f
    movf gc_value_x16+1, w
    btfsc STATUS, C
    incf gc_value_x16+1, w
    addwf gc_value_x2+1, f

    movf gc_value_x8, w ; Add gc_value_x8 to gc_value_x2.
    addwf gc_value_x2, f
    movf gc_value_x8+1, w
    btfsc STATUS, C
    incf gc_value_x8+1, w
    addwf gc_value_x2+1, f

    clrf counter ; Clear counter.

    divide_32 ; Devide gc_value by 32.
    bcf STATUS, C
    rrf gc_value_x2+1, f
    rrf gc_value_x2, f
    incf counter, f
    movf counter, w
    xorlw 0x05
    btfss STATUS, Z
    goto divide_32

    movlw 0x54 ; Transform the value into two's complement.
    subwf gc_value_x2, w
    return

    endif
    Last edited by DarthCloud; 04-02-2011 at 10:25 AM.

  10. #30
    I look forward to link83 building me an adapter...... ;)

  11. #31
    Combat Soldier
    link83's Avatar

    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    503
    Great work DarthCloud :-)

    Quote Originally Posted by DarthCloud View Post
    Finaly fixed it, but it was a bit harder since the GameCube too do not used the full 8bit range, it use only ~[24, 232].
    Wow, how interesting! I wonder why nobody realised this before?

    I just have a few questions if you dont mind:-
    - Did you test the analog stick range on multiple GameCube controllers? (Just in case one is worn out)
    - Is it just a coincidence that 24+232=256? (Maybe 24 is in the 'deadzone' which can vary from controller to controller?)
    - Is the GameCube analog sticks 208 step range caused by the octagonal restrictor plate?
    - Do all controller analog sticks not allow the full range? (Wii, PlayStation, Xbox, etc) :confused:

    [EDIT] I just found this site:-
    http://wiki.dolphin-emulator.com/ind...e=GameCube_pad
    It seems to confirm that the 24 reading is within the GameCube analog sticks deadzone, so perhaps it is important to keep all 256 steps, otherwise some third party GameCube controllers might malfunction?
    Also N64 analog stick should have similar deadzone area according to the patents, so using 256 steps might give it a more accurate feel? (Both should have deadzone area of 0-15% where no movement will occur)

    Also just thought you might want to know in the code you quoted:-
    ;; N64 axis value range between ~[-84, 84] so an aproxiamte resolution of 168
    I think it should be [-84, 83] so that it equals 168 including the zero?

    Lastly, is there any chance the google code page could have the ASM/HEX file as a direct download on the downloads page?:-
    http://code.google.com/p/cube64-dx/downloads/list
    Just thought it might make it easier.

    Quote Originally Posted by derekb View Post
    I look forward to link83 building me an adapter...... ;)
    Sorry but I am really busy at the moment, I havent even got time to build one for myself at the second :DOH: Plus its going to take a while for me to get all the parts together (PIC, extension cables, etc)
    Last edited by link83; 04-02-2011 at 12:11 PM.

  12. #32
    :(
    Last edited by derekb; 04-02-2011 at 11:45 AM.

  13. #33
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by link83 View Post
    Great work DarthCloud :-)


    Wow, how interesting! I wonder why nobody realised this before?
    Since it's easy to see while sniffing with a LA I guess no one bothered to document this.

    I just have a few questions if you dont mind:-
    - Did you test the analog stick range on multiple GameCube controllers? (Just in case one is worn out)
    24 & 232 are the highest value I've read. The adapter do compensate allready if the joystick do not center at 0x80 by adding an offset. Game will not seak for exact value anyway, they check if you are between a range to determine speed.. etc...

    - Is it just a coincidence that 24+232=256? (Maybe 24 is in the 'deadzone' which can vary from controller to controller?)
    No coincidence 24 is the highest value I saw and yes it may change between controller, but again the sitck calibration compensate for this anyway.

    - Is the GameCube analog sticks 208 step range caused by the octagonal restrictor plate?
    Joystick are just variable resistor so they have an infinite range value. So what matter is the ADC used to know the resolution. If the plastic block the stick then yes you might not reach the biggest value. But again it don'T matter because games use a range which take into consideration the octagonal shape.

    - Do all controller analog sticks not allow the full range? (Wii, PlayStation, Xbox, etc) :confused:
    That's likely the case

    [EDIT] I just found this site:-
    http://wiki.dolphin-emulator.com/ind...e=GameCube_pad
    It seems to confirm that the 24 reading is within the GameCube analog sticks deadzone, so perhaps it is important to keep all 256 steps, otherwise some third party GameCube controllers might malfunction?
    Also N64 analog stick should have similar deadzone area according to the patents, so using 256 steps might give it a more accurate feel? (Both should have deadzone area of 0-15% where no movement will occur)
    If those controller don't include the dead zone then those controller might create problem similar to the one the adapter is actually creating in Blast Corps. Btw, if a controller is not licensed by nintendo I don't care if it work or not ;) :)

    But keeping the whole gc range is what I've done first but it's was making it impossible to reach max speed once translated to n64. If the GC never reach 256, and you map 256 as 168 for the n64.. then you can never reach max value on the n64...

    Too feel like a real controller you must used the real range value otherwise you get the feeling that the stick is too sensitive.
    Also just thought you might want to know in the code you quoted:-
    I think it should be [-84, 83] so that it equals 168 including the zero?
    This was just an aproximation

    Lastly, is there any chance the google code page could have the ASM/HEX file as a direct download on the downloads page?:-
    http://code.google.com/p/cube64-dx/downloads/list
    Just thought it might make it easier.
    Yes will add this once the how to done.
    Last edited by DarthCloud; 04-02-2011 at 04:31 PM.

  14. #34
    Will this run on Atmega8?
    Since I can't find a cheap and easy to build pic programmer :(

  15. #35
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by sanni View Post
    Will this run on Atmega8?
    Since I can't find a cheap and easy to build pic programmer :(
    No, PIC12F683 only for all feature and also 12F629/18F84A with reduced feature set.

    Don't waste time building a programmer get a cheap JDM prorgammer on ebay.

    And use WinPic800 as software to program.

  16. #36
    eabay has some 10-15 dollar programmers with one free PIC12F683

  17. #37
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Found some bugs today in my Wavebird implementation. Fixing will need some big change.

    http://code.google.com/p/cube64-dx/issues/detail?id=8

    Normally Gamecube games does calibration of the joystick when you power on your Wavebird.

    The adapter does only this on power up and we might in some case endup with the controller being not calibrated correctly.

    Also Wavebird send different response to 0x00 command under some condition.

    Like receiver only (wavebird power off) will send a response different than while the Wavebird is power on.

    Need to modify Wavebird implementation to support all Wavebird status correctly. And need to periodically check controller identity to know if the Controller has been power off and redo calibration once it's on again.

  18. #38
    Any news on that tutorial, man?

  19. #39
    Combat Soldier
    DarthCloud's Avatar

    Join Date
    Dec 2007
    Location
    Montréal, QC
    Posts
    868
    Quote Originally Posted by Nully View Post
    Any news on that tutorial, man?
    Pictures taken, but I prefer fixing the Wavebird init bug before doing the tuto. I also want to wait receive my BlastCorps cart to make sure the joystick fix work well.

    If you look at the Wiki section on the project page I already uploaded some Tutorial. Only the one about building the adapter is missing.

    I need to update schematic too. Same thing but with 12F683 shown.
    Last edited by DarthCloud; 04-04-2011 at 07:16 PM.

  20. #40
    Have you measured how much current the rumble on the GCN controller takes?

    How much current can you draw from N64's 3.3V line? Has anyone tried pushing that yet?

Page 2 of 10 FirstFirst 12345678910 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •