diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-17 15:40:17 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-23 20:15:49 +0200 |
commit | ae32abffe9c75c130951b8b81097b56c3821ffdd (patch) | |
tree | 2f15cf04cac3b38234e734453d8af3819f78d98a /Ports/openttd/patches/memory.patch | |
parent | 4b3336507823328292fbcc8bc1a1cb726974a1a1 (diff) | |
download | serenity-ae32abffe9c75c130951b8b81097b56c3821ffdd.zip |
Ports: Add openttd
Diffstat (limited to 'Ports/openttd/patches/memory.patch')
-rw-r--r-- | Ports/openttd/patches/memory.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Ports/openttd/patches/memory.patch b/Ports/openttd/patches/memory.patch new file mode 100644 index 0000000000..68729bd13a --- /dev/null +++ b/Ports/openttd/patches/memory.patch @@ -0,0 +1,22 @@ +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 @@ + /* 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; + ++#ifndef __serenity__ + 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 @@ + ScheduleErrorMessage(msg); + } + } ++#else ++ _allocated_sprite_cache_size = target_size / 5; ++ _spritecache_ptr = reinterpret_cast<MemBlock *>(new byte[_allocated_sprite_cache_size]); ++#endif + + /* A big free block */ + _spritecache_ptr->size = (_allocated_sprite_cache_size - sizeof(MemBlock)) | S_FREE_MASK; |