1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 03:10:07 +00:00

little fixes

This commit is contained in:
aap 2021-01-08 13:51:50 +01:00
parent ec61964bce
commit 223b49e3be
3 changed files with 11 additions and 2 deletions

View file

@ -241,7 +241,7 @@ CFileMgr::SetDirMyDocuments(void)
} }
ssize_t 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; int fd;
ssize_t n, len; ssize_t n, len;
@ -257,6 +257,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
return -1; return -1;
#endif #endif
len += n; len += n;
assert(len < maxlen);
}while(n == 0x4000); }while(n == 0x4000);
buf[len] = 0; buf[len] = 0;
myfclose(fd); myfclose(fd);

View file

@ -9,7 +9,7 @@ public:
static void ChangeDir(const char *dir); static void ChangeDir(const char *dir);
static void SetDir(const char *dir); static void SetDir(const char *dir);
static void SetDirMyDocuments(void); 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, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); } static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file); static int OpenFileForWriting(const char *file);

View file

@ -509,10 +509,18 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
mi = CModelInfo::GetModelInfo(streamId); mi = CModelInfo::GetModelInfo(streamId);
// Txd has to be loaded // Txd has to be loaded
#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){ if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil){
#endif
debug("failed to load %s because TXD %s is not in memory\n", mi->GetName(), CTxdStore::GetTxdName(mi->GetTxdSlot())); debug("failed to load %s because TXD %s is not in memory\n", mi->GetName(), CTxdStore::GetTxdName(mi->GetTxdSlot()));
RemoveModel(streamId); RemoveModel(streamId);
#ifndef FIX_BUGS
// if we're just waiting for it to load, don't remove this
RemoveTxd(mi->GetTxdSlot()); RemoveTxd(mi->GetTxdSlot());
#endif
ReRequestModel(streamId); ReRequestModel(streamId);
RwStreamClose(stream, &mem); RwStreamClose(stream, &mem);
return false; return false;