From ed7638488cc1cdb8f2a78f56fe60e59887e3e315 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sat, 25 Dec 2010 04:38:44 +0000 Subject: [PATCH] zzogl-pg: compilation fixex for MSVC builds: * resolve a namespace conflict between std::count (due to a 'using namespatce std;' directive) [debug builds only] * switch all MSW-specific code to be unicode compliant so that unicode-only Utilities lib can be used under Windows. [should work, but needs proper testing] * fix some properties sheets so that windows-specific DLL dependencies (common controls and UUID stuff provided by Windows) are linked automatically into wx/utils based plugins. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4140 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/vsprops/wxWidgetsGui.vsprops | 2 +- .../spu2-x/src/Windows/Spu2-X_vs2008.vcproj | 16 ++-- plugins/zzogl-pg/opengl/GLWin32.cpp | 29 +++---- plugins/zzogl-pg/opengl/GSmain.cpp | 2 +- plugins/zzogl-pg/opengl/GifTransfer.cpp | 6 +- plugins/zzogl-pg/opengl/Util.h | 4 +- plugins/zzogl-pg/opengl/Win32/Conf.cpp | 76 +++++++++---------- plugins/zzogl-pg/opengl/Win32/Win32.cpp | 11 +-- plugins/zzogl-pg/opengl/Win32/aviUtil.h | 16 ++-- .../opengl/Win32/zerogsogl_2008.vcproj | 36 ++++----- plugins/zzogl-pg/opengl/ZZGl.h | 3 +- plugins/zzogl-pg/opengl/ZZoglCRTC.cpp | 2 +- plugins/zzogl-pg/opengl/ZZoglShoots.cpp | 2 +- plugins/zzogl-pg/opengl/glprocs.c | 2 +- plugins/zzogl-pg/opengl/rasterfont.cpp | 2 +- plugins/zzogl-pg/opengl/zerogs.h | 2 +- 16 files changed, 108 insertions(+), 103 deletions(-) diff --git a/common/vsprops/wxWidgetsGui.vsprops b/common/vsprops/wxWidgetsGui.vsprops index 21da1c6967..4e2da77bb7 100644 --- a/common/vsprops/wxWidgetsGui.vsprops +++ b/common/vsprops/wxWidgetsGui.vsprops @@ -12,7 +12,7 @@ /> diff --git a/plugins/spu2-x/src/Windows/Spu2-X_vs2008.vcproj b/plugins/spu2-x/src/Windows/Spu2-X_vs2008.vcproj index 90b2bae491..b7199e77fd 100644 --- a/plugins/spu2-x/src/Windows/Spu2-X_vs2008.vcproj +++ b/plugins/spu2-x/src/Windows/Spu2-X_vs2008.vcproj @@ -20,7 +20,7 @@ ConfigurationType="2" InheritedPropertySheets="..\..\..\..\common\vsprops\plugin_svnroot.vsprops;..\..\..\..\common\vsprops\BaseProperties.vsprops;..\..\..\..\common\vsprops\3rdpartyDeps.vsprops;..\..\..\..\common\vsprops\CodeGen_Devel.vsprops;..\..\..\..\common\vsprops\IncrementalLinking.vsprops;..\..\..\..\common\vsprops\wxWidgetsGui.vsprops;..\..\..\..\common\vsprops\pthreads.vsprops" UseOfMFC="0" - UseOfATL="1" + UseOfATL="0" ATLMinimizesCRunTimeLibraryUsage="false" CharacterSet="1" WholeProgramOptimization="0" @@ -69,7 +69,7 @@ /> @@ -150,7 +150,7 @@ /> @@ -318,7 +318,7 @@ /> mode); #ifdef _DEBUG - ZZLog::Prim_Log("count: %d\n", count); - count++; + ZZLog::Prim_Log("count: %d\n", path1_count); + path1_count++; #endif _GSgifTransfer<0>((u32*)((u8*)pMem + addr), (0x4000 - addr) / 16); diff --git a/plugins/zzogl-pg/opengl/Util.h b/plugins/zzogl-pg/opengl/Util.h index 756e86f3ff..ed148ac7c1 100644 --- a/plugins/zzogl-pg/opengl/Util.h +++ b/plugins/zzogl-pg/opengl/Util.h @@ -26,8 +26,8 @@ #include #include "Utilities/RedtapeWindows.h" -#include -#include +//#include +//#include #include #include diff --git a/plugins/zzogl-pg/opengl/Win32/Conf.cpp b/plugins/zzogl-pg/opengl/Win32/Conf.cpp index 1a38ba531d..c72d1b69b3 100644 --- a/plugins/zzogl-pg/opengl/Win32/Conf.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Conf.cpp @@ -8,31 +8,31 @@ extern HINSTANCE hInst; void SaveConfig() { - char szValue[256]; - const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); + wxChar szValue[256]; + const wxString iniFile( wxString::FromUTF8(s_strIniPath.c_str()) + L"zzogl-pg.ini"); - sprintf(szValue, "%u", conf.interlace); - WritePrivateProfileString("Settings", "Interlace", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.aa); - WritePrivateProfileString("Settings", "Antialiasing", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.bilinear); - WritePrivateProfileString("Settings", "Bilinear", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.zz_options); - WritePrivateProfileString("Settings", "ZZOptions", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.hacks); - WritePrivateProfileString("Settings", "AdvancedOptions", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.width); - WritePrivateProfileString("Settings", "Width", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.height); - WritePrivateProfileString("Settings", "Height", szValue, iniFile.c_str()); - sprintf(szValue, "%u", conf.SkipDraw); - WritePrivateProfileString("Settings", "SkipDraw", szValue, iniFile.c_str()); + wxSprintf(szValue, L"%u", conf.interlace); + WritePrivateProfileString(L"Settings", L"Interlace", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.aa); + WritePrivateProfileString(L"Settings", L"Antialiasing", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.bilinear); + WritePrivateProfileString(L"Settings", L"Bilinear", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.zz_options); + WritePrivateProfileString(L"Settings", L"ZZOptions", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.hacks); + WritePrivateProfileString(L"Settings", L"AdvancedOptions", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.width); + WritePrivateProfileString(L"Settings", L"Width", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.height); + WritePrivateProfileString(L"Settings", L"Height", szValue, iniFile); + wxSprintf(szValue, L"%u", conf.SkipDraw); + WritePrivateProfileString(L"Settings", L"SkipDraw", szValue, iniFile); } void LoadConfig() { - char szValue[256]; - const std::string iniFile(s_strIniPath + "zzogl-pg.ini"); + wxChar szValue[256]; + const wxString iniFile( wxString::FromUTF8(s_strIniPath.c_str()) + L"zzogl-pg.ini"); memset(&conf, 0, sizeof(conf)); conf.interlace = 0; // on, mode 1 @@ -45,34 +45,34 @@ void LoadConfig() conf.SkipDraw = 0; conf.disableHacks = 0; - FILE *fp = fopen(iniFile.c_str(), "rt"); + FILE *fp = wxFopen(iniFile, L"rt"); if (!fp) { SysMessage("Unable to open ZZOgl-PG's ini file!"); - CreateDirectory(s_strIniPath.c_str(), NULL); + CreateDirectory(wxString::FromUTF8(s_strIniPath.c_str()), NULL); SaveConfig();//save and return return ; } fclose(fp); - GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str()); - conf.interlace = (u8)strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str()); - conf.aa = (u8)strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "ZZOptions", NULL, szValue, 20, iniFile.c_str()); - conf.zz_options._u32 = strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str()); - conf.hacks._u32 = strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str()); - conf.bilinear = (u8)strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "Width", NULL, szValue, 20, iniFile.c_str()); - conf.width = strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "Height", NULL, szValue, 20, iniFile.c_str()); - conf.height = strtoul(szValue, NULL, 10); - GetPrivateProfileString("Settings", "SkipDraw", NULL, szValue, 20, iniFile.c_str()); - conf.SkipDraw = strtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"Interlace", NULL, szValue, 20, iniFile); + conf.interlace = (u8)wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"Antialiasing", NULL, szValue, 20, iniFile); + conf.aa = (u8)wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"ZZOptions", NULL, szValue, 20, iniFile); + conf.zz_options._u32 = wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"AdvancedOptions", NULL, szValue, 20, iniFile); + conf.hacks._u32 = wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"Bilinear", NULL, szValue, 20, iniFile); + conf.bilinear = (u8)wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"Width", NULL, szValue, 20, iniFile); + conf.width = wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"Height", NULL, szValue, 20, iniFile); + conf.height = wxStrtoul(szValue, NULL, 10); + GetPrivateProfileString(L"Settings", L"SkipDraw", NULL, szValue, 20, iniFile); + conf.SkipDraw = wxStrtoul(szValue, NULL, 10); if (conf.aa < 0 || conf.aa > 4) conf.aa = 0; diff --git a/plugins/zzogl-pg/opengl/Win32/Win32.cpp b/plugins/zzogl-pg/opengl/Win32/Win32.cpp index e52c6909b1..f7cad522d8 100644 --- a/plugins/zzogl-pg/opengl/Win32/Win32.cpp +++ b/plugins/zzogl-pg/opengl/Win32/Win32.cpp @@ -1,5 +1,6 @@ #include -#include + +#include "Utilities/RedtapeWindows.h" #include #include "resrc1.h" @@ -131,7 +132,7 @@ void OnInitConfDialog(HWND hW) { if (!(conf.zz_options.loaded)) LoadConfig(); - TCHAR *aaName[] = {"None", "x2", "x4", "x8", "x16"}; + TCHAR *aaName[] = {L"None", L"x2", L"x4", L"x8", L"x16"}; for(int i=0; i<5; i++) { @@ -139,7 +140,7 @@ void OnInitConfDialog(HWND hW) } ComboBox_SelectString(GetDlgItem(hW, IDC_AA_COMBO), -1, (LPARAM)aaName[conf.aa]); - TCHAR *sizeName[] = {"640 x 480", "800 x 600", "1024 x 768", "1280 x 960"}; + TCHAR *sizeName[] = {L"640 x 480", L"800 x 600", L"1024 x 768", L"1280 x 960"}; for(int i=0; i<4; i++) { @@ -285,7 +286,7 @@ static int errval; void *SysLoadLibrary(char *lib) { - return LoadLibrary(lib); + return LoadLibrary(wxString::FromUTF8(lib)); } void *SysLoadSym(void *lib, char *sym) @@ -320,5 +321,5 @@ void SysMessage(const char *fmt, ...) va_start(list, fmt); vsprintf(tmp, fmt, list); va_end(list); - MessageBox(0, tmp, "ZZOgl-PG Msg", 0); + MessageBox(0, wxString::FromUTF8(tmp), L"ZZOgl-PG Msg", 0); } diff --git a/plugins/zzogl-pg/opengl/Win32/aviUtil.h b/plugins/zzogl-pg/opengl/Win32/aviUtil.h index 46049b7840..69be284f43 100644 --- a/plugins/zzogl-pg/opengl/Win32/aviUtil.h +++ b/plugins/zzogl-pg/opengl/Win32/aviUtil.h @@ -17,7 +17,7 @@ BOOL AVI_Init() if (wVer < 0x010a){ /* oops, we are too old, blow out of here */ //MessageBeep(MB_ICONHAND); - MessageBox(NULL, "Cant't init AVI File - Video for Windows version is to old", "Error", MB_OK|MB_ICONSTOP); + MessageBox(NULL, L"Cant't init AVI File - Video for Windows version is to old", L"Error", MB_OK|MB_ICONSTOP); return FALSE; } @@ -29,7 +29,7 @@ BOOL AVI_Init() BOOL AVI_FileOpenWrite(PAVIFILE * pfile, const char *filename) { HRESULT hr = AVIFileOpen(pfile, // returned file pointer - filename, // file name + wxString::FromUTF8(filename), // file name OF_WRITE | OF_CREATE, // mode to open file with NULL); // use handler determined // from file extension.... @@ -272,9 +272,9 @@ BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi) NULL); if (hr != AVIERR_OK) { - char strMsg[255]; - _snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr); - MessageBox(NULL, strMsg, "", MB_OK); + TCHAR strMsg[255]; + _snwprintf(strMsg, 255, L"Error: AVIStreamWrite, error %d",hr); + MessageBox(NULL, strMsg, L"", MB_OK); return FALSE; } @@ -410,9 +410,9 @@ bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int widt NULL); if (hr != AVIERR_OK) { - char strMsg[255]; - _snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr); - MessageBox(NULL, strMsg, "", MB_OK); + TCHAR strMsg[255]; + _snwprintf(strMsg, 255, L"Error: AVIStreamWrite, error %d",hr); + MessageBox(NULL, strMsg, L"", MB_OK); return FALSE; } diff --git a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj index e6b3aef5e5..d7e14e7ff4 100644 --- a/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj +++ b/plugins/zzogl-pg/opengl/Win32/zerogsogl_2008.vcproj @@ -18,10 +18,10 @@ - - + + @@ -513,10 +513,6 @@ RelativePath="..\ZZHacks.h" > - - @@ -525,6 +521,10 @@ RelativePath="..\ZZoglCRTC.h" > + + @@ -572,11 +572,11 @@ diff --git a/plugins/zzogl-pg/opengl/ZZGl.h b/plugins/zzogl-pg/opengl/ZZGl.h index 3b7f148ade..74ab676c43 100644 --- a/plugins/zzogl-pg/opengl/ZZGl.h +++ b/plugins/zzogl-pg/opengl/ZZGl.h @@ -26,7 +26,8 @@ // Need this before gl.h #ifdef _WIN32 -#include +#include "Utilities/RedtapeWindows.h" + #include #include #include "glprocs.h" diff --git a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp index e9e9912af0..152601321f 100644 --- a/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglCRTC.cpp @@ -144,7 +144,7 @@ inline void FrameSavingHelper() #ifdef _WIN32 else { - DeleteFile("frame2.tga"); + DeleteFile(L"frame2.tga"); } #endif } diff --git a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp index eb174e9ef0..b43c64d942 100644 --- a/plugins/zzogl-pg/opengl/ZZoglShoots.cpp +++ b/plugins/zzogl-pg/opengl/ZZoglShoots.cpp @@ -22,7 +22,7 @@ //------------------ Includes #include "Util.h" #if defined(_WIN32) -# include +# include "Utilities/RedtapeWindows.h" # include # include "resource.h" #endif diff --git a/plugins/zzogl-pg/opengl/glprocs.c b/plugins/zzogl-pg/opengl/glprocs.c index 601fa63cb5..60fd5eec5d 100644 --- a/plugins/zzogl-pg/opengl/glprocs.c +++ b/plugins/zzogl-pg/opengl/glprocs.c @@ -42,7 +42,7 @@ #include #ifdef _WIN32 - #include + #include "Utilities/RedtapeWindows.h" #include //"gl.h" /* Include local "gl.h". Don't include vc32 . */ #include "glprocs.h" #else /* GLX */ diff --git a/plugins/zzogl-pg/opengl/rasterfont.cpp b/plugins/zzogl-pg/opengl/rasterfont.cpp index f7eba2ec1c..38b04ccf43 100644 --- a/plugins/zzogl-pg/opengl/rasterfont.cpp +++ b/plugins/zzogl-pg/opengl/rasterfont.cpp @@ -18,7 +18,7 @@ */ #ifdef _WIN32 -#include +#include "Utilities/RedtapeWindows.h" #endif #include diff --git a/plugins/zzogl-pg/opengl/zerogs.h b/plugins/zzogl-pg/opengl/zerogs.h index 1c6c1cecde..b898d46829 100644 --- a/plugins/zzogl-pg/opengl/zerogs.h +++ b/plugins/zzogl-pg/opengl/zerogs.h @@ -32,7 +32,7 @@ // State parameters #if defined(_WIN32) -# include +# include "Utilities/RedtapeWindows.h" # include "resource.h" #endif