From 72ae6921ea3fdeb1e1b0f6dd8322c9a6afbc3030 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 5 Apr 2021 00:53:04 -0700 Subject: [PATCH] Add FILESYSTEM_loadAssetToMemory() This is currently just a wrapper around FILESYSTEM_loadFileToMemory(), but assets are supposed to use this function instead of the regular one. --- desktop_version/src/FileSystemUtils.cpp | 13 +++++++++++++ desktop_version/src/FileSystemUtils.h | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index df41432f..e8b0ba4b 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -441,6 +441,19 @@ void FILESYSTEM_loadFileToMemory( PHYSFS_close(handle); } +void FILESYSTEM_loadAssetToMemory( + const char* name, + unsigned char** mem, + size_t* len, + const bool addnull +) { + const char* path; + + path = name; + + FILESYSTEM_loadFileToMemory(path, mem, len, addnull); +} + void FILESYSTEM_freeMemory(unsigned char **mem) { SDL_free(*mem); diff --git a/desktop_version/src/FileSystemUtils.h b/desktop_version/src/FileSystemUtils.h index 0e2fe794..ea6902ad 100644 --- a/desktop_version/src/FileSystemUtils.h +++ b/desktop_version/src/FileSystemUtils.h @@ -22,6 +22,12 @@ bool FILESYSTEM_isAssetMounted(const char* filename); void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem, size_t *len, bool addnull); +void FILESYSTEM_loadAssetToMemory( + const char* name, + unsigned char** mem, + size_t* len, + const bool addnull +); void FILESYSTEM_freeMemory(unsigned char **mem); bool FILESYSTEM_saveTiXml2Document(const char *name, tinyxml2::XMLDocument& doc); bool FILESYSTEM_loadTiXml2Document(const char *name, tinyxml2::XMLDocument& doc);