Step 3: Determine Controller Configuration
We need to figure out which key presses are registered by connecting the different contacts. You can examine the traces on the key matrix, however considering a NES controller only has 8 buttons. I found it just as easy to connect the controller to a computer, fire up notepad and connect the different contacts with a paperclip. You want to find pin combinations that produce key presses that aren't usually assigned to hot keys or other configuration options. This makes the most ideal inputs the 26 alphabet characters, directional inputs, enter, space etc. Inputs such as the function keys or numbers are usually assigned to hot keys in most emulators and will require additional configuration to make everything play nice. Some of the less common inputs like ~ are not recognised by some emulators also therefore it's best to find all safe inputs for smooth results.
Test each contact by holding one end of a paperclip or wire on a contact in group A and touching the other end on the contacts in group B. When a combination provides a useful input, note down which contacts you connected and continue. Ideally you want to have one button per eight of group A's inputs (to prevent key ghosting) however you will likely find that two or three of the contacts won't produce any useful inputs. To remedy this I used a single contact for two switches (see green and orange wires in images) and will connect them to switches that would never be pressed simultaneously such as up/down and left/right.