This page explains how to control input to the program using Lua. You can simulate autohold and autofire, and create macros this way.
A simple autohold script
Suppose you want to hold down the Y button in snes9x. Just run this script:
while true do
joypad.set(1, {Y=1})
emu.frameadvance()
end
You can also use "Y=true" in place of "Y=1". The notation "{Y=1}" indicates a table with key Y set to 1. If variable c is a table, then c.Y (or c["Y"]) is the key Y associated with the table c. So you can write it this way:
local c={}
c.Y=1
while true do
joypad.set(1, c)
emu.frameadvance()
end
If you wanted to have player 2 hold left, you would do it as follows:
local c={}
while true do
joypad.set(2, {left=1})
emu.frameadvance()
end
See a list of table keys for what the keys are named. They are different for each emulator.