diff --git a/premake5.lua b/premake5.lua index acb15555..94f38ea9 100644 --- a/premake5.lua +++ b/premake5.lua @@ -77,6 +77,11 @@ workspace "reVC" "linux-arm-librw_gl3_glfw-oal", } + filter { "system:bsd" } + platforms { + "bsd-amd64-librw_gl3_glfw-oal" + } + filter "configurations:Debug" defines { "DEBUG" } @@ -90,6 +95,9 @@ workspace "reVC" filter { "platforms:linux*" } system "linux" + filter { "platforms:bsd*" } + system "bsd" + filter { "platforms:*x86*" } architecture "x86" @@ -147,6 +155,11 @@ project "librw" targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}" files { path.join(Librw, "src/*.*") } files { path.join(Librw, "src/*/*.*") } + + filter "platforms:bsd*" + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } + filter "platforms:*RW34*" flags { "ExcludeFromBuild" } filter {} @@ -259,6 +272,9 @@ project "reVC" filter "platforms:linux*oal" links { "openal", "mpg123", "sndfile", "pthread" } + + filter "platforms:bsd*oal" + links { "openal", "mpg123", "sndfile", "pthread" } if _OPTIONS["with-opus"] then filter {} @@ -307,3 +323,8 @@ project "reVC" filter "platforms:linux*gl3_glfw*" links { "GL", "GLEW", "glfw" } + + filter "platforms:bsd*gl3_glfw*" + links { "GL", "GLEW", "glfw", "sysinfo" } + includedirs { "/usr/local/include" } + libdirs { "/usr/local/lib" } diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index a2943aff..ffa4c456 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -587,16 +587,16 @@ cSampleManager::Initialise(void) } nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != NULL); + ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0); - if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == NULL ) + if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 ) { Terminate(); return false; } nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != NULL); + ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0); } diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index 45fd9832..e114a29a 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -150,9 +150,11 @@ CdStreamInit(int32 numChannels) ASSERT(0); return; } - +#ifdef __linux__ _gdwCdStreamFlags = O_RDONLY | O_NOATIME; - +#else + _gdwCdStreamFlags = O_RDONLY; +#endif // People say it's slower /* if ( fsInfo.f_bsize <= CDSTREAM_SECTOR_SIZE ) @@ -400,9 +402,12 @@ void *CdStreamThread(void *param) if (gCdStreamThreadStatus == 0){ gCdStreamThreadStatus = 1; #endif + +#ifdef __linux__ pid_t tid = syscall(SYS_gettid); int ret = setpriority(PRIO_PROCESS, tid, getpriority(PRIO_PROCESS, getpid()) + 1); - } +#endif + } // spurious wakeup or we sent interrupt signal for flushing if(pChannel->nSectorsToRead == 0) diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 9a4f2188..0d8361b8 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -213,7 +213,11 @@ double psTimer(void) { struct timespec start; +#ifdef __linux__ clock_gettime(CLOCK_MONOTONIC_RAW, &start); +#else + clock_gettime(CLOCK_MONOTONIC, &start); +#endif return start.tv_sec * 1000.0 + start.tv_nsec/1000000.0; } #endif diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index 75a3a7c9..f758a7fb 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -1863,7 +1863,11 @@ void PlayMovieInWindow(int cmdShow, const char* szFile) MultiByteToWideChar(CP_ACP, 0, szFile, -1, wFileName, sizeof(wFileName) - 1); // Initialize COM +#ifdef FIX_BUGS // will also return S_FALSE if it has already been inited in the same thread + CoInitialize(nil); +#else JIF(CoInitialize(nil)); +#endif // Get the interface for DirectShow's GraphBuilder JIF(CoCreateInstance(CLSID_FilterGraph, nil, CLSCTX_INPROC, @@ -2233,9 +2237,10 @@ WinMain(HINSTANCE instance, case GS_INIT_INTRO_MPEG: { +#ifndef NO_MOVIES CloseClip(); - CoUninitialize(); +#endif if ( FrontEndMenuManager.OS_Language == LANG_FRENCH || FrontEndMenuManager.OS_Language == LANG_GERMAN ) PlayMovieInWindow(cmdShow, "movies\\GTAtitlesGER.mpg"); @@ -2269,8 +2274,10 @@ WinMain(HINSTANCE instance, case GS_INIT_ONCE: { +#ifndef NO_MOVIES CloseClip(); CoUninitialize(); +#endif #ifdef FIX_BUGS // draw one frame because otherwise we'll end up looking at black screen for a while if vsync is on