-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAME custom cmd filename and format #13649
base: master
Are you sure you want to change the base?
MAME custom cmd filename and format #13649
Conversation
* use .mamecmd instead of libretroMAME's .cmd since they have drastically different contents and formats * tolerate leading and trailing newlines
with open(defaultCustomCmdFilepath) as f: | ||
commandArray = f.read().splitlines() # type: ignore | ||
commandArray = f.read().strip("\n").splitlines() # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be using shlex.split()
instead of forcing users to put each command line argument on a separate line? The file format would go from
foo
-n bar baz
ham spam
to
foo -n "bar baz" "ham spam"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into this, @bryanforbes !
I'll try to explain why I chose newline as the delimiter, but we could go either way.
-
I was trying to save users from having to worry about quoting and escaping. Games like
Spy Fox 3: "Operation Ozone"
would require escaping of those double quote symbols. For shlex.split to correctly interpret this file, we'd need to do"Spy Fox 3: \\"Operation Ozone\\".chd"
. -
Standalone MAME requires a lot more parameters and it's difficult to edit when it's all on the same line.
Here's a real-world example of that game:
/usr/bin/mame/mame
-skip_gameinfo
-rompath
/userdata/roms/macintosh/Spy Fox Series;/userdata/bios/mame;/userdata/bios;/userdata/roms/mame
-bgfx_path
/usr/bin/mame/bgfx/
-fontpath
/usr/bin/mame/
-languagepath
/usr/bin/mame/language/
-pluginspath
/usr/bin/mame/plugins/;/userdata/saves/mame/plugins
-samplepath
/userdata/bios/mame/samples
-artpath
/var/run/mame_artwork/;/usr/bin/mame/artwork/;/userdata/bios/mame/artwork;/userdata/decorations
-cheat
-cheatpath
/userdata/cheats/mame
-verbose
-nvram_directory
/userdata/saves/mame/nvram
-cfg_directory
/userdata/system/configs/mame/macqd605
-input_directory
/userdata/saves/mame/input
-state_directory
/userdata/saves/mame/state
-snapshot_directory
/userdata/screenshots
-diff_directory
/userdata/saves/mame/diff
-comment_directory
/userdata/saves/mame/comments
-homepath
/userdata/saves/mame/plugins
-ctrlrpath
/userdata/system/configs/mame/ctrlr
-inipath
/userdata/system/configs/mame;/userdata/system/configs/mame/ini
-crosshairpath
/userdata/bios/mame/artwork/crosshairs
-video
auto
-resolution
1024x768
-plugins
-plugin
hiscore
-dial_device
mouse
-trackball_device
mouse
-paddle_device
mouse
-positional_device
mouse
-mouse_device
mouse
-ui_mouse
-lightgun_device
mouse
-adstick_device
mouse
macqd605
-ramsize
32M
-hard1
/userdata/roms/macintosh/mac755.chd
-cdrom
/userdata/roms/macintosh/Spy Fox Series/Spy Fox 3: "Operation Ozone".chd
as opposed to:
/usr/bin/mame/mame -skip_gameinfo -rompath "/userdata/roms/macintosh/Spy Fox Series;/userdata/bios/mame;/userdata/bios;/userdata/roms/mame" -bgfx_path /usr/bin/mame/bgfx/ -fontpath /usr/bin/mame/ -languagepath /usr/bin/mame/language/ -pluginspath /usr/bin/mame/plugins/;/userdata/saves/mame/plugins -samplepath /userdata/bios/mame/samples -artpath /var/run/mame_artwork/;/usr/bin/mame/artwork/;/userdata/bios/mame/artwork;/userdata/decorations -cheat -cheatpath /userdata/cheats/mame -verbose -nvram_directory /userdata/saves/mame/nvram -cfg_directory /userdata/system/configs/mame/macqd605 -input_directory /userdata/saves/mame/input -state_directory /userdata/saves/mame/state -snapshot_directory /userdata/screenshots -diff_directory /userdata/saves/mame/diff -comment_directory /userdata/saves/mame/comments -homepath /userdata/saves/mame/plugins -ctrlrpath /userdata/system/configs/mame/ctrlr -inipath /userdata/system/configs/mame;/userdata/system/configs/mame/ini -crosshairpath /userdata/bios/mame/artwork/crosshairs -video auto -resolution 1024x768 -plugins -plugin hiscore -dial_device mouse -trackball_device mouse -paddle_device mouse -positional_device mouse -mouse_device mouse -ui_mouse -lightgun_device mouse -adstick_device mouse macqd605 -ramsize 32M -hard1 /userdata/roms/macintosh/mac755.chd -cdrom "/userdata/roms/macintosh/Spy Fox Series/Spy Fox 3: \\"Operation Ozone\\".chd"
I found split lines and not having to escape special symbols easier to edit, but this could be just a preference thing. I can go either way.
Thoughts?
Use doppel quotes if pathes/filenames contains spaces thanks @bryanforbes and his comment to batocera-linux#13649 Helped me out here
If your path or filename contains spaces, then use doppelquotes. This allows the generator to read the whole string as one argument. ``` Wolfenstein (HD).ecwolf "./Wolfenstein (full version)" -data wl6 ``` Thanks to @bryanforbes for the idea, helped me alot. It came from the discussion from batocera-linux#13649
@tsankuanglee I am not the expert of MAME here but I assume that 90% of the parameters can be unchanged for evey rom. What about following idea: This has the big plus that it's very userfriendly and if pathes are changing then you have to alter likely simply the "master-file" only. I setted the file in quotes because you can manage this directly in the py-generator to as a list. If I'm wrong here then please tell me I removed -video -resolution -hd1 and -cdrom from here and the rest should be "equal" to whole romset... I hope
|
@crcerror Thank you for the suggestion. You are definitely not wrong. Each approach has its own pros and cons. I appreciate your idea of having the base template saves repetition. Since different MAME machines require different parameters, we could have a base template for each MAME system at However, for now, I'm leaning toward the simpler approach: one game, one file, and that file is complete on its own; its contents are nearly identical to how MAME is launched universally. The motivation for these
|
@tsankuanglee It is okay for me - my intention was to make things more portable |
a small improvement upon #13643
.mamecmd
instead of libretroMAME's.cmd
since they have drastically different contents and formats. This way, users still get to use both emulators.