Touchscreen Lightgun Functionality

Simply as a starting point, is there anyway to get lightgun functionality working for the NES cores? Eventually I’m interested in lightgun functionality on all cores that should have it. But I thought lets get it working on NES first. Any suggestions?