summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-29 18:08:54 +0200
committeraap <aap@papnet.eu>2020-04-29 18:24:25 +0200
commit804b022e671f11f2cf680862f2822444d6b66a5c (patch)
tree5fe1cd04456d0d5ca1adb674e4a2c9a01567869a /src/core
parentfor real this time (diff)
downloadre3-804b022e671f11f2cf680862f2822444d6b66a5c.tar
re3-804b022e671f11f2cf680862f2822444d6b66a5c.tar.gz
re3-804b022e671f11f2cf680862f2822444d6b66a5c.tar.bz2
re3-804b022e671f11f2cf680862f2822444d6b66a5c.tar.lz
re3-804b022e671f11f2cf680862f2822444d6b66a5c.tar.xz
re3-804b022e671f11f2cf680862f2822444d6b66a5c.tar.zst
re3-804b022e671f11f2cf680862f2822444d6b66a5c.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Frontend.cpp25
-rw-r--r--src/core/Frontend.h10
-rw-r--r--src/core/config.h1
3 files changed, 36 insertions, 0 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index a83bffce..e9ca1755 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -3038,7 +3038,24 @@ CMenuManager::LoadSettings()
if (strncmp(Ver, TopLineEmptyFile, sizeof(TopLineEmptyFile) - 1)) {
CFileMgr::Seek(fileHandle, 0, 0);
ControlsManager.LoadSettings(fileHandle);
+#ifdef IMPROVED_VIDEOMODE
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsWidth, sizeof(m_nPrefsWidth));
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsHeight, sizeof(m_nPrefsHeight));
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsDepth, sizeof(m_nPrefsDepth));
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsWindowed, sizeof(m_nPrefsWindowed));
+ CFileMgr::Read(fileHandle, (char*)&m_nPrefsSubsystem, sizeof(m_nPrefsSubsystem));
+ if(m_nPrefsWindowed != 0 && m_nPrefsWindowed != 1){
+ // garbage data from vanilla settings file
+ // let skeleton find something
+ m_nPrefsWidth = 0;
+ m_nPrefsHeight = 0;
+ m_nPrefsDepth = 0;
+ m_nPrefsWindowed = 0;
+ m_nPrefsSubsystem = 0;
+ }
+#else
CFileMgr::Read(fileHandle, gString, 20);
+#endif
CFileMgr::Read(fileHandle, gString, 20);
CFileMgr::Read(fileHandle, gString, 4);
CFileMgr::Read(fileHandle, gString, 4);
@@ -3120,7 +3137,15 @@ CMenuManager::SaveSettings()
int fileHandle = CFileMgr::OpenFile("gta3.set", "w+");
if (fileHandle) {
ControlsManager.SaveSettings(fileHandle);
+#ifdef IMPROVED_VIDEOMODE
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsWidth, sizeof(m_nPrefsWidth));
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsHeight, sizeof(m_nPrefsHeight));
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsDepth, sizeof(m_nPrefsDepth));
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsWindowed, sizeof(m_nPrefsWindowed));
+ CFileMgr::Write(fileHandle, (char*)&m_nPrefsSubsystem, sizeof(m_nPrefsSubsystem));
+#else
CFileMgr::Write(fileHandle, RubbishString, 20);
+#endif
CFileMgr::Write(fileHandle, RubbishString, 20);
CFileMgr::Write(fileHandle, RubbishString, 4);
CFileMgr::Write(fileHandle, RubbishString, 4);
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index c1284101..fc2c5235 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -533,6 +533,14 @@ public:
int32 m_nCurrSaveSlot;
int32 m_nScreenChangeDelayTimer;
+#ifdef IMPROVED_VIDEOMODE
+ int32 m_nPrefsWidth;
+ int32 m_nPrefsHeight;
+ int32 m_nPrefsDepth;
+ int32 m_nPrefsWindowed;
+ int32 m_nPrefsSubsystem;
+#endif
+
public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
@@ -645,7 +653,9 @@ public:
// uint8 GetNumberOfMenuOptions();
};
+#ifndef IMPROVED_VIDEOMODE
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
+#endif
extern CMenuManager FrontEndMenuManager;
extern unsigned long _dwOperatingSystemVersion; \ No newline at end of file
diff --git a/src/core/config.h b/src/core/config.h
index 163af701..01684afd 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -192,6 +192,7 @@ enum Config {
#define MORE_LANGUAGES // Add more translations to the game
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
+#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define USE_TEXTURE_POOL
//#define OPENAL