One of the difficulties in adding input display is that there are so many different input setups. Different games have different numbers of buttons and players. The buttons have different names. Some have analog controls.
Some modules (unique setups) cover many games, some just one. If you want to add input display to an uncovered game, you just need to add a module to the list by defining the input abbreviations and where on screen you want them shown.
Find the unabbreviated names under "Input" > "Map game inputs..." Then come up with sensible text symbols for each of them, and place them somewhere on screen that doesn't cover important stuff. Follow the examples given for formatting and syntax. You don't have to use x,dx,y,dy for positioning or loops for multiple players, but they make it easier to do tweaks later.
Share your added modules here. This information needs to be collected for all games sooner or later, and at some point input display can be internalized into FBA.
The script in the FBArr-004 archive can be split into the active part and the module list for easier reading. Make sure the list is named "modules.lua" in this case.
input display.lua
--FBA-rr input display script (preliminary)
--This script must be reloaded when you change games.
local c={ --colors:
on1 =0xffff00ff, --pressed: yellow inside
on2 =0x000000ff, --pressed: black border
off1=0x00000000, --unpressed: clear inside
off2=0x00000033 --unpressed: mostly-clear black border
}
inp={}
dofile("modules.lua","r")
local function inputsmatch(table1,table2) --check if all keys of table1 are also keys of table2
local checklist={}
for k,v in pairs(table1) do
checklist[k]=false
for l,u in pairs(table2) do
if k==l then
checklist[k]=true
break
end
end
end
for k,v in pairs(checklist) do
if v==false then
return false
end
end
return true
end
local module
for k,v in pairs(inp) do --find out which module is the correct one
if inputsmatch(v,joypad.get(1)) then
module=k
break
end
end
local function inpdisplay(m)
if not module then
gui.text(0,0,"I don't know how to display this game's input.\nPlease add a module for it!")
else
for k,v in pairs(joypad.get(1)) do
if m[k] then --display only defined inputs
local color1,color2=c.on1,c.on2
if m[k][4] then --analog
gui.text(m[k][2]+m[k][4],m[k][3]+m[k][5],v,color1,color2) --display the value
else --digital
if v==0 then color1,color2=c.off1,c.off2 end --button not pressed
end
gui.text(m[k][2],m[k][3],m[k][1],color1,color2)
end
end
end
end
gui.register(function()
inpdisplay(inp[module])
end)
modules.lua
--Define below input abbreviations and on-screen positions for each module.
--You may add new modules and comment out any inputs you never want displayed.
local x,dx,y,dy,i
--------------------------------------------------------------------------------
--Capcom 6-button fighters
x,dx=0x8,0x128
y,dy=0xd0,0
i={}
for n=0,1 do
i["P"..(n+1).." Coin"] ={"C", x+dx*n+0x00,y+dy*n+0x0}
i["P"..(n+1).." Start"] ={"S", x+dx*n+0x00,y+dy*n+0x8}
i["P"..(n+1).." Up"] ={"^", x+dx*n+0x18,y+dy*n+0x0}
i["P"..(n+1).." Down"] ={"v", x+dx*n+0x18,y+dy*n+0x8}
i["P"..(n+1).." Left"] ={"<", x+dx*n+0x10,y+dy*n+0x4}
i["P"..(n+1).." Right"] ={">", x+dx*n+0x20,y+dy*n+0x4}
i["P"..(n+1).." Weak Punch"] ={"LP",x+dx*n+0x30,y+dy*n+0x0}
i["P"..(n+1).." Medium Punch"]={"MP",x+dx*n+0x38,y+dy*n+0x0}
i["P"..(n+1).." Strong Punch"]={"HP",x+dx*n+0x40,y+dy*n+0x0}
i["P"..(n+1).." Weak Kick"] ={"LK",x+dx*n+0x30,y+dy*n+0x8}
i["P"..(n+1).." Medium Kick"] ={"MK",x+dx*n+0x38,y+dy*n+0x8}
i["P"..(n+1).." Strong Kick"] ={"HK",x+dx*n+0x40,y+dy*n+0x8}
end
table.insert(inp,i)
--------------------------------------------------------------------------------
--NeoGeo
x,dx=0x8,0xd0
y,dy=0xc8,0
i={}
for n=0,1 do
i["P"..(n+1).." Coin"] ={"C",x+dx*n+0x04,y+dy*n+0x0}
i["P"..(n+1).." Start"] ={"S",x+dx*n+0x00,y+dy*n+0x8}
i["P"..(n+1).." Select"] ={"s",x+dx*n+0x08,y+dy*n+0x8}
i["P"..(n+1).." Up"] ={"^",x+dx*n+0x20,y+dy*n+0x0}
i["P"..(n+1).." Down"] ={"v",x+dx*n+0x20,y+dy*n+0x8}
i["P"..(n+1).." Left"] ={"<",x+dx*n+0x18,y+dy*n+0x4}
i["P"..(n+1).." Right"] ={">",x+dx*n+0x28,y+dy*n+0x4}
i["P"..(n+1).." Button A"]={"A",x+dx*n+0x38,y+dy*n+0x4}
i["P"..(n+1).." Button B"]={"B",x+dx*n+0x40,y+dy*n+0x4}
i["P"..(n+1).." Button C"]={"C",x+dx*n+0x48,y+dy*n+0x4}
i["P"..(n+1).." Button D"]={"D",x+dx*n+0x50,y+dy*n+0x4}
end
table.insert(inp,i)
--------------------------------------------------------------------------------
--PGM
x,dx=0x10,0x70
y,dy=0xc0,0
i={}
for n=0,3 do
i["P"..(n+1).." Coin"] ={"C",x+dx*n+0x00,y+dy*n+0x0}
i["P"..(n+1).." Start"] ={"S",x+dx*n+0x00,y+dy*n+0x8}
i["P"..(n+1).." Up"] ={"^",x+dx*n+0x14,y+dy*n+0x0}
i["P"..(n+1).." Down"] ={"v",x+dx*n+0x14,y+dy*n+0x8}
i["P"..(n+1).." Left"] ={"<",x+dx*n+0x0c,y+dy*n+0x4}
i["P"..(n+1).." Right"] ={">",x+dx*n+0x1c,y+dy*n+0x4}
i["P"..(n+1).." Button 1"]={"1",x+dx*n+0x2c,y+dy*n+0x4}
i["P"..(n+1).." Button 2"]={"2",x+dx*n+0x34,y+dy*n+0x4}
i["P"..(n+1).." Button 3"]={"3",x+dx*n+0x3c,y+dy*n+0x4}
i["P"..(n+1).." Button 4"]={"4",x+dx*n+0x44,y+dy*n+0x4}
end
table.insert(inp,i)
--------------------------------------------------------------------------------
--TMNT games (Konami)
x,dx=0x10,0x48
y,dy=0x20,0
i={}
for n=0,3 do
i["Coin "..(n+1)] ={"C",x+dx*n+0x00,y+dy*n+0x4}
i["P"..(n+1).." Up"] ={"^",x+dx*n+0x14,y+dy*n+0x0}
i["P"..(n+1).." Down"] ={"v",x+dx*n+0x14,y+dy*n+0x8}
i["P"..(n+1).." Left"] ={"<",x+dx*n+0x0c,y+dy*n+0x4}
i["P"..(n+1).." Right"] ={">",x+dx*n+0x1c,y+dy*n+0x4}
i["P"..(n+1).." Fire 1"]={"1",x+dx*n+0x2c,y+dy*n+0x4}
i["P"..(n+1).." Fire 2"]={"2",x+dx*n+0x34,y+dy*n+0x4}
end
table.insert(inp,i)
--------------------------------------------------------------------------------
--After Burner II (Sega)
x,dx=0x80,0x10
y,dy=0xc8,0
i={
["Coin 1"] ={"C1", x+0x00,y+0x00},
["Coin 2"] ={"C2", x+0x00,y+0x08},
["Start 1"] ={"S1", x+0x00,y+0x10},
["Left/Right"]={"L/R",x+0x10,y+0x00,dx,dy},
["Up/Down"] ={"U/D",x+0x10,y+0x08,dx,dy},
["Throttle"] ={"T", x+0x10,y+0x10,dx,dy},
["Vulcan"] ={"V", x+0x30,y+0x04},
["Missile"] ={"M", x+0x30,y+0x0c}
}
table.insert(inp,i)
--------------------------------------------------------------------------------