GithubHelp home page GithubHelp logo

darthcloud / cube64-dx Goto Github PK

View Code? Open in Web Editor NEW
66.0 7.0 4.0 1.55 MB

GameCube controllers adaptor for N64

License: GNU General Public License v2.0

Makefile 0.41% Assembly 66.11% Python 33.48%
controller adapter n64 ngc nintendo-64 game-controller nintendo gcn adaptor gamecube

cube64-dx's Introduction

See my new project:
BlueRetro - Multiplayer Bluetooth controllers adapter for retro video game consoles
https://hackaday.io/project/170365-blueretro
https://github.com/darthcloud/BlueRetro

Cube64

Introduction

This is a project to build an adaptor for using GameCube controllers with N64 consoles. The motivation behind this is that the N64 has some really great games, but the controller hardware is rather bad- the joysticks wear out quickly, and the layout is odd. The GameCube controllers, however, have a superset of the features and a much better joystick.

A secondary goal of this project is to more thoroughly reverse engineer the protocols involved and create reusable libraries for interfacing PIC microcontrollers to N64 and GameCube devices. The very basics of reverse engineering the two protocols were done before Micah (@scanlime) started this project, but she quickly discovered that there's much more to the protocol. We believe this project may be the first one to completely reverse engineer the protocol used by standard N64 controllers, including peripherals like the Controller and Rumble Paks.

All code here is released under the GPL. This means that if you have basic electronics skills and a way to program the microcontroller, you can build your own cube64 adaptor easily. The hardware is extremely simple, and all the complexity of reverse engineering and writing code is done for you ;)

Discussion

https://github.com/darthcloud/cube64-dx/discussions

Usage

The completed adaptor plugs into an N64 console, and a regular GameCube controller or WaveBird receiver plugs into the adaptor. The default button mapping is as follows:

GameCube N64

By default the adaptor layout banks are loaded with the first four preset. See wiki for more information on the preset.

Main menu

All the configurable feature of the adaptor can be accessed thought this menu. To access the menu:

  1. Hold down the analog L and R buttons down most of the way, but not enough to push the end-stop buttons, and press Start.

The adaptor LED will be ON as long you are inside the menu.

Once in the menu the N64 will receive blank status packet regardless of buttons pressed on the GameCube controller. An invalid selection in the menu will exit the menu.

Menu options

Axis & Button remapping

The button mapping is stored in non-volatile memory, and may be modified during gameplay. To change the mapping for one button or axis direction:

  1. While in the main menu, press Start again.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press the button you wish to remap. This includes any button or axis direction.

  4. Press the button you want to map it to. This button is always interpreted according to the table below.

  5. If the mapping was successful and you have rumble power connected, you should feel a brief rumble.

GameCube N64

Special function

It's possible to map a special function to a button instead of a N64 button.

  1. While in the main menu, press Y.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press the button you wish to set the function to.

  4. If you have the rumble power connected, you should feel a brief rumble.

  5. Press the button corresponding to the special function you want. This button is always interpreted according to the defaults below.

  6. If the mapping was successful and you have rumble power connected, you should feel a brief rumble.

Function available:
GameCube Function
Temporary overwrite current mapping layout
with layout corresponding to the D-pad
direction until button is released.
A+C-Down two buttons mapping.
B+C-Right two buttons mapping.
Turbo disable (Default).
Faster turbo.
Medium turbo.
Slower turbo.

Mapping analog trigger axes

By default button remapping and special function will only map to the digital trigger buttons. Pressing X before either menu options will allow mapping to the analog trigger axes.

  1. While in the main menu, press X.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press either Start or Y. See Axis & Button remapping or Special function sections for next steps.

Mapping layout reset

To reset the current active mapping layout to the above defaults:

  1. While in the main menu, press Z.

  2. If you have the rumble power connected and the reset was successful, you should feel a brief rumble.

Adaptor accessory mode

The adaptor can either emulate a Rumble Pak, let all controller slot command bypass to a real N64 controller or display the slot as empty. To switch between the modes:

  1. While in the main menu, press D-pad UP.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press D-pad UP for bypass mode, D-pad LEFT for Rumble Pak mode or D-pad RIGHT for emptied slot controller.

  4. If you have the rumble power connected and the mode change was successful, you should feel a brief rumble.

This setting is volatile. Adaptor always starts with Rumble Pak mode.

Empty mode is useful for some game that report error with a Rumble Pak. For those games, without even invoking the main menu you may simply hold D-pad RIGHT on power on to disable the Rumble Pak mode and avoid the error.

Holding D-pad UP at boot will set bypass mode as well.

Setting bypass mode while no N64 controller is present in the secondary adaptor port will make the adaptor reset.

Mapping layout selection

It is possible to save up to 4 sets of mapping layouts so you can easily use different keys mapping in different games. To change between the layout does the following:

  1. While in the main menu, press D-pad LEFT.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press one of the 4 D-pad directions which correspond to the 4 layout available.

  4. If you have the rumble power connected and the layout change was successful, you should feel a brief rumble.

All layout by default hold the default button configuration. Just select one of 4 layouts and then change the button configuration using the button mapping key combo described above.

When you select a layout, it is saved into the EEPROM so the next time you power up the adaptor the last used will be reloaded automatically.

GameCube joysticks config

By default the joysticks value from the GameCube controller are scale to match the N64 joystick value range. This can be disabled to use the GameCube range instead (< v3.1 behavior). A response curve can also be applied to a GC axis. By default none is applied (Linear). Scale and curve setting are save independently for each axis and each layout.

  1. While in the main menu, press D-pad RIGHT.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press either direction on one of the four GC joystick axes.

  4. If you have the rumble power connected, you should feel a brief rumble.

  5. Press X to enable or Y to disable the scaling function. Or press one of the D-pad directions for enabling a response curve. (UP: Aggressive, LEFT: Relaxed, RIGHT: Wide, DOWN: S-Curve) Or press A for no response curve (Linear).

  6. If you have the rumble power connected and the layout change was successful, you should feel a brief rumble.

This option is saved into the EEPROM so the next time you power up the adaptor the last used setting will be reloaded automatically.

Preconfigured button mapping layout

Eight pre-defined button mapping layout can be loaded in the currently active layout. See wiki for preset detail.

  1. While in the main menu, press D-pad DOWN.

  2. If you have the rumble power connected, you should feel a brief rumble.

  3. Press any direction on GC D-pad or main joystick to choose one preset.

  4. If you have the rumble power connected, you should feel a brief rumble.

Calibration

The adaptor handles calibration in almost the exact same way a GameCube does. If your joystick is drifting or unresponsive during gameplay, you should be able to recalibrate it by performing any of the following actions without touching the joystick, C-stick, L button, or R button:

  1. Hold down X, Y, and Start for a couple seconds during gameplay.

  2. Unplug the controller from the adaptor and plug it back in.

  3. Unplug the adaptor from the N64 and plug it back in.

  4. Turn off the N64 then turn it back on. (The reset button won't recalibrate, since the adaptor doesn't lose power or get reinitialized)

1 player 2 controllers control style

If connected to two ports of the system, the adaptor will answer automatically a limited button status and identity commands on the 2nd port. This allows to play GoldenEye 007 and Perfect Dark using their respective 1 player 2 controller control style.

Analog input map for the 1st controller C Buttons will map to the 2nd controller joystick. Digital input map for the 1st controller R button will map to the 2nd controller Z button.

Hardware

There are currently two versions of the Cube64 hardware:

  • The "Cube64 DIY" uses a PIC18F14K22 microcontroller. Just about any electronics hobbyist should be able to build it easily. 5V can be provided either externally or by using a charge pump in 8-pin SOIC package.

  • The "Cube64 SMD" uses a PIC18F24Q10 microcontroller, and a charge pump in 10-pin DFN package. PCB gerber and KiCad sources are provided.

Both versions of the hardware have the same button remapping features and responsiveness, as the only difference in their firmware is a few lines worth of compile-time configuration. The DIP version of the Q10 could also be used for the DIY version, but the package is bigger.

Status

The protocol used between the N64 and controller, and between the controller and Controller Pak is well understood now. An RS-232 to N64 bridge and several Python programs demonstrate just about all of the protocol.

The necessary subset of the protocol has been implemented in the Cube64 firmware to emulate an official N64 controller with Rumble Pak. If 5V power for the motor can be supplied to the GameCube controller, its rumble motor will be used to emulate the N64 Rumble Pak.

It should be possible to emulate the N64 Controller Pak using the results of the reverse engineering.

Contents

firmware

Source code for the firmware, in PIC assembly. It was developed using the open source "gputils" package (use latest snapshot). The firmware for the adaptor itself is "cube64.asm", but there are a few additional test programs and libraries.

hardware

This includes schematics and PCB for the adaptor, in KiCad source format.

notes

Utilities and documentation produced while reverse engineering.

Authors

  • Micah Elizabeth Scott - Initial version - scanlime
  • Jacques Gagnon - Newer stuff - DarthCloud

References

External links

Buttons graphic sources

cube64-dx's People

Contributors

darthcloud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cube64-dx's Issues

Key mapping don't work on 12F683

Doing the key combination work fine since it enable the rumble and then 
pressing the two button I do get another rumble. Controller work fine after 
that.

But the key mapping did not change.

Tested with 629 and it's still working fine. The code might need so adaptation 
for the 683....

Original issue reported on code.google.com by [email protected] on 26 Mar 2011 at 9:20

[Feature] Memory Card Pass-through

I have built several Cube-64DX’s and am very happy with them! Thank you for 
all your hard work updating the Cube64 to support Wavebirds. I am currently 
building a custom N64 with the controller ports replaced by Camecube ports. 
(Allowing direct connection of Wavebirds and GC controllers.)

The problem I am going to have is regarding memory cars (Controller Pak’s). 
As I will not have actual N64 ports available, I will not be able to swap out 
the Wavebirds for N64 controllers when I need to save/load some games. I 
understand that in order for the chip to emulate a memory card it would require 
quite a bit more work. 

My proposal is this: Pass-through all traffic for the memory card out to a 
physical ‘Nintendo Controller Pak’ without processing through the PIC, 
attached to the PIC with leads. This way I could mount a memory card inside the 
case of the N64 and use it for the few games I would need it for. The other 
benefit would be someone could add a memory card port to their Cube64-DX and 
swap out memory cars just like an original N64 controller.

I have plenty of working N64 controllers and Controller Pak’s that I would 
happily destroy in an effort to accomplish this.

Is something like this possible?

Original issue reported on code.google.com by [email protected] on 4 Nov 2011 at 4:48

Detect problem early N64 games

Super Mario 64 / Star Wars: Shadows of the Empire

Bug: When you open the 64 with those games and the adapter the game said that 
no controller is connected. If I start the 64 with a original
controller and swap it with the adapter everything is ok. So it's probably a 
detecting probleme only.

Original issue reported on code.google.com by [email protected] on 26 Mar 2011 at 7:25

Wavebird calibration not done correcly

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.

Original issue reported on code.google.com by [email protected] on 4 Apr 2011 at 4:53

Rumple pak emulation bug in some games

Bug #1: The rumble pak emulation didn't work.
Bug #2: This bug is realy weird. When I use the adapter with that game, the game
            sometime like every 5 or 10 seconde had I little
framerate down, you can easyly
            see that just be watching the opening demo of the game.
It's not a big lag but
            enough to notice it with the picture and the sound (sound
cut). If I unplug the
            adapter everything go back to normal.

Original issue reported on code.google.com by [email protected] on 26 Mar 2011 at 7:23

Add key combination to enable/disable rumble emulation

Something that make the controller to show as a controller without rumble pak 
because a lot of game that don't suport the rumple pak detect it as a corupted 
memory card and said to you to ethier reset or replace another memory card. 
Something to disable the rumble pak emulation will be useful with those games. 
Something like press L + R + Y to
enable/disable will do the trick well.

Original issue reported on code.google.com by [email protected] on 26 Mar 2011 at 7:31

Cruis'n USA crash with adapter

Cruis'n USA

Bug:  The game simplely freeze at the first screen when I use the adapter. Like 
mario and star wars if I connect a original controller first and swap with the 
adapter everything work well.

Original issue reported on code.google.com by [email protected] on 26 Mar 2011 at 7:26

Analog joystick too sensitive

N64 controller never use the full range of -128 to 127 for it's axis. It only 
used it at about 66%.

Sending full range value will confuse some games like Blast Corps.

Original issue reported on code.google.com by [email protected] on 31 Mar 2011 at 12:29

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.