diff options
author | aap <aap@papnet.eu> | 2021-01-08 13:51:42 +0100 |
---|---|---|
committer | aap <aap@papnet.eu> | 2021-01-08 13:51:42 +0100 |
commit | 8be05679249367b39bcee1e07d6831d11918210b (patch) | |
tree | ab13259d150966afc431656d0db65c5870561c3d /src/core | |
parent | wtf (diff) | |
download | re3-8be05679249367b39bcee1e07d6831d11918210b.tar re3-8be05679249367b39bcee1e07d6831d11918210b.tar.gz re3-8be05679249367b39bcee1e07d6831d11918210b.tar.bz2 re3-8be05679249367b39bcee1e07d6831d11918210b.tar.lz re3-8be05679249367b39bcee1e07d6831d11918210b.tar.xz re3-8be05679249367b39bcee1e07d6831d11918210b.tar.zst re3-8be05679249367b39bcee1e07d6831d11918210b.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/FileMgr.cpp | 3 | ||||
-rw-r--r-- | src/core/FileMgr.h | 2 | ||||
-rw-r--r-- | src/core/Streaming.cpp | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/core/FileMgr.cpp b/src/core/FileMgr.cpp index 99923ddf..32aa4041 100644 --- a/src/core/FileMgr.cpp +++ b/src/core/FileMgr.cpp @@ -241,7 +241,7 @@ CFileMgr::SetDirMyDocuments(void) } ssize_t -CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode) +CFileMgr::LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode) { int fd; ssize_t n, len; @@ -257,6 +257,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode) return -1; #endif len += n; + assert(len < maxlen); }while(n == 0x4000); buf[len] = 0; myfclose(fd); diff --git a/src/core/FileMgr.h b/src/core/FileMgr.h index 98a78360..f70451b7 100644 --- a/src/core/FileMgr.h +++ b/src/core/FileMgr.h @@ -9,7 +9,7 @@ public: static void ChangeDir(const char *dir); static void SetDir(const char *dir); static void SetDirMyDocuments(void); - static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode); + static ssize_t LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode); static int OpenFile(const char *file, const char *mode); static int OpenFile(const char *file) { return OpenFile(file, "rb"); } static int OpenFileForWriting(const char *file); diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index 3e470fde..8a75b636 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -526,7 +526,12 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId) // Txd and anim have to be loaded int animId = mi->GetAnimFileIndex(); +#ifdef FIX_BUGS + if(!HasTxdLoaded(mi->GetTxdSlot()) || +#else + // texDict will exist even if only first part has loaded if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil || +#endif animId != -1 && !CAnimManager::GetAnimationBlock(animId)->isLoaded){ RemoveModel(streamId); ReRequestModel(streamId); |