Help with video game controller using rotary encoder on the Arduino Leonardo

Current state: All of the buttons, potentiometers and joysticks are working perfectly in Euro Truck Simulator, except for the rotary encoder, which I want to use as a steering axis. The reason why I selected a rotary encoder for this purpose, is to get 900º or more of steering range. I would like to be able to dynamically adjust the steering range for games that need more precision, like Euro Truck Simulator or BeamNG.drive. I also need to find a solution to lock the steering wheel at a certain point so it doesn't continue to rotate when I'm at the steering lock (ie. 900º).

Desired state: I want to use the rotary encoder as an axis to steer the car or truck in some of my games. I have a decent Logitech steering wheel, pedals and shifter, but I want a custom and portable setup to bring to friends houses.

I'm not sure how to explain what I've changed, the results of the changes and why they failed. I don't think I even know, myself if I'm being honest.

I've worked through the errors in the code, but I am still unable to find a solution to add the rotary encoder as an axis in XInput. I will try to use DirectInput or some other type of HID.

I am also unsure of what the games expect from my contoller. I just know that I want to play driving simulator games with this device.

Thank you for taking time out of your day to help. I appreciate all that people do on this forum.