I wanted to find a way to press CTRL+Open Apple+ESC to get into the control panel of the apple2gs, but LCTRL+LALT+ESC doesn't get passed on with Ubuntu.


One strategy is to assign another key like PgUp to both Open Apple and CTRL, like PgUp, so you can type PgUp + ESC and that will work.

I tried assigning PgUp to CTRL and OpenApple and ESC, but pressing all three simultaneously doesn't seem to work. It seems that ESC must be pressed slightly later than CTRL+OpenApple.



Another strategy is to use lua to press some keys:

So first, let's figure out the names of the ports and fields we need:
Code
[MAME]> function printt(t) for a,b in pairs(t) do print(a,b) end end
[MAME]> printt(manager.machine.ioport.ports)
:a2_config	sol.ioport_port*: 0x5645a8e82b28
:macadb:KEY0	sol.ioport_port*: 0x5645a8e5cf88
:macadb:KEY1	sol.ioport_port*: 0x5645a8df18a8
:macadb:KEY2	sol.ioport_port*: 0x5645a8e34068
:macadb:KEY3	sol.ioport_port*: 0x5645a8dc77a8
...

[MAME]> printt(manager.machine.ioport.ports[":macadb:KEY3"].fields)
Command / Open Apple	sol.ioport_field*: 0x5645a8efe0e8
Esc	sol.ioport_field*: 0x5645a8efa808
Option / Solid Apple	sol.ioport_field*: 0x5645a8eff718
Control	sol.ioport_field*: 0x5645a8f068d8
...

Once we know the name of the port and the fields we need, we can assign them to some variables and make a coroutine function:

Code
 opkey = manager.machine.ioport.ports[":macadb:KEY3"].fields["Command / Open Apple"] 
 esckey = manager.machine.ioport.ports[":macadb:KEY3"].fields["Esc"]
 ctrlkey = manager.machine.ioport.ports[":macadb:KEY3"].fields["Control"]


function cofunc()
 print("press op, ctrl") 
 opkey:set_value(1) 
 ctrlkey:set_value(1) 
 emu.wait(2/60) 
 print("press esc") 
 esckey:set_value(1)
 emu.wait(2/60) print("release")
 opkey:set_value(0) 
 esckey:set_value(0) 
 ctrlkey:set_value(0)  
end

function pressctrlopesc() co1 = coroutine.create(cofunc) coroutine.resume(co1) end

pressctrlopesc()