From f2286d213be59b59074f01e651b522ee4129a016 Mon Sep 17 00:00:00 2001 From: dborth Date: Tue, 13 Apr 2010 05:17:30 +0000 Subject: [PATCH] fix some hangs --- source/fileop.cpp | 1 + source/menu.cpp | 17 +++++++++++------ source/video.cpp | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/source/fileop.cpp b/source/fileop.cpp index 38cdb29..3eab1df 100644 --- a/source/fileop.cpp +++ b/source/fileop.cpp @@ -869,6 +869,7 @@ SaveFile (char * buffer, char *filepath, size_t datasize, bool silent) if(!written) { unmountRequired[device] = true; + if(silent) break; retry = ErrorPromptRetry("Error saving file!"); } } diff --git a/source/menu.cpp b/source/menu.cpp index 1ad5252..ba11893 100644 --- a/source/menu.cpp +++ b/source/menu.cpp @@ -1377,11 +1377,13 @@ static int MenuGame() #endif w.SetEffect(EFFECT_FADE, 15); - AutoSave(); } ResumeGui(); + if(lastMenu == MENU_NONE) + AutoSave(); + while(menu == MENU_NONE) { usleep(THREAD_SLEEP); @@ -3825,7 +3827,7 @@ MainMenu (int menu) mainWindow->Append(gameScreenImg); bgImg->SetVisible(false); } - + GuiTrigger trigA; if(GCSettings.WiimoteOrientation) trigA.SetSimpleTrigger(-1, WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A); @@ -3937,10 +3939,6 @@ MainMenu (int menu) ShutoffRumble(); #endif - // wait for keys to be depressed - while(MenuRequested()) - usleep(THREAD_SLEEP); - CancelAction(); HaltGui(); @@ -3985,4 +3983,11 @@ MainMenu (int menu) free(gameScreenTex2); gameScreenTex2 = NULL; } + + // wait for keys to be depressed + while(MenuRequested()) + { + UpdatePads(); + usleep(THREAD_SLEEP); + } } diff --git a/source/video.cpp b/source/video.cpp index 5d3b5ad..15c935d 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -690,6 +690,9 @@ update_video (int width, int height) { vwidth = width; vheight = height; + + if(IPPU.RenderedFramesCount == prevRenderedFrameCount) + return; // we haven't rendered any frames yet, so we can't draw anything! // Ensure previous vb has complete while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE)) @@ -697,10 +700,10 @@ update_video (int width, int height) whichfb ^= 1; - if ( oldvheight != vheight || oldvwidth != vwidth ) // if rendered width/height changes, update scaling + if (oldvheight != vheight || oldvwidth != vwidth) // if rendered width/height changes, update scaling CheckVideo = 1; - if ( CheckVideo && (IPPU.RenderedFramesCount != prevRenderedFrameCount) ) // if we get back from the menu, and have rendered at least 1 frame + if (CheckVideo) // if we get back from the menu, and have rendered at least 1 frame { int xscale, yscale;