I am trying the following line code and I get the error Warning: Ranges to ignore were outside file bounds.
block1_reduced_crc32=ChecksumAlgStr(CHECKSUM_CRC32,block_1_reduced_crc32,start+(count_sides*0xFFDC),56,“0x1F..0x21,0x27..0x35”,-1,-1);
As it works on the first pass of the count_sides loop, I assume that it is using absolute values for exclusion area instead of the offset from start. In which case I would need to put variables inside the string. I get the feeling I can’t do that? I will give it a go anyway.
Found the answer to my question, in that it uses a buffer and not absolute references
The ranges should be given from the beginning of the file. If you get a message about invalid ranges, that means there is a syntax error in your ranges. In the code you posted there are 3 periods ‘. . .’ and you need to use only two ‘. .’ or it will show that error, but I think that is the forum making that change. Let us know if you can’t get it to work.
Graeme
SweetScape Software
There are two periods are there not?
I believe our forum software used to convert ‘..’ into ‘…’ automatically, as it was some kind of automatic Markdown formatter. This has been fixed since we upgraded the forum so now ‘..’ is being displayed properly.
Graeme
SweetScape Software
Noted, thanks. I Would love to see some sample code for the Checksum functions. I have them working but in a somewhat convoluted way. I have not found anything in the repository yet.
There are some simple examples in the Repository in the files ‘BatchChecksum.1sc’ and ‘DexFixer.1sc’. Let us know if you need a more complicated example.
Graeme
SweetScape Software
Hi Graham, unfortunately the Checksums are far too simplistic, I already have basic Checksums working. I want to both exclude sections and also chain checksums together ideally. As I may have mentioned, my current workaround is to load them into an array and calculate the CRC32 of the entire array. If you take a look at this code for example,
pre_start=startof(FDS_Disk.side[count_sides].block_1);
pre_length=startof(FDS_Disk.side[count_sides].file[0].block_4)-pre_start;
pre_skip_start=pre_start+20;
pre_skip_end=startof(FDS_Disk.side[count_sides].file[0].block_4)-1;
ChecksumAlgBytes(CHECKSUM_CRC32,crc_result,pre_start,pre_length,"startof(FDS_Disk)..startof(FDS_Disk.side[count_sides].files[0]");
I obviously can’t give fixed exclusion regions in relation to the beginning of the file as they can change. I have tried using variables as well and it also does not work. I will have to stick to the array method for now, it just seems inelegant.
regards
You are close but the string you pass to ChecksumAlgBytes must contain the actual addresses. You just need to use SPrintf to convert text like ‘startof(FDS_Disk)’ to an address. For example:
string ranges;
SPrintf( ranges, "%Ld..%Ld", startof(FDS_Disk), startof(FDS_Disk.side[count_sides].files[0] );
ChecksumAlgBytes(CHECKSUM_CRC32,crc_result,pre_start,pre_length,ranges);
Let us know if you can’t get this to work.
Graeme
SweetScape Software
1 Like
Of course, being a programmer of nearly 50 years I guess I should have thought of that one! Thanks for your prompt reply