From b9258a7b0a16389fe1807adbbd91917a66cf68aa Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 25 May 2009 06:47:37 +0000 Subject: [PATCH] fix black screenshot when returning to menu issue, variables cleanup --- source/ngc/input.cpp | 2 +- source/ngc/s9xsupport.cpp | 6 ++---- source/ngc/snes9xGX.cpp | 9 +-------- source/ngc/snes9xGX.h | 2 ++ source/ngc/video.cpp | 8 ++++++++ source/ngc/video.h | 3 +++ 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/ngc/input.cpp b/source/ngc/input.cpp index 48d3dde..cc1d13f 100644 --- a/source/ngc/input.cpp +++ b/source/ngc/input.cpp @@ -582,7 +582,7 @@ void NGCReportButtons () (userInput[i].wpad.btns_h & WPAD_CLASSIC_BUTTON_HOME) ) { - ConfigRequested = 1; // go to the menu + ScreenshotRequested = 1; // go to the menu } } diff --git a/source/ngc/s9xsupport.cpp b/source/ngc/s9xsupport.cpp index 0a0e663..67ae360 100644 --- a/source/ngc/s9xsupport.cpp +++ b/source/ngc/s9xsupport.cpp @@ -37,10 +37,8 @@ #include "video.h" #include "audio.h" -extern u32 FrameTimer; - -long long prev; -long long now; +static long long prev; +static long long now; /*** Miscellaneous Functions ***/ void diff --git a/source/ngc/snes9xGX.cpp b/source/ngc/snes9xGX.cpp index ef76f1f..c889cd7 100644 --- a/source/ngc/snes9xGX.cpp +++ b/source/ngc/snes9xGX.cpp @@ -58,6 +58,7 @@ #include "input.h" static lwp_t mainthread = LWP_THREAD_NULL; +int ScreenshotRequested = 0; int ConfigRequested = 0; int ShutdownRequested = 0; int ResetRequested = 0; @@ -65,11 +66,6 @@ int ExitRequested = 0; char appPath[1024]; FreeTypeGX *fontSystem; -extern int FrameTimer; - -extern long long prev; -extern unsigned int timediffallowed; - /**************************************************************************** * Shutdown / Reboot / Exit ***************************************************************************/ @@ -190,8 +186,6 @@ void ipl_set_config(unsigned char c) * setFrameTimerMethod() * change frametimer method depending on whether ROM is NTSC or PAL ***************************************************************************/ -extern u8 vmode_60hz; -int timerstyle; void setFrameTimerMethod() { @@ -283,7 +277,6 @@ emulate () if((GCSettings.render != 0 && videoReset == -1) || videoReset == 0) { FreeGfxMem(); - TakeScreenshot(); ResetVideo_Menu(); ConfigRequested = 0; GCSettings.render = currentMode; diff --git a/source/ngc/snes9xGX.h b/source/ngc/snes9xGX.h index 7d9be5d..4abc941 100644 --- a/source/ngc/snes9xGX.h +++ b/source/ngc/snes9xGX.h @@ -94,10 +94,12 @@ struct SGCSettings{ void ExitApp(); void ShutdownWii(); extern struct SGCSettings GCSettings; +extern int ScreenshotRequested; extern int ConfigRequested; extern int ShutdownRequested; extern int ExitRequested; extern char appPath[]; extern FreeTypeGX *fontSystem; +extern int timerstyle; #endif diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index b3cb0d4..146a530 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -67,6 +67,7 @@ u8 * gameScreenTex2 = NULL; // a GX texture screen capture of the game (copy) u32 FrameTimer = 0; u8 vmode_60hz = 0; +int timerstyle = 0; bool progressive = 0; #define HASPECT 320 @@ -318,6 +319,13 @@ copy_to_xfb (u32 arg) { if (copynow == GX_TRUE) { + if(ScreenshotRequested) + { + TakeScreenshot(); + ScreenshotRequested = 0; + ConfigRequested = 1; + } + GX_CopyDisp (xfb[whichfb], GX_TRUE); GX_Flush (); copynow = GX_FALSE; diff --git a/source/ngc/video.h b/source/ngc/video.h index 40e3cc7..af4008c 100644 --- a/source/ngc/video.h +++ b/source/ngc/video.h @@ -38,5 +38,8 @@ extern int screenwidth; extern bool progressive; extern u8 * gameScreenTex; extern u8 * gameScreenTex2; +extern u32 FrameTimer; +extern u8 vmode_60hz; +extern int timerstyle; #endif