Here is how I got the Xbox 360 controller working, I hope this helps:
(PS. You can use this method for any controller)
By default, your controller is recognised by the game as a virtual joystick, and is mapped to that virtual joystick in the DOSBox mapper screen. You wouldn't want the controller mapped to this virtual joystick however, since it could conflict with how you'd map it to the DOSBox keyboard. So you should first unmap it from the virtual joystick in the DOSBox mapper screen. Then you'd be able to map it to the DOSBox keyboard with no problems.
However the game will still recognise the controller as a virtual joystick (just that it will no longer recognise any controller button presses as virtual joystick button presses, since you've unmapped the controller from the virtual joystick). This wouldn't usually be a problem, but because it recognises the controller as a virtual joystick, it will still ask you to configure the joystick when you first start up the game. You won't be able to do this now though since you've unmapped the controller from the virtual joystick, so you'd just have to skip this configuration. You may think that this wouldn't matter, but this will actually cause the controls to mess up for the game. Therefore, before unmapping the controller from the virtual joystick (and mapping it to the DOSBox keyboard instead), you must make sure to first start up the game and go through this initial configuration. Then once you've done this, you can do all the mapping then.
1. Install the game
2. Connect the controller to your PC (make sure there are no other controllers connected as well)
3. Start the game
4. Proceed through the initial joystick configuration
5. Once you reach the main menu of the game, exit the game again
6. Open the 'DOSBOX' subfolder in the 'Rayman Forever' folder ("C:\GOG Games\Rayman Forever\DOSBOX")
7. Click on 'DOSBox.exe'
8. Hold Ctrl and press F1
9. To unmap the controller from the virtual joystick, you'll need to delete all the controller button mappings from each of the virtual joystick buttons. To delete a button mapping, simply click on a virtual joystick button, and then click 'Del' on-screen. In the DOSBox mapper screen, you'll see three sections, named 'Axis 1/2', 'Axis 3/4' and 'Disabled'. In each of these sections will be a number of buttons. The controller buttons will be automatically mapped to all of these, so you must now delete all these mappings
10. To map a controller button to a DOSBox keyboard key, first left-click on a key on the on-screen keyboard, then click 'Add', then press a button on the controller. Map the following controller buttons to the corresponding DOSBox keys:
Keyboard Key - Controller Button:
Up Arrow - D-Pad Up, Left Stick Up
Down Arrow - D-Pad Down, Left Stick Down, Left Shoulder, Right Shoulder
Left Arrow - D-Pad Left, Left Stick Left
Right Arrow - D-Pad Right, Left Stick Right
Ctrl - A
Enter - A
Alt - X
X key - B
Esc - Y and Start
(I find that setting the Shoulder buttons to the Down Arrow key is really useful for crawling with Rayman, since you can change directions easily then with the D-Pad. You don't need to do this though if you don't want to)
11. Once you've finished all this, click Save
12. Click Exit
13. Close DOSBox
14. Go back to the main 'Rayman Forever' folder
15. In a separate window, go to the location "C:\Users\(User)\AppData\Local\DOSBox"
16. Move the newly created 'mapperfile=mapper-0.74-2.1.map' file in that location to the 'Rayman Forever' folder
17. You can then delete the other 'dosbox-0.74-2.1.conf' file in that location and you can delete the 'DOSBox' folder altogether from the 'Local' folder
18. In the 'Rayman Forever' folder, rename the .map file that you just moved there to something more suitable like 'RaymanXbox360Controller.map' or something (just make sure that you don't use any spaces in it though)
19. Open the file 'dosboxRayman.conf' in a text editor like Notepad
20. There is a name in the text, called 'mapperfile', the value of it should be the same as the name of the .map file you just moved into the 'Rayman Forever' folder (ie. RaymanXbox360Controller.map). So rename its value to that
21. There is another name in the text, called 'joysticktype', that has a value called 'auto'. Change this value to 'fcs'
22. There is one more name in the text, called 'buttonwrap', that has a value called 'true'. Change this value to 'false'
23. Save these changes you've made to the 'dosboxRayman.conf' file
If you want to set up another controller with Rayman Forever, you can connect this controller to your PC now as well (make sure to disconnect all other controllers first though), and then proceed through steps 6-18 above again in order to map this new controller. Then whenever you wish to switch between controllers, you must open the 'dosboxRayman.conf' file and change the value of the 'mapperfile' to the name of your desired controller's .map file.
Post edited March 11, 2022 by AllHallowSteve