diff --git a/source/menu.cpp b/source/menu.cpp index 1a6ef266..e484c66b 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -333,7 +333,6 @@ int MenuDiscList() { char IDfull[7]; u32 covert = 0; char imgPath[100]; - char dvdID[8]; if (!dvdheader) dvdheader = new struct discHdr; u8 mountMethodOLD =0; @@ -1284,18 +1283,9 @@ int MenuDiscList() { else if (dvdBtn.GetState() == STATE_CLICKED) { mountMethodOLD = (mountMethod==3?mountMethod:0); - mountMethod=DiscMount(dvdID); - dvdheader->id[0]=dvdID[0]; - dvdheader->id[1]=dvdID[1]; - dvdheader->id[2]=dvdID[2]; - dvdheader->id[3]=dvdID[3]; - dvdheader->id[4]=dvdID[4]; - dvdheader->id[5]=dvdID[5]; - + mountMethod=DiscMount(dvdheader); dvdBtn.ResetState(); - char ass[20]; - sprintf(ass,"%i",mountMethod); - WindowPrompt(ass,0,"ok"); + rockout(); //break; } diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index 89c3ce50..d80bbb3c 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -407,17 +407,18 @@ int autoSelectDolMenu(const char *id, bool force) { * Mount a DVD, get the type and ID. *********************************************************************************/ static vu32 dvddone = 0; -static dvddiskid *g_diskID = (dvddiskid*)0x80000000; +static dvddiskid *g_diskID = (dvddiskid*)0x80000000; // If you change this address, the read functions will FAIL! void __dvd_readidcb(s32 result) { dvddone = result; } -u8 DiscMount(char *id) { +u8 DiscMount(discHdr *header) { int ret; - char gameidbuffer[8]; HaltGui(); - memset((char*)0x80000000, 0, 6); + + u8 *tmpBuff = (u8 *) malloc(0x60); + memcpy(tmpBuff, g_diskID, 0x60); // Make a backup of the first 96 bytes at 0x80000000 ret = bwDVD_LowInit(); dvddone = 0; @@ -425,26 +426,19 @@ u8 DiscMount(char *id) { while(ret>=0 && dvddone==0); dvddone = 0; - ret = bwDVD_LowReadID(g_diskID,__dvd_readidcb); + ret = bwDVD_LowReadID(g_diskID, __dvd_readidcb); // Leave this one here, or you'll get an IOCTL error while(ret>=0 && dvddone==0); - memset(gameidbuffer, 0, 8); - memcpy(gameidbuffer, (char*)0x80000000, 6); - strcpy(id,gameidbuffer); - if(gameidbuffer[1] == 0 && - gameidbuffer[2] == 0 && - gameidbuffer[3] == 0 && - gameidbuffer[4] == 0 && - gameidbuffer[5] == 0 && - gameidbuffer[6] == 0) - { - ResumeGui(); - return 0; - } - if(*((u32 *) 0x8000001C) == 0xC2339F3D){ - ResumeGui(); - return 2; - } + dvddone = 0; + ret = bwDVD_LowUnencryptedRead(g_diskID, 0x60, 0x00, __dvd_readidcb); // Overwrite the g_diskID thing + while(ret>=0 && dvddone==0); + + memcpy(header, g_diskID, 0x60); + memcpy(g_diskID, tmpBuff, 0x60); // Put the backup back, or games won't load + ResumeGui(); - return 1; + if (dvddone != 1) { + return 0; + } + return (header->magic == 0x5D1C9EA3) ? 1 : 2; // Don't check gamecube magic (0xC2339F3D) } diff --git a/source/prompts/DiscBrowser.h b/source/prompts/DiscBrowser.h index ad564893..4ea20536 100644 --- a/source/prompts/DiscBrowser.h +++ b/source/prompts/DiscBrowser.h @@ -11,6 +11,6 @@ int DiscBrowse(struct discHdr * header); int autoSelectDol(const char *id, bool force); int autoSelectDolMenu(const char *id, bool force); -u8 DiscMount(char *id); +u8 DiscMount(struct discHdr * header); #endif diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 63463455..d561c7c7 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -1265,8 +1265,8 @@ int GameWindowPrompt() { WBFS_GameSize(header->id, &size); sizeTxt.SetTextf("%.2fGB", size); //set size text; } - - nameTxt.SetText(mountMethod!=1&&mountMethod!=2?get_title(header):IDFull); + + nameTxt.SetText(get_title(header)); struct Game_NUM* game_num = CFG_get_game_num(header->id); if (game_num) {