Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Update openmw, change how patches are applied
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzz committed Apr 1, 2019
1 parent 8ec1845 commit 8e444da
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 33 deletions.
21 changes: 7 additions & 14 deletions buildscripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ set(OSG_FORK_VERSION ecedf3232c2f1b3b6a2f06f77ea37a9afb6a93f5)
set(OSG_FORK_HASH SHA256=254f0ce0e236aa80700877ee8664430c1f491be78ea1118bcd53178260edb4b5)

# https://github.com/OpenMW/openmw/commits/master
set(OPENMW_VERSION 14c93b3df0f998163fd010c56c0a868831dc7b66)
set(OPENMW_HASH SHA256=5fa863bad708ffd00102eee106ca7954292222255ea3ef4477f2f22a566ff976)
set(OPENMW_VERSION aacc275e9c70050d2c95893d46adb7d3e305705d)
set(OPENMW_HASH SHA256=a98c7f6b72524f7f233e3020eb625884bdcfa6ca8017f96b8dc3ff6248ff5176)

# End of configurable options

Expand Down Expand Up @@ -366,16 +366,8 @@ set(OSG_COMMON
-DOSG_GL_VERTEX_FUNCS_AVAILABLE=ON
-DOSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE=ON
-DOSG_GL_FIXED_FUNCTION_AVAILABLE=ON
-DDYNAMIC_OPENTHREADS=OFF
-DDYNAMIC_OPENSCENEGRAPH=OFF
-DBUILD_OSG_APPLICATIONS=OFF
-DBUILD_OSG_PLUGINS_BY_DEFAULT=OFF
-DBUILD_OSG_PLUGIN_OSG=ON
-DBUILD_OSG_PLUGIN_DDS=ON
-DBUILD_OSG_PLUGIN_TGA=ON
-DBUILD_OSG_PLUGIN_BMP=ON
-DBUILD_OSG_PLUGIN_JPEG=ON
-DBUILD_OSG_PLUGIN_PNG=ON
-DBUILD_OSG_DEPRECATED_SERIALIZERS=OFF
)

Expand Down Expand Up @@ -443,13 +435,14 @@ set(OPENMW_COMMON
)

set(OPENMW_PATCH
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw-revert-ui-dimensions.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw-add-simpler-collisions-option.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw-shadows-red-sky.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0001-loadingscreen-disable-for-now.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0002-scenemanager-disable-state-share-inc-compile.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0003-globalmap-fix-race-vs-savegame-load.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0004-getUVBuffer-pre-set-array-binding-to-avoid-thread-ra.patch
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0004-getUVBuffer-pre-set-array-binding-to-avoid-thread-ra.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0005-android-Revert-UI-dimensions.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0006-Add-an-option-to-enable-simple-bounding-box.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0007-android-Fix-red-sky-after-shadows-merge.patch &&
patch -d <SOURCE_DIR> -p1 -t -N < ${CMAKE_SOURCE_DIR}/patches/openmw/0008-Revert-Merge-pull-request-2238-from-Capostrophic-fre.patch
)

ExternalProject_Add(openmw_osg_mainline
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 80d183e9bbcd8dbb3bbd129b1551fff61da0bc01 Mon Sep 17 00:00:00 2001
From 11783d74a43b3b4f3c63341ae63f44259778c24b Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Sun, 10 Feb 2019 19:11:34 -0500
Subject: [PATCH 1/4] loadingscreen: disable for now
Subject: [PATCH 1/8] loadingscreen: disable for now

---
apps/openmw/mwgui/loadingscreen.cpp | 2 ++
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From f5c92393f41d6873ea34245207dd28466e6ebf13 Mon Sep 17 00:00:00 2001
From 8c70bbf13ebe03ae333b6de67201e4d4c163017c Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Sun, 10 Feb 2019 19:12:00 -0500
Subject: [PATCH 2/4] scenemanager: disable state share / inc compile
Subject: [PATCH 2/8] scenemanager: disable state share / inc compile

---
components/resource/scenemanager.cpp | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp
index 328a10cd1..ee68751a3 100644
index 61a40ee4b..dda385c73 100644
--- a/components/resource/scenemanager.cpp
+++ b/components/resource/scenemanager.cpp
@@ -526,9 +526,11 @@ namespace Resource
@@ -515,9 +515,11 @@ namespace Resource
// share state
// do this before optimizing so the optimizer will be able to combine nodes more aggressively
// note, because StateSets will be shared at this point, StateSets can not be modified inside the optimizer
Expand All @@ -23,17 +23,18 @@ index 328a10cd1..ee68751a3 100644

if (canOptimize(normalized))
{
@@ -540,8 +542,10 @@ namespace Resource
@@ -529,9 +531,11 @@ namespace Resource
optimizer.optimize(loaded, options);
}

+ #if 0
if (mIncrementalCompileOperation)
mIncrementalCompileOperation->add(loaded);
else
+ #endif
loaded->getBound();

mCache->addEntryToObjectCache(normalized, loaded);
return loaded;
--
2.19.2

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
From 864a22f03d6fb0440a07ebef25f4ab177f558eb2 Mon Sep 17 00:00:00 2001
From 31b2da5fa1bb9eace51beb53c053358965c52eaf Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Sun, 10 Feb 2019 19:16:45 -0500
Subject: [PATCH 3/4] globalmap: fix race vs savegame load
Subject: [PATCH 3/8] globalmap: fix race vs savegame load

---
apps/openmw/mwrender/globalmap.cpp | 2 ++
1 file changed, 2 insertions(+)

diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp
index d1b6cd239..aacc6fc5a 100644
index 57137d415..e4a7facc8 100644
--- a/apps/openmw/mwrender/globalmap.cpp
+++ b/apps/openmw/mwrender/globalmap.cpp
@@ -267,6 +267,8 @@ namespace MWRender
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 8a071b2ef2fe6157d5f9a694f4fa4290ee874716 Mon Sep 17 00:00:00 2001
From 168b2229b2ec27104bae0b8e875e49f8bdabaec5 Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Sun, 10 Feb 2019 19:31:34 -0500
Subject: [PATCH 4/4] getUVBuffer: pre-set array binding to avoid thread race
Subject: [PATCH 4/8] getUVBuffer: pre-set array binding to avoid thread race

---
components/terrain/buffercache.cpp | 1 +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
From 66a3cf382fbabb7a909d6202d3f89c4b22c9c98e Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Mon, 1 Apr 2019 13:32:32 -0400
Subject: [PATCH 5/8] android: Revert UI dimensions

---
files/settings-default.cfg | 92 +++++++++++++++++++-------------------
1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/files/settings-default.cfg b/files/settings-default.cfg
index 71a93d1a2c..6c2505f4e0 100644
index 353a3ac3d..6e7f31b4f 100644
--- a/files/settings-default.cfg
+++ b/files/settings-default.cfg
@@ -455,34 +455,34 @@ refraction scale = 1.0
@@ -477,34 +477,34 @@ refraction scale = 1.0
# screen size. (0.0 to 1.0). X & Y, Width & Height.

# Stats window displaying level, race, class, skills and stats.
Expand Down Expand Up @@ -53,7 +62,7 @@ index 71a93d1a2c..6c2505f4e0 100644

# Alchemy window for crafting potions.
alchemy x = 0.25
@@ -491,54 +491,54 @@ alchemy w = 0.5
@@ -513,54 +513,54 @@ alchemy w = 0.5
alchemy h = 0.5

# Console command window for debugging commands.
Expand Down Expand Up @@ -138,3 +147,6 @@ index 71a93d1a2c..6c2505f4e0 100644

[Navigator]

--
2.19.2

Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
From 3b848d7c0a20dafa3625a3c0ba0f23de62a08a12 Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Mon, 1 Apr 2019 13:32:49 -0400
Subject: [PATCH 6/8] Add an option to enable simple bounding box

---
apps/openmw/mwphysics/actor.cpp | 5 ++++-
files/settings-default.cfg | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/apps/openmw/mwphysics/actor.cpp b/apps/openmw/mwphysics/actor.cpp
index 632d32c26..6b5c115d4 100644
index 0f8814aca..5bcf01508 100644
--- a/apps/openmw/mwphysics/actor.cpp
+++ b/apps/openmw/mwphysics/actor.cpp
@@ -8,6 +8,7 @@
Expand Down Expand Up @@ -29,10 +39,10 @@ index 632d32c26..6b5c115d4 100644
mShape.reset(new btCapsuleShapeZ(mHalfExtents.x(), 2*mHalfExtents.z() - 2*mHalfExtents.x()));
mRotationallyInvariant = true;
diff --git a/files/settings-default.cfg b/files/settings-default.cfg
index db3d7e75b..3e08bbb0e 100644
index 6e7f31b4f..9293b6117 100644
--- a/files/settings-default.cfg
+++ b/files/settings-default.cfg
@@ -242,6 +242,9 @@ strength influences hand to hand = 0
@@ -258,6 +258,9 @@ strength influences hand to hand = 0
# Render holstered weapons (with quivers and scabbards), requires modded assets
weapon sheathing = false

Expand All @@ -42,3 +52,6 @@ index db3d7e75b..3e08bbb0e 100644
# Allow non-standard ammunition solely to bypass normal weapon resistance or weakness
only appropriate ammunition bypasses resistance = false

--
2.19.2

Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
From c5101e4c9ad30ec501a50e1866084f36dd1f2607 Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Mon, 1 Apr 2019 13:33:12 -0400
Subject: [PATCH 7/8] android: Fix red sky after shadows merge

---
components/sceneutil/shadow.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/components/sceneutil/shadow.cpp b/components/sceneutil/shadow.cpp
index a69fd8090..aa94e14d0 100644
--- a/components/sceneutil/shadow.cpp
Expand All @@ -10,3 +19,6 @@ index a69fd8090..aa94e14d0 100644
int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows");
int baseShadowTextureUnit = 8 - numberOfShadowMapsPerLight;

--
2.19.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 4f7acff35ec600280b083b5cc1edcea31e74222d Mon Sep 17 00:00:00 2001
From: Ilya Zhuravlev <[email protected]>
Date: Mon, 1 Apr 2019 14:01:14 -0400
Subject: [PATCH 8/8] Revert "Merge pull request #2238 from
Capostrophic/freetype"

This reverts commit 1f3813a2301edc17c132f07d360d8f00fe596c4d.
---
CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf489d99c..6aff462a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,7 +262,6 @@ include_directories(SYSTEM ${OPENSCENEGRAPH_INCLUDE_DIRS})
set(USED_OSG_PLUGINS
osgdb_bmp
osgdb_dds
- osgdb_freetype

This comment has been minimized.

Copy link
@akortunov

akortunov Mar 27, 2020

Can you tell why you disabled the FreeType plugin, which is needed for in-game profiler to work properly? Is it just to speedup a build time a bit, or it is a workaround for a some kind of bug?

This comment has been minimized.

Copy link
@xyzz

xyzz Mar 27, 2020

Author Owner

Freetype support in OSG isn't built. The reason is that OSG wants all dependencies for Android to live under 3rdparty. Then they have this file https://github.com/openscenegraph/OpenSceneGraph/blob/f2f22df8115aee710aa5429bf4965def3734edc7/CMakeModules/OsgAndroidMacroUtils.cmake which goes through 3rdparty and picks up the packages (instead of going through pkg-config or similar). Now, I'm not completely sure how they expect us to initialize 3rdparty, the only reference I can find is here http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/43-building-openscenegraph-for-android-3-0-2 which has a dead link to an archive presumably containing a bunch of random binaries (which as per their own docs only work for armeabi/v7a). So for every dependency I have to go and reverse engineer their amazing CMake macro file and figure out which variables I need to set so that it finds the deps from the prefix/{arm64,arm,x86,x86_64} instead. Back to freetype, it being missing didn't appear to break anything, so I never bothered fixing it.

This comment has been minimized.

Copy link
@akortunov

akortunov Mar 28, 2020

Now, I'm not completely sure how they expect us to initialize 3rdparty

I suppose they expect unpacked sources here, so in theory it should be possible just to unpack downloaded freetype sources to the 3rdparty/freetype before OSG configuring. By the way, OSG uses the 3rdparty dir not only for freetype, but for JPEG and PNG readers as well. I have no idea how images of such types are supposed to work in the port - while JPEG files are seem to be unused, PNG reader is used to store a global map and read normal maps for water. In theory, libjpeg's and libpng's sources should be present in related directories as well.

This comment has been minimized.

Copy link
@xyzz

xyzz Mar 28, 2020

Author Owner

In the repo you linked to they don't have just sources (in fact sources appear to be unused by their build process), but also the binaries in e.g. https://github.com/thahemp/osg-android/tree/master/3rdparty/build/freetype/obj/local/armeabi-v7a how they got there is a good question, regardless I'm not really interested in figuring out how their crappy build process works or adopting it.

I have no idea how images of such types are supposed to work in the port - while JPEG files are seem to be unused, PNG reader is used to store a global map and read normal maps for water. In theory, libjpeg's and libpng's sources should be present in related directories as well.

The header files are explicitly passed here

-DJPEG_INCLUDE_DIR=${prefix}/include/
-DPNG_INCLUDE_DIR=${prefix}/include/
, the libraries are linked to the final openmw library.

This comment has been minimized.

Copy link
@xyzz

xyzz Mar 28, 2020

Author Owner

I've added freetype back in f57c7c1, I don't see any difference in the profiler though...

osgdb_jpeg
osgdb_osg
osgdb_png
--
2.19.2

0 comments on commit 8e444da

Please sign in to comment.