fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pti: Add a flags word to the pti header

+26 -10
+5 -2
doc/pti-format.txt
··· 36 36 ------------------------------------------------------------------------ 37 37 38 38 0 4 Magic ('PTI ') 39 - 4 4 Size (8) 39 + 4 4 Size (12) 40 40 8 4 Version (0) 41 41 12 4 Clock 42 - 16 4 CRC 42 + 16 4 Flags 43 + 20 4 CRC 44 + 45 + - No flags are defined yet. 43 46 44 47 45 48 CHUNK "END ": End chunk
+21 -8
src/drivers/pti/pti-img-pti.c
··· 158 158 static 159 159 int pti_load_header (pti_load_t *pti, unsigned long size) 160 160 { 161 - unsigned char buf[8]; 162 - unsigned long vers, clock; 161 + unsigned n; 162 + unsigned char buf[16]; 163 + unsigned long vers, clock, flags; 164 + 165 + n = 12; 163 166 164 167 if (size < 8) { 165 168 return (1); 169 + } 170 + else if (size < 12) { 171 + n = 8; 166 172 } 167 173 168 - if (pti_read_crc (pti, buf, 8)) { 174 + if (pti_read_crc (pti, buf, n)) { 169 175 return (1); 170 176 } 171 177 ··· 180 186 181 187 pti_img_set_clock (pti->img, clock); 182 188 183 - if (pti_skip_chunk (pti, size - 8)) { 189 + flags = (n >= 12) ? pti_get_uint32_be (buf, 8) : 0; 190 + 191 + if (flags) { 192 + fprintf (stderr, "pti: unknown flags (0x%08lx)\n", flags); 193 + } 194 + 195 + if (pti_skip_chunk (pti, size - n)) { 184 196 return (1); 185 197 } 186 198 ··· 467 479 static 468 480 int pti_save_header (FILE *fp, const pti_img_t *img) 469 481 { 470 - unsigned char buf[20]; 482 + unsigned char buf[24]; 471 483 472 484 pti_set_uint32_be (buf, 0, PTI_MAGIC_PTI); 473 - pti_set_uint32_be (buf, 4, 8); 485 + pti_set_uint32_be (buf, 4, 12); 474 486 pti_set_uint32_be (buf, 8, 0); 475 487 pti_set_uint32_be (buf, 12, pti_img_get_clock (img)); 476 - pti_set_uint32_be (buf, 16, pti_crc (0, buf, 16)); 488 + pti_set_uint32_be (buf, 16, 0); 489 + pti_set_uint32_be (buf, 20, pti_crc (0, buf, 20)); 477 490 478 - if (pti_write (fp, buf, 20)) { 491 + if (pti_write (fp, buf, 24)) { 479 492 return (1); 480 493 } 481 494