/usr/share/openmsx/scripts/autoplug.tcl is in openmsx-data 0.10.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # if this machine has a cassetteport, then automatically plug
# in the cassetteplayer
# on a Dingoo, automatically plug in the keyjoystick and if there are real
# joysticks, plug them as well for non-Dingoo platofrms
namespace eval autoplug {
proc plug_if_empty {connector pluggable} {
if {[string first "--empty--" [plug $connector]] != -1} {
# only when nothing already plugged
plug $connector $pluggable
}
}
proc do_autoplug {} {
# do not do any auto plug stuff when replaying, because a reset
# command in the replay will trigger autoplug and will cause the
# replay to get interrupted with the plug event.
if {[dict get [reverse status] status] ne "replaying"} {
set connectors [list]
catch {
#can fail when you activate an 'empty' machine
set connectors [machine_info connector]
}
set pluggables [list]
catch {
#can fail when you activate an 'empty' machine
set pluggables [machine_info pluggable]
}
# cassette port
if {"cassetteport" in $connectors} {
plug_if_empty cassetteport cassetteplayer
}
# joystick ports
if {[string match *-dingux* $::tcl_platform(osVersion)]} { ;# Dingoo
if {"joyporta" in $connectors} {
set ::keyjoystick1.triga LCTRL
set ::keyjoystick1.trigb LALT
plug_if_empty joyporta keyjoystick1
}
} else {
if {("joyporta" in $connectors) &&
("joystick1" in $pluggables)} {
plug_if_empty joyporta joystick1
}
if {("joyportb" in $connectors) &&
("joystick2" in $pluggables)} {
plug_if_empty joyportb joystick2
}
}
}
after boot [namespace code do_autoplug]
}
};# namespace autoplug
after boot autoplug::do_autoplug
|