From ad0db0de862d09e6172d9953426ae465b7aee4e3 Mon Sep 17 00:00:00 2001 From: "andrey.zhirnov" Date: Tue, 30 Jul 2019 11:47:24 +0300 Subject: [PATCH] use vfs for spine --- .../high/assets/spine_model_asset.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sources/enduro2d/high/assets/spine_model_asset.cpp b/sources/enduro2d/high/assets/spine_model_asset.cpp index d0eda81f..a84628ee 100644 --- a/sources/enduro2d/high/assets/spine_model_asset.cpp +++ b/sources/enduro2d/high/assets/spine_model_asset.cpp @@ -5,11 +5,12 @@ ******************************************************************************/ #include - #include #include #include +#include + #include #include @@ -191,8 +192,24 @@ void _spAtlasPage_disposeTexture (spAtlasPage* self) { } char* _spUtil_readFile (const char* path, int* length) { - E2D_ASSERT(false); - return _spReadFile(path, length); + try { + input_stream_uptr stream = the().read(url(path)); + if ( !stream ) { + throw; + } + size_t size = stream->length(); + char* data = MALLOC(char, size); + size_t readn = 0; + + for ( ; readn < size; ) { + readn += stream->read(data + readn, size - readn); + } + *length = math::numeric_cast(readn); + return data; + } catch(...) { + the().error("SPINE: Failed to read file"); + } + return nullptr; } namespace e2d