aboutsummaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-26 09:00:38 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-26 09:03:21 +0100
commitaaf0b6edbbda67c2414b4736b82a00e6fe4025f5 (patch)
treee1fb563f5fcc17209dedc9cc11b2dc328a77e6b4 /src/system
parent1d4cc1d1c2c4f6a574775914078c80cf496fc7de (diff)
Allow reloading images, textures and memory mapped files
Diffstat (limited to 'src/system')
-rw-r--r--src/system/MemoryMappedFile.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/system/MemoryMappedFile.cpp b/src/system/MemoryMappedFile.cpp
index 54f15c1..c823cb5 100644
--- a/src/system/MemoryMappedFile.cpp
+++ b/src/system/MemoryMappedFile.cpp
@@ -12,8 +12,12 @@ namespace mgl {
}
bool MemoryMappedFile::load(const char *filepath, LoadOptions load_options) {
- if(memory_mapped_file.fd != -1)
- return false;
+ if(memory_mapped_file.fd != -1) {
+ mgl_mapped_file_unload(&memory_mapped_file);
+ memory_mapped_file.data = nullptr;
+ memory_mapped_file.size = 0;
+ memory_mapped_file.fd = -1;
+ }
mgl_memory_mapped_file_load_options mapped_file_load_options = {
load_options.readable,