diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60b5d415..71034095 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -135,7 +135,7 @@ set(GLideNUI_SOURCES GLideNUI/icon.qrc ) -if(MUPENPLUSAPI_GLIDENUI) +if(MUPENPLUSAPI_GLIDENUI OR NOT MUPENPLUSAPI) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) @@ -144,10 +144,16 @@ if(MUPENPLUSAPI_GLIDENUI) set(GLIDENUI_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui ) - list(APPEND GLideNUI_SOURCES - GLideNUI/fullscreenresolutions_mupen64plus.cpp - ) -endif(MUPENPLUSAPI_GLIDENUI) + if (MUPENPLUSAPI) + list(APPEND GLideNUI_SOURCES + GLideNUI/fullscreenresolutions_mupen64plus.cpp + ) + else() + list(APPEND GLideNUI_SOURCES + GLideNUI/fullscreenresolutions_windows.cpp + ) + endif() +endif() #check if we're running on Raspberry Pi if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA) @@ -208,15 +214,17 @@ else(MUPENPLUSAPI) if(UNIX) message(FATAL_ERROR "UNIX build requires MUPENPLUSAPI!") endif(UNIX) + include_directories( . inc ) set(GLideN64_SOURCES_WIN ZilmarPluginAPI.cpp GLideNUI/Config_GLideNUI.cpp windows/CommonAPIImpl_windows.cpp windows/GLideN64_windows.cpp windows/MemoryStatus_windows.cpp - common/GLFunctions.cpp windows/ZilmarAPIImpl_windows.cpp Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp + Graphics/OpenGLContext/windows/WindowsWGL.cpp + ${GLideNUI_SOURCES} ) set(GLideN64_DLL_NAME GLideN64) endif(MUPENPLUSAPI) @@ -253,6 +261,9 @@ if(MINGW) add_definitions( -DMINGW ) + if (NOT MUPENPLUSAPI) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static") + endif() endif(MINGW) if(WIN32) @@ -362,6 +373,11 @@ if(ANDROID) set(FREETYPE_LIBRARIES ANDROID_FREETYPE) else(ANDROID) FIND_PACKAGE( Freetype REQUIRED ) + # presume a qt build linked to freetype + # will be used with mingw + if (NOT MUPENPLUSAPI AND MINGW) + set(FREETYPE_LIBRARIES "") + endif() endif(ANDROID) include_directories( ${FREETYPE_INCLUDE_DIRS} ) diff --git a/src/GLideNUI/fullscreenresolutions_windows.cpp b/src/GLideNUI/fullscreenresolutions_windows.cpp index 420c167d..ddeaa2c9 100644 --- a/src/GLideNUI/fullscreenresolutions_windows.cpp +++ b/src/GLideNUI/fullscreenresolutions_windows.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "FullscreenResolutions.h" #include "../Config.h" diff --git a/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp b/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp index cd91caf4..690b9aed 100644 --- a/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp +++ b/src/Graphics/OpenGLContext/windows/WindowsWGL.cpp @@ -35,30 +35,30 @@ bool WindowsWGL::start() hWnd = GetActiveWindow(); if ((hDC = GetDC(hWnd)) == NULL) { - MessageBox(hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK); + MessageBoxW(hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK); return false; } if ((pixelFormat = ChoosePixelFormat(hDC, &pfd)) == 0) { - MessageBox(hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK); + MessageBoxW(hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK); stop(); return false; } if ((SetPixelFormat(hDC, pixelFormat, &pfd)) == FALSE) { - MessageBox(hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK); + MessageBoxW(hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK); stop(); return false; } if ((hRC = wglCreateContext(hDC)) == NULL) { - MessageBox(hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK); + MessageBoxW(hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK); stop(); return false; } if ((wglMakeCurrent(hDC, hRC)) == FALSE) { - MessageBox(hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK); + MessageBoxW(hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK); stop(); return false; } diff --git a/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp b/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp index c125f272..35563f2f 100644 --- a/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp +++ b/src/Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp @@ -118,7 +118,7 @@ void DisplayWindowWindows::_changeWindow() fullscreenMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; if (ChangeDisplaySettings( &fullscreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL) { - MessageBox( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK ); + MessageBoxW( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK ); return; } diff --git a/src/osal/osal_files_win32.c b/src/osal/osal_files_win32.c index ab50439b..7e6d08ea 100644 --- a/src/osal/osal_files_win32.c +++ b/src/osal/osal_files_win32.c @@ -67,7 +67,7 @@ EXPORT int CALL osal_is_directory(const wchar_t* _name) namelen = wcslen(DirName); if (namelen > 0 && DirName[namelen - 1] == OSAL_DIR_SEPARATOR_CHAR) DirName[namelen - 1] = L'\0'; - return (GetFileAttributes(DirName) & FILE_ATTRIBUTE_DIRECTORY); + return (GetFileAttributesW(DirName) & FILE_ATTRIBUTE_DIRECTORY); } EXPORT int CALL osal_mkdirp(const wchar_t * dirpath) @@ -108,7 +108,7 @@ EXPORT int CALL osal_mkdirp(const wchar_t * dirpath) typedef struct { HANDLE hFind; - WIN32_FIND_DATA find_data; + WIN32_FIND_DATAW find_data; } dir_search_info; EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname) @@ -128,7 +128,7 @@ EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname) swprintf(SearchString, MAX_PATH, L"%ls%ls*", pathname, OSAL_DIR_SEPARATOR_STR); SearchString[MAX_PATH] = 0; - pInfo->hFind = FindFirstFile(SearchString, &pInfo->find_data); + pInfo->hFind = FindFirstFileW(SearchString, &pInfo->find_data); return (void *) pInfo; } @@ -142,7 +142,7 @@ EXPORT const wchar_t * CALL osal_search_dir_read_next(void * search_info) wcscpy(last_filename, pInfo->find_data.cFileName); - if (FindNextFile(pInfo->hFind, &pInfo->find_data) == 0) + if (FindNextFileW(pInfo->hFind, &pInfo->find_data) == 0) { pInfo->find_data.cFileName[0] = 0; } diff --git a/src/windows/CommonAPIImpl_windows.cpp b/src/windows/CommonAPIImpl_windows.cpp index 4fd49129..e4af2bdb 100644 --- a/src/windows/CommonAPIImpl_windows.cpp +++ b/src/windows/CommonAPIImpl_windows.cpp @@ -34,7 +34,7 @@ void PluginAPI::FindPluginPath(wchar_t * _strPath) { if (_strPath == NULL) return; - ::GetModuleFileName((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE); + ::GetModuleFileNameW((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE); std::wstring pluginPath(_strPath); std::replace(pluginPath.begin(), pluginPath.end(), L'\\', L'/'); std::wstring::size_type pos = pluginPath.find_last_of(L"/");