Changes

Included all versions of code using #ifdef logic
Line 84: Line 84:  
     bytes_read = NANDRead(fd, buf, _align_size(file_length, 32));
 
     bytes_read = NANDRead(fd, buf, _align_size(file_length, 32));
 
      
 
      
 +
#ifdef 3_3
 
     if (bytes_read != _align_size(file_length, 32)) { // by making the file length not divisible by 32, bytes_read will be less than the aligned size, jumping to the end without deleting the save
 
     if (bytes_read != _align_size(file_length, 32)) { // by making the file length not divisible by 32, bytes_read will be less than the aligned size, jumping to the end without deleting the save
 +
#else
 +
    if (bytes_read != file_length) {
 +
#endif
 
         OSReportError("iplESMisc.cpp::VerifySavedataZD: Read file failed: %d\n");
 
         OSReportError("iplESMisc.cpp::VerifySavedataZD: Read file failed: %d\n");
 
         goto done;
 
         goto done;
Line 141: Line 145:  
int _wad_check_for_twilight_hack(WAD *wadfile) {
 
int _wad_check_for_twilight_hack(WAD *wadfile) {
 
     int i;
 
     int i;
 +
#ifdef 3_4
 +
    int res = 1;
 +
#endif
 
     for (i=0; i <  wadfile.numfiles; i++) {
 
     for (i=0; i <  wadfile.numfiles; i++) {
 
         // skip any leading directory names
 
         // skip any leading directory names
Line 147: Line 154:  
         else p++;
 
         else p++;
 
         if (strcmp(p, "zeldaTp.dat")==0) {
 
         if (strcmp(p, "zeldaTp.dat")==0) {
 +
#ifdef 3_3
 
             return WADCheckSavedataZD(wadfile.filedata[i]); // there should not be a "return" here; this means only the first zeldaTp.dat is checked
 
             return WADCheckSavedataZD(wadfile.filedata[i]); // there should not be a "return" here; this means only the first zeldaTp.dat is checked
 +
#else
 +
#ifdef 3_4
 +
            res = WADCheckSavedataZD(wadfile.filedata[i]); // this means only the sanity of the last zeldaTp.day matters
 +
#else
 +
            if (!WADCheckSavedataZD(wadfile.filedata[i]))
 +
                return 0;
 +
#endif
 +
#endif
 
         }
 
         }
 
     }
 
     }
 +
 +
#ifdef 3_4
 +
    return res;
 +
#else
 +
#ifndef 3_3
 +
    return 1;
 +
#endif
 +
#endif
 
}
 
}
 
</pre>
 
</pre>
5,579

edits