123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|676|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> N64 Controller Project...

Posted : Sunday, 02 October 2022, 04:47
spinal

N64 Controller Project...


OK, joysticks are weird.
My current project is in 2 parts.

Part 1
Using Arduino to convert inputs from an N64 controller to XInput to be used on an emulator (or anything that supports XInput other than games consoles, because that would mean spoofing hardware IDs to have it detected and thats too much work for now). Oh and support RUMBLE!

Part 2
Replace the joystick in an N64 controller with a modern analog stick and convert the inputs so that the controller recognises it.



So far...
Figuring the 'correct' range for an analog stick seems to be difficult. The N64 stick is reported (from the controller) as having a range of -83 to 84. But I need to report slightly higher than that so that I max out every single direction. This means scaling it down(?) to -62 to 64. It LOOKS correct, testing in the windows joystick thingy maxes every direction to the edge of the littls square, with the raw values being reported as between 0 and 65535, floating around 32767 when centered.

To test that the range is within the specific range that an N64 would send, I've put together a small test program in blitz3d, however blitz maps the controller to -1 to 1, making my data, well, different. So I then multiply that by 83 to get a nice display of whats going on.



The next step is to limit the joystick in the N64 to the exact range that a stock joystick was supposed to do when brand new. That'll be fun. I do however have somewhere the PS2 to N64 adapter code somewhere, I should be able to copy-paste that.

|update|
OK, after some googling, it seems that the stick should range from about -84 to 84 by use of the octagonal plastic thingy around the joystick. The stick itself should technically would further than that. With the diagonals being limited to 68.
So my plan is to scale the reading so that the diagonals are outside of the 68,86 distance then limit all the values accordingly.

People have also done a bunch of tests with N64 stick replacements and found them all to be wrong.




Steps I think I need to do....

Determine the angle of the stick, positive 0-90 degrees. Check the distance of the stick.
Check for intersection between the stick line (0,0 to x,y) against either of the 2 lines to the max distance (e,g, 0,84 to 68,68 or 84,0 to 68,68), then the distance of that intersection from the center. If the stick distance is longer than the intersection point then use the intersection point as the x,y of the stick...

Does that sound right?

-=-=-
Check out my excellent homepage!
Posted : Sunday, 02 October 2022, 06:48
Jayenkai
Good grief!!!

At some point...
> Reveal 🔎

-=-=-
''Load, Next List!''
Posted : Monday, 03 October 2022, 00:58
spinal
Oh, wait, thought of a much easier way. Just a look up tables with distances for each angle.

-=-=-
Check out my excellent homepage!
Posted : Monday, 03 October 2022, 01:09
rockford
Haven't you already done this before?
Posted : Monday, 03 October 2022, 03:30
spinal
I'm 50% sure I have, but I can't find anything on myhard drive other than the usb adapter part, and that didn't support rumble.
I did also do a PS2 to N64 adapter, and I remember doing a Wii to N64 adapter also.

And here be a list of distances to the edge for angles 0-90.


-=-=-
Check out my excellent homepage!
Posted : Tuesday, 04 October 2022, 01:54
spinal
KO, just need to figure out which quarter the stick is in...



Its supposed to be a full circle clockwise.

-=-=-
Check out my excellent homepage!
Posted : Tuesday, 04 October 2022, 02:04
Jayenkai
How bizarre!! There doesn't seem to be any logic in the way that's moving!

-=-=-
''Load, Next List!''
Posted : Tuesday, 04 October 2022, 14:35
spinal
Done!



Now I have an N64 controller with a stick that is limited to ONLY what a brand new N64 stick is SUPPOSED to do. Which makes it 1000% better than any of the replacement joysticks and probably replacement controllers.

Question is, should it be open source

-=-=-
Check out my excellent homepage!
Posted : Tuesday, 04 October 2022, 14:39
Jayenkai
Anyone wanting to do anything similar would require all the hardware skills, too. Might as well put it out there, see if anyone dare try it

-=-=-
''Load, Next List!''
Posted : Tuesday, 04 October 2022, 15:04
spinal
Just tested it on my N64. Might need a little work.

Still to do...

1. Add a deadzone in the centre, Mario likes to move if the joystick isn't completely 0,0.

2. Seems a bit floaty, need to see if the lag is my joystick code, or the capture card. Tomorrow will test on a real TV.

|edit|

When testing on my TV, there is no noticable lag when playing, so it was probably the capture device, not the joystick code.
I'm going to have to put together a proper post with details on how it works and stuff now

-=-=-
Check out my excellent homepage!
Posted : Friday, 28 October 2022, 02:57
spinal
Here is the output of my joystick fix.

Here is an original joystick in extremely good condition, best I've owned.


Here is a replacement stick 'gamecube style', it was cheap, but outside of the range of a real joystick. This causes problems in some games like MarioKart.


Here is my modification, using an arduino pro micro, replacing the brains of the gamecube joystick.


Weirdly not perfect, which I don't understand because the code activly makes it perfect.

-=-=-
Check out my excellent homepage!
Posted : Friday, 28 October 2022, 02:59
Jayenkai
Looks like it might be a precision thing.
Can you bitshift it up, then do the maths, then bitshift it down? The higher values might help.. .. maybe..?

-=-=-
''Load, Next List!''