From aaf0b6edbbda67c2414b4736b82a00e6fe4025f5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 26 Nov 2021 09:00:38 +0100 Subject: Allow reloading images, textures and memory mapped files --- src/system/MemoryMappedFile.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/system/MemoryMappedFile.cpp') 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, -- cgit v1.2.3