The minimaws application is in the MAME source tree at scripts/minimaws and should work on any system with MAME (or a copy of its -listxml output), Python 2.7 or Python 3, and a reasonably new version of SQLite (3.6.19 is required for foreign key support). Command-line help is provided for both the main command options and subcommand options (use the -h or --help flag). It's definitely incomplete at this point, but I'm gradually adding functionality to it. I considered a few options for implementing the -listxml consumer, but settled on Python with some of the more interactive features in JavaScript because pretty much everyone has a Python interpreter and a web browser. My apologies if you have trouble reading these languages - they're far from my favourite languages, too. I'm not sure exactly what level of ECMAscript it requires - I've tested it with Firefox 48, and I think the highest feature I use is the 'json' response type for XMLHttpRequest.
Setting up currently requires a couple of steps to make a clean database and load (I intend to streamline this at some point):
Code: Select all
rm minimaws.sqlite3
sqlite3 minimaws.sqlite3
python minimaws.py load path/to/mame
There are a few query commands that work much like MAME's auxiliary verbs, but case sensitive and with better glob behaviour. You should be able to work them out. To run in web server mode, use the serve command:
Code: Select all
python minimaws.py serve
If you know the short name of a machine or driver, or you know the path to a source file with device/system definitions, you can jump straight to it with a URL (note that src/mame/drivers is elided in source file paths for historical reasons). You can also get a list of all source files with device/system definitions, although it's a large page and may perform poorly. Pages are interlinked pretty well - you can jump to any device used by a system/device, or any system that uses a device, or parents/clones systems. You can jump to any device defined in a source file, or the source file that defines a device. Example URLs you could start from include:
- http://localhost:8080/machine/intlc440
- http://localhost:8080/machine/a2mouse
- http://localhost:8080/sourcefile/src/de ... 68kcpu.cpp
- http://localhost:8080/sourcefile/
Although there aren't any in that example, unemulated/imperfect feature flags are shown for devices where applicable. Command-line flags for MAME to produce the selected configuration are shown, including elision of default choices. You can see it in action with any slotted system, for example:
- http://localhost:8080/machine/ibm5150
- http://localhost:8080/machine/apple2e
- http://localhost:8080/machine/ti82
The live slot selection is mostly done in lib/assets/machine.js with a bit of help from the web service. It works as follows:
- On a page for a system/device with slots, the JavaScript requests slot information for the machine and any devices that can be inserted into slots (fetch_slots). It keeps a map of device slot information (slot_info) and checks whether it has already received or requested details for a device.
- The only trick in the slot info web service (lib.wsgiserve.SlotsRpcHandler.data_page) is to filter out slots that come from default devices in other slots. This can be done lexically, there's nothing difficult about it.
- Once all the slot information has been gathered, the slot UI is populated (populate_slots).
- When a slot card is selected, any subslots are added to the UI (in the callback generated by make_slot_change_handler). This uses the same add_slot_items function that populate_slots uses to create the actual controls and apply defaults.
- When applying defaults, remember to walk from the topmost level inwards - defaults specified at a higher level take precedence.
- When a slot card is selected, the JavaScript asynchronously requests emulation status flags if it doesn't have them already (fetch_machine_flags) and adds the information to the table (add_flag_rows).
- The command-line flag preview is updated in update_cmd_preview after any changes.