Implement saving of GraphOS pictures.

This commit is contained in:
Adrien Destugues
2019-12-21 13:50:22 +01:00
parent 1338f2a21c
commit 2537707eaf
5 changed files with 83 additions and 16 deletions

View File

@@ -742,12 +742,17 @@ int CPC_check_AMSDOS(FILE * file, word * loading_address, unsigned long * file_l
fseek(file, 0, SEEK_SET);
if (!Read_bytes(file, data, 128))
return 0;
// Rewind the file so it can be read normally
fseek(file, 0, SEEK_SET);
for (i = 1; i <= 11; i++) // check filename and extension
{
if (data[i] >= 0x10 && data[i] <= 0x19) // sometimes digits are stored as 0x10 to 0x19
continue;
if (data[i] < ' ' || data[i] >= 0x7F)
if (data[i] < ' ' || data[i] >= 0x7F) {
GFX2_Log(GFX2_DEBUG, "Not an AMSDOS file: name is invalid\n");
return 0;
}
}
for (i = 0; i < 67; i++)
checksum += (word)data[i];