Picade joystick and buttons as gamepad not keyboard

It was certainly possible with the old Picade PCB (and a good deal more easy given it was essentially an Arduino Leonardo) and gadgetoid did release a firmware that supported this (New 2.x Configurable Keyboard/Gamepad Firmware)

I’m not aware of anyone having managed this with either the PicadeHAT or PicadeX HAT. RetroPie does have a page on their wiki that covers GPIO modules (https://github.com/RetroPie/RetroPie-Setup/wiki/GPIO-Modules) which conceivably could be modified to match the pinout of the PicadeX HAT (https://pinout.xyz/pinout/picade_x_hat).