summaryrefslogtreecommitdiff
path: root/Ports/openttd
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-05-16 22:55:50 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-05-19 20:17:10 +0430
commit32c380b7f9349562d9bcdbd8887763402ee3adea (patch)
treec34edbbb9ad62abec1199024c20fdb557b111b5a /Ports/openttd
parent2c71a62e0910d3d34b096124cd6997ac14926a8d (diff)
downloadserenity-32c380b7f9349562d9bcdbd8887763402ee3adea.zip
Ports: Update openttd's patches to use git patches
Diffstat (limited to 'Ports/openttd')
-rw-r--r--Ports/openttd/patches/0001-All-sorts-of-fixes-for-the-build.patch (renamed from Ports/openttd/patches/build-fixes.patch)68
-rw-r--r--Ports/openttd/patches/0002-Memory.patch (renamed from Ports/openttd/patches/memory.patch)24
-rw-r--r--Ports/openttd/patches/0003-Pass-setsockopt-argument-as-char.patch25
-rw-r--r--Ports/openttd/patches/0004-Stub-GetPerformanceTimer-to-return-0.patch28
-rw-r--r--Ports/openttd/patches/0005-Don-t-use-the-asm-version-of-rdtsc.patch25
-rw-r--r--Ports/openttd/patches/0006-Don-t-set-any-signal-handlers.patch25
-rw-r--r--Ports/openttd/patches/ReadMe.md34
-rw-r--r--Ports/openttd/patches/os_abstraction.patch11
-rw-r--r--Ports/openttd/patches/perf-timer.patch15
-rw-r--r--Ports/openttd/patches/rdtsc.patch12
-rw-r--r--Ports/openttd/patches/sighandler.patch12
11 files changed, 201 insertions, 78 deletions
diff --git a/Ports/openttd/patches/build-fixes.patch b/Ports/openttd/patches/0001-All-sorts-of-fixes-for-the-build.patch
index 191b4e363d..edb749645f 100644
--- a/Ports/openttd/patches/build-fixes.patch
+++ b/Ports/openttd/patches/0001-All-sorts-of-fixes-for-the-build.patch
@@ -1,7 +1,22 @@
-diff -Naur openttd-1.11.0/cmake/CompileFlags.cmake openttd-1.11.0.serenity/cmake/CompileFlags.cmake
---- openttd-1.11.0/cmake/CompileFlags.cmake 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/cmake/CompileFlags.cmake 2021-04-19 19:30:33.457232215 +0200
-@@ -158,7 +158,7 @@
+From e7cb850da0851c27197f39a2a6593c1c80981a6c Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Tue, 5 Apr 2022 23:05:14 +0200
+Subject: [PATCH 1/6] All sorts of fixes for the build
+
+Co-Authored-By: Kevin Nobel <kevin@2sk.nl>
+---
+ cmake/CompileFlags.cmake | 2 +-
+ src/network/core/host.cpp | 2 ++
+ src/network/core/os_abstraction.h | 3 ++-
+ src/os/unix/unix.cpp | 4 +++-
+ src/stdafx.h | 6 +++---
+ 5 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake
+index ad4a46a..50df38e 100644
+--- a/cmake/CompileFlags.cmake
++++ b/cmake/CompileFlags.cmake
+@@ -163,7 +163,7 @@ macro(compile_flags)
message(FATAL_ERROR "No warning flags are set for this compiler yet; please consider creating a Pull Request to add support for this compiler.")
endif()
@@ -10,10 +25,11 @@ diff -Naur openttd-1.11.0/cmake/CompileFlags.cmake openttd-1.11.0.serenity/cmake
# rdynamic is used to get useful stack traces from crash reports.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
endif()
-diff -Naur openttd-1.11.0/src/network/core/host.cpp openttd-1.11.0.serenity/src/network/core/host.cpp
---- openttd-1.11.0/src/network/core/host.cpp 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/network/core/host.cpp 2021-04-19 19:30:33.457232215 +0200
-@@ -147,6 +147,7 @@
+diff --git a/src/network/core/host.cpp b/src/network/core/host.cpp
+index b55f5f5..0ae76d3 100644
+--- a/src/network/core/host.cpp
++++ b/src/network/core/host.cpp
+@@ -82,6 +82,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // Wi
static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // !GETIFADDRS implementation
{
@@ -21,7 +37,7 @@ diff -Naur openttd-1.11.0/src/network/core/host.cpp openttd-1.11.0.serenity/src/
SOCKET sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock == INVALID_SOCKET) return;
-@@ -183,6 +184,7 @@
+@@ -118,6 +119,7 @@ static void NetworkFindBroadcastIPsInternal(NetworkAddressList *broadcast) // !G
}
closesocket(sock);
@@ -29,10 +45,11 @@ diff -Naur openttd-1.11.0/src/network/core/host.cpp openttd-1.11.0.serenity/src/
}
#endif /* all NetworkFindBroadcastIPsInternals */
-diff -Naur openttd-1.11.0/src/network/core/os_abstraction.h openttd-1.11.0.serenity/src/network/core/os_abstraction.h
---- openttd-1.11.0/src/network/core/os_abstraction.h 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/network/core/os_abstraction.h 2021-04-19 19:30:33.457232215 +0200
-@@ -59,13 +59,14 @@
+diff --git a/src/network/core/os_abstraction.h b/src/network/core/os_abstraction.h
+index 6bb6101..100678a 100644
+--- a/src/network/core/os_abstraction.h
++++ b/src/network/core/os_abstraction.h
+@@ -74,13 +74,14 @@ typedef unsigned long in_addr_t;
# include <unistd.h>
# include <sys/ioctl.h>
# include <sys/socket.h>
@@ -48,9 +65,10 @@ diff -Naur openttd-1.11.0/src/network/core/os_abstraction.h openttd-1.11.0.seren
/* If for any reason ifaddrs.h does not exist on your system, comment out
* the following two lines and an alternative way will be used to fetch
* the list of IPs from the system. */
-diff -Naur openttd-1.11.0/src/os/unix/unix.cpp openttd-1.11.0.serenity/src/os/unix/unix.cpp
---- openttd-1.11.0/src/os/unix/unix.cpp 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/os/unix/unix.cpp 2021-04-19 19:30:33.457232215 +0200
+diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp
+index 95d6fa1..3c7b567 100644
+--- a/src/os/unix/unix.cpp
++++ b/src/os/unix/unix.cpp
@@ -42,9 +42,11 @@
# define HAS_SYSCTL
#endif
@@ -63,7 +81,7 @@ diff -Naur openttd-1.11.0/src/os/unix/unix.cpp openttd-1.11.0.serenity/src/os/un
#ifdef HAS_SYSCTL
#include <sys/sysctl.h>
-@@ -84,7 +86,7 @@
+@@ -84,7 +86,7 @@ bool FiosGetDiskFreeSpace(const char *path, uint64 *tot)
if (statfs(path, &s) != 0) return false;
free = (uint64)s.f_bsize * s.f_bavail;
@@ -72,10 +90,11 @@ diff -Naur openttd-1.11.0/src/os/unix/unix.cpp openttd-1.11.0.serenity/src/os/un
struct statvfs s;
if (statvfs(path, &s) != 0) return false;
-diff -Naur openttd-1.11.0/src/stdafx.h openttd-1.11.0.serenity/src/stdafx.h
---- openttd-1.11.0/src/stdafx.h 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/stdafx.h 2021-04-19 20:08:30.758187723 +0200
-@@ -28,7 +28,7 @@
+diff --git a/src/stdafx.h b/src/stdafx.h
+index effd57c..98800f9 100644
+--- a/src/stdafx.h
++++ b/src/stdafx.h
+@@ -38,7 +38,7 @@
# define TROUBLED_INTS
#endif
@@ -84,7 +103,7 @@ diff -Naur openttd-1.11.0/src/stdafx.h openttd-1.11.0.serenity/src/stdafx.h
# include <strings.h> /* strncasecmp */
#endif
-@@ -107,7 +107,7 @@
+@@ -118,7 +118,7 @@
# define strcasecmp stricmp
#endif
@@ -93,7 +112,7 @@ diff -Naur openttd-1.11.0/src/stdafx.h openttd-1.11.0.serenity/src/stdafx.h
# include <alloca.h>
#endif
-@@ -307,7 +307,7 @@
+@@ -318,7 +318,7 @@
typedef unsigned char byte;
/* This is already defined in unix, but not in QNX Neutrino (6.x) or Cygwin. */
@@ -102,3 +121,6 @@ diff -Naur openttd-1.11.0/src/stdafx.h openttd-1.11.0.serenity/src/stdafx.h
typedef unsigned int uint;
#endif
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/memory.patch b/Ports/openttd/patches/0002-Memory.patch
index 68729bd13a..eeb0e33e3c 100644
--- a/Ports/openttd/patches/memory.patch
+++ b/Ports/openttd/patches/0002-Memory.patch
@@ -1,7 +1,18 @@
-diff -Naur openttd-1.11.0/src/spritecache.cpp openttd-1.11.0.serenity/src/spritecache.cpp
---- openttd-1.11.0/src/spritecache.cpp 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/spritecache.cpp 2021-04-18 21:03:15.916430052 +0200
-@@ -915,6 +915,7 @@
+From 1e9569da4e5b1855031495ca2455ed6fa186b3df Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sat, 17 Apr 2021 15:40:17 +0200
+Subject: [PATCH 2/6] Memory
+
+FIXME: There is no information available about this patch, fill this in.
+---
+ src/spritecache.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/src/spritecache.cpp b/src/spritecache.cpp
+index 6d5ce01..2fda8df 100644
+--- a/src/spritecache.cpp
++++ b/src/spritecache.cpp
+@@ -944,6 +944,7 @@ static void GfxInitSpriteCache()
/* Remember 'target_size' from the previous allocation attempt, so we do not try to reach the target_size multiple times in case of failure. */
static uint last_alloc_attempt = 0;
@@ -9,7 +20,7 @@ diff -Naur openttd-1.11.0/src/spritecache.cpp openttd-1.11.0.serenity/src/sprite
if (_spritecache_ptr == nullptr || (_allocated_sprite_cache_size != target_size && target_size != last_alloc_attempt)) {
delete[] reinterpret_cast<byte *>(_spritecache_ptr);
-@@ -950,6 +951,10 @@
+@@ -979,6 +980,10 @@ static void GfxInitSpriteCache()
ScheduleErrorMessage(msg);
}
}
@@ -20,3 +31,6 @@ diff -Naur openttd-1.11.0/src/spritecache.cpp openttd-1.11.0.serenity/src/sprite
/* A big free block */
_spritecache_ptr->size = (_allocated_sprite_cache_size - sizeof(MemBlock)) | S_FREE_MASK;
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/0003-Pass-setsockopt-argument-as-char.patch b/Ports/openttd/patches/0003-Pass-setsockopt-argument-as-char.patch
new file mode 100644
index 0000000000..0b937224e8
--- /dev/null
+++ b/Ports/openttd/patches/0003-Pass-setsockopt-argument-as-char.patch
@@ -0,0 +1,25 @@
+From 4e0667f3f744b6e7a8ad73581747122d617ea069 Mon Sep 17 00:00:00 2001
+From: Kevin Nobel <kevin@2sk.nl>
+Date: Tue, 5 Apr 2022 23:05:14 +0200
+Subject: [PATCH 3/6] Pass `setsockopt` argument as char*
+
+---
+ src/network/core/os_abstraction.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/network/core/os_abstraction.cpp b/src/network/core/os_abstraction.cpp
+index 225c95d..2da1575 100644
+--- a/src/network/core/os_abstraction.cpp
++++ b/src/network/core/os_abstraction.cpp
+@@ -172,7 +172,7 @@ bool SetReusePort(SOCKET d)
+ return setsockopt(d, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuse_port, sizeof(reuse_port)) == 0;
+ #else
+ int reuse_port = 1;
+- return setsockopt(d, SOL_SOCKET, SO_REUSEPORT, &reuse_port, sizeof(reuse_port)) == 0;
++ return setsockopt(d, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuse_port, sizeof(reuse_port)) == 0;
+ #endif
+ }
+
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/0004-Stub-GetPerformanceTimer-to-return-0.patch b/Ports/openttd/patches/0004-Stub-GetPerformanceTimer-to-return-0.patch
new file mode 100644
index 0000000000..ebd3fa9148
--- /dev/null
+++ b/Ports/openttd/patches/0004-Stub-GetPerformanceTimer-to-return-0.patch
@@ -0,0 +1,28 @@
+From 4a6442ab29becbd29418161635930a4d6d5d55e2 Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Thu, 29 Apr 2021 23:45:51 +0200
+Subject: [PATCH 4/6] Stub GetPerformanceTimer() to return 0
+
+---
+ src/framerate_gui.cpp | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp
+index 1077629..2d15c5b 100644
+--- a/src/framerate_gui.cpp
++++ b/src/framerate_gui.cpp
+@@ -222,8 +222,9 @@ namespace {
+ */
+ static TimingMeasurement GetPerformanceTimer()
+ {
+- using namespace std::chrono;
+- return (TimingMeasurement)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count();
++ //using namespace std::chrono;
++ //return (TimingMeasurement)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count();
++ return 0;
+ }
+
+
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/0005-Don-t-use-the-asm-version-of-rdtsc.patch b/Ports/openttd/patches/0005-Don-t-use-the-asm-version-of-rdtsc.patch
new file mode 100644
index 0000000000..0b20008c49
--- /dev/null
+++ b/Ports/openttd/patches/0005-Don-t-use-the-asm-version-of-rdtsc.patch
@@ -0,0 +1,25 @@
+From 4cf117000029c0620085bd273776dc704e6ebc91 Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sat, 17 Apr 2021 15:40:17 +0200
+Subject: [PATCH 5/6] Don't use the asm version of rdtsc
+
+---
+ src/cpu.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cpu.cpp b/src/cpu.cpp
+index d95c704..762da79 100644
+--- a/src/cpu.cpp
++++ b/src/cpu.cpp
+@@ -40,7 +40,7 @@ unsigned __int64 ottd_rdtsc();
+ #endif
+
+ /* rdtsc for all other *nix-en (hopefully). Use GCC syntax */
+-#if (defined(__i386__) || defined(__x86_64__)) && !defined(RDTSC_AVAILABLE)
++#if (defined(__i386__) || defined(__x86_64__)) && !defined(__serenity__) && !defined(RDTSC_AVAILABLE)
+ uint64 ottd_rdtsc()
+ {
+ uint32 high, low;
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/0006-Don-t-set-any-signal-handlers.patch b/Ports/openttd/patches/0006-Don-t-set-any-signal-handlers.patch
new file mode 100644
index 0000000000..5eac65248c
--- /dev/null
+++ b/Ports/openttd/patches/0006-Don-t-set-any-signal-handlers.patch
@@ -0,0 +1,25 @@
+From 42d2fd4d5ab2aa8883f3722c9008e7413980a755 Mon Sep 17 00:00:00 2001
+From: Gunnar Beutner <gbeutner@serenityos.org>
+Date: Sat, 17 Apr 2021 15:40:17 +0200
+Subject: [PATCH 6/6] Don't set any signal handlers
+
+---
+ src/os/unix/crashlog_unix.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp
+index fc3682d..32b5f1e 100644
+--- a/src/os/unix/crashlog_unix.cpp
++++ b/src/os/unix/crashlog_unix.cpp
+@@ -178,7 +178,7 @@ static void CDECL HandleCrash(int signum)
+ /* static */ void CrashLog::InitialiseCrashLog()
+ {
+ for (const int *i = _signals_to_handle; i != endof(_signals_to_handle); i++) {
+- signal(*i, HandleCrash);
++ //signal(*i, HandleCrash);
+ }
+ }
+
+--
+2.36.1
+
diff --git a/Ports/openttd/patches/ReadMe.md b/Ports/openttd/patches/ReadMe.md
new file mode 100644
index 0000000000..404fc4abdc
--- /dev/null
+++ b/Ports/openttd/patches/ReadMe.md
@@ -0,0 +1,34 @@
+# Patches for openttd on SerenityOS
+
+## `0001-All-sorts-of-fixes-for-the-build.patch`
+
+All sorts of fixes for the build
+
+
+
+## `0002-Memory.patch`
+
+Memory
+
+FIXME: There is no information available about this patch, fill this in.
+
+## `0003-Pass-setsockopt-argument-as-char.patch`
+
+Pass `setsockopt` argument as char*
+
+
+## `0004-Stub-GetPerformanceTimer-to-return-0.patch`
+
+Stub GetPerformanceTimer() to return 0
+
+
+## `0005-Don-t-use-the-asm-version-of-rdtsc.patch`
+
+Don't use the asm version of rdtsc
+
+
+## `0006-Don-t-set-any-signal-handlers.patch`
+
+Don't set any signal handlers
+
+
diff --git a/Ports/openttd/patches/os_abstraction.patch b/Ports/openttd/patches/os_abstraction.patch
deleted file mode 100644
index 5231823717..0000000000
--- a/Ports/openttd/patches/os_abstraction.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- openttd-12.1/src/network/core/os_abstraction_original.cpp 2022-03-31 15:13:24.270873422 +0200
-+++ openttd-12.1/src/network/core/os_abstraction.cpp 2022-03-31 15:14:01.978511406 +0200
-@@ -172,7 +172,7 @@
- return setsockopt(d, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuse_port, sizeof(reuse_port)) == 0;
- #else
- int reuse_port = 1;
-- return setsockopt(d, SOL_SOCKET, SO_REUSEPORT, &reuse_port, sizeof(reuse_port)) == 0;
-+ return setsockopt(d, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuse_port, sizeof(reuse_port)) == 0;
- #endif
- }
-
diff --git a/Ports/openttd/patches/perf-timer.patch b/Ports/openttd/patches/perf-timer.patch
deleted file mode 100644
index fb8535e21c..0000000000
--- a/Ports/openttd/patches/perf-timer.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -Naur openttd-1.11.0/src/framerate_gui.cpp openttd-1.11.0.serenity/src/framerate_gui.cpp
---- openttd-1.11.0/src/framerate_gui.cpp 2021-04-29 23:45:25.247427868 +0200
-+++ openttd-1.11.0.serenity/src/framerate_gui.cpp 2021-04-29 23:41:57.679926623 +0200
-@@ -222,8 +222,9 @@
- */
- static TimingMeasurement GetPerformanceTimer()
- {
-- using namespace std::chrono;
-- return (TimingMeasurement)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count();
-+ //using namespace std::chrono;
-+ //return (TimingMeasurement)time_point_cast<microseconds>(high_resolution_clock::now()).time_since_epoch().count();
-+ return 0;
- }
-
-
diff --git a/Ports/openttd/patches/rdtsc.patch b/Ports/openttd/patches/rdtsc.patch
deleted file mode 100644
index 24f85448f0..0000000000
--- a/Ports/openttd/patches/rdtsc.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur openttd-1.11.0/src/cpu.cpp openttd-1.11.0.serenity/src/cpu.cpp
---- openttd-1.11.0/src/cpu.cpp 2021-04-22 01:14:21.038920133 +0200
-+++ openttd-1.11.0.serenity/src/cpu.cpp 2021-04-22 01:13:56.638440518 +0200
-@@ -40,7 +40,7 @@
- #endif
-
- /* rdtsc for all other *nix-en (hopefully). Use GCC syntax */
--#if (defined(__i386__) || defined(__x86_64__)) && !defined(RDTSC_AVAILABLE)
-+#if (defined(__i386__) || defined(__x86_64__)) && !defined(__serenity__) && !defined(RDTSC_AVAILABLE)
- uint64 ottd_rdtsc()
- {
- uint32 high, low;
diff --git a/Ports/openttd/patches/sighandler.patch b/Ports/openttd/patches/sighandler.patch
deleted file mode 100644
index b9a2c3d38e..0000000000
--- a/Ports/openttd/patches/sighandler.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -Naur openttd-1.11.0/src/os/unix/crashlog_unix.cpp openttd-1.11.0.serenity/src/os/unix/crashlog_unix.cpp
---- openttd-1.11.0/src/os/unix/crashlog_unix.cpp 2021-04-01 14:33:44.000000000 +0200
-+++ openttd-1.11.0.serenity/src/os/unix/crashlog_unix.cpp 2021-04-18 21:40:06.426298674 +0200
-@@ -178,7 +178,7 @@
- /* static */ void CrashLog::InitialiseCrashLog()
- {
- for (const int *i = _signals_to_handle; i != endof(_signals_to_handle); i++) {
-- signal(*i, HandleCrash);
-+ //signal(*i, HandleCrash);
- }
- }
-