From 0711bfacd451b8cbe59ae08efd595178e928f7dc Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 28 Jun 2019 21:24:22 +0200 Subject: fixed CFileMgr, the craziest bug i ever had --- src/FileMgr.cpp | 4 ++-- src/FileMgr.h | 2 +- src/main.cpp | 5 ----- src/re3.cpp | 2 ++ 4 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/FileMgr.cpp b/src/FileMgr.cpp index d4e0b89b..954fcdef 100644 --- a/src/FileMgr.cpp +++ b/src/FileMgr.cpp @@ -265,10 +265,10 @@ CFileMgr::Seek(int fd, int offset, int whence) return !!myfseek(fd, offset, whence); } -char* +bool CFileMgr::ReadLine(int fd, char *buf, int len) { - return myfgets(buf, len, fd); + return myfgets(buf, len, fd) != nil; } int diff --git a/src/FileMgr.h b/src/FileMgr.h index f67056f1..bab86e38 100644 --- a/src/FileMgr.h +++ b/src/FileMgr.h @@ -15,7 +15,7 @@ public: static int Read(int fd, char *buf, int len); static int Write(int fd, char *buf, int len); static bool Seek(int fd, int offset, int whence); - static char *ReadLine(int fd, char *buf, int len); + static bool ReadLine(int fd, char *buf, int len); static int CloseFile(int fd); static int GetErrorReadWrite(int fd); }; diff --git a/src/main.cpp b/src/main.cpp index 7b7c28e4..8835bee9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -90,17 +90,12 @@ void PrintGameVersion(); RwRGBA gColourTop; -#ifndef DEBUG -// This is the weirdest shit. In Debug this causes my game to crash in CPed::IsPedInControl shortly after level change void InitialiseGame(void) { LoadingScreen(nil, nil, "loadsc0"); CGame::Initialise("DATA\\GTA3.DAT"); } -#else -WRAPPER void InitialiseGame(void) { EAXJMP(0x48E7E0); } -#endif void Idle(void *arg) diff --git a/src/re3.cpp b/src/re3.cpp index ec4f4439..4bdb5469 100644 --- a/src/re3.cpp +++ b/src/re3.cpp @@ -344,6 +344,8 @@ patch() Patch(0x46BC61+6, 1.0f); // car distance InjectHook(0x59E460, printf, PATCH_JUMP); + InjectHook(0x475E00, printf, PATCH_JUMP); // _Error + // stolen from silentpatch (sorry) Patch(0x5382BF, 0x0EEB); -- cgit v1.2.3