@Dwarfboysim It's not essential to know what the numbers mean as I would suggest that the sdl-joymap-C64.vjm file is never edited manually. (except for one possible exception, see below). It is better to make the joystick mappings using the VICE menu as shown in the Sir Randall's Gaming C64 configuration video
I would recommend that, once you have the VICE joystick configuration as you would like, the sdl-joymap-C64.vjm file is backed up, to your PC say, as it can easily be overwritten using the VICE menu, something I found out from experience.
You can find my sdl-joymap-C64.vjm file for a PS3 controller at: https://pastebin.com/93iVpBUT.
The explanations of the array of digits are given in lines 13 to 27 but, I have to agree, they are not the most intuitive. I shall try to explain what the numbers allude to.
Digit 1 is the controller number, 0 being the first controller , 1 the second and so on.
Digit 2 is the input type, axis (0), button (1), hat axis (2) or ball (3).
Digit 3 is the axis or button number, the button numbers as given by jstest.
The meaning subsequent digits, the action parameters, will depend whether it is an axis or button. Let's look at some examples.
Axis mapping
Digit 4 is whether an axis/button is mapped to C64 joystick (0= No, 1=Yes);
Digit 5 is the joystick port;
Digit 6 is joystick pin, ie axis direction mapped - 1 is up, 2 is down, 4 is left, 8 is right.
(Note: not 100% certain about this)
Let's take a look at line 33 of sdl-joymap-C64.vjm:
0 0 0 1 1 8
Controller 1 | 0 (Axis Input) | Axis No. 0 | 1 (mapped to joystick) | Joystick Port 1 | pin 8 (Right)
Action: Left analog move to the right
If an axis is not mapped, then the fourth digit would be 0, for example 1 0 4 0.
Button mapping
Digit 4 is the type of mapping
2 mapped to keyboard press;
3mapped to the joystick map function in the VICE menu;
4 brings up the VICE menu (UI),;
5 mapped to a VICE menu (UI) function with the menu path description.
(see lines 24 to 27 of the config file for more info).
Let's take a look at some examples.
Line 43
0 1 1 5 Speed settings&Warp mode
Controller 1 | 1 (Button Input) | Button 1 (L3) | 5 (UI Function) | Speed Settings > Warp mode
Action: L3 toggles Warp mode
Line 44
0 1 2 3
Controller 1 | 1 (Button Input) | Button 2 (R3) | 3 (Joystick Map Function)
Action: R3 maps VICE menu item or key press to joystick button
Line 45
0 1 3 2 7 7
Controller 1 | 1 (Button Input) | Button 3 (START) | Keyboard press (2) | row 7, column 7
Action: START button is mapped to Run/Stop
The key row and column position is given in /opt/retropie/emulators/vice/lib/vice/C64/sdl_pos.vkm, not as seen on the virtual keyboard.
Line 47
0 1 5 4
Controller 1 | 1 (Button Input) | Button 5 (D-pad Left) | 4 (UI Activate)
Action: D-Pad Left button brings up VICE menu
Line 56
0 1 14 1 1 16
Controller 1 | 1 (Button Input) | Button 14 (CROSS) | 1 (mapped to joystick) | Joystick Port 1 | pin 16 (Fire)
Action: CROSS is joystick fire button
If there are multiple mappings, then it is possible to disable buttons. For example, in my config, the Joystick Map function is mapped to button 2 (R3), button 6 (D-pad down) and button 12 (Triangle). If I wished to disable the function for button 6, then I could edit the entry (line 48) to 0 1 6 0. This is the only manual edit I would be comfortable in making.
Note: some of this information may be inaccurate as I'm not 100% familiar with the C64 hardware.
TL;DR
Do not manually edit the joystick mapping file sdl-joymap-C64.vjm. Use the VICE menu as described in Sir Randall's Gaming video.
Back up the joystick mapping file.