mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
fix for SMB, misc improvements
This commit is contained in:
parent
736a08b480
commit
46b109c168
@ -533,7 +533,7 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
u32 nextread = 0;
|
u32 nextread = 0;
|
||||||
while(offset < size)
|
while(offset < size)
|
||||||
{
|
{
|
||||||
if(size - offset > 1024*512) nextread = 1024*512;
|
if(size - offset > 4*1024) nextread = 4*1024;
|
||||||
else nextread = size-offset;
|
else nextread = size-offset;
|
||||||
ShowProgress ("Loading...", offset, size);
|
ShowProgress ("Loading...", offset, size);
|
||||||
readsize = fread (rbuffer + offset, 1, nextread, file); // read in next chunk
|
readsize = fread (rbuffer + offset, 1, nextread, file); // read in next chunk
|
||||||
@ -620,7 +620,7 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
|
|||||||
u32 writesize, nextwrite;
|
u32 writesize, nextwrite;
|
||||||
while(written < datasize)
|
while(written < datasize)
|
||||||
{
|
{
|
||||||
if(datasize - written > 16*1024) nextwrite=16*1024;
|
if(datasize - written > 4*1024) nextwrite=4*1024;
|
||||||
else nextwrite = datasize-written;
|
else nextwrite = datasize-written;
|
||||||
writesize = fwrite (buffer+written, 1, nextwrite, file);
|
writesize = fwrite (buffer+written, 1, nextwrite, file);
|
||||||
if(writesize != nextwrite) break; // write failure
|
if(writesize != nextwrite) break; // write failure
|
||||||
|
@ -100,7 +100,7 @@ GuiFileBrowser::GuiFileBrowser(int w, int h)
|
|||||||
|
|
||||||
for(int i=0; i<PAGESIZE; i++)
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
{
|
{
|
||||||
gameListText[i] = new GuiText("Game",22, (GXColor){0, 0, 0, 0xff});
|
gameListText[i] = new GuiText(NULL,22, (GXColor){0, 0, 0, 0xff});
|
||||||
gameListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
gameListText[i]->SetAlignment(ALIGN_LEFT, ALIGN_MIDDLE);
|
||||||
gameListText[i]->SetPosition(5,0);
|
gameListText[i]->SetPosition(5,0);
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void GuiSaveBrowser::SetFocus(int f)
|
|||||||
for(int i=0; i<SAVELISTSIZE; i++)
|
for(int i=0; i<SAVELISTSIZE; i++)
|
||||||
saveBtn[i]->ResetState();
|
saveBtn[i]->ResetState();
|
||||||
|
|
||||||
if(f == 1)
|
if(f == 1 && selectedItem >= 0)
|
||||||
saveBtn[selectedItem]->SetState(STATE_SELECTED);
|
saveBtn[selectedItem]->SetState(STATE_SELECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
|||||||
}
|
}
|
||||||
else if(listOffset+i < saves->length)
|
else if(listOffset+i < saves->length)
|
||||||
{
|
{
|
||||||
if(saveBtn[i]->GetState() == STATE_DISABLED)
|
if(saveBtn[i]->GetState() == STATE_DISABLED || !saveBtn[i]->IsVisible())
|
||||||
{
|
{
|
||||||
saveBtn[i]->SetVisible(true);
|
saveBtn[i]->SetVisible(true);
|
||||||
saveBtn[i]->SetState(STATE_DEFAULT);
|
saveBtn[i]->SetState(STATE_DEFAULT);
|
||||||
@ -379,12 +379,17 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
|||||||
saveBtn[i]->SetState(STATE_DISABLED);
|
saveBtn[i]->SetState(STATE_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(focus)
|
if(i != selectedItem && saveBtn[i]->GetState() == STATE_SELECTED)
|
||||||
|
saveBtn[i]->ResetState();
|
||||||
|
else if(focus && i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT)
|
||||||
|
saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
||||||
|
|
||||||
|
if(t->wpad.ir.valid && !saveBtn[i]->IsInside(t->wpad.ir.x, t->wpad.ir.y)
|
||||||
|
&& saveBtn[i]->GetState() == STATE_SELECTED)
|
||||||
{
|
{
|
||||||
if(i != selectedItem && saveBtn[i]->GetState() == STATE_SELECTED)
|
saveBtn[i]->ResetState();
|
||||||
saveBtn[i]->ResetState();
|
if(selectedItem == i)
|
||||||
else if(i == selectedItem && saveBtn[i]->GetState() == STATE_DEFAULT)
|
selectedItem = -1;
|
||||||
saveBtn[selectedItem]->SetState(STATE_SELECTED, t->chan);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saveBtn[i]->Update(t);
|
saveBtn[i]->Update(t);
|
||||||
|
@ -224,7 +224,7 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch
|
|||||||
static void *
|
static void *
|
||||||
EmulatorUpdate (void *arg)
|
EmulatorUpdate (void *arg)
|
||||||
{
|
{
|
||||||
sleep(5);
|
sleep(3);
|
||||||
bool installUpdate = WindowPrompt(
|
bool installUpdate = WindowPrompt(
|
||||||
"Update Available",
|
"Update Available",
|
||||||
"An update is available!",
|
"An update is available!",
|
||||||
@ -489,7 +489,7 @@ ShowProgress (const char *msg, int done, int total)
|
|||||||
void
|
void
|
||||||
ShowAction (const char *msg)
|
ShowAction (const char *msg)
|
||||||
{
|
{
|
||||||
if(showProgress != 2)
|
if(showProgress != 0)
|
||||||
CancelAction(); // wait for previous progress window to finish
|
CancelAction(); // wait for previous progress window to finish
|
||||||
|
|
||||||
strncpy(progressMsg, msg, 200);
|
strncpy(progressMsg, msg, 200);
|
||||||
@ -856,25 +856,6 @@ static void WindowCredits(void * ptr)
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static int MenuGameSelection()
|
static int MenuGameSelection()
|
||||||
{
|
{
|
||||||
#ifdef HW_RVL
|
|
||||||
ShutoffRumble();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// populate initial directory listing
|
|
||||||
if(OpenGameList() <= 0)
|
|
||||||
{
|
|
||||||
int choice = WindowPrompt(
|
|
||||||
"Error",
|
|
||||||
"Games directory is inaccessible on selected load device.",
|
|
||||||
"Retry",
|
|
||||||
"Check Settings");
|
|
||||||
|
|
||||||
if(choice)
|
|
||||||
return MENU_GAMESELECTION;
|
|
||||||
else
|
|
||||||
return MENU_SETTINGS_FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int menu = MENU_NONE;
|
int menu = MENU_NONE;
|
||||||
|
|
||||||
GuiText titleTxt("Choose Game", 28, (GXColor){255, 255, 255, 255});
|
GuiText titleTxt("Choose Game", 28, (GXColor){255, 255, 255, 255});
|
||||||
@ -938,6 +919,7 @@ static int MenuGameSelection()
|
|||||||
|
|
||||||
GuiFileBrowser gameBrowser(424, 248);
|
GuiFileBrowser gameBrowser(424, 248);
|
||||||
gameBrowser.SetPosition(50, 108);
|
gameBrowser.SetPosition(50, 108);
|
||||||
|
ResetBrowser();
|
||||||
|
|
||||||
HaltGui();
|
HaltGui();
|
||||||
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
|
||||||
@ -947,57 +929,82 @@ static int MenuGameSelection()
|
|||||||
mainWindow->Append(&buttonWindow);
|
mainWindow->Append(&buttonWindow);
|
||||||
ResumeGui();
|
ResumeGui();
|
||||||
|
|
||||||
while(menu == MENU_NONE)
|
#ifdef HW_RVL
|
||||||
|
ShutoffRumble();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// populate initial directory listing
|
||||||
|
if(OpenGameList() <= 0)
|
||||||
{
|
{
|
||||||
usleep(THREAD_SLEEP);
|
int choice = WindowPrompt(
|
||||||
|
"Error",
|
||||||
|
"Games directory is inaccessible on selected load device.",
|
||||||
|
"Retry",
|
||||||
|
"Check Settings");
|
||||||
|
|
||||||
// update gameWindow based on arrow buttons
|
if(choice)
|
||||||
// set MENU_EXIT if A button pressed on a game
|
menu = MENU_GAMESELECTION;
|
||||||
for(int i=0; i<PAGESIZE; i++)
|
else
|
||||||
|
menu = MENU_SETTINGS_FILE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameBrowser.ResetState();
|
||||||
|
gameBrowser.gameList[0]->SetState(STATE_SELECTED);
|
||||||
|
gameBrowser.TriggerUpdate();
|
||||||
|
|
||||||
|
while(menu == MENU_NONE)
|
||||||
{
|
{
|
||||||
if(gameBrowser.gameList[i]->GetState() == STATE_CLICKED)
|
usleep(THREAD_SLEEP);
|
||||||
|
|
||||||
|
// update gameWindow based on arrow buttons
|
||||||
|
// set MENU_EXIT if A button pressed on a game
|
||||||
|
for(int i=0; i<PAGESIZE; i++)
|
||||||
{
|
{
|
||||||
gameBrowser.gameList[i]->ResetState();
|
if(gameBrowser.gameList[i]->GetState() == STATE_CLICKED)
|
||||||
// check corresponding browser entry
|
|
||||||
if(browserList[browser.selIndex].isdir || IsSz())
|
|
||||||
{
|
{
|
||||||
bool res;
|
gameBrowser.gameList[i]->ResetState();
|
||||||
|
// check corresponding browser entry
|
||||||
if(IsSz())
|
if(browserList[browser.selIndex].isdir || IsSz())
|
||||||
res = BrowserLoadSz(GCSettings.LoadMethod);
|
|
||||||
else
|
|
||||||
res = BrowserChangeFolder(GCSettings.LoadMethod);
|
|
||||||
|
|
||||||
if(res)
|
|
||||||
{
|
{
|
||||||
gameBrowser.ResetState();
|
bool res;
|
||||||
gameBrowser.gameList[0]->SetState(STATE_SELECTED);
|
|
||||||
gameBrowser.TriggerUpdate();
|
if(IsSz())
|
||||||
|
res = BrowserLoadSz(GCSettings.LoadMethod);
|
||||||
|
else
|
||||||
|
res = BrowserChangeFolder(GCSettings.LoadMethod);
|
||||||
|
|
||||||
|
if(res)
|
||||||
|
{
|
||||||
|
gameBrowser.ResetState();
|
||||||
|
gameBrowser.gameList[0]->SetState(STATE_SELECTED);
|
||||||
|
gameBrowser.TriggerUpdate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menu = MENU_GAMESELECTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu = MENU_GAMESELECTION;
|
#ifdef HW_RVL
|
||||||
break;
|
ShutoffRumble();
|
||||||
|
#endif
|
||||||
|
mainWindow->SetState(STATE_DISABLED);
|
||||||
|
if(BrowserLoadFile(GCSettings.LoadMethod))
|
||||||
|
menu = MENU_EXIT;
|
||||||
|
else
|
||||||
|
mainWindow->SetState(STATE_DEFAULT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef HW_RVL
|
|
||||||
ShutoffRumble();
|
|
||||||
#endif
|
|
||||||
mainWindow->SetState(STATE_DISABLED);
|
|
||||||
if(BrowserLoadFile(GCSettings.LoadMethod))
|
|
||||||
menu = MENU_EXIT;
|
|
||||||
else
|
|
||||||
mainWindow->SetState(STATE_DEFAULT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(settingsBtn.GetState() == STATE_CLICKED)
|
if(settingsBtn.GetState() == STATE_CLICKED)
|
||||||
menu = MENU_SETTINGS;
|
menu = MENU_SETTINGS;
|
||||||
else if(exitBtn.GetState() == STATE_CLICKED)
|
else if(exitBtn.GetState() == STATE_CLICKED)
|
||||||
ExitRequested = 1;
|
ExitRequested = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
HaltGui();
|
HaltGui();
|
||||||
mainWindow->Remove(&titleTxt);
|
mainWindow->Remove(&titleTxt);
|
||||||
|
@ -209,8 +209,6 @@ void InitializeNetwork(bool silent)
|
|||||||
ErrorPrompt(msg);
|
ErrorPrompt(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!silent)
|
|
||||||
CancelAction();
|
|
||||||
inNetworkInit = false;
|
inNetworkInit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,8 +279,6 @@ ConnectShare (bool silent)
|
|||||||
{
|
{
|
||||||
networkShareInit = true;
|
networkShareInit = true;
|
||||||
}
|
}
|
||||||
if(!silent)
|
|
||||||
CancelAction();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!networkShareInit && !silent)
|
if(!networkShareInit && !silent)
|
||||||
|
@ -154,6 +154,7 @@ preparePrefsData (int method)
|
|||||||
createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction));
|
createXMLSetting("ExitAction", "Exit Action", toStr(GCSettings.ExitAction));
|
||||||
createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume));
|
createXMLSetting("MusicVolume", "Music Volume", toStr(GCSettings.MusicVolume));
|
||||||
createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume));
|
createXMLSetting("SFXVolume", "Sound Effects Volume", toStr(GCSettings.SFXVolume));
|
||||||
|
createXMLSetting("Rumble", "Rumble", toStr(GCSettings.Rumble));
|
||||||
|
|
||||||
createXMLSection("Controller", "Controller Settings");
|
createXMLSection("Controller", "Controller Settings");
|
||||||
|
|
||||||
@ -308,6 +309,7 @@ decodePrefsData (int method)
|
|||||||
loadXMLSetting(&GCSettings.ExitAction, "ExitAction");
|
loadXMLSetting(&GCSettings.ExitAction, "ExitAction");
|
||||||
loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume");
|
loadXMLSetting(&GCSettings.MusicVolume, "MusicVolume");
|
||||||
loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume");
|
loadXMLSetting(&GCSettings.SFXVolume, "SFXVolume");
|
||||||
|
loadXMLSetting(&GCSettings.Rumble, "Rumble");
|
||||||
|
|
||||||
// Controller Settings
|
// Controller Settings
|
||||||
loadXMLSetting(&GCSettings.Controller, "Controller");
|
loadXMLSetting(&GCSettings.Controller, "Controller");
|
||||||
|
Loading…
Reference in New Issue
Block a user