fix update window causing crash, misc tweaks

This commit is contained in:
dborth 2009-05-30 18:26:45 +00:00
parent e51775b0ad
commit 8a0dde5d59
4 changed files with 62 additions and 66 deletions

View File

@ -87,7 +87,7 @@ HaltDeviceThread()
* This checks our devices for changes (SD/USB removed) and
* initializes the network in the background
***************************************************************************/
static int devsleep = 3*1000*1000;
static int devsleep = 1*1000*1000;
static void *
devicecallback (void *arg)

View File

@ -113,6 +113,11 @@ ResumeGui()
static void
HaltGui()
{
#ifdef HW_RVL
if(updatethread != LWP_THREAD_NULL)
LWP_JoinThread(updatethread, NULL);
#endif
guiHalt = true;
// wait for thread to finish
@ -238,7 +243,6 @@ WindowPrompt(const char *title, const char *msg, const char *btn1Label, const ch
static void *
EmulatorUpdate (void *arg)
{
sleep(3);
bool installUpdate = WindowPrompt(
"Update Available",
"An update is available!",

View File

@ -98,7 +98,7 @@ void UpdateCheck()
else // temporary, for compatibility
{
int versionnum = atoi(version);
if(versionnum > 15) // 015 (4.0.5)
if(versionnum > 16) // 016 (4.0.6)
{
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
if(item)
@ -200,31 +200,33 @@ void InitializeNetwork(bool silent)
while(inNetworkInit) // a network init is already in progress!
usleep(50);
if(networkInit) // check again if the network was inited
return;
inNetworkInit = true;
char ip[16];
s32 initResult = if_config(ip, NULL, NULL, true);
if(initResult == 0)
if(!networkInit) // check again if the network was inited
{
networkInit = true;
}
else
{
// do not automatically attempt a reconnection
autoNetworkInit = false;
inNetworkInit = true;
if(!silent)
char ip[16];
s32 initResult = if_config(ip, NULL, NULL, true);
if(initResult == 0)
{
char msg[150];
sprintf(msg, "Unable to initialize network (Error #: %i)", initResult);
ErrorPrompt(msg);
networkInit = true;
}
else
{
// do not automatically attempt a reconnection
autoNetworkInit = false;
if(!silent)
{
char msg[150];
sprintf(msg, "Unable to initialize network (Error #: %i)", initResult);
ErrorPrompt(msg);
}
}
inNetworkInit = false;
}
inNetworkInit = false;
if(!silent)
CancelAction();
}
void CloseShare()
@ -294,6 +296,9 @@ ConnectShare (bool silent)
{
networkShareInit = true;
}
if(!silent)
CancelAction();
}
if(!networkShareInit && !silent)

View File

@ -57,7 +57,6 @@
#include "filebrowser.h"
#include "input.h"
static lwp_t mainthread = LWP_THREAD_NULL;
int ScreenshotRequested = 0;
int ConfigRequested = 0;
int ShutdownRequested = 0;
@ -318,43 +317,6 @@ void CreateAppPath(char origpath[])
#endif
}
static void * InitThread (void *arg)
{
// Set defaults
DefaultSettings ();
S9xUnmapAllControls ();
SetDefaultButtonMap ();
// Allocate SNES Memory
if (!Memory.Init ())
ExitApp();
// Allocate APU
if (!S9xInitAPU ())
ExitApp();
// Set Pixel Renderer to match 565
S9xSetRenderPixelFormat (RGB565);
// Initialise Snes Sound System
S9xInitSound (5, TRUE, 1024);
// Initialise Graphics
setGFX ();
if (!S9xGraphicsInit ())
ExitApp();
// Check if DVD drive belongs to a Wii
SetDVDDriveType();
S9xSetSoundMute (TRUE);
S9xInitSync(); // initialize frame sync
LWP_JoinThread(mainthread,NULL);
return NULL;
}
/****************************************************************************
* MAIN
*
@ -445,11 +407,36 @@ main(int argc, char *argv[])
// Initialize libFAT for SD and USB
MountAllFAT();
// Create a thread to do remaining initialization tasks
// This allows us to get to the menu faster
mainthread=LWP_GetSelf();
lwp_t initthread;
LWP_CreateThread(&initthread, InitThread, NULL, NULL, 0, 75);
// Set defaults
DefaultSettings ();
S9xUnmapAllControls ();
SetDefaultButtonMap ();
// Allocate SNES Memory
if (!Memory.Init ())
ExitApp();
// Allocate APU
if (!S9xInitAPU ())
ExitApp();
// Set Pixel Renderer to match 565
S9xSetRenderPixelFormat (RGB565);
// Initialise Snes Sound System
S9xInitSound (5, TRUE, 1024);
// Initialise Graphics
setGFX ();
if (!S9xGraphicsInit ())
ExitApp();
// Check if DVD drive belongs to a Wii
SetDVDDriveType();
S9xSetSoundMute (TRUE);
S9xInitSync(); // initialize frame sync
// Audio
AUDIO_Init (NULL);