diff --git a/gui.pnproj b/gui.pnproj index c65840bb..04a3e2a1 100644 --- a/gui.pnproj +++ b/gui.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/gui.pnps b/gui.pnps index 3c3ba32e..e865af66 100644 --- a/gui.pnps +++ b/gui.pnps @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/source/filelist.h b/source/filelist.h index 993f3f9f..06feaac1 100644 --- a/source/filelist.h +++ b/source/filelist.h @@ -504,4 +504,7 @@ extern const u32 pegi_18_png_size; extern const u8 usbport_png[]; extern const u32 usbport_png_size; +extern const u8 dvd_png[]; +extern const u32 dvd_png_size; + #endif diff --git a/source/images/arrangeCarousel.png b/source/images/arrangeCarousel.png index b76d5d8b..48e50243 100644 Binary files a/source/images/arrangeCarousel.png and b/source/images/arrangeCarousel.png differ diff --git a/source/images/dvd.png b/source/images/dvd.png new file mode 100644 index 00000000..35f78a5d Binary files /dev/null and b/source/images/dvd.png differ diff --git a/source/menu.cpp b/source/menu.cpp index 720adcf0..72e8ed3d 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -64,6 +64,9 @@ float gamesize; int currentMenu; int idiotFlag=-1; char idiotChar[50]; +u8 dvdMounted=0; +struct discHdr *dvdheader = NULL; + /*** Variables used only in menu.cpp ***/ static GuiImage * coverImg = NULL; @@ -76,6 +79,7 @@ static int ExitRequested = 0; static char gameregion[7]; static bool altdoldefault = true; + /*** Extern variables ***/ extern FreeTypeGX *fontClock; extern u8 shutdown; @@ -209,15 +213,16 @@ void ExitGUIThreads() { } void rockout(int f = 0) { + HaltGui(); int num=(f==2?-1:gameSelected); char imgPath[100]; #ifdef HW_RVL - if (!(strcasestr(get_title(&gameList[num]),"guitar")|| + if ((!(strcasestr(get_title(&gameList[num]),"guitar")|| strcasestr(get_title(&gameList[num]),"band")|| strcasestr(get_title(&gameList[num]),"rock")|| - f==1)) { + f==1))||dvdMounted) { for (int i = 0; i < 4; i++) delete pointer[i]; snprintf(imgPath, sizeof(imgPath), "%splayer1_point.png", CFG.theme_path); @@ -299,11 +304,11 @@ GuiImageData *LoadCoverImage(struct discHdr *header, bool Prefere3D, bool noCove /**************************************************************************** * MenuDiscList ***************************************************************************/ -GuiButton *Toolbar[7]; +GuiButton *Toolbar[8]; void DiscListWinUpdateCallback(void * e) { GuiWindow *w = (GuiWindow *)e; - for(int i=0; i<7; ++i) + for(int i=0; i<8; ++i) { if(Toolbar[i]->GetState() == STATE_SELECTED) { @@ -328,7 +333,11 @@ int MenuDiscList() { char IDfull[7]; u32 covert = 0; char imgPath[100]; - + char dvdID[8]; + if (!dvdheader) + dvdheader = new struct discHdr; + + WDVD_GetCoverStatus(&covert); u32 covertOld=covert; @@ -424,6 +433,8 @@ int MenuDiscList() { GuiImageData imgarrangeCarousel(imgPath, arrangeCarousel_png); // snprintf(imgPath, sizeof(imgPath), "%sarrangeCarousel_gray.png", CFG.theme_path); // GuiImageData imgarrangeCarousel_gray(imgPath, arrangeCarousel_gray_png); + snprintf(imgPath, sizeof(imgPath), "%sdvd.png", CFG.theme_path); + GuiImageData imgdvd(imgPath, dvd_png); snprintf(imgPath, sizeof(imgPath), "%sbrowser.png", CFG.theme_path); GuiImageData homebrewImgData(imgPath, browser_png); @@ -608,6 +619,18 @@ int MenuDiscList() { GuiButton carouselBtn(&carouselBtnImg_g,&carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_carousel_x, THEME.gamelist_carousel_y, &trigA, &btnSoundOver, &btnClick,1, &carouselBtnTT, 15, 52, 1, 3); carouselBtn.SetAlpha(180); + GuiTooltip dvdBtnTT(tr("Mount DVD drive")); + if (Settings.wsprompt == yes) + dvdBtnTT.SetWidescreen(CFG.widescreen); + dvdBtnTT.SetAlpha(THEME.tooltipAlpha); + GuiImage dvdBtnImg(&imgdvd); + dvdBtnImg.SetWidescreen(CFG.widescreen); + GuiImage dvdBtnImg_g(dvdBtnImg); //dvdBtnImg_g.SetGrayscale(); +// GuiImage carouselBtnImg_g(&imgarrangeCarousel_gray); + dvdBtnImg_g.SetWidescreen(CFG.widescreen); + GuiButton dvdBtn(&dvdBtnImg_g,&dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, THEME.gamelist_dvd_x, THEME.gamelist_dvd_y, &trigA, &btnSoundOver, &btnClick,1, &dvdBtnTT, 15, 52, 1, 3); + dvdBtn.SetAlpha(180); + GuiTooltip homebrewBtnTT(tr("Homebrew Launcher")); if (Settings.wsprompt == yes) homebrewBtnTT.SetWidescreen(CFG.widescreen); @@ -664,6 +687,7 @@ int MenuDiscList() { listBtn.SetPosition(THEME.gamelist_list_x, THEME.gamelist_list_y); gridBtn.SetPosition(THEME.gamelist_grid_x, THEME.gamelist_grid_y); carouselBtn.SetPosition(THEME.gamelist_carousel_x, THEME.gamelist_carousel_y); + dvdBtn.SetPosition(THEME.gamelist_dvd_x, THEME.gamelist_dvd_y); } else if(Settings.gameDisplay==grid) { favoriteBtn.SetPosition(THEME.gamegrid_favorite_x, THEME.gamegrid_favorite_y); searchBtn.SetPosition(THEME.gamegrid_search_x, THEME.gamegrid_search_y); @@ -672,6 +696,7 @@ int MenuDiscList() { listBtn.SetPosition(THEME.gamegrid_list_x, THEME.gamegrid_list_y); gridBtn.SetPosition(THEME.gamegrid_grid_x, THEME.gamegrid_grid_y); carouselBtn.SetPosition(THEME.gamegrid_carousel_x, THEME.gamegrid_carousel_y); + dvdBtn.SetPosition(THEME.gamegrid_dvd_x, THEME.gamegrid_dvd_y); } else if(Settings.gameDisplay==carousel) { favoriteBtn.SetPosition(THEME.gamecarousel_favorite_x, THEME.gamecarousel_favorite_y); searchBtn.SetPosition(THEME.gamecarousel_search_x, THEME.gamecarousel_favorite_y); @@ -680,6 +705,7 @@ int MenuDiscList() { listBtn.SetPosition(THEME.gamecarousel_list_x, THEME.gamecarousel_list_y); gridBtn.SetPosition(THEME.gamecarousel_grid_x, THEME.gamecarousel_grid_y); carouselBtn.SetPosition(THEME.gamecarousel_carousel_x, THEME.gamecarousel_carousel_y); + dvdBtn.SetPosition(THEME.gamecarousel_dvd_x, THEME.gamecarousel_dvd_y); } @@ -778,6 +804,8 @@ int MenuDiscList() { Toolbar[5] = &gridBtn; w.Append(&carouselBtn); Toolbar[6] = &carouselBtn; + w.Append(&dvdBtn); + Toolbar[7] = &dvdBtn; w.SetUpdateCallback(DiscListWinUpdateCallback); // End Toolbar @@ -1255,6 +1283,19 @@ int MenuDiscList() { menu = MENU_DISCLIST; break; } + } + else if (dvdBtn.GetState() == STATE_CLICKED) { + dvdMounted=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]; + + dvdBtn.ResetState(); + rockout(1); + //break; } if (Settings.gameDisplay==grid) { int selectimg; @@ -1384,31 +1425,36 @@ int MenuDiscList() { } } - if ((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) { + if (((gameSelected >= 0) && (gameSelected < (s32)gameCnt)) || dvdMounted) { if(searchBar) { HaltGui(); mainWindow->Remove(searchBar); ResumeGui(); } - rockout(); - struct discHdr *header = &gameList[gameSelected]; - WBFS_GameSize(header->id, &size); - if (strlen(get_title(header)) < (MAX_CHARACTERS + 3)) { - sprintf(text, "%s", get_title(header)); - } else { - strlcpy(text, get_title(header), MAX_CHARACTERS+1); - text[MAX_CHARACTERS] = '\0'; - strcat(text, "..."); - } + rockout(); + struct discHdr *header = (dvdMounted?dvdheader:&gameList[gameSelected]); + // struct discHdr *header = dvdheader:&gameList[gameSelected]); + if (!dvdMounted)//only get this stuff it we are booting a game from USB + { + WBFS_GameSize(header->id, &size); + if (strlen(get_title(header)) < (MAX_CHARACTERS + 3)) { + sprintf(text, "%s", get_title(header)); + } else { + strncpy(text, get_title(header), MAX_CHARACTERS); + text[MAX_CHARACTERS] = '\0'; + strncat(text, "...", 3); + } + } //check if alt Dol and gct file is present FILE *exeFile = NULL; char nipple[100]; - header = &gameList[gameSelected]; //reset header + header = (dvdMounted?dvdheader:&gameList[gameSelected]); //reset header snprintf (IDfull,sizeof(IDfull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); struct Game_CFG* game_cfg = CFG_get_game_opt(header->id); - if (game_cfg) { + + if (game_cfg) { alternatedol = game_cfg->loadalternatedol; ocarinaChoice = game_cfg->ocarina; } else { @@ -1518,7 +1564,7 @@ int MenuDiscList() { menu = MENU_EXIT; } else if (choice == 2) { - wiilight(0); + wiilight(0); HaltGui(); if (Settings.gameDisplay==list) mainWindow->Remove(gameBrowser); else if (Settings.gameDisplay==grid) mainWindow->Remove(gameGrid); @@ -1527,7 +1573,7 @@ int MenuDiscList() { ResumeGui(); //re-evaluate header now in case they changed games while on the game prompt - header = &gameList[gameSelected]; + header = (dvdMounted?dvdheader:&gameList[gameSelected]); int settret = GameSettings(header); /* unneeded for now, kept in case database gets a separate language setting //menu = MENU_DISCLIST; // refresh titles (needed if the language setting has changed) @@ -1546,7 +1592,7 @@ int MenuDiscList() { rockout(2); } - else if (choice == 3) { //WBFS renaming + else if (choice == 3 && !dvdMounted) { //WBFS renaming wiilight(0); //re-evaluate header now in case they changed games while on the game prompt header = &gameList[gameSelected]; @@ -1563,6 +1609,7 @@ int MenuDiscList() { } } else if (choice == 0) { rockout(2); + dvdMounted =0; if (Settings.gameDisplay==list) { gameBrowser->SetFocus(1); } else if (Settings.gameDisplay==grid) { @@ -1600,7 +1647,7 @@ int MenuDiscList() { // set alt dol default if (menu == MENU_EXIT && altdoldefault) { - struct discHdr *header = &gameList[gameSelected]; + struct discHdr *header = (dvdMounted?dvdheader:&gameList[gameSelected]); struct Game_CFG* game_cfg = CFG_get_game_opt(header->id); // use default only if no alt dol was selected manually if (game_cfg) { @@ -1640,6 +1687,8 @@ int MenuDiscList() { gameGrid = NULL; delete gameCarousel; gameCarousel = NULL; + //delete dvdheader; + //dvdheader = NULL; ResumeGui(); return menu; } @@ -2113,7 +2162,12 @@ int MainMenu(int menu) { } //MemInfoPrompt(); - + if (dvdMounted) + { + char tmp[30]; + sprintf(tmp,"boot method --> %i",dvdMounted); + WindowPrompt(0,tmp,0,0,0,0,100); + } CloseXMLDatabase(); ExitGUIThreads(); bgMusic->Stop(); @@ -2131,6 +2185,11 @@ int MainMenu(int menu) { delete fontSystem; ShutdownAudio(); StopGX(); + if (dvdMounted==2) + { + WII_Initialize(); + WII_LaunchTitle(0x0000000100000100ULL); + } if (boothomebrew == 1) { BootHomebrew(Settings.selected_homebrew); @@ -2139,7 +2198,7 @@ int MainMenu(int menu) { } else { int ret = 0; - struct discHdr *header = &gameList[gameSelected]; + struct discHdr *header = (dvdMounted?dvdheader:&gameList[gameSelected]); struct Game_CFG* game_cfg = CFG_get_game_opt(header->id); @@ -2174,7 +2233,7 @@ int MainMenu(int menu) { } reloadblock = off; } - int ios2; + int ios2; switch (iosChoice) { case i249: ios2 = 249; @@ -2200,15 +2259,24 @@ int MainMenu(int menu) { Sys_IosReload(249); } } - ret = Disc_SetUSB(header->id); - if (ret < 0) Sys_BackToLoader(); + if (!dvdMounted) + { + ret = Disc_SetUSB(header->id); + if (ret < 0) Sys_BackToLoader(); + } ret = Disc_Open(); if (ret < 0) Sys_BackToLoader(); SDCard_deInit(); USBDevice_deInit(); - if (reloadblock == on && (IOS_GetVersion() == 222 || IOS_GetVersion() == 223)) { + if (gameList){ + free(gameList); + } + if(dvdheader) + delete dvdheader; + + if (reloadblock == on && (IOS_GetVersion() == 222 || IOS_GetVersion() == 223)) { patch_cios_data(); mload_close(); } diff --git a/source/prompts/DiscBrowser.cpp b/source/prompts/DiscBrowser.cpp index a1c25858..9fad3e89 100644 --- a/source/prompts/DiscBrowser.cpp +++ b/source/prompts/DiscBrowser.cpp @@ -18,6 +18,9 @@ #include "settings/cfg.h" #include "memory.h" #include "../wad/title.h" +#include "../patches/dvd_broadway.h" + +#define BC 0x0000000100000100ULL /*** Extern functions ***/ extern void ResumeGui(); @@ -27,25 +30,28 @@ extern void HaltGui(); extern GuiWindow * mainWindow; extern u8 shutdown; extern u8 reset; +extern u8 dvdMounted; /******************************************************************************** -*Game specific settings +*Disk Browser *********************************************************************************/ int DiscBrowse(struct discHdr * header) { bool exit = false; int ret, choice; u64 offset; - //Halt Gui seems to fix that pain in the ass code dump. We'll see. HaltGui(); - ret = Disc_SetUSB(header->id); - if (ret < 0) { - ResumeGui(); - WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK")); - return ret; - } + if (!dvdMounted) + { + ret = Disc_SetUSB(header->id); + if (ret < 0) { + ResumeGui(); + WindowPrompt(tr("ERROR:"), tr("Could not set USB."), tr("OK")); + return ret; + } + } - ret = Disc_Open(); + ret = Disc_Open(); if (ret < 0) { ResumeGui(); WindowPrompt(tr("ERROR:"), tr("Could not open disc."), tr("OK")); @@ -65,8 +71,8 @@ int DiscBrowse(struct discHdr * header) { WindowPrompt(tr("ERROR:"), tr("Could not open WBFS partition"), tr("OK")); return ret; } - - int *buffer = (int*)allocate_memory(0x20); + + int *buffer = (int*)allocate_memory(0x20); if (buffer == NULL) { ResumeGui(); @@ -80,8 +86,8 @@ int DiscBrowse(struct discHdr * header) { WindowPrompt(tr("ERROR:"), tr("Could not read the disc."), tr("OK")); return ret; } - - void *fstbuffer = allocate_memory(buffer[2]*4); + + void *fstbuffer = allocate_memory(buffer[2]*4); FST_ENTRY *fst = (FST_ENTRY *)fstbuffer; if (fst == NULL) { @@ -193,7 +199,6 @@ int DiscBrowse(struct discHdr * header) { mainWindow->Append(&w); ResumeGui(); - while (!exit) { VIDEO_WaitVSync(); @@ -396,3 +401,50 @@ int autoSelectDolMenu(const char *id, bool force) { return -1; } + + +/******************************************************************************** +* Mount a DVD, get the type and ID. +*********************************************************************************/ +static vu32 dvddone = 0; +static dvddiskid *g_diskID = (dvddiskid*)0x80000000; +void __dvd_readidcb(s32 result) +{ + dvddone = result; +} + +u8 DiscMount(char *id) { + int ret; + char gameidbuffer[8]; + HaltGui(); + memset((char*)0x80000000, 0, 6); + + ret = bwDVD_LowInit(); + dvddone = 0; + ret = bwDVD_LowReset(__dvd_readidcb); + while(ret>=0 && dvddone==0); + + dvddone = 0; + ret = bwDVD_LowReadID(g_diskID,__dvd_readidcb); + 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; + } + ResumeGui(); + return 1; +} diff --git a/source/prompts/DiscBrowser.h b/source/prompts/DiscBrowser.h index fa41f54c..5c02b3d6 100644 --- a/source/prompts/DiscBrowser.h +++ b/source/prompts/DiscBrowser.h @@ -11,5 +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); #endif diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index c2955fbc..18483cf4 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -51,6 +51,8 @@ extern float gamesize; extern struct discHdr * gameList; extern u8 shutdown; extern u8 reset; +extern u8 dvdMounted; +extern struct discHdr *dvdheader; /*** Extern functions ***/ extern void ResumeGui(); @@ -1031,7 +1033,7 @@ int GameWindowPrompt() { GuiImage dialogBoxImg(&dialogBox); GuiTooltip nameBtnTT(tr("Rename Game on WBFS")); - if (Settings.wsprompt == yes) + if (Settings.wsprompt == yes && !dvdMounted) nameBtnTT.SetWidescreen(CFG.widescreen); GuiText nameTxt("", 22, THEME.prompttext); if (Settings.wsprompt == yes) @@ -1046,7 +1048,7 @@ int GameWindowPrompt() { nameBtn.SetSoundClick(&btnClick); nameBtn.SetToolTip(&nameBtnTT,24,-30, ALIGN_LEFT); - if (Settings.godmode == 1) { + if (Settings.godmode == 1 && !dvdMounted) { nameBtn.SetTrigger(&trigA); nameBtn.SetEffectGrow(); } @@ -1088,7 +1090,7 @@ int GameWindowPrompt() { btn2Img.SetWidescreen(CFG.widescreen); } GuiButton btn2(&btn2Img,&btn2Img, 1, 5, 0, 0, &trigA, &btnSoundOver, &btnClick,1); - if (Settings.godmode == 1) { + if (Settings.godmode == 1 && dvdMounted!=2) { btn2.SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM); btn2.SetPosition(-50, -40); } else { @@ -1138,15 +1140,18 @@ int GameWindowPrompt() { promptWindow.Append(&dialogBoxImg); promptWindow.Append(&nameBtn); - promptWindow.Append(&sizeTxt); promptWindow.Append(&playcntTxt); promptWindow.Append(&btn2); - promptWindow.Append(&btnLeft); - promptWindow.Append(&btnRight); - promptWindow.Append(&btnFavorite); + if (!dvdMounted)//stuff we don't show if it is a DVD mounted + { + promptWindow.Append(&sizeTxt); + promptWindow.Append(&btnLeft); + promptWindow.Append(&btnRight); + promptWindow.Append(&btnFavorite); + } //check if unlocked - if (Settings.godmode == 1) { + if (Settings.godmode == 1 && dvdMounted!=2) { promptWindow.Append(&btn3); } @@ -1174,7 +1179,7 @@ int GameWindowPrompt() { } //load disc image based or what game is seleted - struct discHdr * header = &gameList[gameSelected]; + struct discHdr * header = (dvdMounted?dvdheader:&gameList[gameSelected]); snprintf (ID,sizeof(ID),"%c%c%c", header->id[0], header->id[1], header->id[2]); snprintf (IDFull,sizeof(IDFull),"%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); @@ -1253,10 +1258,14 @@ int GameWindowPrompt() { nameTxt.SetEffect(EFFECT_FADE, 17); } else diskImg.SetImage(diskCover); - - WBFS_GameSize(header->id, &size); - sizeTxt.SetTextf("%.2fGB", size); //set size text; - nameTxt.SetText(get_title(header)); + + if (!dvdMounted) + { + WBFS_GameSize(header->id, &size); + sizeTxt.SetTextf("%.2fGB", size); //set size text; + } + + nameTxt.SetText(!dvdMounted?get_title(header):IDFull); struct Game_NUM* game_num = CFG_get_game_num(header->id); if (game_num) { @@ -1312,7 +1321,6 @@ int GameWindowPrompt() { } choice = 1; - //SDCard_deInit();// moved this into menu.cpp after checking for gct file and alt dol } else if (btn2.GetState() == STATE_CLICKED) { //back diff --git a/source/settings/Settings.cpp b/source/settings/Settings.cpp index 462c7179..32c54591 100644 --- a/source/settings/Settings.cpp +++ b/source/settings/Settings.cpp @@ -35,6 +35,8 @@ extern GuiImageData * pointer[4]; extern GuiImageData * background; extern u8 shutdown; extern u8 reset; +extern u8 dvdMounted; +extern struct discHdr *dvdheader; /**************************************************************************** * MenuSettings @@ -1795,18 +1797,26 @@ int GameSettings(struct discHdr * header) { trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B); char gameName[31]; + if (!dvdMounted) + { + if (strlen(get_title(header)) < (27 + 3)) { + sprintf(gameName, "%s", get_title(header)); + } else { + strncpy(gameName, get_title(header), 27); + gameName[27] = '\0'; + strncat(gameName, "...", 3); + } + } + else sprintf(gameName, "%c%c%c%c%c%c", header->id[0], header->id[1], header->id[2],header->id[3], header->id[4], header->id[5]); - if (strlen(get_title(header)) < (27 + 3)) { + if (strlen(get_title(header)) < (27 + 3)) { strcpy(gameName, get_title(header)); } else { strlcpy(gameName, get_title(header), 27+1); strcat(gameName, "..."); } - - - - GuiText titleTxt(get_title(header), 28, (GXColor) {0, 0, 0, 255}); + GuiText titleTxt(!dvdMounted?get_title(header):gameName, 28, (GXColor) {0, 0, 0, 255}); titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(12,40); titleTxt.SetMaxWidth(356, GuiText::SCROLL); @@ -2373,7 +2383,7 @@ int GameSettings(struct discHdr * header) { switch (ret) { case 0: choice1 = WindowPrompt(tr("Do you really want to delete:"),gameName,tr("Yes"),tr("Cancel")); - if (choice1 == 1) { + if (choice1 == 1 && !dvdMounted) { CFG_forget_game_opt(header->id); CFG_forget_game_num(header->id); ret = WBFS_RemoveGame(header->id); diff --git a/source/settings/cfg.c b/source/settings/cfg.c index 62c2caf3..58d1c7d3 100644 --- a/source/settings/cfg.c +++ b/source/settings/cfg.c @@ -279,6 +279,8 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode THEME.gamelist_grid_y = 13; THEME.gamelist_carousel_x = CFG.widescreen ? 480 : 500; THEME.gamelist_carousel_y = 13; + THEME.gamelist_dvd_x = CFG.widescreen ? 512 : 540; + THEME.gamelist_dvd_y = 13; THEME.gamegrid_favorite_x = CFG.widescreen ? 208 : 180; THEME.gamegrid_favorite_y = 13; @@ -294,6 +296,8 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode THEME.gamegrid_grid_y = 13; THEME.gamegrid_carousel_x = CFG.widescreen ? 400 : 420; THEME.gamegrid_carousel_y = 13; + THEME.gamegrid_dvd_x = CFG.widescreen ? 432 : 460; + THEME.gamegrid_dvd_y = 13; THEME.gamecarousel_favorite_x = CFG.widescreen ? 208 : 180; THEME.gamecarousel_favorite_y = 13; @@ -309,6 +313,8 @@ void CFG_Default(int widescreen) { // -1 = non forced Mode THEME.gamecarousel_grid_y = 13; THEME.gamecarousel_carousel_x = CFG.widescreen ? 400 : 420; THEME.gamecarousel_carousel_y = 13; + THEME.gamecarousel_dvd_x = CFG.widescreen ? 432 : 460; + THEME.gamecarousel_dvd_y = 13; } void Global_Default(void) { @@ -571,6 +577,7 @@ void path_set(char *name, char *val) { #define OLD_LIST_ICON 8 #define OLD_GRID_ICON 16 #define OLD_CAROUSEL_ICON 32 +#define OLD_DVD_ICON 64 short WorkAroundIconSet=0; short WorkAroundBarOffset=100; @@ -647,6 +654,10 @@ void theme_set(char *name, char *val) { else CFG_COORDS2(gamegrid_carousel) else CFG_COORDS2(gamecarousel_carousel) + else CFG_COORDS2(gamelist_dvd) + else CFG_COORDS2(gamegrid_dvd) + else CFG_COORDS2(gamecarousel_dvd) + //********************************** // Workaround for old Themes //********************************** @@ -748,6 +759,17 @@ void theme_set(char *name, char *val) { } } + else if (strcmp(cfg_name, "dvd_coords") == 0) { + short x,y; + if (sscanf(val, "%hd,%hd", &x, &y) == 2) { + if(!CFG.widescreen) x+=24; + THEME.gamelist_dvd_x = x; + THEME.gamegrid_dvd_x = THEME.gamecarousel_dvd_x = x-WorkAroundBarOffset; + THEME.gamelist_dvd_y = THEME.gamegrid_dvd_y = THEME.gamecarousel_dvd_y = y; + WorkAroundIconSet |= OLD_DVD_ICON; + } + } + else if (strcmp(cfg_name, "sortBarOffset") == 0) { short o; if (sscanf(val, "%hd", &o) == 1) { @@ -783,6 +805,11 @@ void theme_set(char *name, char *val) { THEME.gamegrid_carousel_x += WorkAroundBarOffset - o; THEME.gamecarousel_carousel_x += WorkAroundBarOffset - o; } + if(WorkAroundIconSet & OLD_DVD_ICON) + { + THEME.gamegrid_dvd_x += WorkAroundBarOffset - o; + THEME.gamecarousel_dvd_x += WorkAroundBarOffset - o; + } WorkAroundBarOffset = o; } } diff --git a/source/settings/cfg.h b/source/settings/cfg.h index 497ee1d2..5696b69f 100644 --- a/source/settings/cfg.h +++ b/source/settings/cfg.h @@ -143,6 +143,8 @@ extern "C" { short gamelist_grid_y; short gamelist_carousel_x; short gamelist_carousel_y; + short gamelist_dvd_x; + short gamelist_dvd_y; // Toolbar Icons in GameGrid short gamegrid_favorite_x; short gamegrid_favorite_y; @@ -158,6 +160,8 @@ extern "C" { short gamegrid_grid_y; short gamegrid_carousel_x; short gamegrid_carousel_y; + short gamegrid_dvd_x; + short gamegrid_dvd_y; // Toolbar Icons in GameCarousel short gamecarousel_favorite_x; short gamecarousel_favorite_y; @@ -173,6 +177,8 @@ extern "C" { short gamecarousel_grid_y; short gamecarousel_carousel_x; short gamecarousel_carousel_y; + short gamecarousel_dvd_x; + short gamecarousel_dvd_y; }; diff --git a/source/usbloader/alternatedol.c b/source/usbloader/alternatedol.c index 490d31e8..8f9b0283 100644 --- a/source/usbloader/alternatedol.c +++ b/source/usbloader/alternatedol.c @@ -8,6 +8,9 @@ #include "apploader.h" #include "wdvd.h" #include "fstfile.h" +#include "../patches/dvd_broadway.h" + +extern u8 dvdMounted; /** Alternate dolloader made by WiiPower modified by dimok **/ bool Load_Dol(void **buffer, int* dollen, char * filepath) { @@ -180,7 +183,11 @@ bool load_dol_image_modified(void **offset, u32 *pos, u32 *len) { } return false; } - +static vu32 dvddone = 0; +void __dvd_readidcb(s32 result) +{ + dvddone = result; +} u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u8 vipatch) { int ret; void *dol_header; @@ -191,8 +198,14 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u return -1; } - ret = WDVD_Read(dol_header, sizeof(dolheader), (doloffset<<2)); - + if (!dvdMounted)ret = WDVD_Read(dol_header, sizeof(dolheader), (doloffset<<2)); + + else{ + dvddone = 0; + ret = bwDVD_LowRead(dol_header, sizeof(dolheader), doloffset, __dvd_readidcb); + while(ret>=0 && dvddone==0); + } + entrypoint = load_dol_start(dol_header); if (entrypoint == 0) { @@ -221,4 +234,5 @@ u32 Load_Dol_from_disc(u32 doloffset, u8 videoSelected, u8 patchcountrystring, u free(dol_header); return entrypoint; + } diff --git a/source/usbloader/apploader.c b/source/usbloader/apploader.c index 4fc25292..7c3e3291 100644 --- a/source/usbloader/apploader.c +++ b/source/usbloader/apploader.c @@ -13,10 +13,15 @@ #include "fstfile.h" #include "settings/cfg.h" +#define BC 0x0000000100000100ULL +#define MIOS 0x0000000100000101ULL +static tikview view ATTRIBUTE_ALIGN(32); + /*KENOBI! - FISHEARS*/ extern const unsigned char kenobiwii[]; extern const int kenobiwii_size; /*KENOBI! - FISHEARS*/ +extern u8 dvdMounted; /* Apploader function pointers */ typedef int (*app_main)(void **dst, int *size, int *offset); @@ -300,6 +305,23 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 ret = WDVD_Read(appldr, appldr_len, APPLDR_OFFSET + 0x20); if (ret < 0) return ret; + + if (dvdMounted==2) + { + int retval; + retval = ES_GetTicketViews(BC, &view, 1); + if (retval != 0){ + // error. do something smart here like exit. anything besides return 0; + return 0; + } + + WPAD_Shutdown(); + *(volatile unsigned int *)0xCC003024 |= 7; + + retval = ES_LaunchTitle(BC, &view); // bushing's code + return 0; + } + /* Set apploader entry function */ appldr_entry = (app_entry)buffer[4]; @@ -309,7 +331,7 @@ s32 Apploader_Run(entry_point *entry, u8 cheat, u8 videoSelected, u8 vipatch, u8 /* Initialize apploader */ appldr_init(__noprint); - + if (error002fix!=0) { /* ERROR 002 fix (thanks to WiiPower for sharing this)*/ *(u32 *)0x80003140 = *(u32 *)0x80003188; diff --git a/source/usbloader/disc.c b/source/usbloader/disc.c index cc7db4e2..6c46f054 100644 --- a/source/usbloader/disc.c +++ b/source/usbloader/disc.c @@ -318,6 +318,8 @@ s32 Disc_WiiBoot(u8 videoselected, u8 cheat, u8 vipatch, u8 patchcountrystring, return Disc_BootPartition(offset, videoselected, cheat, vipatch, patchcountrystring, error002fix, alternatedol, alternatedoloffset); } + + void PatchCountryStrings(void *Address, int Size) { u8 SearchPattern[4] = { 0x00, 0x00, 0x00, 0x00 }; u8 PatchData[4] = { 0x00, 0x00, 0x00, 0x00 };