*Added return grid rows after closing a search to the amount of which one has before doing search

*Fixed weird last random character at game info text 
*Reload background/cursor/... on theme apply after download 
*Added connection check function for URLs (like a PING)
*Added timeout on trying to connect to the theme download hoster
*Fixed redundant characters on search bar when both upper and lower case exist in a search
This commit is contained in:
dimok321 2011-01-25 20:19:15 +00:00
parent ca430264b6
commit 0cca811b34
30 changed files with 367 additions and 437 deletions

View File

@ -2,8 +2,8 @@
<app version="1">
<name> USB Loader GX</name>
<coder>USB Loader GX Team</coder>
<version>2.0 r1055</version>
<release_date>201101242033</release_date>
<version>2.0 r1056</version>
<release_date>201101251820</release_date>
<no_ios_reload/>
<short_description>Loads games from USB-devices</short_description>
<long_description>USB Loader GX is a libwiigui based USB iso loader with a wii-like GUI. You can install games to your HDDs and boot them with shorter loading times.

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: David Jelinek (djelinek@hotmail.com) e->e,r->r,u->u, c->c \n"
"Language-Team: r1043 - last version on http://djelinek.sweb.cz/_USBLoderGX/czech.lang \n"
@ -282,6 +282,9 @@ msgstr "Naprogramoval: %s"
msgid "Coding:"
msgstr "Programování:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konzole"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Fox888[dk]\n"
"Language-Team: [dk]\n"
@ -282,6 +282,9 @@ msgstr "Programmeret af: %s"
msgid "Coding:"
msgstr "Programmering:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsol"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2011-01-24 07:20+0100\n"
"Last-Translator: glowy\n"
"Language-Team: tj_cool, glowy\n"
@ -282,6 +282,9 @@ msgstr "Geprogrammeerd door: %s"
msgid "Coding:"
msgstr "Codering:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -282,6 +282,9 @@ msgstr ""
msgid "Coding:"
msgstr ""
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: c64rmx\n"
"Language-Team: \n"
@ -282,6 +282,9 @@ msgstr "Koodaus: %s"
msgid "Coding:"
msgstr "Koodaus"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsoli"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: Cyan\n"
"Language-Team: Badablek, Amour, ikya & Kin8\n"
@ -282,6 +282,9 @@ msgstr "Développé par: %s"
msgid "Coding:"
msgstr "Développement:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr ""

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2010-07-03 17:35-0800\n"
"Last-Translator: TheRealVisitor\n"
"Language-Team: Bertilax, Snoozer, wishmasterf, ZEN.13, TheRealVisitor\n"
@ -282,6 +282,9 @@ msgstr "Programmiert von: %s"
msgid "Coding:"
msgstr "Programmierung:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsolenstatus"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-12-29 11:05+0100\n"
"Last-Translator: Springdale\n"
"Language-Team: Tusk, Springdale\n"
@ -282,6 +282,9 @@ msgstr "Kódolás: %s"
msgid "Coding:"
msgstr "Kódolás:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konzol"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-24 21:19+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2011-01-22 20:00+0200\n"
"Last-Translator: Cambo \n"
"Language-Team: Cambo\n"
@ -282,6 +282,9 @@ msgstr "Sviluppato da: %s"
msgid "Coding:"
msgstr "Sviluppo:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Terminale"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: ichiroling\n"
"Language-Team: hosigumayuugi, papa\n"
@ -282,6 +282,9 @@ msgstr "開発: %s"
msgid "Coding:"
msgstr "開発者:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "状態"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: nextos@korea.com\n"
"Language-Team: \n"
@ -282,6 +282,9 @@ msgstr "Coded by: %s"
msgid "Coding:"
msgstr "코디:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "콘솔"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: raschi\n"
"Language-Team: raschi\n"
@ -282,6 +282,9 @@ msgstr "Kodet av: %s"
msgid "Coding:"
msgstr "Koding:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsoll"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: ziom666 (zadania_prog@vp.pl)\n"
"Language-Team: \n"
@ -282,6 +282,9 @@ msgstr ""
msgid "Coding:"
msgstr ""
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsola"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-23 18:52+0200\n"
"Last-Translator: aniemotion\n"
"Language-Team: boto12, aniemotion\n"
@ -282,6 +282,9 @@ msgstr "Programado por: %s"
msgid "Coding:"
msgstr "Desenvolvimento:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Configuração"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2010-03-22 10:55-0000\n"
"Last-Translator: Sky8000\n"
"Language-Team: Sky8000 <sky8000@hotmail.com>\n"
@ -282,6 +282,9 @@ msgstr "Programado por: %s"
msgid "Coding:"
msgstr "Desenvolvimento:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Configuração"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: nikolai_ca\n"
"Language-Team: Kir, alendit, nikolai_ca\n"
@ -282,6 +282,9 @@ msgstr "Создано: %s"
msgid "Coding:"
msgstr "Создание:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Консоль"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-24 21:19+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: knife.hu kavid emul8ion\n"
"Language-Team: kavid\n"
@ -282,6 +282,9 @@ msgstr "编程: %s"
msgid "Coding:"
msgstr "编程:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "控制台"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: SirPalax\n"
"Language-Team: Penn, SirPalax\n"
@ -282,6 +282,9 @@ msgstr "Programado por: %s"
msgid "Coding:"
msgstr "Programación:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Consola"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2010-01-19 17:39+0200\n"
"Last-Translator: Katsurou\n"
"Language-Team: Katsurou, pirateX\n"
@ -282,6 +282,9 @@ msgstr "Kodad av: %s"
msgid "Coding:"
msgstr "Kodning:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsol"

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 20:46+0100\n"
"PO-Revision-Date: 2010-02-15 21:00+0800\n"
"Last-Translator: Jane.H\n"
"Language-Team: kyogc, Miller, Mika Li, Jane.H\n"
@ -282,6 +282,9 @@ msgstr "程式設計者: %s"
msgid "Coding:"
msgstr "編譯:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "控制台"
@ -1780,4 +1783,4 @@ msgstr "剩餘秒數"
#~ msgstr "不存在!檔案錯誤"
#~ msgid "file left"
#~ msgstr "剩餘文件"
#~ msgstr "剩餘文件"

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: USB Loader GX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-23 21:03+0100\n"
"POT-Creation-Date: 2011-01-25 21:17+0100\n"
"PO-Revision-Date: 2009-10-01 01:00+0200\n"
"Last-Translator: omercigingelini\n"
"Language-Team: omercigingelini\n"
@ -282,6 +282,9 @@ msgstr "%s tarafından kodlandı"
msgid "Coding:"
msgstr "Kodlama:"
msgid "Connection to server timed out."
msgstr ""
msgid "Console"
msgstr "Konsol"

View File

@ -296,7 +296,11 @@ void Text::CalcLineOffsets()
TmpLine.CharCount = ch - TmpLine.LineOffset;
TmpLine.width = currWidth;
if (TmpLine.CharCount > 0) TextLines.push_back(TmpLine);
if (TmpLine.CharCount-1 > 0)
{
TmpLine.CharCount -= 1;
TextLines.push_back(TmpLine);
}
}
void Text::Draw()

View File

@ -861,11 +861,13 @@ int GameBrowseMenu::MainLoop()
gameList.FilterList(oldFilter.c_str());
ReloadBrowser();
searchBtn->ResetState();
if(show_searchwindow && wcslen(gameList.GetCurrentFilter()) == 0)
GridRowsPreSearch = Settings.gridRows; //! store old rows amount
}
else if (searchBar && (searchChar = searchBar->GetClicked()))
{
if (searchChar > 27)
if (searchChar > 27) //! Character clicked
{
int len = gameList.GetCurrentFilter() ? wcslen(gameList.GetCurrentFilter()) : 0;
wchar_t newFilter[len + 2];
@ -875,18 +877,20 @@ int GameBrowseMenu::MainLoop()
gameList.FilterList(newFilter);
}
else if (searchChar == 7) // Close
else if (searchChar == 7) //! Close
{
show_searchwindow = false;
searchBtn->StopEffect();
}
else if (searchChar == 8) // Backspace
else if (searchChar == 8) //! Backspace
{
int len = wcslen(gameList.GetCurrentFilter());
wchar_t newFilter[len + 1];
if (gameList.GetCurrentFilter()) wcscpy(newFilter, gameList.GetCurrentFilter());
newFilter[len > 0 ? len - 1 : 0] = 0;
gameList.FilterList(newFilter);
if(len == 1)
Settings.gridRows = GridRowsPreSearch; //! restore old rows amount so we don't stay on one row
}
ReloadBrowser();
return MENU_NONE;

View File

@ -34,6 +34,7 @@ class GameBrowseMenu : public GuiWindow
int returnMenu;
int gameSelectedOld;
int gameClicked;
int GridRowsPreSearch;
time_t lastrawtime;
bool show_searchwindow;
wchar_t searchChar;

View File

@ -10,10 +10,12 @@
#include <string.h>
#include <ogcsys.h>
#include <ogc/machine/processor.h>
#include <fcntl.h>
#include "prompts/PromptWindows.h"
#include "language/gettext.h"
#include "settings/CSettings.h"
#include "utils/timer.h"
#include "networkops.h"
#include "main.h"
#include "http.h"
@ -294,6 +296,62 @@ void CloseConnection()
}
}
/****************************************************************************
* Test if connection to the address is available (PING)
***************************************************************************/
bool CheckConnection(const char *url, float timeout)
{
//Check if the url starts with "http://", if not it is not considered a valid url
if (strncmp(url, "http://", strlen("http://")) != 0)
return false;
//Locate the path part of the url by searching for '/' past "http://"
char *path = strchr(url + strlen("http://"), '/');
//At the very least the url has to end with '/', ending with just a domain is invalid
if (path == NULL)
return false;
//Extract the domain part out of the url
int domainlength = path - url - strlen("http://");
if (domainlength == 0)
return false;
char domain[domainlength + 1];
strlcpy(domain, url + strlen("http://"), domainlength + 1);
//Parsing of the URL is done, start making an actual connection
u32 ipaddress = getipbynamecached(domain);
if (ipaddress == 0)
return false;
//Initialize socket
s32 connection = net_socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
if (connection < 0) return connection;
s32 flags = net_fcntl(connection, F_GETFL, 0);
if (flags >= 0) flags = net_fcntl(connection, F_SETFL, flags | 4);
struct sockaddr_in connect_addr;
memset(&connect_addr, 0, sizeof(connect_addr));
connect_addr.sin_family = AF_INET;
connect_addr.sin_port = 80;
connect_addr.sin_addr.s_addr = getipbynamecached(domain);
Timer netTime;
int res = -1;
while(res < 0 && res != -127 && netTime.elapsed() < timeout)
{
res = net_connect(connection, (struct sockaddr*) &connect_addr, sizeof(connect_addr));
usleep(1000);
}
net_close(connection);
return !(res < 0 && res != -127);
}
/****************************************************************************
* NetworkWait
***************************************************************************/

View File

@ -15,6 +15,7 @@ bool IsNetworkInit(void);
char * GetNetworkIP(void);
char * GetIncommingIP(void);
bool ShutdownWC24();
bool CheckConnection(const char *url, float timeout = 5.0f);
s32 network_request(s32 connection, const char * request, char * filename);
s32 network_read(s32 connection, u8 *buf, u32 len);
s32 download_request(const char * url, char * filename = NULL);

View File

@ -222,12 +222,19 @@ void ThemeDownloader::SetupMainButtons()
ShowProgress(tr("Downloading pagelist:"), "www.spiffy360.com", tr("Please wait..."), 0, 1);
if(!CheckConnection(ThemeListURL.c_str()))
{
ShowError(tr("Connection to server timed out."));
return;
}
ThemeList = new Theme_List(ThemeListURL.c_str());
if (ThemeList->GetThemeCount() == 0)
{
WindowPrompt(tr( "No themes found on the site." ), 0, "OK");
returnMenu = MENU_SETTINGS;
ProgressStop();
}
for(int i = 0; i < ThemeList->GetThemeCount(); ++i)
@ -369,7 +376,10 @@ void ThemeDownloader::MainButtonClicked(int button)
{
result = DownloadTheme(downloadlink, title);
if (result == 2)
{
returnMenu = MENU_THEMEDOWNLOADER;
leave = true;
}
}
mainWindow->SetState(STATE_DISABLED);
promptWindow.SetState(STATE_DEFAULT);
@ -475,6 +485,7 @@ int ThemeDownloader::DownloadTheme(const char *url, const char *title)
if (Theme::Load(real_themepath))
{
snprintf(Settings.theme, sizeof(Settings.theme), real_themepath);
Theme::Reload();
result = 2;
}

View File

@ -23,6 +23,7 @@
***************************************************************************/
#include <algorithm>
#include <string>
#include <wctype.h>
#include <malloc.h>
#include "usbloader/wbfs.h"
#include "settings/newtitles.h"
@ -172,8 +173,12 @@ int GameList::FilterList(const wchar_t * gameFilter)
if (gameName)
{
if (wcslen(gameName) > GameFilter.size() && AvailableSearchChars.find(gameName[GameFilter.size()]) == std::string::npos)
if (wcslen(gameName) > GameFilter.size() &&
AvailableSearchChars.find(towupper(gameName[GameFilter.size()])) == std::string::npos &&
AvailableSearchChars.find(towlower(gameName[GameFilter.size()])) == std::string::npos)
{
AvailableSearchChars.push_back(gameName[GameFilter.size()]);
}
delete [] gameName;
}
@ -211,9 +216,14 @@ int GameList::LoadUnfiltered()
wchar_t *gameName = charToWideChar(GameTitles.GetTitle(header));
if (gameName)
{
if (wcslen(gameName) > GameFilter.size() && AvailableSearchChars.find(gameName[GameFilter.size()]) == std::string::npos)
if (wcslen(gameName) > GameFilter.size() &&
AvailableSearchChars.find(towupper(gameName[GameFilter.size()])) == std::string::npos &&
AvailableSearchChars.find(towlower(gameName[GameFilter.size()])) == std::string::npos)
{
AvailableSearchChars.push_back(gameName[GameFilter.size()]);
delete[] gameName;
}
delete [] gameName;
}
FilteredList.push_back(header);