How does retroarch make my controller work?!?

This is a weird question i guess… But how the hell does retroarch make my ps3/pc gamepad work on windows 10? I tried using SCP to make it work for Windows game, such as Celeste, but it just doesnt work at all. The driver install, but the controller stops working. And Im kinda confused, how retroarch is able to make it work just fine. PPSSPP standalone emulator works too.