little fixes

This commit is contained in:
aap
2021-01-08 13:51:42 +01:00
parent 824ca7599c
commit 8be0567924
5 changed files with 12 additions and 4 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);