The Trackball assembly may look complicated because it has many wires and connectors coming out of it, but there actually only 5 types of wires with several duplicates of each. Here are the functions for each wire color respectively :
Black = All black wires are ground (use a ground with each wire below)
White = Mouse Button 1 (mouse 0 in MAME)
Brown = Mouse Button 2 (mouse button 1 in MAME)
Orange = Mouse Button 3 (mouse button 2 in MAME)
Blue = Horizontal Disabler (use for perfect straight shots in Golf or Bowling)