Possible to send game controller signals to devices?

One thing I've always dreamed of doing is to create an adapter that allows me to not only hook up a DS4 controller to a Nintendo Switch (or other consoles), but to also create macros for them.

What key words or topics can I research to learn more about the steps needed to achieve this goal? I don't have any knowledge on how game controllers work, or how they communicate with devices.

I'd greatly appreciate any help.