Game pad input recorder and repeater

Hi, my goal is to be able to show pre recorded gameplay on real old consoles/computers (DB9 input). There are 6 different buttons to manage with this standard (up/down/left/right/A/B).

The module I'd like to build would insert between the console and the game pad. I may also need a SD storage and some buttons/switches on the module itself in order to select if:

  • I want to record inputs of a human actually playing the game while repeating all the inputs on the outputs (passthrough)
  • I want the arduino to output the sequence (previously recorded) to the console with accurate timings.

I searched deeply into the web to find such a project but I couldn't find anything like this... Very surprising since it could be an awesome and really easy to build accessory :disappointed_relieved:

May someone help about it?

Regards,
Thomas.

1 Like

Such devices will also need to record the length of time each switch is activated and the interval between any activity in order to get realistic replaying.
Paul

How do you plan on storing all this data and what format? Have you got the hardware interface designed, if so post a schematic, not a frizzy thing. I am not surprised you could not find it, something like this takes a lot of time and resources. Validating it will be a real interesting project if the game used random numbers.

Indeed it may be harder than I thought...

Here is a guy who made it for a NES (Super Mario Bros) - link -
The file he uses to feed the arduino, easy to understand once opened with a text editor - link-

Two things make such a project difficult :

  • timings : the nes controller is polled every 1/60th of a second, an "atari controller" isn't polled at all since it is strictly passive... need to add a feedback input from the video sync out.
  • randomness generation : depending on the game this may prevent any pre-recorded sequence from working (the guy says it works for SMB but many other games not).

Stupid idea, better forget about it... maybe it would be "easier" to develop a smart bot with self-learning capabilities? :rofl:

In theory this shouldn't be too hard. What you're describing is essentially a keylogger.

Do you know what signalling the controller uses?

If it's one wire per button then it should be fairly straightforward. Connect each of the gamepad button pins to an Arduino input pin. Connect an Arduino output pin to each of the corresponding console input pins. Use the Bounce2 library to determine if a button has gone high or low. If so, set the Arduino output pin to match it Then save the number of millis() that have elapsed since the timer began to the SD card.

Your SD card will end up with a file that looks like this

Time.. Button.. Button state
0..... Left.... HIGH
234... Up...... HIGH
1257.. Left.... LOW
5347.. Up...... LOW

The entire loop that checks to see if a button has changed state will be pretty quick, probably less than a millisecond. Writing to the SD card will be relatively slow so you may want to hold 200 or so button events in RAM before writing them to the card all in one go.