Skip to content

Conversation

ajrhacker
Copy link
Contributor

@ajrhacker ajrhacker commented Aug 27, 2025

Since a feature like this seems to be commonly requested, and some of the new software in #14091 demands it, I'm showing how simple it is to implement. The intended usage is:

<feature name="write_protected" value="true" />

to protect one disk image, or

<sharedfeat name="write_protected" value="true" />

to protect all disk images. If other devs want to use a different name or value for this, please comment.

@A-Noid33
Copy link
Contributor

@ajrhacker Thanks for the code changes. Wouldn't we need to update the XML schema "softwarelists.dtd? For disks (hard drive images), they used writeable.

		<!ELEMENT dataarea (rom*)>
			<!ATTLIST dataarea name CDATA #REQUIRED>
			<!ATTLIST dataarea size CDATA #REQUIRED>
			<!ATTLIST dataarea width (8|16|32|64) "8">
			<!ATTLIST dataarea endianness (big|little) "little">
			<!ELEMENT rom EMPTY>
				<!ATTLIST rom name CDATA #IMPLIED>
				<!ATTLIST rom size CDATA #IMPLIED>
				<!ATTLIST rom crc CDATA #IMPLIED>
				<!ATTLIST rom sha1 CDATA #IMPLIED>
				<!ATTLIST rom offset CDATA #IMPLIED>
				<!ATTLIST rom value CDATA #IMPLIED>
				<!ATTLIST rom status (baddump|nodump|good) "good">
				<!ATTLIST rom loadflag (load16_byte|load16_word|load16_word_swap|load32_byte|load32_word|load32_word_swap|load32_dword|load64_word|load64_word_swap|reload|fill|continue|reload_plain|ignore) #IMPLIED>
		<!ELEMENT diskarea (disk*)>
			<!ATTLIST diskarea name CDATA #REQUIRED>
			<!ELEMENT disk EMPTY>
				<!ATTLIST disk name CDATA #REQUIRED>
				<!ATTLIST disk sha1 CDATA #IMPLIED>
				<!ATTLIST disk status (baddump|nodump|good) "good">
				<!ATTLIST disk writeable (yes|no) "no">

A-Noid

@ajrhacker
Copy link
Contributor Author

disk is an entirely different XML element which is only used for CHD software images. The feature and sharedfeat elements already allow the name and value to be practically any string.

@A-Noid33
Copy link
Contributor

A-Noid33 commented Aug 27, 2025

@ajrhacker You're right. This will protect all disks. We definitely have some data disks in Apple2, which we would want to be writable. It would probably be better to have it as an attribute on the rom element, so that each disk can be write-protected independently. Just my opinion.

A-Noid.

@ajrhacker
Copy link
Contributor Author

The <feature> tag goes inside the <part> tag and only applies to that part (floppy disk, cartridge ROM, whatever). The <sharedfeat> tag goes outside and is distributed to all software parts.

@A-Noid33
Copy link
Contributor

@ajrhacker Thanks... I understand now. That should work.

A-Noid

@A-Noid33
Copy link
Contributor

@ajrhacker I verified that this change does work for Apple II both as a feature or a sharedfeat. I'll update my pull request #14091.
Thanks,
A-Noid

@cuavas cuavas merged commit 8283c83 into mamedev:master Sep 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants