[Linked Image from i.imgur.com]

Managed to figure out enough about layouts to make a row of buttons.

Launching mame with -override_artwork my_art_directory works pretty well.

I have to be careful with this XML stuff, if there's any errors mame segfaults on startup. Segfault! (sung to the Freak out song) Segfault!

xmllint is pretty darn useful in this case to zero in on the erroneous xml. It's so easy to lose a quote here and there.

Code
Segmentation fault (core dumped)

$ xmllint artwork/segfault_apple2p/default.lay  
artwork/segfault_apple2p/default.lay:165: parser error : Unescaped '<' not allowed in attributes values
"menu~menunum~" inputtag=" sl2:agraphtablet:joystick_3_buttons" inputmask="0x10>
                                                                               ^
artwork/segfault_apple2p/default.lay:165: parser error : attributes construct error
"menu~menunum~" inputtag=" sl2:agraphtablet:joystick_3_buttons" inputmask="0x10>
                                                                               ^