From 1d51734d0bf73e3febc2afb2fe1ed8b40038f241 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 3 Jul 2021 15:33:40 +0300 Subject: Fix Mac M1 premake --- premake5.lua | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/premake5.lua b/premake5.lua index af41a5a3..69090d49 100644 --- a/premake5.lua +++ b/premake5.lua @@ -147,12 +147,18 @@ workspace "reVC" filter { "platforms:*arm*" } architecture "ARM" - filter { "platforms:macosx-arm64-*" } + filter { "platforms:macosx-arm64-*", "files:**.cpp"} buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" } - filter { "platforms:macosx-amd64-*" } + filter { "platforms:macosx-arm64-*", "files:**.c"} + buildoptions { "-target", "arm64-apple-macos11" } + + filter { "platforms:macosx-amd64-*", "files:**.cpp"} buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" } + filter { "platforms:macosx-amd64-*", "files:**.c"} + buildoptions { "-target", "x86_64-apple-macos10.12" } + filter { "platforms:*librw_d3d9*" } defines { "RW_D3D9" } if(not _OPTIONS["with-librw"]) then @@ -212,13 +218,19 @@ project "librw" includedirs { "/usr/local/include" } libdirs { "/usr/local/lib" } - filter "platforms:macosx*" - -- Support MacPorts and Homebrew + -- Support MacPorts and Homebrew + filter "platforms:macosx-arm64-*" + includedirs { "/opt/local/include" } + includedirs {"/opt/homebrew/include" } + libdirs { "/opt/local/lib" } + libdirs { "/opt/homebrew/lib" } + + filter "platforms:macosx-amd64-*" includedirs { "/opt/local/include" } includedirs {"/usr/local/include" } libdirs { "/opt/local/lib" } libdirs { "/usr/local/lib" } - + filter "platforms:*gl3_glfw*" staticruntime "off" @@ -375,6 +387,12 @@ project "reVC" filter "platforms:macosx*oal" links { "openal", "mpg123", "sndfile", "pthread" } + + filter "platforms:macosx-arm64-*oal" + includedirs { "/opt/homebrew/opt/openal-soft/include" } + libdirs { "/opt/homebrew/opt/openal-soft/lib" } + + filter "platforms:macosx-amd64-*oal" includedirs { "/usr/local/opt/openal-soft/include" } libdirs { "/usr/local/opt/openal-soft/lib" } @@ -426,10 +444,18 @@ project "reVC" includedirs { "/usr/local/include" } libdirs { "/usr/local/lib" } - filter "platforms:macosx*gl3_glfw*" + filter "platforms:macosx-arm64-*gl3_glfw*" links { "glfw" } linkoptions { "-framework OpenGL" } includedirs { "/opt/local/include" } - includedirs { "/usr/local/include" } + includedirs {"/opt/homebrew/include" } + libdirs { "/opt/local/lib" } + libdirs { "/opt/homebrew/lib" } + + filter "platforms:macosx-amd64-*gl3_glfw*" + links { "glfw" } + linkoptions { "-framework OpenGL" } + includedirs { "/opt/local/include" } + includedirs {"/usr/local/include" } libdirs { "/opt/local/lib" } libdirs { "/usr/local/lib" } -- cgit v1.2.3 From 3750124dcc12b4ffadeb37fb3ecdbf23fd21f4d3 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 3 Jul 2021 16:34:55 +0300 Subject: Add MacOS to Readme --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 444213c6..d6d9b524 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ In this repository you'll find the fully reversed source code for GTA III ([master](https://github.com/GTAmodding/re3/tree/master/) branch) and GTA VC ([miami](https://github.com/GTAmodding/re3/tree/miami/) branch). -It has been tested and works on Windows, Linux and FreeBSD, on x86, amd64, arm and arm64.\ +It has been tested and works on Windows, Linux, MacOS and FreeBSD, on x86, amd64, arm and arm64.\ Rendering is handled either by original RenderWare (D3D8) or the reimplementation [librw](https://github.com/aap/librw) (D3D9, OpenGL 2.1 or above, OpenGL ES 2.0 or above).\ Audio is done with MSS (using dlls from original GTA) or OpenAL. @@ -22,7 +22,7 @@ We cannot build for PS2 or Xbox yet. If you're interested in doing so, get in to - [Windows D3D9 64bit](https://nightly.link/GTAmodding/re3/workflows/reVC_msvc_amd64/miami/reVC_Release_win-amd64-librw_d3d9-oal.zip) - [Windows OpenGL 64bit](https://nightly.link/GTAmodding/re3/workflows/reVC_msvc_amd64/miami/reVC_Release_win-amd64-librw_gl3_glfw-oal.zip) - [Linux 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/miami/ubuntu-18.04-gl3.zip) - - [MacOS 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/miami/macos-latest-gl3.zip) + - [MacOS 64bit x86-64](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/miami/macos-latest-gl3.zip) - Extract the downloaded zip over your GTA VC directory and run reVC. The zip includes the gamefiles and in case of OpenAL the required dlls. ## Screenshots @@ -107,6 +107,12 @@ conan build .. -if build -bf build -pf package ``` +
MacOS Premake + +For MacOS using premake, proceed: [Building on MacOS](https://github.com/GTAmodding/re3/wiki/Building-on-MacOS) + +
+
FreeBSD For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD) -- cgit v1.2.3 From 70876d3cde319a586c3b9a8c74b97c0325278d21 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 3 Jul 2021 16:43:35 +0200 Subject: fix screenshot name --- src/core/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/main.cpp b/src/core/main.cpp index 74b896c6..e84c6eeb 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -379,7 +379,7 @@ DoRWStuffEndOfFrame(void) } #else if (CPad::GetPad(1)->GetLeftShockJustDown() || CPad::GetPad(0)->GetFJustDown(11)) { - sprintf(s, "screen_0%11lld.png", time(nil)); + sprintf(s, "screen_%011lld.png", time(nil)); RwGrabScreen(Scene.camera, s); } #endif -- cgit v1.2.3 From 10d7b303a55c89c2abe08d59acdd405e95ce9814 Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 3 Jul 2021 23:11:35 +0200 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6d9b524..759993a1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ We cannot build for PS2 or Xbox yet. If you're interested in doing so, get in to - [Windows OpenGL 64bit](https://nightly.link/GTAmodding/re3/workflows/reVC_msvc_amd64/miami/reVC_Release_win-amd64-librw_gl3_glfw-oal.zip) - [Linux 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/miami/ubuntu-18.04-gl3.zip) - [MacOS 64bit x86-64](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/miami/macos-latest-gl3.zip) -- Extract the downloaded zip over your GTA VC directory and run reVC. The zip includes the gamefiles and in case of OpenAL the required dlls. +- Extract the downloaded zip over your GTA VC directory and run reVC. The zip includes the binary, updated and additional gamefiles and in case of OpenAL the required dlls. ## Screenshots -- cgit v1.2.3 From 2029ac3d62929d808cba9c376854cf39b563be46 Mon Sep 17 00:00:00 2001 From: Adrian Graber Date: Sun, 4 Jul 2021 18:17:22 +0200 Subject: Update librw --- .github/workflows/build-cmake-conan.yml | 2 +- vendor/librw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-cmake-conan.yml b/.github/workflows/build-cmake-conan.yml index 8a447093..e331e00a 100644 --- a/.github/workflows/build-cmake-conan.yml +++ b/.github/workflows/build-cmake-conan.yml @@ -85,7 +85,7 @@ jobs: fi - name: "Export Playstation 2 CMake toolchain conan recipe" run: | - conan export vendor/librw/cmake/ps2toolchain ps2dev-cmaketoolchain/master@ + conan export vendor/librw/cmake/ps2/cmaketoolchain ps2dev-cmaketoolchain/master@ - name: "Export librw conan recipe" run: | conan export vendor/librw librw/master@ diff --git a/vendor/librw b/vendor/librw index af20de45..a5bc9723 160000 --- a/vendor/librw +++ b/vendor/librw @@ -1 +1 @@ -Subproject commit af20de45226f5152a035866da32517466e81142d +Subproject commit a5bc97232293250ae1bbd6ef6642532a541034ca -- cgit v1.2.3 From 0b27a3dc2343e17d88c47042ba1a359c5db65780 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 5 Jul 2021 19:00:34 +0200 Subject: fix cmake workflow --- .github/workflows/build-cmake-conan.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cmake-conan.yml b/.github/workflows/build-cmake-conan.yml index e331e00a..e5e80791 100644 --- a/.github/workflows/build-cmake-conan.yml +++ b/.github/workflows/build-cmake-conan.yml @@ -27,7 +27,7 @@ jobs: platform: 'gl3' gl3_gfxlib: 'glfw' audio: 'openal' -# - os: 'ubuntu-latest' +# - os: 'ubuntu-18.04' # platform: 'gl3' # gl3_gfxlib: 'sdl2' # audio: 'openal' @@ -63,8 +63,9 @@ jobs: python -m pip install conan conan config init conan config set log.print_run_commands=True - conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan - conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev + conan config set general.revisions_enabled=1 + conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan +# conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev - name: "Add os=playstation2 + gcc.version=3.2 to .conan/settings.yml" shell: python run: | -- cgit v1.2.3 From c5e896c4202e6518a31cf7edb5a4f9c8bfdb2dea Mon Sep 17 00:00:00 2001 From: mssx86 Date: Thu, 1 Jul 2021 20:12:28 +0300 Subject: fix: add missing limits.h includes to enable bulding on musl. --- src/core/CdStreamPosix.cpp | 1 + src/skel/crossplatform.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp index 30fe06a0..bc9129eb 100644 --- a/src/core/CdStreamPosix.cpp +++ b/src/core/CdStreamPosix.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #ifdef __linux__ #include diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h index 24c3fb4d..a073f854 100644 --- a/src/skel/crossplatform.h +++ b/src/skel/crossplatform.h @@ -1,4 +1,5 @@ #include +#include // This is the common include for platform/renderer specific skeletons(glfw.cpp, win.cpp etc.) and using cross platform things (like Windows directories wrapper, platform specific global arrays etc.) // Functions that's different on glfw and win but have same signature, should be located on platform.h. -- cgit v1.2.3 From 37a43ebf45d5e58352b34113b1826b3afba4be67 Mon Sep 17 00:00:00 2001 From: mssx86 Date: Thu, 1 Jul 2021 20:14:46 +0300 Subject: fix: printHash.sh; replace echo -n, check if $1 is set. --- printHash.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/printHash.sh b/printHash.sh index e7d6f018..213d9353 100755 --- a/printHash.sh +++ b/printHash.sh @@ -1,12 +1,14 @@ -#!/usr/bin/env bash - -> $1 - -echo -n "#define GIT_SHA1 \"" > $1 - -if (command -v "git" >/dev/null) then -git rev-parse --short HEAD | tr -d '\n' >> $1 +#!/usr/bin/env sh +if [ -z "${1}" ] + then + printf "%s\n" "Input the path to the file for writing the commit hash to." + else + printf "%s" "#define GIT_SHA1 \"" > $1 + + if (command -v "git" >/dev/null) then + git rev-parse --short HEAD | tr -d '\n' >> $1 + fi + + printf "%s\n" "\"" >> $1 + printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1 fi - -echo "\"" >> $1 -echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1 \ No newline at end of file -- cgit v1.2.3 From e6544a69834f6bf8c8b412d02d19c3b5c29f9178 Mon Sep 17 00:00:00 2001 From: withmorten Date: Wed, 7 Jul 2021 01:59:16 +0200 Subject: fix sampman_null build --- src/audio/sampman_null.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp index a5ed2889..af4c54ad 100644 --- a/src/audio/sampman_null.cpp +++ b/src/audio/sampman_null.cpp @@ -114,7 +114,7 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume) } void -cSampleManager::SetMusicMasterVolume(uint8 nVolume) +cSampleManager::SetMP3BoostVolume(uint8 nVolume) { } @@ -231,35 +231,35 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) void cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) { - ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } void cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ) { - ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } void cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin) { - ASSERT( nChannel != CHANNEL2D ); + ASSERT( nChannel < MAXCHANNELS ); ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } void cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) { - ASSERT( nChannel == CHANNEL2D ); + ASSERT( nChannel >= MAXCHANNELS ); ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } void cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) { - ASSERT(nChannel == CHANNEL2D); + ASSERT( nChannel >= MAXCHANNELS ); ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } -- cgit v1.2.3 From 79c010f08275a7152e920bd0a9e3dbf6493f5b4c Mon Sep 17 00:00:00 2001 From: withmorten Date: Thu, 8 Jul 2021 01:44:55 +0200 Subject: fix macro redefinition warnings on win-glfw build --- src/audio/sampman_miles.cpp | 1 + src/control/Script.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index e8c28dc4..49f2f10f 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1,3 +1,4 @@ +#define WITHWINDOWS #include "common.h" #ifdef AUDIO_MSS diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 4b70a678..1eee1c9e 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2209,8 +2209,9 @@ int scriptToLoad = 0; const char *scriptfile = "main.scm"; #ifdef _WIN32 -#include +extern "C" __declspec(dllimport) short __stdcall GetAsyncKeyState(int); #endif + int open_script() { // glfwGetKey doesn't work because of CGame::Initialise is blocking -- cgit v1.2.3 From 72f67809059c732588ac29eedf8a10f9156b27b4 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 8 Jul 2021 03:37:14 +0300 Subject: Use CPad functions to check key states in script loader --- src/control/Script.cpp | 15 +++++---------- src/core/Frontend.cpp | 10 +--------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 1eee1c9e..76ab9471 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -2208,21 +2208,16 @@ void CRunningScript::Init() int scriptToLoad = 0; const char *scriptfile = "main.scm"; -#ifdef _WIN32 -extern "C" __declspec(dllimport) short __stdcall GetAsyncKeyState(int); -#endif - int open_script() { - // glfwGetKey doesn't work because of CGame::Initialise is blocking -#ifdef _WIN32 - if (GetAsyncKeyState('G') & 0x8000) + // glfwGetKey doesn't work because of CGame::Initialise is blocking + CPad::UpdatePads(); + if (CPad::GetPad(0)->GetChar('G')) scriptToLoad = 0; - if (GetAsyncKeyState('R') & 0x8000) + if (CPad::GetPad(0)->GetChar('R')) scriptToLoad = 1; - if (GetAsyncKeyState('D') & 0x8000) + if (CPad::GetPad(0)->GetChar('D')) scriptToLoad = 2; -#endif switch (scriptToLoad) { case 0: scriptfile = "main.scm"; break; case 1: scriptfile = "freeroam_miami.scm"; break; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 13db6b98..632a69ab 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -4558,19 +4558,11 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u #ifdef USE_DEBUG_SCRIPT_LOADER if (m_nCurrScreen == MENUPAGE_START_MENU || m_nCurrScreen == MENUPAGE_NEW_GAME || m_nCurrScreen == MENUPAGE_NEW_GAME_RELOAD) { -#ifdef RW_GL3 - if (glfwGetKey(PSGLOBAL(window), GLFW_KEY_R) == GLFW_PRESS) { + if (CPad::GetPad(0)->GetChar('R')) { scriptToLoad = 1; DoSettingsBeforeStartingAGame(); return; } -#elif defined _WIN32 - if (GetAsyncKeyState('R') & 0x8000) { - scriptToLoad = 1; - DoSettingsBeforeStartingAGame(); - return; - } -#endif } #endif -- cgit v1.2.3