From 58180a2fcfeeed612c92c78b225c55ca849cee49 Mon Sep 17 00:00:00 2001 From: Manuel Alfayate Corchete Date: Sun, 10 May 2020 15:19:18 +0200 Subject: [PATCH 1/2] Star GLES in fullscreen without trying to set a new video mode. (#258) * In SDL2, do not try to change video mode when using GLES. * In SDL, build GLES2 version by default as its the most compatible (it can be changed in build.sh). --- src/platform/sdl2/build.sh | 4 ++-- src/platform/sdl2/main.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/platform/sdl2/build.sh b/src/platform/sdl2/build.sh index d11d39c..fd4046a 100755 --- a/src/platform/sdl2/build.sh +++ b/src/platform/sdl2/build.sh @@ -1,10 +1,10 @@ set -e # Use this compilation line to build SDL2/GLES version, GLES2 version. -#g++ -DSDL2_GLES -D_GAPI_GLES2 -std=c++11 `sdl2-config --cflags` -O3 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__SDL2__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o OpenLara `sdl2-config --libs` -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev +g++ -DSDL2_GLES -D_GAPI_GLES2 -std=c++11 `sdl2-config --cflags` -O3 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__SDL2__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o OpenLara `sdl2-config --libs` -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev # Use this compilation line to build SDL2/GLES version, GLES3, which is an extension to GLES2 so we use -lGLESv2, too. -g++ -DSDL2_GLES -std=c++11 `sdl2-config --cflags` -O3 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__SDL2__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o OpenLara `sdl2-config --libs` -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev +#g++ -DSDL2_GLES -std=c++11 `sdl2-config --cflags` -O3 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__SDL2__ main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o OpenLara `sdl2-config --libs` -lGLESv2 -lEGL -lm -lrt -lpthread -lasound -ludev # Use this compilation line to build SDL2/OpenGL version. #g++ -std=c++11 `sdl2-config --cflags` -O3 -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wl,--gc-sections -DNDEBUG -D__SDL2__ -D_SDL2_OPENGL main.cpp ../../libs/stb_vorbis/stb_vorbis.c ../../libs/minimp3/minimp3.cpp ../../libs/tinf/tinflate.c -I../../ -o OpenLara `sdl2-config --libs` -lGL -lm -lrt -lpthread -lasound -ludev diff --git a/src/platform/sdl2/main.cpp b/src/platform/sdl2/main.cpp index 42eca0f..f99cbd9 100644 --- a/src/platform/sdl2/main.cpp +++ b/src/platform/sdl2/main.cpp @@ -443,11 +443,15 @@ int main(int argc, char **argv) { SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - // We start in fullscreen mode using the vide mode currently in use, to avoid video mode changes. + /* In GLES, start in fullscreen mode using the vide mode currently in use. */ sdl_window = SDL_CreateWindow(WND_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - //sdl_displaymode.w, sdl_displaymode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP); - WIN_W, WIN_H, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN ); - +#ifdef _GAPI_GLES + sdl_displaymode.w, sdl_displaymode.h, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP +#else + WIN_W, WIN_H, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN +#endif + ); + // We try to use the current video mode, but we inform the core of whatever mode SDL2 gave us in the end. SDL_GetWindowSize(sdl_window, &w, &h); From 2cc2d74b7f99b98522597c42b40c0892c2194c3c Mon Sep 17 00:00:00 2001 From: Timur Gagiev Date: Sun, 17 May 2020 09:55:36 +0300 Subject: [PATCH 2/2] fix ios & osx builds --- src/gapi/gl.h | 2 +- .../ios/openlara.xcodeproj/project.pbxproj | 90 +++++++++++++++++-- .../osx/OpenLara.xcodeproj/project.pbxproj | 8 +- 3 files changed, 89 insertions(+), 11 deletions(-) diff --git a/src/gapi/gl.h b/src/gapi/gl.h index 13bcbb4..360d316 100644 --- a/src/gapi/gl.h +++ b/src/gapi/gl.h @@ -254,7 +254,7 @@ #undef GL_RG16F #undef GL_HALF_FLOAT - #define RG GL_RGBA + #define GL_RG GL_RGBA #define GL_RG16F GL_RGBA #define GL_RG32F GL_RGBA #define GL_RGBA32F GL_RGBA diff --git a/src/platform/ios/openlara.xcodeproj/project.pbxproj b/src/platform/ios/openlara.xcodeproj/project.pbxproj index 8c3b33e..dc6c576 100644 --- a/src/platform/ios/openlara.xcodeproj/project.pbxproj +++ b/src/platform/ios/openlara.xcodeproj/project.pbxproj @@ -10,7 +10,6 @@ 99266D7E160A568B003FFEBA /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99266D7D160A568B003FFEBA /* AudioToolbox.framework */; }; 99266D81160A5E7C003FFEBA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99266D80160A5E7C003FFEBA /* UIKit.framework */; }; 992B0783212BC0DA00B42DDC /* tinflate.c in Sources */ = {isa = PBXBuildFile; fileRef = 992B0782212BC0DA00B42DDC /* tinflate.c */; }; - 992B0786212BC39300B42DDC /* level in Resources */ = {isa = PBXBuildFile; fileRef = 992B0784212BC39200B42DDC /* level */; }; 992B0787212BC39300B42DDC /* audio in Resources */ = {isa = PBXBuildFile; fileRef = 992B0785212BC39300B42DDC /* audio */; }; 996585AF160A31450097B128 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 996585AE160A31450097B128 /* Foundation.framework */; }; 996585CB160A3A8B0097B128 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 996585C8160A3A8B0097B128 /* AppDelegate.mm */; }; @@ -21,13 +20,18 @@ 99CF06301E91505D0072E389 /* minimp3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 99CF062E1E91505D0072E389 /* minimp3.cpp */; }; 99CF06311E91505D0072E389 /* stb_vorbis.c in Sources */ = {isa = PBXBuildFile; fileRef = 99CF062F1E91505D0072E389 /* stb_vorbis.c */; }; 99CF06381E9193370072E389 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 99CF06231E9143C60072E389 /* Default-568h@2x.png */; }; + 99FE1DBD2471162300E3B247 /* DELDATA in Resources */ = {isa = PBXBuildFile; fileRef = 99FE1DBB2471162300E3B247 /* DELDATA */; }; + 99FE1DBE2471162300E3B247 /* FMV in Resources */ = {isa = PBXBuildFile; fileRef = 99FE1DBC2471162300E3B247 /* FMV */; }; + 99FE642A2471148E00E3B247 /* lang in Resources */ = {isa = PBXBuildFile; fileRef = 99FE641E2471148D00E3B247 /* lang */; }; + 99FE642B2471148E00E3B247 /* shaders in Resources */ = {isa = PBXBuildFile; fileRef = 99FE64222471148E00E3B247 /* shaders */; }; + 99FE642C2471148E00E3B247 /* gapi in Resources */ = {isa = PBXBuildFile; fileRef = 99FE64232471148E00E3B247 /* gapi */; }; + 99FE642E2471152700E3B247 /* PSXDATA in Resources */ = {isa = PBXBuildFile; fileRef = 99FE642D2471152700E3B247 /* PSXDATA */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 99266D7D160A568B003FFEBA /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 99266D80160A5E7C003FFEBA /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 992B0782212BC0DA00B42DDC /* tinflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tinflate.c; path = ../../libs/tinf/tinflate.c; sourceTree = ""; }; - 992B0784212BC39200B42DDC /* level */ = {isa = PBXFileReference; lastKnownFileType = folder; name = level; path = ../../../bin/level; sourceTree = ""; }; 992B0785212BC39300B42DDC /* audio */ = {isa = PBXFileReference; lastKnownFileType = folder; name = audio; path = ../../../bin/audio; sourceTree = ""; }; 996585A8160A31450097B128 /* OpenLara.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenLara.app; sourceTree = BUILT_PRODUCTS_DIR; }; 996585AE160A31450097B128 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -63,7 +67,6 @@ 99CF061A1E9140630072E389 /* sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sound.h; path = ../../sound.h; sourceTree = ""; }; 99CF061B1E9140630072E389 /* sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sprite.h; path = ../../sprite.h; sourceTree = ""; }; 99CF061C1E9140630072E389 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = texture.h; path = ../../texture.h; sourceTree = ""; }; - 99CF061D1E9140630072E389 /* trigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = trigger.h; path = ../../trigger.h; sourceTree = ""; }; 99CF061E1E9140630072E389 /* ui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ui.h; path = ../../ui.h; sourceTree = ""; }; 99CF061F1E9140630072E389 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = utils.h; path = ../../utils.h; sourceTree = ""; }; 99CF06231E9143C60072E389 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; @@ -72,6 +75,23 @@ 99CF062F1E91505D0072E389 /* stb_vorbis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../libs/stb_vorbis/stb_vorbis.c; sourceTree = ""; }; 99CF06331E9154170072E389 /* LEVEL2.PSX */ = {isa = PBXFileReference; lastKnownFileType = file; path = LEVEL2.PSX; sourceTree = ""; }; 99CF06341E9154170072E389 /* 05.ogg */ = {isa = PBXFileReference; lastKnownFileType = file; path = 05.ogg; sourceTree = ""; }; + 99FE1DBB2471162300E3B247 /* DELDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DELDATA; path = ../../../bin/DELDATA; sourceTree = ""; }; + 99FE1DBC2471162300E3B247 /* FMV */ = {isa = PBXFileReference; lastKnownFileType = folder; name = FMV; path = ../../../bin/FMV; sourceTree = ""; }; + 99FE641C2471148D00E3B247 /* gameflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gameflow.h; path = ../../gameflow.h; sourceTree = ""; }; + 99FE641D2471148D00E3B247 /* gltf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gltf.h; path = ../../gltf.h; sourceTree = ""; }; + 99FE641E2471148D00E3B247 /* lang */ = {isa = PBXFileReference; lastKnownFileType = folder; name = lang; path = ../../lang; sourceTree = ""; }; + 99FE641F2471148D00E3B247 /* json.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = json.h; path = ../../json.h; sourceTree = ""; }; + 99FE64202471148D00E3B247 /* lang.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lang.h; path = ../../lang.h; sourceTree = ""; }; + 99FE64212471148D00E3B247 /* objects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = objects.h; path = ../../objects.h; sourceTree = ""; }; + 99FE64222471148E00E3B247 /* shaders */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shaders; path = ../../shaders; sourceTree = ""; }; + 99FE64232471148E00E3B247 /* gapi */ = {isa = PBXFileReference; lastKnownFileType = folder; name = gapi; path = ../../gapi; sourceTree = ""; }; + 99FE64242471148E00E3B247 /* napi_socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = napi_socket.h; path = ../../napi_socket.h; sourceTree = ""; }; + 99FE64252471148E00E3B247 /* extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = extension.h; path = ../../extension.h; sourceTree = ""; }; + 99FE64262471148E00E3B247 /* napi_dummy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = napi_dummy.h; path = ../../napi_dummy.h; sourceTree = ""; }; + 99FE64272471148E00E3B247 /* network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = network.h; path = ../../network.h; sourceTree = ""; }; + 99FE64282471148E00E3B247 /* savegame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = savegame.h; path = ../../savegame.h; sourceTree = ""; }; + 99FE64292471148E00E3B247 /* video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = video.h; path = ../../video.h; sourceTree = ""; }; + 99FE642D2471152700E3B247 /* PSXDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = PSXDATA; path = ../../../bin/PSXDATA; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -93,8 +113,10 @@ 9965859D160A31450097B128 = { isa = PBXGroup; children = ( + 99FE1DBB2471162300E3B247 /* DELDATA */, + 99FE1DBC2471162300E3B247 /* FMV */, + 99FE642D2471152700E3B247 /* PSXDATA */, 992B0785212BC39300B42DDC /* audio */, - 992B0784212BC39200B42DDC /* level */, 992B0782212BC0DA00B42DDC /* tinflate.c */, 996585CD160A3AC50097B128 /* src */, 996585B8160A31450097B128 /* main.m */, @@ -145,6 +167,20 @@ 996585CD160A3AC50097B128 /* src */ = { isa = PBXGroup; children = ( + 99FE64252471148E00E3B247 /* extension.h */, + 99FE641C2471148D00E3B247 /* gameflow.h */, + 99FE64232471148E00E3B247 /* gapi */, + 99FE641D2471148D00E3B247 /* gltf.h */, + 99FE641F2471148D00E3B247 /* json.h */, + 99FE641E2471148D00E3B247 /* lang */, + 99FE64202471148D00E3B247 /* lang.h */, + 99FE64262471148E00E3B247 /* napi_dummy.h */, + 99FE64242471148E00E3B247 /* napi_socket.h */, + 99FE64272471148E00E3B247 /* network.h */, + 99FE64212471148D00E3B247 /* objects.h */, + 99FE64282471148E00E3B247 /* savegame.h */, + 99FE64222471148E00E3B247 /* shaders */, + 99FE64292471148E00E3B247 /* video.h */, 99CF062E1E91505D0072E389 /* minimp3.cpp */, 99CF062F1E91505D0072E389 /* stb_vorbis.c */, 99CF06281E9145EC0072E389 /* shaders */, @@ -169,7 +205,6 @@ 99CF061A1E9140630072E389 /* sound.h */, 99CF061B1E9140630072E389 /* sprite.h */, 99CF061C1E9140630072E389 /* texture.h */, - 99CF061D1E9140630072E389 /* trigger.h */, 99CF061E1E9140630072E389 /* ui.h */, 99CF061F1E9140630072E389 /* utils.h */, ); @@ -217,6 +252,44 @@ hasScannedForEncodings = 0; knownRegions = ( en, + ar, + ca, + cs, + da, + de, + el, + en_AU, + en_GB, + es, + es_419, + fi, + fr, + fr_CA, + he, + hi, + hr, + hu, + id, + it, + ja, + ko, + ms, + nl, + no, + pl, + pt, + pt_PT, + ro, + ru, + sk, + sv, + th, + tr, + uk, + vi, + zh_CN, + zh_HK, + zh_TW, ); mainGroup = 9965859D160A31450097B128; productRefGroup = 996585A9160A31450097B128 /* Products */; @@ -233,8 +306,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 992B0786212BC39300B42DDC /* level in Resources */, + 99FE642E2471152700E3B247 /* PSXDATA in Resources */, + 99FE1DBD2471162300E3B247 /* DELDATA in Resources */, + 99FE642C2471148E00E3B247 /* gapi in Resources */, 992B0787212BC39300B42DDC /* audio in Resources */, + 99FE1DBE2471162300E3B247 /* FMV in Resources */, + 99FE642A2471148E00E3B247 /* lang in Resources */, + 99FE642B2471148E00E3B247 /* shaders in Resources */, 99CF06381E9193370072E389 /* Default-568h@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj index d48ef40..78f6106 100644 --- a/src/platform/osx/OpenLara.xcodeproj/project.pbxproj +++ b/src/platform/osx/OpenLara.xcodeproj/project.pbxproj @@ -59,10 +59,10 @@ 99713CC8204CAD9900006FAC /* tinflate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = tinflate.c; path = ../../libs/tinf/tinflate.c; sourceTree = ""; }; 9975BF0A21E9F5D300F13342 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = SOURCE_ROOT; }; 99BF38CC21E7176900D90A38 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = ""; }; - 99BF38CE21E7202500D90A38 /* audio */ = {isa = PBXFileReference; lastKnownFileType = folder; name = audio; path = ../../../../Desktop/OpenLara_TR1/audio; sourceTree = ""; }; - 99BF38CF21E7202500D90A38 /* DELDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DELDATA; path = ../../../../Desktop/OpenLara_TR1/DELDATA; sourceTree = ""; }; - 99BF38D021E7202500D90A38 /* PSXDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = PSXDATA; path = ../../../../Desktop/OpenLara_TR1/PSXDATA; sourceTree = ""; }; - 99BF38D121E7202500D90A38 /* FMV */ = {isa = PBXFileReference; lastKnownFileType = folder; name = FMV; path = ../../../../Desktop/OpenLara_TR1/FMV; sourceTree = ""; }; + 99BF38CE21E7202500D90A38 /* audio */ = {isa = PBXFileReference; lastKnownFileType = folder; name = audio; path = ../../../bin/audio; sourceTree = ""; }; + 99BF38CF21E7202500D90A38 /* DELDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DELDATA; path = ../../../bin/DELDATA; sourceTree = ""; }; + 99BF38D021E7202500D90A38 /* PSXDATA */ = {isa = PBXFileReference; lastKnownFileType = folder; name = PSXDATA; path = ../../../bin/PSXDATA; sourceTree = ""; }; + 99BF38D121E7202500D90A38 /* FMV */ = {isa = PBXFileReference; lastKnownFileType = folder; name = FMV; path = ../../../bin/FMV; sourceTree = ""; }; 99BFB69E1DCA7F1700E2E997 /* libs */ = {isa = PBXFileReference; lastKnownFileType = folder; name = libs; path = ../../libs; sourceTree = ""; }; 99BFB6A81DCA87BF00E2E997 /* stb_vorbis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = stb_vorbis.c; path = ../../libs/stb_vorbis/stb_vorbis.c; sourceTree = ""; }; 99BFB6AA1DCA87C500E2E997 /* minimp3.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = minimp3.cpp; path = ../../libs/minimp3/minimp3.cpp; sourceTree = ""; };