Sadly, the TSR solution is easier said then done. The tool would need to manage protected mode ISR-s from within the same DPMI host the game uses, and reassign its own ISR back after the game starts to run, so the above technique would not work.
I experimented with the suggested direction, though, but results were mixed. I ended up with a tool that works with real mode games, e.g. can change weapons in Wolf 3D, but... only in DOSBox-X, so application with handhelds is somewhat limited 😉
EDIT: ... but then I actually went ahead and patched the executable. I was curious how patching a Doom engine game would work out, and indeed work out it did. Sadly only had time to test with DOSBox and did not play through any of the maps.
Now, I have no idea how playable Heretic would be on a device with 4 action buttons, and even if every map could be completed, but I was thinking a similar patch for Ultimate Doom/Doom II/Final Doom could probably be useful for someone, as the four buttons could be Fire, Use, Strafe and Next weapon.
EDIT2: ... and I made those Doom patches as well
EDITX: removing the attachments; see below post for up to date versions attached.
GA-G41M-Combo G41/ICH7 - Core 2 Quad Q9550 - DDR3 1033 - Radeon RX570 - YMF744 (Cobra) - X3MB (Buran)