From: Clinton Ebadi Date: Mon, 12 Jul 2021 02:40:18 +0000 (-0400) Subject: mame-catver-filter: filter mame roms by category X-Git-Url: http://git.hcoop.net/clinton/scratch.git/commitdiff_plain/6a6db01d7cb6cd6bb6db0f05770679333e2c006f mame-catver-filter: filter mame roms by category --- diff --git a/mame-catver-filter/catver.lisp b/mame-catver-filter/catver.lisp new file mode 100644 index 0000000..8b80872 --- /dev/null +++ b/mame-catver-filter/catver.lisp @@ -0,0 +1,564 @@ +;;; Simple program to parse catver.ini +;;; (http://www.progettosnaps.net/catver/) and filter the results. +;;; 2019 Clinton Ebadi +;;; CC0 To the extent possible under law, Clinton Ebadi has waived all +;;; copyright and related or neighboring rights to MAME Category +;;; Filter. + +(quicklisp:quickload '(:parser.ini :cl-ppcre :alexandria :arnesi)) + +(import '(alexandria:read-file-into-string)) + +;; fixme: parser.ini doesn't handle DOS line endings so file has to be +;; converted to unix line endings. manually open the stream instead +;; after I remember how external formats work again. + +;; fixme: since I'm using an ad-hoc parser and put zero effort into this, you have to edit catver.ini and extract just the [Category] section +(defparameter *catver-source* (pathname "/home/clinton/src/repos/local/scratch/mame-catver-filter/pS_CatVer_230/catver-only.ini")) + +;; parser.ini barfed on catver (ate all ram and then died...) +;; (defparameter *parsed-catver* +;; (let ((parser.ini:*value-terminating-whitespace-expression* #\Newline)) +;; (parser.ini:parse *catver-source* 'list))) + +(defparameter *catver-hash* (make-hash-table :test 'equal)) + +(with-open-file (catver-stream *catver-source* ) + (arnesi:awhile (read-line catver-stream nil nil) + (cl-ppcre:register-groups-bind (game category) + ("([^=]+)=([^=]+)" arnesi:it) + (format t "KEY ~A VALUE ~A~%" game category) + (setf (gethash category *catver-hash*) (cons game (gethash category *catver-hash*)))))) + +(defun print-cats () + (format t "(") + (maphash (lambda (key value) + (format t "~S~%" key)) + *catver-hash*) + (format t ")")) + +(defun filter-games (categories) + (mapcan (lambda (cat) (gethash cat *catver-hash*)) categories)) + +(defun dump-games (filename categories) + (with-open-file (outf filename :direction :output :if-exists :error) + (mapc (lambda (x) (format outf "~A~%" x)) (filter-games categories)))) + + +;; 2020-11-19: might want to review these for new categories, haven't checked since mame 0.214 +(defparameter *filtered-cats* + '("Maze / Shooter Small" + "Sports / Football" + "Sports / Soccer" + "Driving / Truck Guide" + "Shooter / Flying Vertical" + "Sports / Basketball" + "Sports / Baseball" + "Driving / 1st Person" + "Shooter / Gun" + "Sports / Wrestling" + "Shooter / Field" + "Sports / Tennis" + "Shooter / Flying Horizontal" + "Puzzle / Match" + "Casino / Misc." + "Driving / Motorbike" + "Maze / Collect" + "Fighter / 2.5D" + "Sports / Skateboarding" + "Shooter / Misc. Horizontal" + "Sports / Track & Field" + "Sports / Pool" + "Computer / Training Board" + "Shooter / Gallery" + "Shooter / Flying (chase view)" + "Platform / Run Jump" + "Sports / Volleyball" + "Driving / Race 1st Person" + "Fighter / Versus" + "Platform / Shooter Scrolling" + "Maze / Change Surface" + "Driving / Race (chase view)" + "Shooter / Misc. Vertical" + "Puzzle / Sliding" + "Shooter / Flying 1st Person" + "Driving / Plane" + "Sports / Fishing" + "Platform / Fighter Scrolling" + "Sports / Golf" + "Platform / Run, Jump & Scrolling" + "Shooter / 1st Person" + "Maze / Shooter Large" + "Shooter / 3rd Person" + "Sports / Bowling" + "Shooter / Misc." + "Sports / Skiing" + "Shooter / Walking" + "Sports / Darts" + "Sports / Hockey" + "Maze / Outline" + "Driving / Race Track" + "Climbing / Tree - Plant" + "Driving / Misc." + "Shooter / Flying" + "Shooter / Driving (chase view)" + "Driving / Boat" + "Puzzle / Drop" + "Puzzle / Misc." + "Sports / Misc." + "Platform / Fighter" + "Fighter / 2D" + "Driving / Race (chase view) Bike" + "Ball & Paddle / Breakout" + "Sports / Horse Racing" + "Sports / Armwrestling" + "Sports / Boxing" + "Fighter / 3D" + "Shooter / Driving" + "Shooter / Versus" + "Shooter / Driving Vertical" + "Fighter / Vertical" + "Driving / Race" + "Rhythm / Dance" + "Maze / Surround" + "Misc. / Toy Cars" + "Puzzle / Maze" + "Platform / Shooter" + "Maze / Escape" + "Shooter / Driving Diagonal" + "Ball & Paddle / Pong" + "Maze / Collect & Put" + "Rhythm / Instruments" + "Fighter / Misc." + "Maze / Digging" + "Maze / Blocks" + "Maze / Cross" + "Shooter / Driving Horizontal" + "Fighter / Field" + "Sports / Bull Fighting" + "Shooter / Driving 1st Person" + "Maze / Ladders" + "Puzzle / Reconstruction" + "Maze / Driving" + "Maze / Defeat Enemies" + "Ball & Paddle / Jump and Touch" + "Climbing / Building" + "Puzzle / Outline" + "Driving / Race Bike" + "Shooter / Command" + "Sports / Sumo" + "Fighter / Compilation" + "Rhythm / Misc." + "Driving / Demolition Derby" + "Maze / Paint" + "Sports / Rugby Football" + "Fighter / Driving Vertical" + "Fighter / Versus Co-op" + "Maze / Fighter" + "Misc. / Prediction" + "Fighter / Asian 3D" + "Maze / Move and Sort" + "Sports / Hang Gliding" + "Maze / Integrate" + "Shooter / Flying Diagonal" + "Platform / Maze" + "Sports / Horseshoes" + "Sports / Handball" + "Maze / Ball Guide" + "Misc. / Reflex" + "Driving / Motorbike (Motocross)" + "Driving / Guide and Collect" + "Sports / Volley - Soccer" + "Misc. / Versus" + "Tabletop / Othello - Reversi" + "Driving / Landing" + "Music / Drum Machine" + "Maze / Marble Madness" + "Shooter / Submarine" + "Maze / Misc." + "Sports / Dodgeball" + "Shooter / Motorbike" + "Sports / Ping Pong" + "Misc. / Hot-air Balloon" + "Driving / Guide and Shoot" + "Sports / SkyDiving" + "Climbing / Mountain - Wall" + "Shooter / Underwater" + "Sports / Shuffleboard" + "Ball & Paddle / Misc." + "Sports / Swimming" + "Maze / Run Jump" + "Driving / Catch" + "Sports / Gun")) + +;; for reference +(defparameter *all-cats* + '("Maze / Shooter Small" + "System / Device" + "Slot Machine / Video Slot" + "Sports / Football" + "Sports / Soccer" + "Game Console / Home Videogame" + "Electromechanical / Misc." + "Driving / Truck Guide" + "Shooter / Flying Vertical" + "MultiGame / Compilation" + "Sports / Basketball" + "Tabletop / Multi-Games" + "Sports / Baseball" + "Electromechanical / Pinball" + "Music / JukeBox" + "Driving / 1st Person" + "Shooter / Gun" + "Computer / Workstation - Server" + "Computer / Business - Terminal" + "Sports / Wrestling" + "System / BIOS" + "Puzzle / Match * Mature *" + "Shooter / Field" + "Casino / Cards" + "Misc. / Clock" + "Sports / Tennis" + "Shooter / Flying Horizontal" + "Puzzle / Match" + "Tabletop / Mahjong * Mature *" + "Casino / Misc." + "Driving / Motorbike" + "Maze / Collect" + "Fighter / 2.5D" + "Computer / Single Board" + "Utilities / EPROM Programmer" + "Sports / Skateboarding" + "Handheld / Electronic Game" + "Tabletop / Cards" + "Shooter / Misc. Horizontal" + "Sports / Track & Field" + "Sports / Pool" + "Misc. / Print Club" + "Computer / Training Board" + "Shooter / Gallery" + "Computer / Home System" + "Computer / Portable Digital Teletype" + "Quiz / Questions in Japanese" + "Shooter / Flying (chase view)" + "Platform / Run Jump" + "Tabletop / Hanafuda * Mature *" + "Computer / Construction Kit" + "Slot Machine / Reels" + "Board Game / Chess Machine" + "Computer / Misc." + "Sports / Volleyball" + "Driving / Race 1st Person" + "Utilities / Modem" + "Fighter / Versus" + "Casino / Multiplay" + "Platform / Shooter Scrolling" + "Maze / Change Surface" + "Driving / Race (chase view)" + "Slot Machine / Video Slot * Mature *" + "Shooter / Misc. Vertical" + "Coin Pusher / Misc." + "Puzzle / Sliding" + "Calculator / Pocket Computer" + "Computer / Development System" + "Tabletop / Mahjong" + "Shooter / Flying 1st Person" + "Driving / Plane" + "Sports / Fishing" + "Platform / Fighter Scrolling" + "Computer / Microcomputer" + "Sports / Golf" + "Music / Synthesizer" + "Platform / Run, Jump & Scrolling" + "Medal Game / Action" + "Misc. / Pinball" + "Shooter / 1st Person" + "Maze / Shooter Large" + "Shooter / 3rd Person" + "Sports / Bowling" + "Shooter / Misc." + "Misc. / Toy Robot" + "Sports / Skiing" + "Misc. / Multiplay" + "Shooter / Walking" + "Utilities / Test" + "Sports / Darts" + "Sports / Hockey" + "Maze / Outline" + "Telephone / Car Phone" + "Driving / Race Track" + "Climbing / Tree - Plant" + "Misc. / Catch" + "Whac-A-Mole / Hammer" + "Electromechanical / Redemption" + "Misc. / Bank-teller Terminal" + "Driving / Misc." + "Computer / Punched Car" + "Shooter / Flying" + "Shooter / Driving (chase view)" + "Driving / Boat" + "Puzzle / Drop" + "Puzzle / Misc." + "Misc. / Coin Pusher" + "Sports / Misc." + "Platform / Fighter" + "Fighter / 2D" + "Tabletop / Misc." + "Misc. / Electronic Board Game" + "Driving / Race (chase view) Bike" + "Ball & Paddle / Breakout" + "Sports / Horse Racing" + "Sports / Armwrestling" + "Misc. / Laser Disk Simulator" + "Sports / Boxing" + "Computer / Word-processing Machine" + "Fighter / 3D" + "Shooter / Driving" + "Calculator / Astrological Computer" + "Misc. / Teletype" + "Shooter / Versus" + "Shooter / Driving Vertical" + "Fighter / Vertical" + "Handheld / Pocket Device - Pad - PDA" + "Casino / Bingo" + "Puzzle / Toss" + "Casino / Racing" + "Electromechanical / Reels" + "Driving / Race" + "Board Game / Backgammon" + "Rhythm / Dance" + "Handheld / Plug n' Play TV Game" + "Misc. / Document Processors" + "Maze / Surround" + "Puzzle / Drop * Mature *" + "Board Game / Bridge Machine" + "Quiz / Questions in English" + "Misc. / Toy Cars" + "Multiplay / Mini-Games" + "Puzzle / Maze" + "Platform / Shooter" + "Maze / Escape" + "Casino / Lottery" + "Quiz / Questions in English * Mature *" + "Sports / Pool * Mature *" + "Medal Game / Bingo" + "Medal Game / Casino" + "MultiGame / Mini-Games" + "Handheld / Home Videogame Console" + "Platform / Run Jump * Mature *" + "Fighter / Versus * Mature *" + "Shooter / Driving Diagonal" + "Ball & Paddle / Breakout * Mature *" + "Ball & Paddle / Pong" + "Maze / Collect & Put" + "Rhythm / Instruments" + "Fighter / Misc." + "Misc. / Spank * Mature *" + "Maze / Digging" + "Maze / Blocks" + "Misc. / Device Programmer" + "Misc. / Cash Counter" + "Maze / Cross" + "Shooter / Driving Horizontal" + "Electromechanical / Bingo" + "Fighter / Field" + "Computer / Laptop - Notebook - Portable" + "Sports / Multiplay" + "Misc. / Unknown" + "Puzzle / Toss * Mature *" + "Sports / Bull Fighting" + "Shooter / Driving 1st Person" + "Casino / Cards * Mature *" + "Maze / Ladders" + "Misc. / Electronic Typewriter" + "Puzzle / Reconstruction" + "Misc. / Redemption" + "Maze / Driving" + "Handheld / Child Computer" + "Maze / Defeat Enemies" + "Ball & Paddle / Jump and Touch" + "Computer / Cablenet Controller" + "Climbing / Building" + "Utilities / Update" + "Puzzle / Outline" + "Computer / Child Computer" + "Medical Equipment / Visual Field Screener" + "Casino / Unknown" + "Board Game / Checker Machine" + "Misc. / Fingerprint Reader" + "Driving / Race Bike" + "Music / Audio Sequencer" + "Misc. / Jump and Bounce" + "Casino / Roulette" + "Shooter / Command" + "Sports / Sumo" + "Casino / Misc. * Mature *" + "Fighter / Compilation" + "Rhythm / Misc." + "Driving / Demolition Derby" + "Whac-A-Mole / Shooter" + "Maze / Paint" + "Sports / Rugby Football" + "Tabletop / Multiplay" + "Fighter / Driving Vertical" + "Fighter / Versus Co-op" + "Board Game / Dame Machine" + "Puzzle / Outline * Mature *" + "Maze / Fighter" + "Misc. / Satellite Receiver" + "Tabletop / Othello - Reversi * Mature *" + "Misc. / Speech Synthesizer" + "Misc. / Prediction" + "Electromechanical / Utilities" + "Printer / Matrix Printer" + "Misc. / EPROM Programmer" + "Misc. / Engine Control Unit" + "Shooter / Gallery * Mature *" + "Fighter / Asian 3D" + "Medal Game / Timing" + "Sports / Cards" + "Game Console / Fitness Game" + "Maze / Move and Sort" + "Computer Graphic Workstation / Broadcast Television" + "Quiz / Questions in Korean" + "Medal Game / Adventure" + "Misc. / Graphics Display Controller" + "Driving / Ambulance Guide" + "Misc. / Dartboard" + "Misc. / Electronic Game" + "Misc. / Wavetables Generator" + "Misc. / Car Voice Alert" + "Music / Instruments" + "Shooter / Flying * Mature *" + "Sports / Hang Gliding" + "Tabletop / Hanafuda" + "Puzzle / Reconstruction * Mature *" + "Quiz / Questions in Italian" + "Driving / FireTruck Guide" + "Utilities / Arcade System" + "Maze / Integrate" + "Whac-A-Mole / Fighter" + "Quiz / Questions in German" + "Maze / Collect * Mature *" + "Shooter / Flying Diagonal" + "Misc. / Pinball * Mature *" + "Tabletop / Match * Mature *" + "Misc. / Mini-Games" + "Medal Game / Horse Racing" + "Board Game / Cards" + "Tabletop / Renju" + "Platform / Maze" + "Utilities / Network Processor" + "Misc. / Similar Bowling Game" + "Whac-A-Mole / Gun" + "Tabletop / Go" + "Utilities / Redemption Board" + "Sports / Horseshoes" + "Misc. / Digital MultiMeter (DMM)" + "Computer / Pocket PC" + "Misc. / Drum Machine" + "Sports / Handball" + "Quiz / Questions in Japanese * Mature *" + "Telephone / ComputerPhone" + "Misc. / Dog Sitter" + "Telephone / Mobile Phone - Smartphone" + "Maze / Ball Guide" + "Misc. / Reflex" + "Casino / Horse Racing" + "Driving / Motorbike (Motocross)" + "Misc. / Gambling Board" + "Driving / Guide and Collect" + "Tabletop / Shougi" + "Misc. / Educational Game" + "Sports / Volley - Soccer" + "Misc. / Versus" + "Tabletop / Othello - Reversi" + "Fighter / Multiplay" + "Misc. / Response Time" + "Printer / Handbook" + "Misc. / DVD Reader-Writer" + "Driving / Landing" + "Maze / Escape * Mature *" + "Printer / Laser Printer" + "Misc. / In Circuit Emulator" + "Game Console / Home Videogame Console Expansion" + "MultiGame / Gambling" + "MultiGame / Gambling Board" + "Music / Drum Machine" + "Maze / Marble Madness" + "Quiz / Questions in Spanish" + "MultiGame / Compilation * Mature *" + "Printer / 3D Printer" + "Shooter / Submarine" + "Medical Equipment / ECG Unit" + "Computer / Video Production" + "Misc. / Time-Access Control TerminalTime and access control terminal" + "Maze / Misc." + "Printer / Thermal Printer" + "Multiplay / Compilation" + "Music / Tone Generator" + "Sports / Dodgeball" + "Calculator / Math Game Learning" + "Shooter / Motorbike" + "Medal Game / Versus" + "Utilities / Test ROM" + "Printer / Barcode Printer" + "Misc. / Pachinko" + "Puzzle / Paint * Mature *" + "Puzzle / Misc. * Mature *" + "Medal Game / Driving" + "Misc. / Virtual Environment" + "Sports / Ping Pong" + "Medal Game / Compilation" + "Misc. / VTR Control" + "Misc. / Hot-air Balloon" + "Misc. / Shoot Photos" + "Puzzle / Sliding * Mature *" + "Maze / Blocks * Mature *" + "Quiz / Questions in Chinese" + "Driving / Guide and Shoot" + "Sports / SkyDiving" + "Climbing / Mountain - Wall" + "Shooter / Outline * Mature *" + "Multiplay / Cards" + "Quiz / Questions in French" + "Puzzle / Cards" + "Misc. / Portable Media Player" + "Utilities / Weight Scale" + "Electromechanical / Change Money" + "Misc. / Graphic Tablet" + "Shooter / Flying Horizontal * Mature *" + "Misc. / Robot Control" + "Shooter / Underwater" + "Sports / Shuffleboard" + "Misc. / Temperature Controller" + "Misc. / Laserdisc Simulator" + "Casino / Multi-Games" + "Ball & Paddle / Misc." + "Utilities / Arcade Switcher" + "Shooter / Flying Vertical * Mature *" + "Calculator / Talking Calculator" + "Computer / Educational Game" + "Misc. / DVD Player" + "Maze / Digging * Mature *" + "Whac-A-Mole / Footsteps" + "Handheld / E-Book Reading" + "Multiplay / Misc. * Mature *" + "Sports / Swimming" + "Computer / Milling" + "Misc. / Order" + "Misc. / Dot-Matrix Display" + "Medal Game / Cards" + "Music / MIDI Player" + "Maze / Run Jump" + "Utilities / Electronic Digital Thermostat" + "Utilities / TV Test Pattern Generator" + "Misc. / Credit Card Terminal" + "Multiplay / Mini-Games * Mature *" + "Music / Player" + "Misc. / Laserdisc Player" + "Driving / Catch" + "Sports / Gun" + "Computer / Programming Machine" + "Medal Game / Dance" + "Handheld / Handpuppet Toy"))