Skip to content

Commit

Permalink
- Fix 2 disc detection
Browse files Browse the repository at this point in the history
- Fix GameID display
  • Loading branch information
emukidid committed Jul 1, 2019
1 parent 018a75b commit bfed754
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions cube/swiss/source/devices/fat/deviceHandler-FAT.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,12 @@ s32 deviceHandler_FAT_setupFile(file_handle* file, file_handle* file2) {
if(totFrags+1 == maxFrags) {
return 0;
}
devices[DEVICE_CUR]->closeFile(file);
// TODO fix 2 disc patched games
if((frags = getFragments(file2, &fragList[(maxFrags*3)], maxFrags, 0, 0, DEVICE_CUR))) {
totFrags += frags;
}
devices[DEVICE_CUR]->closeFile(file2);
}

// Disk 1 base sector
Expand Down
19 changes: 11 additions & 8 deletions cube/swiss/source/swiss.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,16 +1429,16 @@ void load_game() {
// look to see if it's a two disc game
// set things up properly to allow disc swapping
// the files must be setup as so: game-disc1.xxx game-disc2.xxx
secondDisc = memalign(32,sizeof(file_handle));
memcpy(secondDisc,&curFile,sizeof(file_handle));
secondDisc = calloc(1,sizeof(file_handle));
memcpy(secondDisc->name,&curFile.name,PATHNAME_MAX);
secondDisc->fp = 0;
secondDisc->ffsFp = NULL;

// you're trying to load a disc1 of something
if(curFile.name[strlen(secondDisc->name)-5] == '1') {
if(curFile.name[strlen(curFile.name)-5] == '1') {
secondDisc->name[strlen(secondDisc->name)-5] = '2';
} else if(curFile.name[strlen(secondDisc->name)-5] == '2' && strcasecmp(getRelativeName(curFile.name), "disc2.iso")) {
secondDisc->name[strlen(secondDisc->name)-5] = '1';
} else if(curFile.name[strlen(curFile.name)-5] == '2' && strcasecmp(getRelativeName(curFile.name), "disc2.iso")) {
secondDisc->name[strlen(curFile.name)-5] = '1';
} else if(!strcasecmp(getRelativeName(curFile.name), "game.iso")) {
memset(secondDisc->name, 0, PATHNAME_MAX);
strncpy(secondDisc->name, curFile.name, strlen(curFile.name)-strlen(getRelativeName(curFile.name)));
Expand Down Expand Up @@ -1612,7 +1612,10 @@ uiDrawObj_t* draw_game_info() {
}
}
if(GCMDisk.DVDMagicWord == DVD_MAGIC) {
sprintf(txtbuffer,"GameID: [%s] Audio Streaming [%s]", (const char*)&GCMDisk ,(GCMDisk.AudioStreaming==1) ? "YES":"NO");
strcpy(txtbuffer, "GameID: [");
strncat(txtbuffer, (const char*)&GCMDisk, 6);
strcat(txtbuffer, "] Audio Streaming ");
strcat(txtbuffer, (GCMDisk.AudioStreaming==1) ? "[YES]":"[NO]");
DrawAddChild(container, DrawStyledLabel(640/2, 200, txtbuffer, 0.8f, true, defaultColor));
DrawAddChild(container, DrawStyledLabel(640/2, 220, (GCMDisk.DiscID ? "Disc 2":""), 0.8f, true, defaultColor));
}
Expand All @@ -1631,8 +1634,8 @@ int info_game()
int ret = -1;
ConfigEntry *config = NULL;
// Find the config for this game, or default if we don't know about it
config = memalign(32, sizeof(ConfigEntry));
*(u32*)&config->game_id[0] = *(u32*)&GCMDisk.ConsoleID; // Lazy
config = calloc(1, sizeof(ConfigEntry));
memcpy(config->game_id, &GCMDisk.ConsoleID, 4);
strncpy(&config->game_name[0],&GCMDisk.GameName[0],32);
config_find(config); // populate
uiDrawObj_t *infoPanel = DrawPublish(draw_game_info());
Expand Down

0 comments on commit bfed754

Please sign in to comment.