jfdelnero / HxCFloppyEmulator

HxC Floppy Drive Emulator toolkit
https://hxc2001.com/floppy_drive_emulator/
101 stars 15 forks source link

XML files do not contain status of CRC check #11

Open bsdphk opened 1 year ago

bsdphk commented 1 year ago

I wasted a bit of time thinking that the produced XML files contained only sectors where the CRC check matched.

I can fully see the reasoning for including all sectors, but then the CRC status should be included.

I am not familiar enough with the HxC source code, to know if this is how to do it, or even how you want this to look in the XML file, but this seems to work for me:

(NB: copy&pasted patch)

diff --git a/libhxcfe/sources/loaders/xml_loader/xml_writer.c b/libhxcfe/sources/loaders/xml_loader/xml_writer.c
index f597b361..b75b8b25 100644
--- a/libhxcfe/sources/loaders/xml_loader/xml_writer.c
+++ b/libhxcfe/sources/loaders/xml_loader/xml_writer.c
@@ -236,7 +236,8 @@ int XML_libWrite_DiskFile(HXCFE_IMGLDR* imgldr_ctx,HXCFE_FLOPPY * floppy,char *
        for(s=0;s<nb_sectorfound;s++)
        {

-               fprintf(xmlfile,"\t\t\t\t\t<sector sector_id=\"%d\" sector_size=\"%d\">\n",sca[s]->sector,sca[s]->sectorsize);
+               fprintf(xmlfile,"\t\t\t\t\t<sector sector_id=\"%d\" sector_size=\"%d\" hcrc=\"%d\" dcrc=\"%d\">\n",
+                   sca[s]->sector,sca[s]->sectorsize, sca[s]->use_alternate_header_crc, sca[s]->use_alternate_data_crc);
                if(sca[s]->fill_byte_used)
                {
                        fprintf(xmlfile,"\t\t\t\t\t\t<data_fill>0x%.2X</data_fill>\n",sca[s]->fill_byte);