small bugfixes

This commit is contained in:
dborth 2009-03-20 07:30:29 +00:00
parent 565aafb30f
commit 84aaefd004
6 changed files with 18 additions and 6 deletions

View File

@ -227,14 +227,14 @@ bool MakeFilePath(char filepath[], int type, int method, char * filename, int fi
if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB) if(method == METHOD_MC_SLOTA || method == METHOD_MC_SLOTB)
{ {
filename[26] = 0; // truncate filename filename[26] = 0; // truncate filename
sprintf(file, "%s%i.%", filename, filenum, ext); sprintf(file, "%s%i.%s", filename, filenum, ext);
} }
else else
{ {
if(filenum == 0) if(filenum == 0)
sprintf(file, "%s Auto.%", filename, ext); sprintf(file, "%s Auto.%s", filename, ext);
else else
sprintf(file, "%s %i.%", filename, filenum, ext); sprintf(file, "%s %i.%s", filename, filenum, ext);
} }
} }
else else

View File

@ -453,7 +453,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
// add device to filepath // add device to filepath
char fullpath[1024]; char fullpath[1024];
sprintf(fullpath, "%s%s", rootdir, filepath); sprintf(fullpath, "%s/%s", rootdir, filepath);
file = fopen (fullpath, "rb"); file = fopen (fullpath, "rb");
@ -551,7 +551,7 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
// add device to filepath // add device to filepath
char fullpath[1024]; char fullpath[1024];
sprintf(fullpath, "%s%s", rootdir, filepath); sprintf(fullpath, "%s/%s", rootdir, filepath);
// open file for writing // open file for writing
file = fopen (fullpath, "wb"); file = fopen (fullpath, "wb");

View File

@ -151,6 +151,7 @@ void GuiFileBrowser::SetFocus(int f)
void GuiFileBrowser::ResetState() void GuiFileBrowser::ResetState()
{ {
state = STATE_DEFAULT; state = STATE_DEFAULT;
selectedItem = 0;
for(int i=0; i<PAGESIZE; i++) for(int i=0; i<PAGESIZE; i++)
{ {
@ -188,6 +189,9 @@ void GuiFileBrowser::Draw()
void GuiFileBrowser::Update(GuiTrigger * t) void GuiFileBrowser::Update(GuiTrigger * t)
{ {
if(state == STATE_DISABLED || !t)
return;
// update the location of the scroll box based on the position in the file list // update the location of the scroll box based on the position in the file list
int position = 136*(browser.pageIndex + selectedItem) / browser.numEntries; int position = 136*(browser.pageIndex + selectedItem) / browser.numEntries;
scrollbarBoxBtn->SetPosition(0,position+36); scrollbarBoxBtn->SetPosition(0,position+36);
@ -205,7 +209,7 @@ void GuiFileBrowser::Update(GuiTrigger * t)
if(t->Right() || arrowDownBtn->GetState() == STATE_CLICKED) if(t->Right() || arrowDownBtn->GetState() == STATE_CLICKED)
{ {
if(browser.pageIndex < browser.numEntries) if(browser.pageIndex < browser.numEntries && browser.numEntries > PAGESIZE)
{ {
browser.pageIndex += PAGESIZE; browser.pageIndex += PAGESIZE;
if(browser.pageIndex+PAGESIZE >= browser.numEntries) if(browser.pageIndex+PAGESIZE >= browser.numEntries)

View File

@ -235,6 +235,9 @@ void GuiOptionBrowser::Draw()
void GuiOptionBrowser::Update(GuiTrigger * t) void GuiOptionBrowser::Update(GuiTrigger * t)
{ {
if(state == STATE_DISABLED || !t)
return;
int next, prev; int next, prev;
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list

View File

@ -219,6 +219,9 @@ void GuiSaveBrowser::Draw()
void GuiSaveBrowser::Update(GuiTrigger * t) void GuiSaveBrowser::Update(GuiTrigger * t)
{ {
if(state == STATE_DISABLED || !t)
return;
int i, len; int i, len;
char savetext[50]; char savetext[50];
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list

View File

@ -916,8 +916,10 @@ static int MenuGameSelection()
#ifdef HW_RVL #ifdef HW_RVL
ShutoffRumble(); ShutoffRumble();
#endif #endif
mainWindow->SetState(STATE_DISABLED);
if(BrowserLoadFile(GCSettings.LoadMethod)) if(BrowserLoadFile(GCSettings.LoadMethod))
menu = MENU_EXIT; menu = MENU_EXIT;
mainWindow->SetState(STATE_DEFAULT);
} }
} }
} }