Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
##
|
|
|
|
## license:BSD-3-Clause
|
|
|
|
## copyright-holders:Vas Crabb
|
2017-08-03 15:38:22 +02:00
|
|
|
##
|
|
|
|
## Demonstrates use of MAME's XML system information output
|
|
|
|
##
|
2017-08-25 06:18:20 +02:00
|
|
|
## This script requires Python 2.7 or Python 3.4, and SQLite 3.6.19 at
|
2017-08-03 15:38:22 +02:00
|
|
|
## the very least. Help is provided for all command-line options (use
|
|
|
|
## -h or --help).
|
|
|
|
##
|
|
|
|
## Before you can use the scripts, you need to load MAME system
|
2017-08-04 11:23:18 +02:00
|
|
|
## information into a database:
|
2017-08-03 15:38:22 +02:00
|
|
|
##
|
|
|
|
## $ python minimaws.py load --executable path/to/mame
|
|
|
|
##
|
|
|
|
## (The script uses the name "minimaws.sqlite3" for the database by
|
|
|
|
## default, but you can override this with the --database option.)
|
|
|
|
##
|
|
|
|
## After you've loaded the database, you can use query commands. Most
|
|
|
|
## of the query commands behave similarly to MAME's auxiliary verbs but
|
|
|
|
## case-sensitive and with better globbing (output not shown for
|
|
|
|
## brevity):
|
|
|
|
##
|
|
|
|
## $ python minimaws.py listfull "unkch*"
|
|
|
|
## $ python minimaws.py listclones "unkch*"
|
|
|
|
## $ python minimaws.py listbrothers superx
|
|
|
|
##
|
2019-09-30 06:38:26 +02:00
|
|
|
## The romident command does not support archives or software lists, but
|
|
|
|
## it's far faster than using MAME as it has optimised indexes, and
|
|
|
|
## results are grouped by machine rather than by file:
|
2019-09-28 13:25:50 +02:00
|
|
|
##
|
|
|
|
## $ python minimaws.py romident 27c64.bin dump-dir
|
|
|
|
##
|
2017-08-03 15:38:22 +02:00
|
|
|
## One more sophisticated query command is provided that MAME has no
|
|
|
|
## equivalent for. The listaffected command shows all runnable machines
|
|
|
|
## that reference devices defined in specified source files:
|
|
|
|
##
|
|
|
|
## $ python minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/cpu/mcs40/mcs40.cpp
|
|
|
|
##
|
|
|
|
## This script can also run a local web server allowing you to explore
|
|
|
|
## systems, devices and source files:
|
|
|
|
##
|
|
|
|
## $ python minimaws.py serve
|
|
|
|
##
|
|
|
|
## The default TCP port is 8080 but if desired, this can be changed with
|
|
|
|
## the --port option. The web service is implemented using WSGI, so it
|
|
|
|
## can be run in a web server if desired (e.g. using Apache mod_wsgi).
|
|
|
|
## It uses get queries and provides cacheable reponses, so it should
|
|
|
|
## work behind a caching proxy (e.g. squid or nginx). Although the
|
|
|
|
## service is written to avoid SQL injected and directory traversal
|
|
|
|
## attacks, and it avoids common sources of security issues, it has not
|
|
|
|
## been audited for vulnerabilities and is not recommended for use on
|
|
|
|
## public web sites.
|
|
|
|
##
|
|
|
|
## To use the web service, you need to know the short name of a device/
|
|
|
|
## system, or the name of a source file containing a system:
|
|
|
|
##
|
|
|
|
## http://localhost:8080/machine/intlc440
|
|
|
|
## http://localhost:8080/machine/a2mouse
|
|
|
|
## http://localhost:8080/sourcefile/src/devices/cpu/m68000/m68kcpu.cpp
|
|
|
|
##
|
|
|
|
## You can also start with a list of all source files containing machine
|
|
|
|
## definitions, but this is quite a large page and may perform poorly:
|
|
|
|
##
|
|
|
|
## http://localhost:8080/sourcefile/
|
|
|
|
##
|
|
|
|
## One feature that may be of iterest to front-end authors or users of
|
|
|
|
## computer emulation is the ability to show available slot options and
|
|
|
|
## update live as changes are made. This can be seen in action on
|
|
|
|
## computer systems:
|
|
|
|
##
|
|
|
|
## http://localhost:8080/machine/ibm5150
|
|
|
|
## http://localhost:8080/machine/apple2e
|
|
|
|
## http://localhost:8080/machine/ti82
|
|
|
|
##
|
|
|
|
## On any of these, and many other systems, you can select slot options
|
|
|
|
## and see dependent slots update. Required command-line arguments to
|
|
|
|
## produce the selected configuration are also displayed.
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-10-01 18:11:58 +02:00
|
|
|
import argparse
|
|
|
|
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('--database', metavar='<dbfile>', default='minimaws.sqlite3', help='SQLite 3 info database file (defaults to minimaws.sqlite3)')
|
|
|
|
subparsers = parser.add_subparsers(title='commands', dest='command', metavar='<command>')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('listfull', help='list short names and full names')
|
|
|
|
subparser.add_argument('pattern', nargs='?', metavar='<pat>', help='short name glob pattern')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('listsource', help='list short names and source files')
|
|
|
|
subparser.add_argument('pattern', nargs='?', metavar='<pat>', help='short name glob pattern')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('listclones', help='show clones')
|
|
|
|
subparser.add_argument('pattern', nargs='?', metavar='<pat>', help='short name/parent glob pattern')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('listbrothers', help='show drivers from the same source file(s)')
|
|
|
|
subparser.add_argument('pattern', nargs='?', metavar='<pat>', help='short name glob pattern')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('listaffected', help='show drivers affected by source change(s)')
|
|
|
|
subparser.add_argument('pattern', nargs='+', metavar='<pat>', help='source file glob pattern')
|
|
|
|
|
2019-09-28 13:25:50 +02:00
|
|
|
subparser = subparsers.add_parser('romident', help='identify ROM dump(s)')
|
|
|
|
subparser.add_argument('path', nargs='+', metavar='<path>', help='ROM dump file/directory path')
|
|
|
|
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
subparser = subparsers.add_parser('serve', help='serve over HTTP')
|
|
|
|
subparser.add_argument('--port', metavar='<port>', default=8080, type=int, help='server TCP port')
|
|
|
|
subparser.add_argument('--host', metavar='<host>', default='', help='server TCP hostname')
|
|
|
|
|
|
|
|
subparser = subparsers.add_parser('load', help='load machine information')
|
|
|
|
group = subparser.add_mutually_exclusive_group(required=True)
|
|
|
|
group.add_argument('--executable', metavar='<exe>', help='emulator executable')
|
|
|
|
group.add_argument('--file', metavar='<xmlfile>', help='XML machine information file')
|
2019-12-17 18:25:52 +01:00
|
|
|
subparser.add_argument('--softwarepath', required=True, action='append', metavar='<path>', help='Software list directory path')
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
|
|
|
|
options = parser.parse_args()
|
2019-10-01 18:11:58 +02:00
|
|
|
|
|
|
|
import lib.auxverbs
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
if options.command == 'listfull':
|
|
|
|
lib.auxverbs.do_listfull(options)
|
|
|
|
elif options.command == 'listsource':
|
|
|
|
lib.auxverbs.do_listsource(options)
|
|
|
|
elif options.command == 'listclones':
|
|
|
|
lib.auxverbs.do_listclones(options)
|
|
|
|
elif options.command == 'listbrothers':
|
|
|
|
lib.auxverbs.do_listbrothers(options)
|
|
|
|
elif options.command == 'listaffected':
|
|
|
|
lib.auxverbs.do_listaffected(options)
|
2019-09-28 13:25:50 +02:00
|
|
|
elif options.command == 'romident':
|
|
|
|
lib.auxverbs.do_romident(options)
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
elif options.command == 'serve':
|
2019-10-01 18:11:58 +02:00
|
|
|
import wsgiref.simple_server
|
|
|
|
import lib.wsgiserve
|
|
|
|
application = lib.wsgiserve.MiniMawsApp(options.database)
|
|
|
|
server = wsgiref.simple_server.make_server(options.host, options.port, application)
|
|
|
|
try:
|
|
|
|
server.serve_forever()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
pass
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
elif options.command == 'load':
|
2019-10-01 18:11:58 +02:00
|
|
|
import lib.lxparse
|
Add "minimaws" sample script demonstrating how to do some tasks with
output from -listxml verb. Compatible with Python 2.7 or Python 3.
Requires at least SQLite 3.6.19 for foreign key support.
This serves a few purposes:
* Demonstrating some things that can be done with -listxml output
* Providing a reference implementation for useful queries
* Helping ensure our XML output isn't completely useless
* Providing additional queries over MAME's auxiliary verbs
* Proper glob support unlike the broken implementation in MAME right now
Right now, it's a bit ugly to use. You can only load into a completely
clean database, and you need to manually create the schema. I'll
address this later. The default database filename is minimaws.sqlite3
(you can override this with --database before the verb on the command
line). Loading isn't particularly fast, but query performance is very
good.
Create a database first:
rm -f minimaws.sqlite3
sqlite3 minimaws.sqlite3 < scripts/minimaws/schema.sql
Now you can load it using a MAME binary or XML output (use one of these
options, not both):
python scripts/minimaws/minimaws.py load --executable ./mame
python scripts/minimaws/minimaws.py load --file mame0188.xml
Once that's done you can do queries:
python scripts/minimaws/minimaws.py listfull
python scripts/minimaws/minimaws.py listclones "*cmast*"
python scripts/minimaws/minimaws.py listsource "*mous*"
python scripts/minimaws/minimaws.py listbrothers "intl*"
These work much like the equivalent MAME verbs, but without the overhead
of loading MAME's static data. But there's one already query that you
can't easily do with MAME:
python scripts/minimaws/minimaws.py listaffected "src/devices/cpu/m6805/*" src/devices/sound/qsound.cpp
This will list all runnable systems that use a device defined in any
file under devices/cpu/m6805 or in devices/sound/qsound.cpp (you can
specify and arbitrary number of files or glob patterns). This may be
useful for planning regression tests.
Another thing this does (that gives rise to the name) is serving
information over HTTP. It's implemented as a WSGI, and it mainly uses
GET requests. This means it can run hosted in Apache mod_wsgi, or
cached by Apache mod_proxy, Squid, nginx, or something else. It can
also run out-of-the-box using wsgiref.simple_server components. The
default port is 8080 but this can be changed with the --port option.
Start the web server with the serve verb (stop it with keyboard
interrupt ^C or similar):
python scripts/minimaws/minimaws.py serve
Right now it's rather crude, and doesn't list devices for you. This
means you have to know the shortname of a machine to get a useful URL.
For example, you can look at a driver and see its parent set and the
devices it references:
http://localhost:8080/machine/kof2000n
Or you can look at a device, and see the devices it refereces, as well
as the devices/systems that reference it:
http://localhost:8080/machine/zac1b11142
The links between devices/systems are clickable. They might 404 on you
if you used a single-driver build with broken parent/clone
relationships, but they should all work in a full build that passes
validation.
There's still a lot to do. In particular I want to demonstrate how to
do live DIP switch preview and dynamic slot discovery. But I've already
discovered stuff in the -listxml output that's less than ideal with
this, so it's helping.
2017-07-31 18:55:25 +02:00
|
|
|
lib.lxparse.load_info(options)
|