Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
09111 Media Support Minor Always 9 days ago 2 days ago
Tester Robbbert View Status Public Platform MAME (Self-compiled)
Assigned To Resolution Open OS Windows 10/11 (64-bit)
Status [?] Driver
Version 0.274 Fixed in Version Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary 09111: All systems that have cassette support: If a non-existing cassette file is specified, a 0-byte file gets created
Description On any system that supports cassettes, if a file that doesn't exist was accidentally specified on the command line, an unwanted zero-byte file gets left behind.

I've used super80 in the examples below, but any cassette-supporting system can be used.
Steps To Reproduce If you didn't specify a folder then the MAME folder gets used.

>mame super80 -cass t
Firstly it lists a bunch of nearly matching software items. Then it says:

Unable to load image 't': No such file or directory (generic:2)

This isn't fatal: the emulation starts up. MAME creates an empty file and loads it into the file manager. If you now quit, the zero-byte file gets left behind.

>dir t
Directory of C:\MAME

2025-02-12 20:13 0 t

-----------------

Now, we specifiy a folder that exists:

>mame super80 -cass temp\t

This time there's no software list suggestions; it just says:

Unable to load image 'temp\t': No such file or directory (generic:2)

Again, a zero-byte file is left behind.

------------------

Now we specifiy a folder that doesn't exist

>mame super80 -cass temp2\t

Unable to load image 'temp2\t': No such file or directory (generic:2)
Unable to create image 'temp2\t': No such file or directory (generic:2)
Fatal error: Device Cassette load (-cassette ) failed: No such file or directory (generic:2)

This is fatal. You can see that it tries to create a file.
Additional Information What happens above is almost right, but I'd suggest that a new file gets created only if it was written to. Leaving zero-byte files littering the system is untidy at best.

Other missing media (eg floppies) don't create empty files.

Also note that MAME will allow creation and usage of files that don't have approved extensions, and thus cannot be used for reading later.
Github Commit
Flags
Regression Version
Affected Sets / Systems All systems that have cassette support
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
1
User avatar
No.23018
AJR
Developer
2 days ago
edited on: 2 days ago
The suggestion does not seem very workable given MAME's current handling of image files. Creating the file at the moment the image is first written to creates overhead where overhead is not desirable. Removing the file if it ends up as empty could perhaps be done, but MAME is not alone in exhibiting the "untidy" behavior of creating 0-byte files, which might even be correct for some uses.

Floppy disks are treated differently in this regard due to support_command_line_image_creation() returning false for their image device.

Currently the core does not appear to actually enforce the list of supported extensions, leaving it up to the image devices to reject files without approved extensions. Perhaps the core should check it when trying to create a new image file from a command line parameter.