mirror of
https://github.com/wiidev/usbloadergx.git
synced 2024-11-22 19:29:18 +01:00
- fix tooltips in GameCarousel
- change gui_keyboard stuff - change filebrowser stuff
This commit is contained in:
parent
608dd91a21
commit
505e4cd09c
@ -193,6 +193,7 @@ GuiFileBrowser::~GuiFileBrowser()
|
|||||||
|
|
||||||
void GuiFileBrowser::SetFocus(int f)
|
void GuiFileBrowser::SetFocus(int f)
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
focus = f;
|
focus = f;
|
||||||
|
|
||||||
for(int i=0; i<FILEBROWSERSIZE; i++)
|
for(int i=0; i<FILEBROWSERSIZE; i++)
|
||||||
@ -204,11 +205,13 @@ void GuiFileBrowser::SetFocus(int f)
|
|||||||
|
|
||||||
void GuiFileBrowser::DisableTriggerUpdate(bool set)
|
void GuiFileBrowser::DisableTriggerUpdate(bool set)
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
triggerdisabled = set;
|
triggerdisabled = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiFileBrowser::ResetState()
|
void GuiFileBrowser::ResetState()
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
state = STATE_DEFAULT;
|
state = STATE_DEFAULT;
|
||||||
stateChan = -1;
|
stateChan = -1;
|
||||||
selectedItem = 0;
|
selectedItem = 0;
|
||||||
@ -221,6 +224,7 @@ void GuiFileBrowser::ResetState()
|
|||||||
|
|
||||||
void GuiFileBrowser::TriggerUpdate()
|
void GuiFileBrowser::TriggerUpdate()
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +233,7 @@ void GuiFileBrowser::TriggerUpdate()
|
|||||||
*/
|
*/
|
||||||
void GuiFileBrowser::Draw()
|
void GuiFileBrowser::Draw()
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
if(!this->IsVisible())
|
if(!this->IsVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -249,6 +254,7 @@ void GuiFileBrowser::Draw()
|
|||||||
|
|
||||||
void GuiFileBrowser::Update(GuiTrigger * t)
|
void GuiFileBrowser::Update(GuiTrigger * t)
|
||||||
{
|
{
|
||||||
|
LOCK(this);
|
||||||
if(state == STATE_DISABLED || !t || triggerdisabled)
|
if(state == STATE_DISABLED || !t || triggerdisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -263,7 +269,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
if(scrollbarBoxBtn->GetState() == STATE_HELD &&
|
if(scrollbarBoxBtn->GetState() == STATE_HELD &&
|
||||||
scrollbarBoxBtn->GetStateChan() == t->chan &&
|
scrollbarBoxBtn->GetStateChan() == t->chan &&
|
||||||
t->wpad.ir.valid &&
|
t->wpad.ir.valid &&
|
||||||
browser.numEntries > FILEBROWSERSIZE
|
browser->browserList.size() > FILEBROWSERSIZE
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scrollbarBoxBtn->SetPosition(20,-10);
|
scrollbarBoxBtn->SetPosition(20,-10);
|
||||||
@ -274,15 +280,15 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
else if(positionWiimote > scrollbarBoxBtn->GetMaxY())
|
else if(positionWiimote > scrollbarBoxBtn->GetMaxY())
|
||||||
positionWiimote = scrollbarBoxBtn->GetMaxY();
|
positionWiimote = scrollbarBoxBtn->GetMaxY();
|
||||||
|
|
||||||
browser.pageIndex = (positionWiimote * browser.numEntries)/136.0 - selectedItem;
|
browser->pageIndex = (positionWiimote * browser->browserList.size())/136.0 - selectedItem;
|
||||||
|
|
||||||
if(browser.pageIndex <= 0)
|
if(browser->pageIndex <= 0)
|
||||||
{
|
{
|
||||||
browser.pageIndex = 0;
|
browser->pageIndex = 0;
|
||||||
}
|
}
|
||||||
else if(browser.pageIndex+FILEBROWSERSIZE >= browser.numEntries)
|
else if(browser->pageIndex+FILEBROWSERSIZE >= (int)browser->browserList.size())
|
||||||
{
|
{
|
||||||
browser.pageIndex = browser.numEntries-FILEBROWSERSIZE;
|
browser->pageIndex = browser->browserList.size()-FILEBROWSERSIZE;
|
||||||
}
|
}
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
focus = false;
|
focus = false;
|
||||||
@ -314,32 +320,32 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
*/
|
*/
|
||||||
if(t->Right())
|
if(t->Right())
|
||||||
{
|
{
|
||||||
if(browser.pageIndex < browser.numEntries && browser.numEntries > FILEBROWSERSIZE)
|
if(browser->pageIndex < (int)browser->browserList.size() && browser->browserList.size() > FILEBROWSERSIZE)
|
||||||
{
|
{
|
||||||
browser.pageIndex += FILEBROWSERSIZE;
|
browser->pageIndex += FILEBROWSERSIZE;
|
||||||
if(browser.pageIndex+FILEBROWSERSIZE >= browser.numEntries)
|
if(browser->pageIndex+FILEBROWSERSIZE >= (int)browser->browserList.size())
|
||||||
browser.pageIndex = browser.numEntries-FILEBROWSERSIZE;
|
browser->pageIndex = browser->browserList.size()-FILEBROWSERSIZE;
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(t->Left())
|
else if(t->Left())
|
||||||
{
|
{
|
||||||
if(browser.pageIndex > 0)
|
if(browser->pageIndex > 0)
|
||||||
{
|
{
|
||||||
browser.pageIndex -= FILEBROWSERSIZE;
|
browser->pageIndex -= FILEBROWSERSIZE;
|
||||||
if(browser.pageIndex < 0)
|
if(browser->pageIndex < 0)
|
||||||
browser.pageIndex = 0;
|
browser->pageIndex = 0;
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(t->Down())
|
else if(t->Down())
|
||||||
{
|
{
|
||||||
if(browser.pageIndex + selectedItem + 1 < browser.numEntries)
|
if(browser->pageIndex + selectedItem + 1 < (int)browser->browserList.size())
|
||||||
{
|
{
|
||||||
if(selectedItem == FILEBROWSERSIZE-1)
|
if(selectedItem == FILEBROWSERSIZE-1)
|
||||||
{
|
{
|
||||||
// move list down by 1
|
// move list down by 1
|
||||||
browser.pageIndex++;
|
browser->pageIndex++;
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
}
|
}
|
||||||
else if(fileList[selectedItem+1]->IsVisible())
|
else if(fileList[selectedItem+1]->IsVisible())
|
||||||
@ -351,10 +357,10 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else if(t->Up())
|
else if(t->Up())
|
||||||
{
|
{
|
||||||
if(selectedItem == 0 && browser.pageIndex + selectedItem > 0)
|
if(selectedItem == 0 && browser->pageIndex + selectedItem > 0)
|
||||||
{
|
{
|
||||||
// move list up by 1
|
// move list up by 1
|
||||||
browser.pageIndex--;
|
browser->pageIndex--;
|
||||||
listChanged = true;
|
listChanged = true;
|
||||||
}
|
}
|
||||||
else if(selectedItem > 0)
|
else if(selectedItem > 0)
|
||||||
@ -370,17 +376,21 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
{
|
{
|
||||||
if(listChanged)
|
if(listChanged)
|
||||||
{
|
{
|
||||||
if(browser.pageIndex+i < browser.numEntries)
|
bool haveselected = false;
|
||||||
|
if(browser->pageIndex+i < (int)browser->browserList.size())
|
||||||
{
|
{
|
||||||
if(fileList[i]->GetState() == STATE_DISABLED)
|
if(fileList[i]->GetState() == STATE_DISABLED)
|
||||||
fileList[i]->SetState(STATE_DEFAULT);
|
fileList[i]->SetState(STATE_DEFAULT);
|
||||||
|
|
||||||
|
if(fileList[i]->GetState() == STATE_SELECTED)
|
||||||
|
haveselected = true;
|
||||||
|
|
||||||
fileList[i]->SetVisible(true);
|
fileList[i]->SetVisible(true);
|
||||||
|
|
||||||
fileListText[i]->SetText(browserList[browser.pageIndex+i].displayname);
|
fileListText[i]->SetText(browser->browserList[browser->pageIndex+i].displayname);
|
||||||
fileListTextOver[i]->SetText(browserList[browser.pageIndex+i].displayname);
|
fileListTextOver[i]->SetText(browser->browserList[browser->pageIndex+i].displayname);
|
||||||
|
|
||||||
if(browserList[browser.pageIndex+i].isdir) // directory
|
if(browser->browserList[browser->pageIndex+i].isdir) // directory
|
||||||
{
|
{
|
||||||
fileList[i]->SetIcon(fileListFolder[i]);
|
fileList[i]->SetIcon(fileListFolder[i]);
|
||||||
fileListText[i]->SetPosition(30,0);
|
fileListText[i]->SetPosition(30,0);
|
||||||
@ -427,6 +437,9 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
fileList[i]->SetVisible(false);
|
fileList[i]->SetVisible(false);
|
||||||
fileList[i]->SetState(STATE_DISABLED);
|
fileList[i]->SetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
|
if(!haveselected && browser->pageIndex < (int)browser->browserList.size())
|
||||||
|
fileList[i]->SetState(STATE_SELECTED, t->chan);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i != selectedItem && fileList[i]->GetState() == STATE_SELECTED)
|
if(i != selectedItem && fileList[i]->GetState() == STATE_SELECTED)
|
||||||
@ -445,7 +458,6 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
if(fileList[i]->GetState() == STATE_SELECTED)
|
if(fileList[i]->GetState() == STATE_SELECTED)
|
||||||
{
|
{
|
||||||
selectedItem = i;
|
selectedItem = i;
|
||||||
browser.selIndex = browser.pageIndex + i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,11 +468,11 @@ void GuiFileBrowser::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
position = 136*(browser.pageIndex + FILEBROWSERSIZE/2.0) / (browser.numEntries*1.0);
|
position = 136*(browser->pageIndex + FILEBROWSERSIZE/2.0) / (browser->browserList.size()*1.0);
|
||||||
|
|
||||||
if(browser.pageIndex/(FILEBROWSERSIZE/2.0) < 1)
|
if(browser->pageIndex/(FILEBROWSERSIZE/2.0) < 1)
|
||||||
position = -10;
|
position = -10;
|
||||||
else if((browser.pageIndex+FILEBROWSERSIZE)/(FILEBROWSERSIZE*1.0) >= (browser.numEntries)/(FILEBROWSERSIZE*1.0))
|
else if((browser->pageIndex+FILEBROWSERSIZE)/(FILEBROWSERSIZE*1.0) >= (browser->browserList.size())/(FILEBROWSERSIZE*1.0))
|
||||||
position = 156;
|
position = 156;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,10 +344,7 @@ void GuiGameCarousel::Update(GuiTrigger * t)
|
|||||||
else
|
else
|
||||||
gamename->SetText((char*)NULL);
|
gamename->SetText((char*)NULL);
|
||||||
if(selectedItem_old>=0)
|
if(selectedItem_old>=0)
|
||||||
{
|
|
||||||
game[selectedItem_old]->SetEffect(EFFECT_SCALE, -1, 100);
|
game[selectedItem_old]->SetEffect(EFFECT_SCALE, -1, 100);
|
||||||
game[selectedItem_old]->RemoveToolTip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// navigation
|
// navigation
|
||||||
if(focus && gameCnt>6)
|
if(focus && gameCnt>6)
|
||||||
|
@ -32,10 +32,10 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
|||||||
focus = 0; // allow focus
|
focus = 0; // allow focus
|
||||||
alignmentHor = ALIGN_CENTRE;
|
alignmentHor = ALIGN_CENTRE;
|
||||||
alignmentVert = ALIGN_MIDDLE;
|
alignmentVert = ALIGN_MIDDLE;
|
||||||
strncpy(kbtextstr, t, max); // do not change from strncpy to strlcpy, it needs to be padded with 0
|
kbtextmaxlen = max>sizeof(kbtextstr) ? sizeof(kbtextstr) : max; // limit max up to sizeof(kbtextstr)
|
||||||
kbtextstr[max] = 0;
|
// strlcpy(kbtextstr, t, kbtextmaxlen);
|
||||||
kbtextmaxlen = max;
|
strncpy(kbtextstr, t, kbtextmaxlen); // strncpy is needed to fill the rest with \0
|
||||||
|
kbtextstr[sizeof(kbtextstr)-1] = 0; // terminate with \0
|
||||||
//QWERTY//
|
//QWERTY//
|
||||||
if (mode == 0){
|
if (mode == 0){
|
||||||
Key thekeys[4][11] = {
|
Key thekeys[4][11] = {
|
||||||
@ -471,6 +471,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
|||||||
//keySpace->SetEffectGrow();
|
//keySpace->SetEffectGrow();
|
||||||
this->Append(keySpace);
|
this->Append(keySpace);
|
||||||
|
|
||||||
|
char txt[2] = { 0, 0 };
|
||||||
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
for(int j=0; j<11; j++)
|
for(int j=0; j<11; j++)
|
||||||
@ -479,7 +480,8 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max, int min, int lang)
|
|||||||
{
|
{
|
||||||
keyImg[i][j] = new GuiImage(key);
|
keyImg[i][j] = new GuiImage(key);
|
||||||
keyImgOver[i][j] = new GuiImage(keyOver);
|
keyImgOver[i][j] = new GuiImage(keyOver);
|
||||||
keyTxt[i][j] = new GuiText(NULL, 20, (GXColor){0, 0, 0, 0xff});
|
txt[0] = keys[i][j].ch;
|
||||||
|
keyTxt[i][j] = new GuiText(txt, 20, (GXColor){0, 0, 0, 0xff});
|
||||||
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||||
keyTxt[i][j]->SetPosition(0, -10);
|
keyTxt[i][j]->SetPosition(0, -10);
|
||||||
keyBtn[i][j] = new GuiButton(keyImg[i][j], keyImgOver[i][j], 0, 3, (j*42+21*i+40)+eurocheck, i*42+120, trigA, keySoundOver, keySoundClick,1);
|
keyBtn[i][j] = new GuiButton(keyImg[i][j], keyImgOver[i][j], 0, 3, (j*42+21*i+40)+eurocheck, i*42+120, trigA, keySoundOver, keySoundClick,1);
|
||||||
@ -563,11 +565,11 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
catch (const std::exception& e) { }
|
catch (const std::exception& e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
bool update = false;
|
bool changedShiftKey = false;
|
||||||
|
|
||||||
if(keySpace->GetState() == STATE_CLICKED)
|
if(keySpace->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
if(strlen(kbtextstr) < kbtextmaxlen)
|
if(strlen(kbtextstr) < kbtextmaxlen-1) // -1 --> kbtextmaxlen means with terminating '\0'
|
||||||
{
|
{
|
||||||
kbtextstr[strlen(kbtextstr)] = ' ';
|
kbtextstr[strlen(kbtextstr)] = ' ';
|
||||||
kbText->SetText(kbtextstr);
|
kbText->SetText(kbtextstr);
|
||||||
@ -578,19 +580,21 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
{
|
{
|
||||||
if (strlen(kbtextstr) >(m)){
|
if (strlen(kbtextstr) >(m)){
|
||||||
kbtextstr[strlen(kbtextstr)-1] = 0;
|
kbtextstr[strlen(kbtextstr)-1] = 0;
|
||||||
kbText->SetText(kbtextstr);}
|
kbText->SetText(kbtextstr);
|
||||||
|
}
|
||||||
keyBack->SetState(STATE_SELECTED, t->chan);
|
keyBack->SetState(STATE_SELECTED, t->chan);
|
||||||
}
|
}
|
||||||
else if(keyClear->GetState() == STATE_CLICKED)
|
else if(keyClear->GetState() == STATE_CLICKED)
|
||||||
{ clearMore:
|
{
|
||||||
if (strlen(kbtextstr) >(m)){
|
while (strlen(kbtextstr) >(m)){
|
||||||
kbtextstr[strlen(kbtextstr)-1] = 0;
|
kbtextstr[strlen(kbtextstr)-1] = 0;
|
||||||
kbText->SetText(kbtextstr);
|
kbText->SetText(kbtextstr);
|
||||||
goto clearMore;}
|
}
|
||||||
keyClear->SetState(STATE_SELECTED, t->chan);
|
keyClear->SetState(STATE_SELECTED, t->chan);
|
||||||
}
|
}
|
||||||
else if(keyShift->GetState() == STATE_CLICKED)
|
else if(keyShift->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
|
changedShiftKey =true;
|
||||||
shift ^= 1;
|
shift ^= 1;
|
||||||
if(alt) alt ^= 1;
|
if(alt) alt ^= 1;
|
||||||
if(alt2) alt2 ^= 1;
|
if(alt2) alt2 ^= 1;
|
||||||
@ -598,6 +602,7 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else if(keyAlt->GetState() == STATE_CLICKED)
|
else if(keyAlt->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
|
changedShiftKey =true;
|
||||||
alt ^= 1;
|
alt ^= 1;
|
||||||
if(shift) shift ^= 1;
|
if(shift) shift ^= 1;
|
||||||
if(alt2) alt2 ^= 1;
|
if(alt2) alt2 ^= 1;
|
||||||
@ -605,6 +610,7 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else if(keyAlt2->GetState() == STATE_CLICKED)
|
else if(keyAlt2->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
|
changedShiftKey =true;
|
||||||
alt2 ^= 1;
|
alt2 ^= 1;
|
||||||
if(shift) shift ^= 1;
|
if(shift) shift ^= 1;
|
||||||
if(alt) alt ^= 1;
|
if(alt) alt ^= 1;
|
||||||
@ -612,14 +618,19 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else if(keyCaps->GetState() == STATE_CLICKED)
|
else if(keyCaps->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
|
changedShiftKey =true;
|
||||||
caps ^= 1;
|
caps ^= 1;
|
||||||
keyCaps->SetState(STATE_SELECTED, t->chan);
|
keyCaps->SetState(STATE_SELECTED, t->chan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool update = false;
|
||||||
|
|
||||||
char txt[2] = { 0, 0 };
|
char txt[2] = { 0, 0 };
|
||||||
|
|
||||||
startloop:
|
do
|
||||||
|
{
|
||||||
|
update = false;
|
||||||
for(int i=0; i<4; i++)
|
for(int i=0; i<4; i++)
|
||||||
{
|
{
|
||||||
for(int j=0; j<11; j++)
|
for(int j=0; j<11; j++)
|
||||||
@ -635,45 +646,31 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
|||||||
else
|
else
|
||||||
txt[0] = keys[i][j].ch;
|
txt[0] = keys[i][j].ch;
|
||||||
|
|
||||||
|
if(changedShiftKey) // change text only if needed
|
||||||
keyTxt[i][j]->SetText(txt);
|
keyTxt[i][j]->SetText(txt);
|
||||||
|
|
||||||
if(keyBtn[i][j]->GetState() == STATE_CLICKED)
|
if(keyBtn[i][j]->GetState() == STATE_CLICKED)
|
||||||
{
|
{
|
||||||
if(strlen(kbtextstr) < kbtextmaxlen)
|
if(strlen(kbtextstr) < kbtextmaxlen-1) // -1 --> kbtextmaxlen means with term. '\0'
|
||||||
{
|
{
|
||||||
if(shift || caps)
|
kbtextstr[strlen(kbtextstr)] = txt[0];
|
||||||
{
|
|
||||||
kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift;
|
|
||||||
}
|
|
||||||
else if(alt)
|
|
||||||
{
|
|
||||||
kbtextstr[strlen(kbtextstr)] = keys[i][j].chalt;
|
|
||||||
}
|
|
||||||
else if(alt2)
|
|
||||||
{
|
|
||||||
kbtextstr[strlen(kbtextstr)] = keys[i][j].chalt2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
kbtextstr[strlen(kbtextstr)] = keys[i][j].ch;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
kbText->SetText(kbtextstr);
|
kbText->SetText(kbtextstr);
|
||||||
|
}
|
||||||
keyBtn[i][j]->SetState(STATE_SELECTED, t->chan);
|
keyBtn[i][j]->SetState(STATE_SELECTED, t->chan);
|
||||||
|
|
||||||
|
|
||||||
if(shift || alt || alt2)
|
if(shift || alt || alt2)
|
||||||
{
|
{
|
||||||
if(shift) shift ^= 1;
|
if(shift) shift ^= 1;
|
||||||
if(alt) alt ^= 1;
|
if(alt) alt ^= 1;
|
||||||
if(alt2) alt2 ^= 1;
|
if(alt2) alt2 ^= 1;
|
||||||
update = true;
|
update = true;
|
||||||
goto startloop;
|
changedShiftKey = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} while(update);
|
||||||
|
|
||||||
kbText->SetPosition(0, 53);
|
kbText->SetPosition(0, 53);
|
||||||
|
|
||||||
|
@ -31,27 +31,36 @@ bool findfile(const char * filename, const char * path) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool subfoldercreate(char * fullpath) {
|
bool subfoldercreate(const char * fullpath) {
|
||||||
//check forsubfolders
|
//check forsubfolders
|
||||||
char dircheck[300];
|
char dir[300];
|
||||||
char dirnoslash[300];
|
|
||||||
char * pch = NULL;
|
char * pch = NULL;
|
||||||
u32 cnt = 0;
|
u32 len;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
snprintf(dirnoslash, strlen(fullpath), "%s", fullpath);
|
strlcpy(dir, fullpath, sizeof(dir));
|
||||||
|
len = strlen(dir);
|
||||||
if (stat(fullpath, &st) != 0) {
|
if(len && len< sizeof(dir)-2 && dir[len-1] != '/');
|
||||||
pch = strrchr(dirnoslash, '/');
|
{
|
||||||
cnt = pch-dirnoslash;
|
dir[len++] = '/';
|
||||||
snprintf(dircheck, cnt+2, "%s", dirnoslash);
|
dir[len] = '\0';
|
||||||
subfoldercreate(dircheck);
|
}
|
||||||
};
|
if (stat(dir, &st) != 0) // fullpath not exist?
|
||||||
|
{
|
||||||
if (mkdir(dirnoslash, 0777) == -1) {
|
while(len && dir[len-1] == '/')
|
||||||
|
dir[--len] = '\0'; // remove all trailing /
|
||||||
|
pch = strrchr(dir, '/');
|
||||||
|
if(pch == NULL) return false;
|
||||||
|
*pch = '\0';
|
||||||
|
if(subfoldercreate(dir))
|
||||||
|
{
|
||||||
|
*pch = '/';
|
||||||
|
if (mkdir(dir, 0777) == -1)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ extern "C" {
|
|||||||
bool findfile(const char * filename, const char * path);
|
bool findfile(const char * filename, const char * path);
|
||||||
char * GetFileName(int i);
|
char * GetFileName(int i);
|
||||||
int GetAllDirFiles(char * filespath);
|
int GetAllDirFiles(char * filespath);
|
||||||
bool subfoldercreate(char * fullpath);
|
bool subfoldercreate(const char * fullpath);
|
||||||
bool checkfile(char * path);
|
bool checkfile(char * path);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -15,9 +15,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
|
#include <sys/iosupport.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "filebrowser.h"
|
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
#include "listfiles.h"
|
#include "listfiles.h"
|
||||||
@ -25,6 +26,7 @@
|
|||||||
#include "PromptWindows.h"
|
#include "PromptWindows.h"
|
||||||
#include "libwiigui/gui.h"
|
#include "libwiigui/gui.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
#include "filebrowser.h"
|
||||||
|
|
||||||
/*** Extern variables ***/
|
/*** Extern variables ***/
|
||||||
extern GuiWindow * mainWindow;
|
extern GuiWindow * mainWindow;
|
||||||
@ -35,157 +37,222 @@ extern u8 reset;
|
|||||||
extern void ResumeGui();
|
extern void ResumeGui();
|
||||||
extern void HaltGui();
|
extern void HaltGui();
|
||||||
|
|
||||||
BROWSERINFO browser;
|
static int curDevice = -1;
|
||||||
BROWSERENTRY * browserList = NULL; // list of files/folders in browser
|
static std::vector<BROWSERINFO> browsers;
|
||||||
|
BROWSERINFO *browser = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* FileFilterCallbacks
|
||||||
|
* return: 1-visible 0-hidden
|
||||||
|
***************************************************************************/
|
||||||
|
int noDIRS(BROWSERENTRY *Entry, void* Args)
|
||||||
|
{
|
||||||
|
return !Entry->isdir;
|
||||||
|
}
|
||||||
|
int noFILES(BROWSERENTRY *Entry, void* Args)
|
||||||
|
{
|
||||||
|
return Entry->isdir;
|
||||||
|
}
|
||||||
|
int noEXT(BROWSERENTRY *Entry, void* Args)
|
||||||
|
{
|
||||||
|
if(!Entry->isdir)
|
||||||
|
{
|
||||||
|
char *cptr = strrchr(Entry->displayname, '.');
|
||||||
|
if(cptr && cptr!= Entry->displayname) *cptr = 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResetBrowser(BROWSERINFO *browser);
|
||||||
|
/****************************************************************************
|
||||||
|
* InitBrowsers()
|
||||||
|
* Clears the file browser memory, and allocates one initial entry
|
||||||
|
***************************************************************************/
|
||||||
|
int InitBrowsers() {
|
||||||
|
curDevice = -1;
|
||||||
|
browsers.clear();
|
||||||
|
browser = NULL;
|
||||||
|
char rootdir[ROOTDIRLEN];
|
||||||
|
for(int i=3; i<STD_MAX; i++)
|
||||||
|
{
|
||||||
|
if(strcmp(devoptab_list[i]->name, "stdnull"))
|
||||||
|
{
|
||||||
|
snprintf(rootdir, sizeof(rootdir) , "%s:/", devoptab_list[i]->name);
|
||||||
|
if(DIR_ITER *dir = diropen(rootdir))
|
||||||
|
{
|
||||||
|
dirclose(dir);
|
||||||
|
BROWSERINFO browser;
|
||||||
|
browser.dir[0] = '\0';
|
||||||
|
strcpy(browser.rootdir, rootdir);
|
||||||
|
ResetBrowser(&browser);
|
||||||
|
browsers.push_back(browser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!browsers.size()) return -1;
|
||||||
|
curDevice = 0;
|
||||||
|
browser = &browsers[curDevice];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ResetBrowser()
|
* ResetBrowser()
|
||||||
* Clears the file browser memory, and allocates one initial entry
|
* Clears the file browser memory, and allocates one initial entry
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ResetBrowser() {
|
void ResetBrowser(BROWSERINFO *browser) {
|
||||||
browser.numEntries = 0;
|
browser->pageIndex = 0;
|
||||||
browser.selIndex = 0;
|
browser->browserList.clear();
|
||||||
browser.pageIndex = 0;
|
/*
|
||||||
|
|
||||||
// Clear any existing values
|
// Clear any existing values
|
||||||
if (browserList != NULL) {
|
if (browser->browserList != NULL) {
|
||||||
free(browserList);
|
free(browser->browserList);
|
||||||
browserList = NULL;
|
browser->browserList = NULL;
|
||||||
}
|
}
|
||||||
// set aside space for 1 entry
|
// set aside space for 1 entry
|
||||||
browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
|
browser->browserList = (BROWSERENTRY *)malloc(sizeof(BROWSERENTRY));
|
||||||
memset(browserList, 0, sizeof(BROWSERENTRY));
|
if(browser->browserList)
|
||||||
}
|
memset(browser->browserList, 0, sizeof(BROWSERENTRY));
|
||||||
|
*/
|
||||||
/****************************************************************************
|
|
||||||
* UpdateDirName()
|
|
||||||
* Update curent directory name for file browser
|
|
||||||
***************************************************************************/
|
|
||||||
int UpdateDirName() {
|
|
||||||
int size=0;
|
|
||||||
char * test;
|
|
||||||
char temp[1024];
|
|
||||||
|
|
||||||
/* current directory doesn't change */
|
|
||||||
if (strcmp(browserList[browser.selIndex].filename,".") == 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/* go up to parent directory */
|
|
||||||
else if (strcmp(browserList[browser.selIndex].filename,"..") == 0) {
|
|
||||||
/* determine last subdirectory namelength */
|
|
||||||
sprintf(temp,"%s",browser.dir);
|
|
||||||
test = strtok(temp,"/");
|
|
||||||
while (test != NULL) {
|
|
||||||
size = strlen(test);
|
|
||||||
test = strtok(NULL,"/");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* remove last subdirectory name */
|
|
||||||
size = strlen(browser.dir) - size - 1;
|
|
||||||
browser.dir[size] = 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* Open a directory */
|
|
||||||
else {
|
|
||||||
/* test new directory namelength */
|
|
||||||
if ((strlen(browser.dir)+1+strlen(browserList[browser.selIndex].filename)) < MAXPATHLEN) {
|
|
||||||
/* update current directory name */
|
|
||||||
sprintf(browser.dir, "%s/%s",browser.dir, browserList[browser.selIndex].filename);
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* FileSortCallback
|
* FileSortCallback
|
||||||
*
|
*
|
||||||
* Quick sort callback to sort file entries with the following order:
|
* sort callback to sort file entries with the following order:
|
||||||
* .
|
* .
|
||||||
* ..
|
* ..
|
||||||
* <dirs>
|
* <dirs>
|
||||||
* <files>
|
* <files>
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int FileSortCallback(const void *f1, const void *f2) {
|
//int FileSortCallback(const void *f1, const void *f2) {
|
||||||
|
bool operator< (const BROWSERENTRY &f1, const BROWSERENTRY &f2) {
|
||||||
/* Special case for implicit directories */
|
/* Special case for implicit directories */
|
||||||
if (((BROWSERENTRY *)f1)->filename[0] == '.' || ((BROWSERENTRY *)f2)->filename[0] == '.') {
|
if (f1.filename[0] == '.' || f2.filename[0] == '.') {
|
||||||
if (strcmp(((BROWSERENTRY *)f1)->filename, ".") == 0) {
|
if (strcmp(f1.filename, ".") == 0) {
|
||||||
return -1;
|
return true;
|
||||||
}
|
}
|
||||||
if (strcmp(((BROWSERENTRY *)f2)->filename, ".") == 0) {
|
if (strcmp(f2.filename, ".") == 0) {
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
if (strcmp(((BROWSERENTRY *)f1)->filename, "..") == 0) {
|
if (strcmp(f1.filename, "..") == 0) {
|
||||||
return -1;
|
return true;
|
||||||
}
|
}
|
||||||
if (strcmp(((BROWSERENTRY *)f2)->filename, "..") == 0) {
|
if (strcmp(f2.filename, "..") == 0) {
|
||||||
return 1;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If one is a file and one is a directory the directory is first. */
|
/* If one is a file and one is a directory the directory is first. */
|
||||||
if (((BROWSERENTRY *)f1)->isdir && !(((BROWSERENTRY *)f2)->isdir)) return -1;
|
if (f1.isdir && !(f2.isdir)) return true;
|
||||||
if (!(((BROWSERENTRY *)f1)->isdir) && ((BROWSERENTRY *)f2)->isdir) return 1;
|
if (!(f1.isdir) && f2.isdir) return false;
|
||||||
|
|
||||||
return stricmp(((BROWSERENTRY *)f1)->filename, ((BROWSERENTRY *)f2)->filename);
|
return stricmp(f1.filename, f2.filename)<0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ParseFilter(FILTERCASCADE *Filter, BROWSERENTRY* Entry)
|
||||||
|
{
|
||||||
|
while(Filter)
|
||||||
|
{
|
||||||
|
if(Filter->filter && Filter->filter(Entry, Filter->filter_args) == 0)
|
||||||
|
return 0;
|
||||||
|
Filter = Filter->next;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Browse subdirectories
|
* Browse subdirectories
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
int
|
int ParseDirectory(const char* Path, int Flags, FILTERCASCADE *Filter) {
|
||||||
ParseDirectory() {
|
|
||||||
DIR_ITER *dir = NULL;
|
DIR_ITER *dir = NULL;
|
||||||
char fulldir[MAXPATHLEN];
|
char fulldir[MAXPATHLEN];
|
||||||
char filename[MAXPATHLEN];
|
char filename[MAXPATHLEN];
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
// reset browser
|
if(curDevice == -1)
|
||||||
ResetBrowser();
|
if(InitBrowsers()) return -1; // InitBrowser fails
|
||||||
|
|
||||||
// open the directory
|
if(Path) // note in this codeblock use filename temporary
|
||||||
sprintf(fulldir, "%s%s", browser.rootdir, browser.dir); // add currentDevice to path
|
{
|
||||||
dir = diropen(fulldir);
|
strlcpy(fulldir, Path, sizeof(fulldir));
|
||||||
|
if(*fulldir && fulldir[strlen(fulldir)-1] != '/') // a file
|
||||||
// if we can't open the dir, try opening the root dir
|
{
|
||||||
if (dir == NULL) {
|
char * chrp = strrchr(fulldir, '/');
|
||||||
sprintf(browser.dir,"/");
|
if(chrp) chrp[1] = 0;
|
||||||
dir = diropen(browser.rootdir);
|
}
|
||||||
if (dir == NULL) {
|
if(strchr(fulldir, ':') == NULL) // Path has no device device
|
||||||
|
{
|
||||||
|
getcwd(filename, sizeof(filename)); // save the current working dir
|
||||||
|
if(*fulldir==0) // if path is empty
|
||||||
|
strlcpy(fulldir, filename, sizeof(fulldir)); // we use the current working dir
|
||||||
|
else
|
||||||
|
{ // path is not empty
|
||||||
|
if(chdir(fulldir)); // sets the path to concatenate and validate
|
||||||
|
{
|
||||||
|
if(Flags & (FB_TRYROOTDIR | FB_TRYSTDDEV))
|
||||||
|
if(chdir("/") && !(Flags & FB_TRYSTDDEV))// try to set root if is needed
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if(getcwd(fulldir, sizeof(fulldir))) return -1; // gets the concatenated current working dir
|
||||||
|
chdir(filename); // restore the saved cwd
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// index files/folders
|
for(i=0; i<browsers.size(); i++) // searchs the browser who match the path
|
||||||
int entryNum = 0;
|
{
|
||||||
|
if(strnicmp(fulldir, browsers[i].rootdir, strlen(browsers[i].rootdir)-1 /*means without trailing '/'*/) == 0)
|
||||||
while (dirnext(dir,filename,&filestat) == 0) {
|
{
|
||||||
if (strcmp(filename,".") != 0) {
|
browser = &browsers[curDevice];
|
||||||
BROWSERENTRY * newBrowserList = (BROWSERENTRY *)realloc(browserList, (entryNum+1) * sizeof(BROWSERENTRY));
|
|
||||||
|
|
||||||
if (!newBrowserList) { // failed to allocate required memory
|
|
||||||
ResetBrowser();
|
|
||||||
entryNum = -1;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
browserList = newBrowserList;
|
|
||||||
}
|
}
|
||||||
memset(&(browserList[entryNum]), 0, sizeof(BROWSERENTRY)); // clear the new entry
|
}
|
||||||
|
if(i != browsers.size()) // found browser
|
||||||
|
{
|
||||||
|
curDevice = i;
|
||||||
|
browser = &browsers[curDevice];
|
||||||
|
strcpy(browser->dir, &fulldir[strlen(browser->rootdir)]);
|
||||||
|
}
|
||||||
|
else if(Flags & FB_TRYSTDDEV)
|
||||||
|
{
|
||||||
|
curDevice = 0;
|
||||||
|
browser = &browsers[curDevice]; // when no browser was found and
|
||||||
|
browser->dir[0] = 0; // we alowed try StdDevice and try RootDir
|
||||||
|
strlcpy(fulldir, browser->rootdir, sizeof(fulldir)); // set the first browser with root-dir
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
snprintf(fulldir, sizeof(fulldir), "%s%s", browser->rootdir, browser->dir);
|
||||||
|
|
||||||
strncpy(browserList[entryNum].filename, filename, MAXJOLIET);
|
// reset browser
|
||||||
|
ResetBrowser(browser);
|
||||||
|
|
||||||
if (strcmp(filename,"..") == 0) {
|
// open the directory
|
||||||
sprintf(browserList[entryNum].displayname, "..");
|
if((dir = diropen(fulldir)) == NULL)
|
||||||
} else {
|
{
|
||||||
strcpy(browserList[entryNum].displayname, filename); // crop name for display
|
if(Flags & FB_TRYROOTDIR)
|
||||||
|
{
|
||||||
|
browser->dir[0] = 0;
|
||||||
|
if((dir = diropen(browser->rootdir)) == NULL)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
browserList[entryNum].length = filestat.st_size;
|
while (dirnext(dir,filename,&filestat) == 0)
|
||||||
browserList[entryNum].isdir = (filestat.st_mode & _IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
{
|
||||||
|
if (strcmp(filename,".") != 0)
|
||||||
entryNum++;
|
{
|
||||||
|
BROWSERENTRY newEntry;
|
||||||
|
memset(&newEntry, 0, sizeof(BROWSERENTRY)); // clear the new entry
|
||||||
|
strlcpy(newEntry.filename, filename, sizeof(newEntry.filename));
|
||||||
|
strlcpy(newEntry.displayname, filename, sizeof(newEntry.displayname));
|
||||||
|
newEntry.length = filestat.st_size;
|
||||||
|
newEntry.isdir = (filestat.st_mode & S_IFDIR) == 0 ? 0 : 1; // flag this as a dir
|
||||||
|
if(ParseFilter(Filter, &newEntry))
|
||||||
|
browser->browserList.push_back(newEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,76 +260,38 @@ ParseDirectory() {
|
|||||||
dirclose(dir);
|
dirclose(dir);
|
||||||
|
|
||||||
// Sort the file list
|
// Sort the file list
|
||||||
qsort(browserList, entryNum, sizeof(BROWSERENTRY), FileSortCallback);
|
std::sort(browser->browserList.begin(), browser->browserList.end());
|
||||||
|
return 0;
|
||||||
browser.numEntries = entryNum;
|
}
|
||||||
return entryNum;
|
int ParseDirectory(int Device, int Flags, FILTERCASCADE *Filter)
|
||||||
|
{
|
||||||
|
if(Device >=0 && Device < (int)browsers.size())
|
||||||
|
{
|
||||||
|
int old_curDevice = curDevice;
|
||||||
|
curDevice = Device;
|
||||||
|
browser = &browsers[curDevice];
|
||||||
|
if(ParseDirectory((char*)NULL, Flags, Filter) == 0) return 0;
|
||||||
|
curDevice = old_curDevice;
|
||||||
|
browser = &browsers[old_curDevice];
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* BrowserChangeFolder
|
|
||||||
*
|
|
||||||
* Update current directory and set new entry list if directory has changed
|
|
||||||
***************************************************************************/
|
|
||||||
int BrowserChangeFolder() {
|
|
||||||
if (!UpdateDirName())
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ParseDirectory();
|
|
||||||
|
|
||||||
return browser.numEntries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* BrowseDevice
|
* BrowseDevice
|
||||||
* Displays a list of files on the selected device
|
* Displays a list of files on the selected path
|
||||||
***************************************************************************/
|
|
||||||
int BrowseDevice(int device) {
|
|
||||||
sprintf(browser.dir, "/");
|
|
||||||
switch (device) {
|
|
||||||
case SD:
|
|
||||||
sprintf(browser.rootdir, "SD:");
|
|
||||||
break;
|
|
||||||
case USB:
|
|
||||||
sprintf(browser.rootdir, "USB:");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ParseDirectory(); // Parse root directory
|
|
||||||
return browser.numEntries;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* MenuBrowseDevice
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
int BrowseDevice(char * var, int force) {
|
int BrowseDevice(char * Path, int Path_size, int Flags, FILTERCASCADE *Filter/*=NULL*/)
|
||||||
|
{
|
||||||
int result=-1;
|
int result=-1;
|
||||||
int i;
|
int i;
|
||||||
char currentdir[90];
|
|
||||||
int curDivice = -1;
|
|
||||||
int forced =force;
|
|
||||||
|
|
||||||
if (forced>-1) {
|
if(InitBrowsers() || ParseDirectory(Path, Flags, Filter))
|
||||||
if (BrowseDevice(forced) > 0) {
|
{
|
||||||
curDivice = forced;
|
WindowPrompt(tr("Error"),0,tr("Ok"));
|
||||||
goto main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ((!strcasecmp(bootDevice, "USB:"))&&(BrowseDevice(USB) > 0)) {
|
|
||||||
curDivice = USB;
|
|
||||||
goto main;
|
|
||||||
} else if ((!strcasecmp(bootDevice, "SD:"))&&(BrowseDevice(SD) > 0)) {
|
|
||||||
curDivice = SD;
|
|
||||||
goto main;
|
|
||||||
} else {
|
|
||||||
WindowPrompt(tr("Error"),0,tr("OK"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
main:
|
|
||||||
int menu = MENU_NONE;
|
int menu = MENU_NONE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -305,7 +334,7 @@ main:
|
|||||||
ExitBtn.SetTrigger(&trigB);
|
ExitBtn.SetTrigger(&trigB);
|
||||||
ExitBtn.SetEffectGrow();
|
ExitBtn.SetEffectGrow();
|
||||||
|
|
||||||
GuiText usbBtnTxt((curDivice==SD?"USB":"SD"), 24, (GXColor) {0, 0, 0, 255});
|
GuiText usbBtnTxt(browsers[(curDevice+1)%browsers.size()].rootdir, 24, (GXColor) {0, 0, 0, 255});
|
||||||
GuiImage usbBtnImg(&btnOutline);
|
GuiImage usbBtnImg(&btnOutline);
|
||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
usbBtnTxt.SetWidescreen(CFG.widescreen);
|
||||||
@ -319,7 +348,7 @@ main:
|
|||||||
usbBtn.SetTrigger(&trigA);
|
usbBtn.SetTrigger(&trigA);
|
||||||
usbBtn.SetEffectGrow();
|
usbBtn.SetEffectGrow();
|
||||||
|
|
||||||
GuiText okBtnTxt(tr("OK"), 22, THEME.prompttext);
|
GuiText okBtnTxt(tr("Ok"), 22, THEME.prompttext);
|
||||||
GuiImage okBtnImg(&btnOutline);
|
GuiImage okBtnImg(&btnOutline);
|
||||||
if (Settings.wsprompt == yes) {
|
if (Settings.wsprompt == yes) {
|
||||||
okBtnTxt.SetWidescreen(CFG.widescreen);
|
okBtnTxt.SetWidescreen(CFG.widescreen);
|
||||||
@ -333,8 +362,8 @@ main:
|
|||||||
fileBrowser.SetPosition(0, 120);
|
fileBrowser.SetPosition(0, 120);
|
||||||
|
|
||||||
GuiImageData Address(addressbar_textbox_png);
|
GuiImageData Address(addressbar_textbox_png);
|
||||||
snprintf(currentdir, sizeof(currentdir), "%s%s", browser.rootdir, browser.dir);
|
GuiText AdressText(NULL, 20, (GXColor) { 0, 0, 0, 255});
|
||||||
GuiText AdressText(currentdir, 20, (GXColor) { 0, 0, 0, 255});
|
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
||||||
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
AdressText.SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
AdressText.SetPosition(20, 0);
|
AdressText.SetPosition(20, 0);
|
||||||
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
|
AdressText.SetMaxWidth(Address.GetWidth()-40, GuiText::SCROLL);
|
||||||
@ -345,10 +374,6 @@ main:
|
|||||||
Adressbar.SetImage(&AdressbarImg);
|
Adressbar.SetImage(&AdressbarImg);
|
||||||
Adressbar.SetLabel(&AdressText);
|
Adressbar.SetLabel(&AdressText);
|
||||||
|
|
||||||
//save var in case they cancel and return it to them
|
|
||||||
snprintf(currentdir, sizeof(currentdir), "%s", var);
|
|
||||||
sprintf(var,"%s", browser.rootdir);
|
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
GuiWindow w(screenwidth, screenheight);
|
GuiWindow w(screenwidth, screenheight);
|
||||||
w.Append(&ExitBtn);
|
w.Append(&ExitBtn);
|
||||||
@ -356,11 +381,13 @@ main:
|
|||||||
w.Append(&fileBrowser);
|
w.Append(&fileBrowser);
|
||||||
w.Append(&Adressbar);
|
w.Append(&Adressbar);
|
||||||
w.Append(&okBtn);
|
w.Append(&okBtn);
|
||||||
|
if(!(Flags & FB_NOFOLDER_BTN))
|
||||||
w.Append(&folderBtn);
|
w.Append(&folderBtn);
|
||||||
|
if(browsers.size()>1 && !(Flags & FB_NODEVICE_BTN))
|
||||||
w.Append(&usbBtn);
|
w.Append(&usbBtn);
|
||||||
mainWindow->Append(&w);
|
mainWindow->Append(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
int clickedIndex = -1;
|
||||||
while (menu == MENU_NONE) {
|
while (menu == MENU_NONE) {
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
|
||||||
@ -370,77 +397,120 @@ main:
|
|||||||
if (reset == 1)
|
if (reset == 1)
|
||||||
Sys_Reboot();
|
Sys_Reboot();
|
||||||
|
|
||||||
for (i=0; i<PAGESIZE; i++) {
|
for (i=0; i<FILEBROWSERSIZE; i++) {
|
||||||
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
if (fileBrowser.fileList[i]->GetState() == STATE_CLICKED) {
|
||||||
fileBrowser.fileList[i]->ResetState();
|
fileBrowser.fileList[i]->ResetState();
|
||||||
|
|
||||||
|
clickedIndex = browser->pageIndex + i;
|
||||||
|
bool pathCanged = false;
|
||||||
// check corresponding browser entry
|
// check corresponding browser entry
|
||||||
if (browserList[browser.selIndex].isdir) {
|
if (browser->browserList[clickedIndex].isdir)
|
||||||
if (BrowserChangeFolder()) {
|
{
|
||||||
|
/* go up to parent directory */
|
||||||
|
if (strcmp(browser->browserList[clickedIndex].filename,"..") == 0)
|
||||||
|
{
|
||||||
|
/* remove last subdirectory name */
|
||||||
|
int len = strlen(browser->dir);
|
||||||
|
while(browser->dir[0] && browser->dir[len-1] == '/')
|
||||||
|
browser->dir[--len] = '\0'; // remove all trailing '/'
|
||||||
|
char *cptr = strrchr(browser->dir, '/');
|
||||||
|
if(cptr) *++cptr = 0; else browser->dir[0] = '\0'; // remove trailing dir
|
||||||
|
pathCanged = true;
|
||||||
|
}
|
||||||
|
/* Open a directory */
|
||||||
|
/* current directory doesn't change */
|
||||||
|
else if (strcmp(browser->browserList[clickedIndex].filename,"."))
|
||||||
|
{
|
||||||
|
/* test new directory namelength */
|
||||||
|
if ((strlen(browser->dir) + strlen(browser->browserList[clickedIndex].filename)
|
||||||
|
+ 1/*'/'*/) < MAXPATHLEN)
|
||||||
|
{
|
||||||
|
/* update current directory name */
|
||||||
|
sprintf(browser->dir, "%s%s/",browser->dir,
|
||||||
|
browser->browserList[clickedIndex].filename);
|
||||||
|
pathCanged = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pathCanged)
|
||||||
|
{
|
||||||
|
LOCK(&fileBrowser);
|
||||||
|
ParseDirectory((char*)NULL, Flags, Filter);
|
||||||
fileBrowser.ResetState();
|
fileBrowser.ResetState();
|
||||||
fileBrowser.fileList[0]->SetState(STATE_SELECTED);
|
|
||||||
fileBrowser.TriggerUpdate();
|
fileBrowser.TriggerUpdate();
|
||||||
sprintf(var,"%s", browser.rootdir);
|
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
||||||
int len=strlen(browser.rootdir);
|
|
||||||
for (unsigned int i=len;i<strlen(browser.rootdir)+strlen(browser.dir);i++) {
|
|
||||||
var[i]=browser.dir[i-(len-1)];
|
|
||||||
}
|
}
|
||||||
AdressText.SetTextf("%s", var);
|
clickedIndex = -1;
|
||||||
} else {
|
|
||||||
menu = MENU_DISCLIST;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
else /* isFile */
|
||||||
mainWindow->SetState(STATE_DISABLED);
|
{
|
||||||
mainWindow->SetState(STATE_DEFAULT);
|
AdressText.SetTextf("%s%s%s", browser->rootdir, browser->dir, browser->browserList[clickedIndex].filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExitBtn.GetState() == STATE_CLICKED) {
|
if (ExitBtn.GetState() == STATE_CLICKED) {
|
||||||
snprintf(var,sizeof(currentdir),"%s", currentdir);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (okBtn.GetState() == STATE_CLICKED) {
|
else if (okBtn.GetState() == STATE_CLICKED) {
|
||||||
|
if(clickedIndex>=0)
|
||||||
|
snprintf(Path, Path_size, "%s%s%s", browser->rootdir, browser->dir,browser->browserList[clickedIndex].filename);
|
||||||
|
else
|
||||||
|
snprintf(Path, Path_size, "%s%s", browser->rootdir, browser->dir);
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
} else if (usbBtn.GetState() == STATE_CLICKED) {
|
}
|
||||||
HaltGui();
|
else if (usbBtn.GetState() == STATE_CLICKED) {
|
||||||
mainWindow->Remove(&w);
|
usbBtn.ResetState();
|
||||||
ResumeGui();
|
for(u32 i=1; i<browsers.size(); i++)
|
||||||
result = BrowseDevice(var, (curDivice==SD?USB:SD));
|
{
|
||||||
|
LOCK(&fileBrowser);
|
||||||
|
if(ParseDirectory((curDevice+i) % browsers.size(), Flags, Filter)==0)
|
||||||
|
{
|
||||||
|
fileBrowser.ResetState();
|
||||||
|
fileBrowser.TriggerUpdate();
|
||||||
|
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
||||||
|
usbBtnTxt.SetText(browsers[(curDevice+1)%browsers.size()].rootdir);
|
||||||
break;
|
break;
|
||||||
} else if (folderBtn.GetState() == STATE_CLICKED) {
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (folderBtn.GetState() == STATE_CLICKED) {
|
||||||
|
folderBtn.ResetState();
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&w);
|
mainWindow->Remove(&w);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
char newfolder[100];
|
char newfolder[100];
|
||||||
char oldfolder[100];
|
char oldfolder[100];
|
||||||
sprintf(newfolder,"%s/",var);
|
snprintf(newfolder, sizeof(newfolder), "%s%s", browser->rootdir, browser->dir);
|
||||||
strcpy(oldfolder,newfolder);
|
strcpy(oldfolder,newfolder);
|
||||||
|
|
||||||
int result = OnScreenKeyboard(newfolder,100,0);
|
int result = OnScreenKeyboard(newfolder, sizeof(newfolder), strlen(browser->rootdir));
|
||||||
|
|
||||||
if ( result == 1 ) {
|
if ( result == 1 ) {
|
||||||
int len = (strlen(newfolder)-1);
|
unsigned int len = strlen(newfolder);
|
||||||
if (newfolder[len] !='/')
|
if (len>0 && len+1 < sizeof(newfolder) && newfolder[len-1] !='/')
|
||||||
strncat (newfolder, "/", 1);
|
{
|
||||||
char* pos = newfolder;
|
newfolder[len] = '/';
|
||||||
char root[6];
|
newfolder[len+1] = '\0';
|
||||||
sprintf(root,"%s/",browser.rootdir);
|
}
|
||||||
if (len > 0 && strcmp(oldfolder,newfolder)!=0 && strstr(newfolder,root) == pos && strstr(newfolder,"//") == NULL) {
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(newfolder, &st) != 0) {
|
if (stat(newfolder, &st) != 0) {
|
||||||
if (subfoldercreate(newfolder) != 1) {
|
if(WindowPrompt(tr("Directory does not exist!"),tr("The entered directory does not exist. Would you like to create it?") ,tr("OK"), tr("Cancel")) == 1)
|
||||||
|
if (subfoldercreate(newfolder) == false)
|
||||||
WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
|
WindowPrompt(tr("Error !"),tr("Can't create directory"),tr("OK"));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else {
|
if(ParseDirectory(newfolder, Flags, Filter)==0)
|
||||||
break;
|
{
|
||||||
|
fileBrowser.ResetState();
|
||||||
|
fileBrowser.TriggerUpdate();
|
||||||
|
AdressText.SetTextf("%s%s", browser->rootdir, browser->dir);
|
||||||
|
usbBtnTxt.SetText(browsers[(curDevice+1)%browsers.size()].rootdir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
HaltGui();
|
||||||
result = BrowseDevice(var, (curDivice==SD?SD:USB));
|
mainWindow->Append(&w);
|
||||||
break;
|
ResumeGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -453,3 +523,12 @@ main:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BrowseDevice(char * Path, int Path_size, int Flags, FILEFILTERCALLBACK Filter, void *FilterArgs)
|
||||||
|
{
|
||||||
|
if(Filter)
|
||||||
|
{
|
||||||
|
FILTERCASCADE filter = {Filter, FilterArgs, NULL};
|
||||||
|
return BrowseDevice(Path, Path_size, Flags, &filter);
|
||||||
|
}
|
||||||
|
return BrowseDevice(Path, Path_size, Flags);
|
||||||
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* libwiigui Template
|
* libwiigui Template
|
||||||
* Tantric 2009
|
* Tantric 2009
|
||||||
*
|
*
|
||||||
* modified by dimok
|
* modified by dimok and ardi
|
||||||
*
|
*
|
||||||
* filebrowser.h
|
* filebrowser.h
|
||||||
*
|
*
|
||||||
@ -17,21 +17,9 @@
|
|||||||
|
|
||||||
#define MAXJOLIET 255
|
#define MAXJOLIET 255
|
||||||
#define MAXDISPLAY MAXPATHLEN
|
#define MAXDISPLAY MAXPATHLEN
|
||||||
|
#define ROOTDIRLEN 10
|
||||||
|
|
||||||
|
|
||||||
enum {
|
|
||||||
SD,
|
|
||||||
USB
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char dir[MAXPATHLEN]; // directory path of browserList
|
|
||||||
char rootdir[10]; // directory path of browserList
|
|
||||||
int numEntries; // # of entries in browserList
|
|
||||||
int selIndex; // currently selected index of browserList
|
|
||||||
int pageIndex; // starting index of browserList page display
|
|
||||||
} BROWSERINFO;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 offset; // DVD offset
|
u64 offset; // DVD offset
|
||||||
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
u64 length; // file length in 64 bytes for sizes higher than 4GB
|
||||||
@ -40,15 +28,52 @@ typedef struct {
|
|||||||
char displayname[MAXDISPLAY + 1]; // name for browser display
|
char displayname[MAXDISPLAY + 1]; // name for browser display
|
||||||
} BROWSERENTRY;
|
} BROWSERENTRY;
|
||||||
|
|
||||||
extern BROWSERINFO browser;
|
typedef struct {
|
||||||
extern BROWSERENTRY * browserList;
|
char dir[MAXPATHLEN]; // directory path of browserList
|
||||||
|
char rootdir[ROOTDIRLEN];// directory path of browserList
|
||||||
|
int pageIndex; // starting index of browserList page display
|
||||||
|
std::vector<BROWSERENTRY> browserList;
|
||||||
|
} BROWSERINFO;
|
||||||
|
extern BROWSERINFO *browser;
|
||||||
|
|
||||||
int UpdateDirName();
|
|
||||||
int FileSortCallback(const void *f1, const void *f2);
|
#define FB_NOFOLDER_BTN 0x0001
|
||||||
void ResetBrowser();
|
#define FB_NODEVICE_BTN 0x0002
|
||||||
int ParseDirectory();
|
#define FB_TRYROOTDIR 0x0004
|
||||||
int BrowserChangeFolder();
|
#define FB_TRYSTDDEV 0x0008
|
||||||
int BrowseDevice(int device);
|
#define FB_DEFAULT (FB_TRYROOTDIR | FB_TRYSTDDEV)
|
||||||
int BrowseDevice(char * var, int force =-1);
|
|
||||||
|
typedef int (*FILEFILTERCALLBACK)(BROWSERENTRY *Entry, void* Args);
|
||||||
|
int noDIRS(BROWSERENTRY *Entry, void* Args);
|
||||||
|
int noFILES(BROWSERENTRY *Entry, void* Args);
|
||||||
|
int noEXT(BROWSERENTRY *Entry, void* Args);
|
||||||
|
|
||||||
|
typedef struct _FILTERCASCADE{
|
||||||
|
FILEFILTERCALLBACK filter;
|
||||||
|
void *filter_args;
|
||||||
|
_FILTERCASCADE *next;
|
||||||
|
} FILTERCASCADE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* BrowseDevice
|
||||||
|
* Displays a list of files on the selected path
|
||||||
|
* Path returns the selectet Path/File
|
||||||
|
* Path_size is the space of the Path-array
|
||||||
|
* Ret: 0 ok / -1 Error
|
||||||
|
***************************************************************************/
|
||||||
|
/***************************************************************************
|
||||||
|
* Example:
|
||||||
|
* FILTERKASKADE filter2 = {noEXT, NULL, NULL};
|
||||||
|
* FILTERKASKADE filter1 = {noDirs, NULL, &filter2};
|
||||||
|
* char Path[MAXPATHLEN] = "SD:/";
|
||||||
|
* BrowseDevice(Path, MAXPATHLEN, FB_DEFAULT, &filter1);
|
||||||
|
*
|
||||||
|
*
|
||||||
|
***************************************************************************/
|
||||||
|
int BrowseDevice(char * Path, int Path_size, int Flags/*=FB_DEFAULT*/, FILTERCASCADE *Filter=NULL) ;
|
||||||
|
int BrowseDevice(char * Path, int Path_size, int Flags, FILEFILTERCALLBACK Filter, void *FilterArgs=NULL);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1259,7 +1259,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.covers_path, sizeof(entered));
|
strlcpy(entered, Settings.covers_path, sizeof(entered));
|
||||||
titleTxt.SetText(tr("3D Cover Path"));
|
titleTxt.SetText(tr("3D Cover Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1285,7 +1285,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.covers2d_path, sizeof(entered));
|
strlcpy(entered, Settings.covers2d_path, sizeof(entered));
|
||||||
titleTxt.SetText(tr("2D Cover Path"));
|
titleTxt.SetText(tr("2D Cover Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1311,7 +1311,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.disc_path, sizeof(entered));
|
strlcpy(entered, Settings.disc_path, sizeof(entered));
|
||||||
titleTxt.SetText(tr("Disc Artwork Path"));
|
titleTxt.SetText(tr("Disc Artwork Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1337,7 +1337,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
titleTxt.SetText(tr("Theme Path"));
|
titleTxt.SetText(tr("Theme Path"));
|
||||||
strlcpy(entered, CFG.theme_path, sizeof(entered));
|
strlcpy(entered, CFG.theme_path, sizeof(entered));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
HaltGui();
|
HaltGui();
|
||||||
w.RemoveAll();
|
w.RemoveAll();
|
||||||
if ( result == 1 ) {
|
if ( result == 1 ) {
|
||||||
@ -1394,7 +1394,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
titleTxt.SetText(tr("WiiTDB Path"));
|
titleTxt.SetText(tr("WiiTDB Path"));
|
||||||
strlcpy(entered, Settings.titlestxt_path, sizeof(entered));
|
strlcpy(entered, Settings.titlestxt_path, sizeof(entered));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1425,7 +1425,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.update_path, sizeof(entered));
|
strlcpy(entered, Settings.update_path, sizeof(entered));
|
||||||
titleTxt.SetText(tr("Update Path"));
|
titleTxt.SetText(tr("Update Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1446,7 +1446,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.Cheatcodespath, sizeof(entered));
|
strlcpy(entered, Settings.Cheatcodespath, sizeof(entered));
|
||||||
titleTxt.SetText(tr("GCT Cheatcodes Path"));
|
titleTxt.SetText(tr("GCT Cheatcodes Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1467,7 +1467,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.TxtCheatcodespath, sizeof(entered));
|
strlcpy(entered, Settings.TxtCheatcodespath, sizeof(entered));
|
||||||
titleTxt.SetText(tr("TXT Cheatcodes Path"));
|
titleTxt.SetText(tr("TXT Cheatcodes Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1488,7 +1488,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.dolpath, sizeof(entered));
|
strlcpy(entered, Settings.dolpath, sizeof(entered));
|
||||||
titleTxt.SetText(tr("DOL Path"));
|
titleTxt.SetText(tr("DOL Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
@ -1514,7 +1514,7 @@ int MenuSettings() {
|
|||||||
char entered[43] = "";
|
char entered[43] = "";
|
||||||
strlcpy(entered, Settings.homebrewapps_path, sizeof(entered));
|
strlcpy(entered, Settings.homebrewapps_path, sizeof(entered));
|
||||||
titleTxt.SetText(tr("Homebrew Apps Path"));
|
titleTxt.SetText(tr("Homebrew Apps Path"));
|
||||||
int result = BrowseDevice(entered);
|
int result = BrowseDevice(entered, sizeof(entered), FB_DEFAULT, noFILES);
|
||||||
titleTxt.SetText(tr("Custom Paths"));
|
titleTxt.SetText(tr("Custom Paths"));
|
||||||
w.Append(&optionBrowser2);
|
w.Append(&optionBrowser2);
|
||||||
w.Append(&backBtn);
|
w.Append(&backBtn);
|
||||||
|
Loading…
Reference in New Issue
Block a user