From 92ae4707253def6cfcc3b8a783254a6b0a6f4ed3 Mon Sep 17 00:00:00 2001 From: giantpune Date: Mon, 29 Jun 2009 19:15:11 +0000 Subject: [PATCH] added 2 more servers to get images from. they are cycled to spread the load. if an image is missing on one, we try the others. changed a bit the way that the screensaver is called --- source/menu.cpp | 9 +- source/prompts/PromptWindows.cpp | 143 +++++++++++++++++-------------- source/prompts/PromptWindows.h | 2 +- 3 files changed, 83 insertions(+), 71 deletions(-) diff --git a/source/menu.cpp b/source/menu.cpp index 0441059c..5d490bf4 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -155,7 +155,7 @@ UpdateGUI (void *arg) return 0; } } - + switch (Settings.screensaver) { case 1: @@ -1198,9 +1198,10 @@ int MenuDiscList() // screensaver is called when wiimote shuts down, depending on the wiimotet idletime if(!IsWpadConnected() && check !=0) { check++; - if(check==100) //to allow time for the wii to turn off and not show teh screensaver - WindowScreensaver(); - check=0; + int screensaverIsOn=0; + if(check==100) //to allow time for the wii to turn off and not show the screensaver + screensaverIsOn=WindowScreensaver(); + if (screensaverIsOn==1)check=0; } } diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 92899776..5bb6c22e 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -321,7 +321,7 @@ void WindowCredits() * WindowScreensaver * Display screensaver ***************************************************************************/ -void WindowScreensaver() +int WindowScreensaver() { int i = 0; bool exit = false; @@ -367,6 +367,7 @@ void WindowScreensaver() mainWindow->Remove(&screensaverWindow); mainWindow->SetState(STATE_DEFAULT); ResumeGui(); + return 1; } /**************************************************************************** @@ -1714,6 +1715,7 @@ void SearchMissingImages(int choice2) bool found1 = false;/////add Ids of games that are missing covers to cntMissFiles bool found2 = false; + bool found3 = false; for (i = 0; i < gameCnt && cntMissFiles < 500; i++) { struct discHdr* header = &gameList[i]; @@ -1721,10 +1723,14 @@ void SearchMissingImages(int choice2) snprintf (filename,sizeof(filename),"%c%c%c.png", header->id[0], header->id[1], header->id[2]); found2 = findfile(filename, Settings.covers_path); + + snprintf (filename,sizeof(filename),"%c%c%c%c.png", header->id[0], header->id[1], header->id[2], header->id[3]); + found3 = findfile(filename, Settings.covers_path); + snprintf(filename,sizeof(filename),"%c%c%c%c%c%c.png",header->id[0], header->id[1], header->id[2], header->id[3], header->id[4], header->id[5]); //full id found1 = findfile(filename, Settings.covers_path); - if (!found1 && !found2) //if could not find any image + if (!found1 && !found2 && !found3) //if could not find any image { snprintf(missingFiles[cntMissFiles],11,"%s",filename); cntMissFiles++; @@ -1987,7 +1993,7 @@ ProgressDownloadWindow(int choice2) titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); titleTxt.SetPosition(0,60); - GuiText msgTxt(NULL, 22, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); + GuiText msgTxt(NULL, 20, (GXColor){THEME.prompttxt_r, THEME.prompttxt_g, THEME.prompttxt_b, 255}); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetPosition(0,130); @@ -2031,6 +2037,28 @@ ProgressDownloadWindow(int choice2) mainWindow->ChangeFocus(&promptWindow); ResumeGui(); + int serverCnt3d=3,serverCntDisc=2,serverCnt2d=3, offset=0, tries=0, m=0; + + char server3d[serverCnt3d][75]; + char serverDisc[serverCntDisc][75]; + char server2d[serverCnt2d][75]; + + snprintf(server3d[m], sizeof(server3d[m]), "http://boxart.rowdyruff.net/3d/");m++; + snprintf(server3d[m], sizeof(server3d[m]), "http://gxload.joschtex.com/3d/");m++; + snprintf(server3d[m], sizeof(server3d[m]), "http://wiicover.gateflorida.com/3d/");m++; + + m=0; + snprintf(serverDisc[m], sizeof(serverDisc[m]), "http://gxload.joschtex.com/disc/");m++; + //snprintf(serverDisc[k], sizeof(serverDisc[k]), "http://awiibit.com/BoxArt160x160/");k++; + snprintf(serverDisc[m], sizeof(serverDisc[m]), "http://wiicover.gateflorida.com/disc/");m++; + + m=0; + snprintf(server2d[m], sizeof(server2d[m]), "http://wiicover.gateflorida.com/2d/");m++; + snprintf(server2d[m], sizeof(server2d[m]), "http://boxart.rowdyruff.net/flat/");m++; + snprintf(server2d[m], sizeof(server2d[m]), "http://gxload.joschtex.com/2d/");m++; + + + //check if directory exist and if not create one struct stat st; if(stat(Settings.covers_path, &st) != 0) { @@ -2045,10 +2073,10 @@ ProgressDownloadWindow(int choice2) cntMissFiles = 0; } } - int server = 1, serverCnt=2; + //int server = 1; while (i < cntMissFiles) { - + tries=0; prTxt.SetTextf("%i%%", 100*i/cntMissFiles); if ((Settings.wsprompt == yes) && (CFG.widescreen)) @@ -2066,60 +2094,48 @@ ProgressDownloadWindow(int choice2) msg2Txt.SetTextf("%s", missingFiles[i]); - - - - - - //download boxart image char imgPath[100]; char URLFile[100]; struct block file = downloadfile(URLFile); if (choice2 == 2) - { - //if (server==1)sprintf(URLFile,"http://boxart.rowdyruff.net/3d/%s",missingFiles[i]); // For 3D Covers - sprintf(URLFile,"http://gxload.joschtex.com/3d/%s",missingFiles[i]); // For 3D Covers + { + while(triesserverCnt)server=1; - file = downloadfile(URLFile);//reject known bad images - - if (file.size == 36864 || file.size <= 1024 || file.size == 7386 || file.data == NULL) { + if (file.size == 36864 || file.size <= 1024 || file.size <= 1174 || file.size == 7386 || file.data == NULL) { cntNotFound++; i++; } @@ -2151,42 +2167,37 @@ ProgressDownloadWindow(int choice2) char URLFile[100]; struct block file = downloadfile(URLFile); if (choice2 == 2) - { - //if (server==1)sprintf(URLFile,"http://boxart.rowdyruff.net/3d/%s",missingFiles[0]); // For 3D Covers - sprintf(URLFile,"http://gxload.joschtex.com/3d/%s",missingFiles[0]); // For 3D Covers - sprintf(imgPath,"%s%s", Settings.covers_path, missingFiles[i]); + { + while(tries