Retro Controller to Xbox 360 Project :D

Started by Waterbury, September 21, 2009, 03:08:08 AM

Previous topic - Next topic

Waterbury

I've been working on a retro controller to Xbox 360 Project. Thus far I am able to use both SNES and Saturn controllers to control my 360. Most of what I'm working on now is the aesthetics portion of the project as everything is a mess! Schematics, build notes and PIC source code/hex files to come.  ;D







ulao

Waterbury, sounds interesting. What chip are you using? Have you seen Mojo's design on shoryuken?

Waterbury

I'm using 4 4066 Analog switches to act as button presses on the controller as in a Saturn to 360 design Twisted Symphony implemented. To control those 4 4066 chips, I'm using a PIC 16f737 microcontroller. I haven't heard of this Mojo guy, what did he do?

ulao

Ahh twisted, nice guy !!

Hey keep at it, like to see the progress.. Mojo is doing this project.

http://forums.shoryuken.com/showthread.php?t=193531

Waterbury

Upon looking at that site I realize I have seen that before. It's a kick ass project. Rock on!

I put the project box together tonight and for all extents and purposes I'm done. More info later.

Waterbury

Front panel Xbox 360 Guide button added to box. Used a POS Saturn 3rd party game pad that I got with one of the Saturns that I purchased and cut a piece to use for the front panel guide button.





l_oliveira

So sweet looking ... 
I'm in process of making something similar to yours but using a wireless controller as basis.

With rechargeable battery support and everything.

I did some reverse engineering work on the rechargeable battery which I posted here:

http://www.xboxhacker.net/index.php?topic=12438.0

And plan on "cloning" an battery so I don't ruin a perfectly fine battery pack on this mod.

Matarick

Waterbury, I wonder if it is possible for you to have a 360/Twinstick mode if you want to test out a Saturn Twin Stick for Virtual On?

Here is the config of the Twin Stick posted by our very own Kendrick:

Quote from: kendrick on May 25, 2005, 08:51:50 AM
As a public service, I spent some time with both versions of the Saturn release of Virtual On and mapped out how the standard pad input corresponds to the Twin Stick controls:

Left stick: Up/Down/Left/Right is normal. L-trigger is left-side weapon, R trigger is left dash.

Right stick: X for left, Z for right, Y for up, B for down. A is right-side weapon, C is right side dash.

Start button remains unchanged.

As for the 360 VOOT layout for Twin Stick Type B:

~Twin Stick Type B
Left Analog - Left lever
D-pad - Left lever
Right Analog - Right Lever
Face Buttons - Right Lever

LT - Left Weapon
RT - Right Weapon
LB - Left Turbo
RB - Right Turbo
Back - Special

Thus:

Up ↔ Left Stick, Up ↔ Up
Right ↔ Left Stick, Right ↔ Right
Left ↔ Left Stick, Left ↔ Left
Down ↔ Left Stick, Down ↔ Down
L-Trigger ↔ Left Stick, Trigger (Weapon) ↔ LT
R-Trigger ↔ Left Stick, Thumb (Dash) ↔ LB
Y ↔ Right Stick, Up ↔ Y
Z ↔ Right Stick, Right ↔ B
X ↔ Right Stick, Left ↔ X
B ↔ Right Stick, Down ↔ A
A ↔ Right Stick, Trigger (Weapon) ↔ RT
C ↔ Right Stick, Thumb (Dash) ↔ RB

I know that you have to make a series of wires connected to a switch board but it would make your life easier if you want to play VOOT.

As for the Back buttons, I am sure you can make an external Button box so that you can slam your fist when doing a Special.

Hope I made some sense.

Waterbury

Currently for the back button I have a mode where I hold start button and press the right trigger. It's sort of a combo mode that I'll get into in a bit.

Currently though I'm confused when it comes to Virtual On. Is there a Virtual On game for the 360, or one for the original Xbox you are referring to?

Waterbury

Pictures of corresponding Controller box being worked on. (Will house a SNES and a Saturn controller port with a toggle switch for choosing which to use). As the back panel is the only piece which is fully dremeled, it currently is the only piece painted.




Waterbury

Matarick, to further elaborate, my current design unfortunately will not emulate or use the 360's thumb sticks or the analog feature of the triggers. I will need digital pots to be able to implement that functionality which I am forgoing for the moment.

The main goal of this project was to emulate classic controllers for Xbox Live Arcade titles. As for the 3d titles, I am quite satisfied with my 360 controller.  :D 

Matarick

Quote from: Waterbury on October 13, 2009, 11:25:48 AM
Matarick, to further elaborate, my current design unfortunately will not emulate or use the 360's thumb sticks or the analog feature of the triggers. I will need digital pots to be able to implement that functionality which I am forgoing for the moment.

The main goal of this project was to emulate classic controllers for Xbox Live Arcade titles. As for the 3d titles, I am quite satisfied with my 360 controller.  :D 

Who said the analog features are needed?  Virtual On Oratorio Tangram uses just digital buttons in one of the configurations.  Some people modded the analog triggers to work as digital buttons and there is a setup in the control schemes uses digital buttons.  Most, if not all Virtual On arcade setups are just digital joysticks using a digital inputs.  The gameplay behind the Virtual On series does not depend on analog movement.  I just wanted to let you know and I did not mean this to be a flame.  The Saturn Virtual On stick is pure digital and uses the same encoder chip as the default Saturn Pad.  Keep up the good work though.

Waterbury

Quote from: Matarick on November 06, 2009, 12:09:01 AM
Quote from: Waterbury on October 13, 2009, 11:25:48 AM
Matarick, to further elaborate, my current design unfortunately will not emulate or use the 360's thumb sticks or the analog feature of the triggers. I will need digital pots to be able to implement that functionality which I am forgoing for the moment.

The main goal of this project was to emulate classic controllers for Xbox Live Arcade titles. As for the 3d titles, I am quite satisfied with my 360 controller.  :D  

Who said the analog features are needed?  Virtual On Oratorio Tangram uses just digital buttons in one of the configurations.  Some people modded the analog triggers to work as digital buttons and there is a setup in the control schemes uses digital buttons.  Most, if not all Virtual On arcade setups are just digital joysticks using a digital inputs.  The gameplay behind the Virtual On series does not depend on analog movement.  I just wanted to let you know and I did not mean this to be a flame.  The Saturn Virtual On stick is pure digital and uses the same encoder chip as the default Saturn Pad.  Keep up the good work though.

I never took it as a flame. I just never knew that Virtual On used digital sticks, I always thought they were analog.

Anyway, this project is still ongoing, I just haven't had the time to work on it. The SNES and Saturn code works as independent modules. I'm working on putting both ports in one box. There is not enough I/O pins on my PIC to have two controllers hooked up at the same time, so I have to multiplex the lines.

Everything works as is currently though. In fact, over my Thanksgiving holiday I played through Braid on the Xbox 360 using exclusively a Saturn Pad, and a bit of Castle Crashers. The D-Pad is ALOT more responsive then the one on the 360 controller.  :D

TrekkiesUnite118

Myself and a Friend have been trying to make our own version of Twisted Symphony's Saturn to 360 adapter but we are a little stuck. We can't really tell where we are to solder the wires on the 360 controller. Would someone here be kind enough to explain this in vivid details?

Waterbury

What kind of controller are you using? Is it an official wired or wireless controller? If not, what type of controller is it? Also, have you already bought your micro-controllers?

:)

TrekkiesUnite118

Well my friends dad works in an Electronics Shop so he has access to all the stuff on Twisted's schematic and more. I have a Wireless 360 controller I intend to use. It's the Matrix Style one.

Waterbury

Have you looked over the datasheets for the 4066 chip yet?  "Matrix Style?" Is it official?

TrekkiesUnite118

Quote from: Waterbury on February 24, 2010, 12:03:47 PM
Have you looked over the datasheets for the 4066 chip yet?  "Matrix Style?" Is it official?

It's an official one, matrix style is what Twisted referred to it as. And no I haven't really looked over the datasheets yet.

Waterbury

I'm not sure how much you know about controller hacking, but the matrix reference refers to the type of button protocol that is used. In most controllers, a button simply is a switch that gets grounded out when pressed. Therefore, connecting the "B button" signal to ground would relate to the B button as being registered as being pressed. However, in a wireless Xbox 360 controller, buttons don't get connected to a common ground, rather, when pressed connects to another signal line. See Below:



The 4066 chip is used to connect the two signal lines when it's corresponding "Control" line is pulled to active high. Best bet would be to solder a wire to each side of the button pad and to connect each of those cables to the switch pins of the 4066.



I'm probably not explaining this too well, I'll try and clean it up later.   :-X

TrekkiesUnite118

Well we get that, the main issue is we don't know where we need to connect the wires to on the 360 controller's board.

Waterbury

Are the button pads coated with copper? Just solder a cable to each half and use those signals. You could solder in alternative points to save wire count, it may get a bit more confusing though.

Twisted's main project page:
http://forums.xbox-scene.com/index.php?showtopic=509748&st=165

Signal Matrix of wireless 360 controller:
http://forums.xbox-scene.com/index.php?showtopic=512342

TrekkiesUnite118

Please keep in mind I am a complete moron when it comes to reading schematics and what not. But basically what my friend said is when he looks at Twisted's schematic, he follows it up to the 20 pin connector, it's after that where he can't tell where he is to solder each pin on the 360 controller.

However after looking over the two I think I kind of get it.  I'll use the X button as an example. Going off of Twisted's code and schematic (Keep in mind I can't read a schematic, so I am guessing here), the two sides that are connected when the buttons are pressed correspond to pins 4 and 7 on the 20 pin connector on Twisted's schematic. The wires from those pins are then soldered to where I have marked with red squares in this picture:


Is that correct or am I completely wrong here? The schematic I am looking at is this one here:


Also, does yours have functionality for the Start Button, I remember Twisted's original design didn't.

Waterbury

I have support for the start button along with other combo functions, but you will be unable to achieve it with a PIC 16F690, there are too few pins.

Waterbury

Quote from: TrekkiesUnite118 on February 24, 2010, 04:26:06 PM
Please keep in mind I am a complete moron when it comes to reading schematics and what not. But basically what my friend said is when he looks at Twisted's schematic, he follows it up to the 20 pin connector, it's after that where he can't tell where he is to solder each pin on the 360 controller.

I think you may have a bit of a grasp of what's going on.

Keep in mind that I am not Twisted. I did not use his schematic for the most part when building my project. That said, I believe that 18 of the pins correspond to the 18 different color traces in the following diagram:


Pin 20 is likely Voltage, VCC.
Pin 19 is likely Ground.

I take no responsibility though if you break something.

Waterbury

From PIC ASM comments, which output pins drive which control.

This project is not black and white, it is fairly straight forward but you are going to have to do your homework.

;PIC(PIN) : Output
;RB4(13) : "R"
;RB5(12) : "X"
;RB6(11) : "Y"
;RB7(10) : "Z"
;RC0(16) : "L"
;RC1(15) : "A"
;RC2(14) : "C"
;RC3(07) : "B"
;RC4(06) : "D-Right"
;RC5(05) : "D-Left"
;RC6(08) : "D-Down"
;RC7(09) : "D-Up"

Waterbury

I bought a PIC16F747 so I could have SNES, NES and Saturn controller support all at the same time. With little adaption my Saturn PIC16F737 code is running off it. Now I need to adapt SNES and NES code in the same source.

After long delay I will finally start posting schematics and source code. I'm almost done with the first schematic, now I just need to clean my 16F737 code.


PIC16F747 interpreting Saturn controller:

Waterbury

#27
MS Paint Schematics FTW.

Waterbury

#28
Controller box completed:




Waterbury

#29
I feel confident in the commenting and reliability in my SNES Code to upload it. I still need to clean things up, but this code should execute and work as planned.


Edit: Version 2.8A of SNES code has been uploaded that has a different PORTA pin configuration. If building a circuit, I will no longer be uploading code that supports the PORTA configuration in this file.

TrekkiesUnite118

Will you be uploading the code for the Saturn version any time soon?

Waterbury

Quote from: TrekkiesUnite118 on March 30, 2010, 03:44:11 AM
Will you be uploading the code for the Saturn version any time soon?

Yeah, very soon. Just need to comment a few things.

Waterbury

Beta version of Saturn PIC16F737 code. I say beta, but things should be stable.

Waterbury

This must be said. The code I have thus far uploaded will NOT work applied directly to Twisted's schematics for wireless controllers. This code has button presses as active high, non presses as logic low. However, I am pretty certain that logic low is button presses in Twisted's project and the default state is high.

With the SNES code, only two lines of code should need to be changed to reverse the logic output, on the Saturn code things may be a bit more tricky due to the way I coded the Mode B routines.

With the PIC16F747 code, I may make the default logic state switchable.

Waterbury

#34
Uploading Version 2.8A of SNES code. Nothing really has changed except the pin configuration. When building a circuit, this will be the final I/O configuration. No NES code yet, but these will be the pins I will be using. The SNES Plugged In LED and Mode B LED are currently reversed, RA7 illuminates for Mode B and RC6 illuminates for connected controller. This is because I only had an LED connected to RC6 on my test circuit. Working on a low level project that involves hardware and software is tricky as changing one often requires the change of another.

;PIC(pin) : SNES(pin)
;RA0(02) : (S)NES Data Latch (3) 'Orange'
;RA1(03) : SNES Data Clock (2) 'Yellow'
;RA2(04) : NES Serial Data
;RA3(05) : SNES Serial Data(4) 'Red'
;RA4(02) : NES Data Latch <--- Maybe, will be redundant as RA0 should work fine.  RA4 sucks.  ???
;RA5(07) : NES Data Clock

;RA6(10) : "NES Plugged In LED"
;RA7(09) : "SNES Plugged In LED"

;RC6(17) : "SNES MODE LED, low for default, high for Mode B Function"

P.S. Lawrence must be getting tired of all this coding jargon flying across his boards. As I understand it, coding talk should be left to a minimum in these boards.  :P

Waterbury

NES code has been implemented with SNES code. NES controllers are reading fine now.  :)  I'll upload within the next few days when I make a few more changes.

Waterbury

#36
Final version of SNES code. NES functionality is fully supported now. Both a SNES and a NES pad could be connected at the same time.

Edit: Took down V3.1A and replaced it with V3.2A. V3.1 had a bug with the NES code.

Waterbury

;SATURN TO PARALLEL
;(C) 2010 Ted Wahrburg (Xbox Live: Waterbury)
;For use with Microchip PIC16F747
;
;---------------------------------------------------------------------------------------------------------------------
;Delay Routine generated from "http://www.piclist.com/techref/piclist/codegen/delay.htm" Generated in 2009/2010.
;---------------------------------------------------------------------------------------------------------------------

;This Program comes with no warranty. USE AT YOUR OWN RISK. Free for all non-commercial use. Plese provide proper credit if code is used in future project.
;
;Converts Saturn, NES, and SNES Standard Game Pad protocol to Individual Button Outputs, with a pin for each button.
;Default Pin state is low. Pins go high with button presses

;SNES mode B Combos:
;Code Allows for a Mode B to be activated when the user presses X while holding Select on an SNES controller.
;Pressing these two buttons in Mode B causes Mode A to become active again
;
;When in Mode B, Start+L causes RC0(Start Button) to go high. Start+R causes RC7(Select Button) to go high.
;When in both Modes A & B, Start+A+B+C causes RC5 to go high. This combo is useful to trigger a utility button, such as the Xbox 360 Guide Button
;
;####################################
;Change Log:
; V.1.0) Implemented Saturn Controller Routine with coresponding status LEDs.
; V.2.0) Completely Rewrote Saturn Controller Routine, added support for SNES & NES Controllers. Saturn Mode B routines are broken in this version.
; V.2.1) Fixed Timing with SNES/NES Latch. Impliment Saturn Mode B Routines, it is not working correctly.....
; V.2.2) Fixed bug with SNES Mode B that would cause SAT Mode B Routine to be run instead..
; V.2.3) Uncommented Saturn Code. It works with Mode B Routine still commented out.
; V.2.4) Uncommented Saturn Mode B Code. Saturn controllers don't seem to be reading as detected as all..SNES Code + Mode B seems find.
; V.2.5) Saturn Mode B Routine works now. Problem seems to have stemmed from SAT_OPTIONS_REGISTER.
;         The register resided @ address 0x33, and it's bits would always read high. Created psuedo "REGISTER_THIRTYTHREE" to reside @ 0x33.
;         SAT_OPTIONS_REGISTER seems to work fine now in memeory address 0x34, at this time I do not understand why register 0x33 is giving me problems.
; V.2.6) Sets Saturn Reconnected bit as high on power up. Disabling Power Up Test. Changing Reconnect delay from 500ms to 200ms.
; V.2.7) Fixed SNES Left Bumper & Right Bumper inversion. L Button in Mode B is now tied to RB3, R Button is tied to RC2. Setting RA7 as an input, to be used as default output state select.

;PIC(pin) : Saturn(pin: Input)
;RA0(02) : D3(7)
;RA1(03) : D2(8)
;RA2(04) : D1(2)
;RA3(05) : D0(3)
;PIC(pin) : Saturn(pin: Output)
;RA5(07) : S0(4)
;RA6(14) : S1(5)
;
;RA7(13) : Output Logic Level Select Input. Hold pin low to select Active High for button presses, Active Low for non-presses. Holding Pin high will inverse this.
;
;
;PIC(pin) : SNES(pin)
;RD0(19) : SNES Data Latch (SNES PIN 3) 'Orange'
;RD1(20) : SNES Data Clock (SNES PIN 2) 'Yellow'

;RD2(21) : NES Serial Data
;RD3(22) : SNES Serial Data(SNES PIN 4) 'Red'

;RD4(27) : NES Data Latch <--- Will be redundant as RD0 should work fine.
;RD5(28) : NES Data Clock

;RD7(30) : "SNES Mode B LED"

;RE0(08) : Saturn Contoller Plugged In LED
;RE1(09) : SNES Contoller Plugged In LED
;RE2(10) : NES Contoller Plugged In LED
;
;PIC(PIN) : Button Output
;RB0(33) : "R"
;RB1(34) : "X"
;RB2(35) : "Y"
;RB3(36) : "Z"
;RB4(37) : "D-RIGHT"
;RB5(38) : "D-LEFT"
;RB6(39) : "D-DOWN"
;RB7(40) : "D-UP"
;RC0(15) : "START"
;RC1(16) : "A"
;RC2(17) : "C"
;RC3(18) : "B"
;RC4(23) : "L"
;RC5(24) : "RESET CHECK, USE TO ATTACH TO RIGHT THUMSTICK BUTTON OR XBOX 360 GUIDE CONTROL FOR EXAMPLE"
;RC6(25) : "Saturn Mode B LED"
;RC7(26) : "SELECT"

l_oliveira

Guys, the newer XBOX360 controllers (Made from 2008 onwards) use an single chip design based on the X810462 chip which contains the RF module hardware built in.
Because it has a higher pin count on it's package MS engineers did opt for a common ground design instead of that keyboard matrix style which was only desirable to lower the main IC pin count.

I was able to connect my saturn controller to jamma converter (http://nfggames.com/forum2/index.php?topic=3711.0) straight to it and draw power from the USB play and charge cable to power the Saturn controller and TTL parts.

Due to the higher power requirements of this design I had to transform it into an wired design. But hell it plays great on Street Fighter 4 (and soon will play even greater on Super Street Fighter 4 once I buy my copy)

By this post, I mean that you guys could greatly simplify your work by just buying an controller of the newer type.

Waterbury

l_oliveira, read my "Interfacing Microcontroller to controller W/ Common Ground" thread to see my problems with interfacing my chip directly to a common ground pad. If you have any advice, that would be great.