Skip to content

Commit

Permalink
- Fix regression with Wiikey Fusion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Dec 27, 2019
1 parent 6fa3487 commit 9b2868e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 8 additions & 8 deletions cube/swiss/source/devices/fat/deviceHandler-FAT.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,6 @@ void print_frag_list(int hasDisc2) {
*/
s32 getFragments(file_handle* file, vu32* fragTbl, s32 maxFrags, u32 forceBaseOffset, u32 forceSize, u32 dev) {
int i;
if(file->ffsFp != NULL && file->ffsFp->cltbl != NULL) {
devices[dev]->closeFile(file); // If we've already read fragments, reopen it
}
if(!file->ffsFp) {
devices[dev]->readFile(file, NULL, 0); // open the file (should be open already)
}
Expand All @@ -278,7 +275,11 @@ s32 getFragments(file_handle* file, vu32* fragTbl, s32 maxFrags, u32 forceBaseOf
DWORD clmt[(maxFrags+1)*2];
clmt[0] = (maxFrags+1)*2;
file->ffsFp->cltbl = &clmt[0];
if(f_lseek(file->ffsFp, CREATE_LINKMAP) != FR_OK) return 0; // Too many fragments for our buffer
if(f_lseek(file->ffsFp, CREATE_LINKMAP) != FR_OK) {
file->ffsFp->cltbl = NULL;
return 0; // Too many fragments for our buffer
}
file->ffsFp->cltbl = NULL;

print_gecko("getFragments [%s] - found %i fragments [%i arr]\r\n",file->name, (clmt[0] >> 1)-1, clmt[0]);

Expand Down Expand Up @@ -374,12 +375,11 @@ s32 deviceHandler_FAT_setupFile(file_handle* file, file_handle* file2, int numTo

// If there is a disc 2 and it's fragmented, make a note of the fragments and their sizes
if(file2) {
devices[DEVICE_CUR]->closeFile(file);
// TODO fix 2 disc patched games
if((frags = getFragments(file2, &fragList[totFrags*3], maxFrags-totFrags, 0x80000000, DISC_SIZE, DEVICE_CUR))) {
totFrags += frags;
if(!(frags = getFragments(file2, &fragList[totFrags*3], maxFrags-totFrags, 0x80000000, DISC_SIZE, DEVICE_CUR))) {
return 0;
}
devices[DEVICE_CUR]->closeFile(file2);
totFrags += frags;
}

memset(VAR_SECTOR_BUF, 0, sizeof(VAR_SECTOR_BUF));
Expand Down
2 changes: 0 additions & 2 deletions cube/swiss/source/devices/gcloader/deviceHandler-gcloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ s32 deviceHandler_GCLOADER_setupFile(file_handle* file, file_handle* file2, int
if(!(disc1Frags = getFragments(file, &discFragList[0], maxDiscFrags, 0, DISC_SIZE, DEVICE_CUR))) {
return 0;
}
devices[DEVICE_CUR]->deinit(file);

// write disc 1 frags
gcloaderWriteFrags(0, &discFragList[0], disc1Frags);
Expand All @@ -90,7 +89,6 @@ s32 deviceHandler_GCLOADER_setupFile(file_handle* file, file_handle* file2, int
if(!(disc2Frags = getFragments(file2, &discFragList[0], maxDiscFrags, 0, DISC_SIZE, DEVICE_CUR))) {
return 0;
}
devices[DEVICE_CUR]->deinit(file2);
gcloaderWriteFrags(1, &discFragList[0], disc2Frags);
}

Expand Down

0 comments on commit 9b2868e

Please sign in to comment.