Game controller events (emulation)

Is there a way of emulating game pad in MacOS? More precisely, I would like to 'sent' the thumbsticks coordinates to a game, so that it could be controlled from external application. I know it's feasible with keyboard, but I can't find a solution for a gamepad (PS4 gamepad).