mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 03:09:15 +01:00
*Skip spaces at the end of a category in WiiTDB (e.g 'Rhythm ')
*Change in nand title search (fixed bug which can find wrong nand title and set it as return to) *Fixed bug when a wiimote leaves the game list choice and returns to it without going over another game that game was not clickable (Issue 1918) *Changed search bar to clear text on [X] button click. search bar is now closed by pressing B
This commit is contained in:
parent
f98b9d02d0
commit
74181ae5bc
@ -2,8 +2,8 @@
|
||||
<app version="1">
|
||||
<name> USB Loader GX</name>
|
||||
<coder>USB Loader GX Team</coder>
|
||||
<version>2.1 r1086</version>
|
||||
<release_date>201106032029</release_date>
|
||||
<version>2.1 r1087</version>
|
||||
<release_date>201106041627</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.
|
||||
|
@ -380,7 +380,7 @@ void GuiGameBrowser::Update(GuiTrigger * t)
|
||||
if (i != selectedItem && game[i]->GetState() == STATE_SELECTED)
|
||||
game[i]->ResetState();
|
||||
else if (i == selectedItem && game[i]->GetState() == STATE_DEFAULT)
|
||||
game[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
||||
game[selectedItem]->SetState(STATE_SELECTED, -1);
|
||||
}
|
||||
|
||||
game[i]->Update(t);
|
||||
|
@ -36,6 +36,7 @@ GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) :
|
||||
keyOverImageData(Resources::GetFile("keyboard_key_over.png"), Resources::GetFileSize("keyboard_key_over.png"))
|
||||
{
|
||||
trig.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
||||
trigB.SetButtonOnlyTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);
|
||||
SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
|
||||
cnt = wcslen(SearchChars);
|
||||
@ -83,6 +84,10 @@ GuiSearchBar::GuiSearchBar(const wchar_t *SearchChars) :
|
||||
ClearBtn = new GuiButton(ClearBtnImg, ClearBtnImg_Over, ALIGN_RIGHT, ALIGN_TOP, -10, 10, &trig, btnSoundOver, btnSoundClick, 1);
|
||||
this->Append(ClearBtn);
|
||||
|
||||
CloseBtn = new GuiButton(0, 0);
|
||||
CloseBtn->SetTrigger(&trigB);
|
||||
this->Append(CloseBtn);
|
||||
|
||||
// SetPosition(100,100);
|
||||
|
||||
}
|
||||
@ -99,6 +104,8 @@ GuiSearchBar::~GuiSearchBar()
|
||||
delete ClearBtnImg_Over;
|
||||
delete imgClearBtn;
|
||||
|
||||
delete CloseBtn;
|
||||
|
||||
delete BacspaceBtn;
|
||||
delete BacspaceBtnImg;
|
||||
delete BacspaceBtnImg_Over;
|
||||
@ -151,7 +158,8 @@ wchar_t GuiSearchBar::GetClicked()
|
||||
}
|
||||
}
|
||||
if (BacspaceBtn->GetState() == STATE_CLICKED) return 8;
|
||||
if (ClearBtn->GetState() == STATE_CLICKED) return 7;
|
||||
else if (ClearBtn->GetState() == STATE_CLICKED) return 7;
|
||||
else if (CloseBtn->GetState() == STATE_CLICKED) return 27;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -27,12 +27,15 @@ class GuiSearchBar: public GuiWindow
|
||||
GuiImage* ClearBtnImg_Over;
|
||||
GuiButton* ClearBtn;
|
||||
|
||||
GuiButton* CloseBtn;
|
||||
|
||||
cSearchButton **buttons;
|
||||
int cnt;
|
||||
GuiImageData keyImageData;
|
||||
GuiImageData keyOverImageData;
|
||||
GuiTrigger trig;
|
||||
GuiTrigger trigB;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -193,6 +193,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
favoriteBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
favoriteBtn = new GuiButton(favoriteBtnImg_g, favoriteBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0,
|
||||
trigA, btnSoundOver, btnSoundClick2, 1, favoriteBtnTT, -15, 52, 0, 3);
|
||||
favoriteBtn->SetSelectable(false);
|
||||
|
||||
searchBtnTT = new GuiTooltip(tr( "Set Search-Filter" ));
|
||||
if (Settings.wsprompt) searchBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -203,6 +204,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
searchBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
searchBtn = new GuiButton(searchBtnImg_g, searchBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0,
|
||||
trigA, btnSoundOver, btnSoundClick2, 1, searchBtnTT, -15, 52, 0, 3);
|
||||
searchBtn->SetSelectable(false);
|
||||
|
||||
sortBtnTT = new GuiTooltip(" ");
|
||||
if (Settings.wsprompt) sortBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -211,6 +213,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
sortBtnImg = new GuiImage(imgabcIcon);
|
||||
sortBtnImg->SetWidescreen(Settings.widescreen);
|
||||
sortBtn = new GuiButton(sortBtnImg, sortBtnImg, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, sortBtnTT, -15, 52, 0, 3);
|
||||
sortBtn->SetSelectable(false);
|
||||
|
||||
categBtnTT = new GuiTooltip(tr("Select game categories"));
|
||||
if (Settings.wsprompt) sortBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -221,6 +224,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
categBtnImg_g = new GuiImage(imgCategory_gray);
|
||||
categBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
categBtn = new GuiButton(categBtnImg, categBtnImg, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, categBtnTT, -15, 52, 0, 3);
|
||||
categBtn->SetSelectable(false);
|
||||
|
||||
listBtnTT = new GuiTooltip(tr( "Display as a list" ));
|
||||
if (Settings.wsprompt) listBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -230,6 +234,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
listBtnImg_g = new GuiImage(imgarrangeList_gray);
|
||||
listBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
listBtn = new GuiButton(listBtnImg_g, listBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, listBtnTT, 15, 52, 1, 3);
|
||||
listBtn->SetSelectable(false);
|
||||
|
||||
gridBtnTT = new GuiTooltip(tr( "Display as a grid" ));
|
||||
if (Settings.wsprompt) gridBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -239,6 +244,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
gridBtnImg_g = new GuiImage(imgarrangeGrid_gray);
|
||||
gridBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
gridBtn = new GuiButton(gridBtnImg_g, gridBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, gridBtnTT, 15, 52, 1, 3);
|
||||
gridBtn->SetSelectable(false);
|
||||
|
||||
carouselBtnTT = new GuiTooltip(tr( "Display as a carousel" ));
|
||||
if (Settings.wsprompt) carouselBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -248,6 +254,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
carouselBtnImg_g = new GuiImage(imgarrangeCarousel_gray);
|
||||
carouselBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
carouselBtn = new GuiButton(carouselBtnImg_g, carouselBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, carouselBtnTT, 15, 52, 1, 3);
|
||||
carouselBtn->SetSelectable(false);
|
||||
|
||||
lockBtnTT = new GuiTooltip(NULL);
|
||||
if (Settings.wsprompt) lockBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -257,6 +264,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
lockBtnImg_g = new GuiImage(imgLock_gray);
|
||||
lockBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
lockBtn = new GuiButton(lockBtnImg_g, lockBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0, trigA, btnSoundOver, btnSoundClick2, 1, lockBtnTT, 15, 52, 1, 3);
|
||||
lockBtn->SetSelectable(false);
|
||||
|
||||
unlockBtnImg = new GuiImage(imgUnlock);
|
||||
unlockBtnImg->SetWidescreen(Settings.widescreen);
|
||||
@ -272,6 +280,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
dvdBtnImg_g->SetWidescreen(Settings.widescreen);
|
||||
dvdBtn = new GuiButton(dvdBtnImg_g, dvdBtnImg_g, ALIGN_LEFT, ALIGN_TOP, 0, 0,
|
||||
trigA, btnSoundOver, btnSoundClick2, 1, dvdBtnTT, 15, 52, 1, 3);
|
||||
dvdBtn->SetSelectable(false);
|
||||
|
||||
homebrewBtnTT = new GuiTooltip(tr( "Homebrew Launcher" ));
|
||||
if (Settings.wsprompt) homebrewBtnTT->SetWidescreen(Settings.widescreen);
|
||||
@ -293,6 +302,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
DownloadBtn->SetTrigger(0, trigA);
|
||||
DownloadBtn->SetTrigger(1, trig1);
|
||||
DownloadBtn->SetToolTip(DownloadBtnTT, 205, -30);
|
||||
DownloadBtn->SetSelectable(false);
|
||||
|
||||
gameCoverImg = new GuiImage();
|
||||
gameCoverImg->SetPosition(thInt("26 - cover/download btn pos x"), thInt("58 - cover/download btn pos y"));
|
||||
@ -307,6 +317,7 @@ GameBrowseMenu::GameBrowseMenu()
|
||||
idBtn->SetSoundOver(btnSoundOver);
|
||||
idBtn->SetTrigger(0, trigA);
|
||||
idBtn->SetToolTip(IDBtnTT, 205, -30);
|
||||
idBtn->SetSelectable(false);
|
||||
|
||||
GXColor clockColor = thColor("r=138 g=138 b=138 a=240 - clock color");
|
||||
clockTimeBack = new GuiText("88:88", 40, (GXColor) {clockColor.r, clockColor.g, clockColor.b, clockColor.a / 6});
|
||||
@ -917,11 +928,16 @@ int GameBrowseMenu::MainLoop()
|
||||
|
||||
gameList.FilterList(newFilter);
|
||||
}
|
||||
else if (searchChar == 7) //! Close
|
||||
else if (searchChar == 27) //! Close
|
||||
{
|
||||
show_searchwindow = false;
|
||||
searchBtn->StopEffect();
|
||||
}
|
||||
else if (searchChar == 7) //! Clear
|
||||
{
|
||||
gameList.FilterList(L"");
|
||||
Settings.gridRows = GridRowsPreSearch; //! restore old rows amount so we don't stay on one row
|
||||
}
|
||||
else if (searchChar == 8) //! Backspace
|
||||
{
|
||||
int len = wcslen(gameList.GetCurrentFilter());
|
||||
|
@ -209,9 +209,9 @@ void GameLoadSM::SetOptionValues()
|
||||
if(GameConfig.returnTo)
|
||||
{
|
||||
const char* TitleName = NULL;
|
||||
int haveTitle = NandTitles.FindU32(Settings.returnTo);
|
||||
if (haveTitle >= 0)
|
||||
TitleName = NandTitles.NameFromIndex(haveTitle);
|
||||
u64 tid = NandTitles.FindU32(Settings.returnTo);
|
||||
if (tid > 0)
|
||||
TitleName = NandTitles.NameOf(tid);
|
||||
Options->SetValue(Idx++, "%s", TitleName ? TitleName : strlen(Settings.returnTo) > 0 ?
|
||||
Settings.returnTo : tr( OnOffText[0] ));
|
||||
}
|
||||
|
@ -228,9 +228,9 @@ void LoaderSettings::SetOptionValues()
|
||||
|
||||
//! Settings: Return To
|
||||
const char* TitleName = NULL;
|
||||
int haveTitle = NandTitles.FindU32(Settings.returnTo);
|
||||
if (haveTitle >= 0)
|
||||
TitleName = NandTitles.NameFromIndex(haveTitle);
|
||||
u64 tid = NandTitles.FindU32(Settings.returnTo);
|
||||
if (tid > 0)
|
||||
TitleName = NandTitles.NameOf(tid);
|
||||
TitleName = TitleName ? TitleName : strlen(Settings.returnTo) > 0 ? Settings.returnTo : tr(OnOffText[0]);
|
||||
Options->SetValue(Idx++, "%s", TitleName);
|
||||
|
||||
|
@ -193,7 +193,7 @@ int GameBooter::BootGame(const char * gameID)
|
||||
u8 alternatedol = game_cfg->loadalternatedol;
|
||||
u32 alternatedoloffset = game_cfg->alternatedolstart;
|
||||
u8 reloadblock = game_cfg->iosreloadblock;
|
||||
u64 returnToChoice = game_cfg->returnTo ? NandTitles.At(NandTitles.FindU32(Settings.returnTo)) : 0;
|
||||
u64 returnToChoice = game_cfg->returnTo ? NandTitles.FindU32(Settings.returnTo) : 0;
|
||||
|
||||
//! Prepare alternate dol settings
|
||||
SetupAltDOL(gameHeader.id, alternatedol, alternatedoloffset);
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <ogc/isfs.h>
|
||||
#include <stdlib.h>
|
||||
#include "nandtitle.h"
|
||||
#include "usbloader/playlog.h"
|
||||
#include "utils/tools.h"
|
||||
@ -8,28 +9,6 @@ NandTitle NandTitles;
|
||||
|
||||
static u8 tmd_buf[MAX_SIGNED_TMD_SIZE] ATTRIBUTE_ALIGN( 32 );
|
||||
|
||||
//based on one from comex's nand formatter
|
||||
static u64 atoi_hex(const char *s)
|
||||
{
|
||||
u64 ret = 0;
|
||||
u32 n = strlen(s);
|
||||
|
||||
for (u32 i = 0; i < n; i++)
|
||||
{
|
||||
if (s[i] > 0x39)
|
||||
{
|
||||
ret += (s[i] & ~0x20) - 0x37;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret += (s[i] - 0x30);
|
||||
}
|
||||
if (i != (n - 1)) ret *= 16;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
NandTitle::NandTitle()
|
||||
{
|
||||
currentIndex = 0;
|
||||
@ -97,25 +76,21 @@ s32 NandTitle::Get()
|
||||
|
||||
tmd* NandTitle::GetTMD(u64 tid)
|
||||
{
|
||||
//gprintf("GetTMD( %016llx ): ", tid );
|
||||
signed_blob *s_tmd = (signed_blob *) tmd_buf;
|
||||
u32 tmd_size;
|
||||
|
||||
if (ES_GetStoredTMDSize(tid, &tmd_size) < 0)
|
||||
{
|
||||
//gprintf("!size\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 ret = ES_GetStoredTMD(tid, s_tmd, tmd_size);
|
||||
if (ret < 0)
|
||||
{
|
||||
//gprintf("!tmd - %04x\n", ret );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
tmd *t = (tmd*) SIGNATURE_PAYLOAD(s_tmd);
|
||||
//gprintf("ok\n");
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -420,20 +395,31 @@ s32 NandTitle::GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int NandTitle::FindU64(const char *s)
|
||||
u64 NandTitle::FindU64(const char *s)
|
||||
{
|
||||
u64 tid = atoi_hex(s);
|
||||
return IndexOf(tid);
|
||||
}
|
||||
u64 tid = strtoull(s, NULL, 16);
|
||||
|
||||
int NandTitle::FindU32(const char *s)
|
||||
{
|
||||
u64 tid = atoi_hex(s);
|
||||
for (u32 i = 0; i < titleIds.size(); i++)
|
||||
{
|
||||
if (TITLE_LOWER( titleIds.at( i ) ) == TITLE_LOWER( tid )) return i;
|
||||
if(titleIds[i] == tid)
|
||||
return titleIds[i];
|
||||
}
|
||||
return WII_EINSTALL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 NandTitle::FindU32(const char *s)
|
||||
{
|
||||
u32 tid = (u32) strtoull(s, NULL, 16);
|
||||
if(!tid)
|
||||
return 0;
|
||||
|
||||
for (u32 i = 0; i < titleIds.size(); i++)
|
||||
{
|
||||
if (TITLE_LOWER(titleIds[i]) == tid)
|
||||
return titleIds[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NandTitle::LoadFileFromNand(const char *filepath, u8 **outbuffer, u32 *outfilesize)
|
||||
|
@ -88,15 +88,12 @@ class NandTitle
|
||||
bool Exists(u64 tid);
|
||||
bool ExistsFromIndex(u32 i);
|
||||
|
||||
int FindU64(const char *s);
|
||||
int FindU32(const char *s);
|
||||
u64 FindU64(const char *s);
|
||||
u64 FindU32(const char *s);
|
||||
|
||||
s32 GetTicketViews(u64 tid, tikview **outbuf, u32 *outlen);
|
||||
|
||||
u64 operator[](u32 i)
|
||||
{
|
||||
return At(i);
|
||||
}
|
||||
u64 operator[](u32 i) { return At(i); }
|
||||
|
||||
static int LoadFileFromNand(const char *filepath, u8 **outbuffer, u32 *outfilesize);
|
||||
private:
|
||||
|
@ -650,7 +650,7 @@ bool WiiTDB::GetGenreList(const char * id, vector<string> & genre)
|
||||
ptr++;
|
||||
while(*ptr == ' ') ptr++;
|
||||
|
||||
while(genre[genre_num][genre[genre_num].size()-1] == ' ')
|
||||
while(genre[genre_num].size() > 0 && genre[genre_num][genre[genre_num].size()-1] == ' ')
|
||||
genre[genre_num].erase(genre[genre_num].size()-1);
|
||||
|
||||
genre_num++;
|
||||
@ -665,6 +665,9 @@ bool WiiTDB::GetGenreList(const char * id, vector<string> & genre)
|
||||
++ptr;
|
||||
}
|
||||
|
||||
while(genre[genre_num].size() > 0 && genre[genre_num][genre[genre_num].size()-1] == ' ')
|
||||
genre[genre_num].erase(genre[genre_num].size()-1);
|
||||
|
||||
delete [] data;
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user