ladybird/Ports/openttd/patches/0002-Memory.patch

33 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gbeutner@serenityos.org>
Date: Sat, 17 Apr 2021 15:40:17 +0200
Subject: [PATCH] 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;
+#ifndef __serenity__
if (_spritecache_ptr == nullptr || (_allocated_sprite_cache_size != target_size && target_size != last_alloc_attempt)) {
delete[] reinterpret_cast<byte *>(_spritecache_ptr);
@@ -979,6 +980,10 @@ static void GfxInitSpriteCache()
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;