I only know a tool to do it the other way around.
FakeCD32Joypad.
AFAIK, one of the JOTD (jst) packages also contains such a tool. Maybe it has source somewhere?
What you're trying to do is quite rare. I think such a tool doesn't exist, unless you write one for yourself.