From 297d2f2d557e1dd4f6ed02a595ff365ccee0bd00 Mon Sep 17 00:00:00 2001 From: ugetab Date: Fri, 23 Apr 2010 22:08:39 +0000 Subject: [PATCH] Attempted optimization broke the Visual Themes coding in Release builds. --- src/drivers/win/guiconfig.cpp | 37 +++++++++++++++-------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/drivers/win/guiconfig.cpp b/src/drivers/win/guiconfig.cpp index 1464b234..b3693f80 100644 --- a/src/drivers/win/guiconfig.cpp +++ b/src/drivers/win/guiconfig.cpp @@ -3,29 +3,13 @@ #include "gui.h" extern bool rightClickEnabled; //Declared in window.cpp and only an extern here - -/** -* Processes information from the GUI options dialog after -* the dialog was closed. -* -* @param hwndDlg Handle of the dialog window. -**/ -char* ManifestFilePath() -{ - char tempfilepath[2048]; - GetModuleFileName(0, tempfilepath, 2048); - //std::string TestFilepath = tempfilepath; - - strcat(tempfilepath,".manifest"); - - return tempfilepath; -} +char ManifestFilePath[2048]; bool ManifestFileExists() { long endPos = 0; - FILE * stream = fopen( ManifestFilePath(), "r" ); + FILE * stream = fopen( ManifestFilePath, "r" ); if (stream) { fseek( stream, 0L, SEEK_END ); endPos = ftell( stream ); @@ -35,6 +19,12 @@ bool ManifestFileExists() return (endPos > 0); } +/** +* Processes information from the GUI options dialog after +* the dialog was closed. +* +* @param hwndDlg Handle of the dialog window. +**/ void CloseGuiDialog(HWND hwndDlg) { if(IsDlgButtonChecked(hwndDlg, CB_LOAD_FILE_OPEN) == BST_CHECKED) @@ -79,7 +69,7 @@ void CloseGuiDialog(HWND hwndDlg) if(IsDlgButtonChecked(hwndDlg, CB_PARTIALVISUALTHEME)==BST_CHECKED) { - FILE * stream = fopen( ManifestFilePath(), "w" ); + FILE * stream = fopen( ManifestFilePath, "w" ); if (stream) { fputs ("<\?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"\?>\n\n\nFCEUX\n\n",stream); fclose(stream); @@ -88,7 +78,7 @@ void CloseGuiDialog(HWND hwndDlg) else { - remove(ManifestFilePath()); + remove(ManifestFilePath); } @@ -129,7 +119,12 @@ BOOL CALLBACK GUIConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) CheckDlgButton(hwndDlg, CB_ENABLECONTEXTMENU, BST_CHECKED); } - if(ManifestFileExists() > 0) { + GetModuleFileName(0, ManifestFilePath, 2048); + //std::string TestFilepath = tempfilepath; + + strcat((char*)ManifestFilePath,".manifest"); + + if(ManifestFileExists()) { CheckDlgButton(hwndDlg, CB_PARTIALVISUALTHEME, BST_CHECKED); }