summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2019-10-30 00:14:59 +0100
committerSergeanur <s.anureev@yandex.ua>2019-10-30 00:14:59 +0100
commit74ca8bb608c93058e744105d44b874f77374fd59 (patch)
treebc7580af604f97f9a4944488eb742bd42af1f441
parentSmall CPad fixes (diff)
downloadre3-74ca8bb608c93058e744105d44b874f77374fd59.tar
re3-74ca8bb608c93058e744105d44b874f77374fd59.tar.gz
re3-74ca8bb608c93058e744105d44b874f77374fd59.tar.bz2
re3-74ca8bb608c93058e744105d44b874f77374fd59.tar.lz
re3-74ca8bb608c93058e744105d44b874f77374fd59.tar.xz
re3-74ca8bb608c93058e744105d44b874f77374fd59.tar.zst
re3-74ca8bb608c93058e744105d44b874f77374fd59.zip
-rw-r--r--src/core/ControllerConfig.cpp3
-rw-r--r--src/core/Frontend.cpp6
-rw-r--r--src/core/PCSave.h2
3 files changed, 7 insertions, 4 deletions
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index 30930a78..f0492b0f 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -16,6 +16,7 @@
#include "ModelIndices.h"
#include "Camera.h"
#include "win.h"
+#include "PCSave.h"
CControllerConfigManager &ControlsManager = *(CControllerConfigManager*)0x8F43A4;
@@ -75,7 +76,7 @@ void CControllerConfigManager::LoadSettings(int32 file)
char buff[29];
CFileMgr::Read(file, buff, sizeof(buff));
- if (!strcmp(buff, "THIS FILE IS NOT VALID YET"))
+ if (!strncmp(buff, TopLineEmptyFile, sizeof(TopLineEmptyFile)-1))
bValid = false;
else
CFileMgr::Seek(file, 0, 0);
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 984e693f..5911433c 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -1148,12 +1148,12 @@ void CMenuManager::LoadSettings()
CMBlur::BlurOn = true;
MousePointerStateHelper.bInvertVertically = true;
- static char Ver;
+ char Ver[50];
int fileHandle = CFileMgr::OpenFile("gta3.set", "r");
if (fileHandle) {
- CFileMgr::Read(fileHandle, (char*)&Ver, sizeof(Ver));
+ CFileMgr::Read(fileHandle, Ver, 29);
- if (strncmp(&Ver, "THIS FILE IS NOT VALID YET", 26)) {
+ if (strncmp(Ver, TopLineEmptyFile, sizeof(TopLineEmptyFile) - 1)) {
CFileMgr::Seek(fileHandle, 0, 0);
ControlsManager.LoadSettings(fileHandle);
CFileMgr::Read(fileHandle, gString, 20);
diff --git a/src/core/PCSave.h b/src/core/PCSave.h
index 696e158a..42239744 100644
--- a/src/core/PCSave.h
+++ b/src/core/PCSave.h
@@ -19,3 +19,5 @@ extern C_PcSave PcSaveHelper;
extern int *Slots;
extern int *SlotFileName;
extern int *SlotSaveDate;
+
+const char TopLineEmptyFile[] = "THIS FILE IS NOT VALID YET";