mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Ports: Add GemRB
GemRB is an open-source implementation of the Infinity engine by Bioware, used in some of their classic role-playing games.
This commit is contained in:
parent
b789debe07
commit
9be9bf3379
Notes:
sideshowbarker
2024-07-17 00:31:47 +09:00
Author: https://github.com/janso3 Commit: https://github.com/SerenityOS/serenity/commit/9be9bf3379 Pull-request: https://github.com/SerenityOS/serenity/pull/17428
@ -75,6 +75,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n
|
||||
| [`gawk`](gawk/) | GNU awk | 5.2.1 | https://www.gnu.org/software/gawk/ |
|
||||
| [`gcc`](gcc/) | GNU Compiler Collection | 12.2.0 | https://gcc.gnu.org/ |
|
||||
| [`gdb`](gdb/) | GNU Project Debugger | 11.2 | https://sourceware.org/gdb |
|
||||
| [`gemrb`](gemrb/) | GemRB | 0.9.1 | https://gemrb.org/ |
|
||||
| [`genemu`](genemu/) | Genesis / MegaDrive Emulator | e39f690 | https://github.com/rasky/genemu |
|
||||
| [`genext2fs`](genext2fs/) | genext2fs | 1.5.0 | https://github.com/bestouff/genext2fs |
|
||||
| [`gettext`](gettext/) | GNU gettext | 0.21 | https://www.gnu.org/software/gettext/ |
|
||||
|
40
Ports/gemrb/package.sh
Executable file
40
Ports/gemrb/package.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env -S bash ../.port_include.sh
|
||||
port='gemrb'
|
||||
version='0.9.1'
|
||||
useconfigure='true'
|
||||
files="https://github.com/gemrb/gemrb/archive/refs/tags/v${version}.tar.gz gemrb-${version}.tar.gz 6e5dbcf7398d5566751f434b0d4647196bfbe9a813e3b65ad6a4ee2f1bbfb9ba"
|
||||
auth_type='sha256'
|
||||
depends=(
|
||||
'freetype'
|
||||
'libiconv'
|
||||
'python3'
|
||||
'SDL2'
|
||||
'SDL2_mixer'
|
||||
'zlib'
|
||||
)
|
||||
configopts=(
|
||||
"-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt"
|
||||
"-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local/"
|
||||
'-DCMAKE_BUILD_TYPE=Release'
|
||||
'-DDISABLE_WERROR=1'
|
||||
'-DSTATIC_LINK=ON'
|
||||
'-DSDL_BACKEND=SDL2'
|
||||
)
|
||||
icon_file='artwork/gemrb-logo.ico'
|
||||
launcher_name='GemRB'
|
||||
launcher_category='Games'
|
||||
launcher_command='/usr/local/bin/gemrb'
|
||||
|
||||
configure() {
|
||||
mkdir -p "${PORT_BUILD_DIR}/gemrb-${version}-build"
|
||||
cd "${PORT_BUILD_DIR}/gemrb-${version}-build"
|
||||
cmake -G Ninja "${configopts[@]}" "${PORT_BUILD_DIR}/gemrb-${version}"
|
||||
}
|
||||
|
||||
build() {
|
||||
ninja -C "${PORT_BUILD_DIR}/gemrb-${version}-build"
|
||||
}
|
||||
|
||||
install() {
|
||||
ninja -C "${PORT_BUILD_DIR}/gemrb-${version}-build" install
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= <offenhaeuser@protonmail.com>
|
||||
Date: Sat, 11 Feb 2023 00:05:55 +0100
|
||||
Subject: [PATCH] Hard-code some paths for runtime purposes
|
||||
|
||||
GemRB uses the paths where its libraries and data are copied to during
|
||||
installation at runtime by generating a header. This does not work for
|
||||
us, as our paths change from compilation to runtime. The easiest fix for
|
||||
this is to hard-code these paths in the header file.
|
||||
---
|
||||
cmake/cmake_config.h.in | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/cmake/cmake_config.h.in b/cmake/cmake_config.h.in
|
||||
index 17584b33da6e9cc610d8be7d1a4f28b8b587844a..02a6214f4215723eb4c90b65f67aea6d508be193 100644
|
||||
--- a/cmake/cmake_config.h.in
|
||||
+++ b/cmake/cmake_config.h.in
|
||||
@@ -10,9 +10,9 @@
|
||||
#cmakedefine HAVE_MEMALIGN 1
|
||||
#cmakedefine HAVE_ALIGNED_MALLOC 1
|
||||
#cmakedefine HAVE_POSIX_MEMALIGN 1
|
||||
-#cmakedefine PLUGIN_DIR "${PLUGIN_DIR}"
|
||||
-#cmakedefine DATA_DIR "${DATA_DIR}"
|
||||
-#cmakedefine SYSCONF_DIR "${SYSCONF_DIR}"
|
||||
+#cmakedefine PLUGIN_DIR "/usr/local/lib/gemrb/plugins/"
|
||||
+#cmakedefine DATA_DIR "/usr/local/share/gemrb/"
|
||||
+#cmakedefine SYSCONF_DIR "/usr/local/etc/gemrb/"
|
||||
#cmakedefine NO_COLOR ${NOCOLOR}
|
||||
#cmakedefine OPENGL_BACKEND ${OPENGL_BACKEND}
|
||||
#cmakedefine NOFPSLIMIT ${NOFPSLIMIT}
|
@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= <offenhaeuser@protonmail.com>
|
||||
Date: Sat, 11 Feb 2023 00:34:13 +0100
|
||||
Subject: [PATCH] Create SDL2 renderer as unaccelerated
|
||||
|
||||
---
|
||||
gemrb/plugins/SDLVideo/SDL20Video.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gemrb/plugins/SDLVideo/SDL20Video.cpp b/gemrb/plugins/SDLVideo/SDL20Video.cpp
|
||||
index 36dc17caffc89bed2610d26d19e97290905bcf20..158ee2fe5eb1b396c1a63b1e7bc898bd1ae224fc 100644
|
||||
--- a/gemrb/plugins/SDLVideo/SDL20Video.cpp
|
||||
+++ b/gemrb/plugins/SDLVideo/SDL20Video.cpp
|
||||
@@ -139,7 +139,7 @@ int SDL20VideoDriver::CreateSDLDisplay(const char* title)
|
||||
SetWindowIcon(window);
|
||||
#endif
|
||||
|
||||
- renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_TARGETTEXTURE | SDL_RENDERER_ACCELERATED);
|
||||
+ renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_TARGETTEXTURE);
|
||||
SDL_RendererInfo info;
|
||||
SDL_GetRendererInfo(renderer, &info);
|
||||
Log(DEBUG, "SDL20Video", "Renderer: {}", info.name);
|
35
Ports/gemrb/patches/0003-Get-rid-of-swscanf-usage.patch
Normal file
35
Ports/gemrb/patches/0003-Get-rid-of-swscanf-usage.patch
Normal file
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= <offenhaeuser@protonmail.com>
|
||||
Date: Sat, 11 Feb 2023 00:52:51 +0100
|
||||
Subject: [PATCH] Get rid of swscanf() usage
|
||||
|
||||
This function is currently not implemented in our LibC.
|
||||
---
|
||||
gemrb/core/GUI/TextSystem/GemMarkup.cpp | 14 +++++++++++++-
|
||||
1 file changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gemrb/core/GUI/TextSystem/GemMarkup.cpp b/gemrb/core/GUI/TextSystem/GemMarkup.cpp
|
||||
index f0f604ccb0c3d37098976f0e05371fb4a1988a67..2741aa6cd6b27961ac9bcd11992cb6cef4fa2a9f 100644
|
||||
--- a/gemrb/core/GUI/TextSystem/GemMarkup.cpp
|
||||
+++ b/gemrb/core/GUI/TextSystem/GemMarkup.cpp
|
||||
@@ -25,7 +25,19 @@ namespace GemRB {
|
||||
static Color ParseColor(const String& colorString)
|
||||
{
|
||||
Color color = ColorWhite;
|
||||
- swscanf(colorString.c_str(), L"%02hhx%02hhx%02hhx%02hhx", &color.r, &color.g, &color.b, &color.a);
|
||||
+
|
||||
+ auto h2i = [](wchar_t c) -> int {
|
||||
+ if (c >= '0' && c <= '9') return c - '0';
|
||||
+ else if (c >= 'a' && c <='f') return c - 'a' + 10;
|
||||
+ else if (c >= 'A' && c <='F') return c - 'A' + 10;
|
||||
+ return 0;
|
||||
+ };
|
||||
+
|
||||
+ color.r = (h2i(colorString[0]) << 4) | h2i(colorString[1]);
|
||||
+ color.g = (h2i(colorString[2]) << 4) | h2i(colorString[3]);
|
||||
+ color.b = (h2i(colorString[4]) << 4) | h2i(colorString[5]);
|
||||
+ color.a = (h2i(colorString[6]) << 4) | h2i(colorString[7]);
|
||||
+
|
||||
return color;
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= <offenhaeuser@protonmail.com>
|
||||
Date: Sat, 11 Feb 2023 02:30:10 +0100
|
||||
Subject: [PATCH] Be a bit more lenient with matching savegame directories
|
||||
|
||||
Our sscanf() implementation failed to match this case. Making it more
|
||||
inclusive should be fine, since invalid savegame directories probably
|
||||
won't contain the right files anyway.
|
||||
---
|
||||
gemrb/core/SaveGameIterator.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/gemrb/core/SaveGameIterator.h b/gemrb/core/SaveGameIterator.h
|
||||
index 4d1550eddcd2f656205170131a04f570570430f9..e93b171123c68e41e607518e6c4ffc93e455f92d 100644
|
||||
--- a/gemrb/core/SaveGameIterator.h
|
||||
+++ b/gemrb/core/SaveGameIterator.h
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace GemRB {
|
||||
|
||||
-#define SAVEGAME_DIRECTORY_MATCHER "%d - %[A-Za-z0-9- _+*#%&|()=!?':;]"
|
||||
+#define SAVEGAME_DIRECTORY_MATCHER "%d - %s"
|
||||
|
||||
class GEM_EXPORT SaveGameIterator {
|
||||
private:
|
30
Ports/gemrb/patches/ReadMe.md
Normal file
30
Ports/gemrb/patches/ReadMe.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Patches for gemrb on SerenityOS
|
||||
|
||||
## `0001-Hard-code-some-paths-for-runtime-purposes.patch`
|
||||
|
||||
Hard-code some paths for runtime purposes
|
||||
|
||||
GemRB uses the paths where its libraries and data are copied to during
|
||||
installation at runtime by generating a header. This does not work for
|
||||
us, as our paths change from compilation to runtime. The easiest fix for
|
||||
this is to hard-code these paths in the header file.
|
||||
|
||||
## `0002-Create-SDL2-renderer-as-unaccelerated.patch`
|
||||
|
||||
Create SDL2 renderer as unaccelerated
|
||||
|
||||
|
||||
## `0003-Get-rid-of-swscanf-usage.patch`
|
||||
|
||||
Get rid of swscanf() usage
|
||||
|
||||
This function is currently not implemented in our LibC.
|
||||
|
||||
## `0004-Be-a-bit-more-lenient-with-matching-savegame-directo.patch`
|
||||
|
||||
Be a bit more lenient with matching savegame directories
|
||||
|
||||
Our sscanf() implementation failed to match this case. Making it more
|
||||
inclusive should be fine, since invalid savegame directories probably
|
||||
won't contain the right files anyway.
|
||||
|
Loading…
Reference in New Issue
Block a user