From 9240100697ae5123f1a512ff25383bceaec0d6f9 Mon Sep 17 00:00:00 2001
From: FunkyFr3sh <cc.red.alert.1@googlemail.com>
Date: Fri, 2 Jul 2021 00:22:01 +0200
Subject: [PATCH] add compatibility settings

---
 config/ConfigFormUnit.cpp | 198 ++++++++++++----
 config/ConfigFormUnit.dfm | 484 +++++++++++++++++++++++++-------------
 config/ConfigFormUnit.h   |  19 ++
 3 files changed, 494 insertions(+), 207 deletions(-)

diff --git a/config/ConfigFormUnit.cpp b/config/ConfigFormUnit.cpp
index 1dc9409..28891ea 100644
--- a/config/ConfigFormUnit.cpp
+++ b/config/ConfigFormUnit.cpp
@@ -45,41 +45,23 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
 
 	/* Display Settings */
 
-	auto s = LowerCase(ini->ReadString("ddraw", "windowed", "false"));
-	bool windowed = s == "true" || s == "yes" || s == "1";
-
-	s = LowerCase(ini->ReadString("ddraw", "fullscreen", "false"));
-	bool fullscreen = s == "true" || s == "yes" || s == "1";
-
-	s = LowerCase(ini->ReadString("ddraw", "nonexclusive", "false"));
-	bool nonexclusive = s == "true" || s == "yes" || s == "1";
-
+	bool windowed = GetBool(ini, "windowed", false);
+	bool fullscreen = GetBool(ini, "fullscreen", false);
 
 	if (windowed && fullscreen) {
-		PresentationCbx->ItemIndex = 2;
+		PresentationCbx->ItemIndex = 1;
 	}
 	else if (windowed) {
-		PresentationCbx->ItemIndex = 3;
-	}
-	else if (nonexclusive) {
-		PresentationCbx->ItemIndex = 1;
+		PresentationCbx->ItemIndex = 2;
 	}
 	else {
 		PresentationCbx->ItemIndex = 0;
 	}
 
-
-	s = LowerCase(ini->ReadString("ddraw", "maintas", "false"));
-	MaintasChk->State = s == "true" || s == "yes" || s == "1" ? tssOn : tssOff;
-
-	s = LowerCase(ini->ReadString("ddraw", "vsync", "false"));
-	VsyncChk->State = s == "true" || s == "yes" || s == "1" ? tssOn : tssOff;
-
-	s = LowerCase(ini->ReadString("ddraw", "adjmouse", "false"));
-	AdjmouseChk->State = s == "true" || s == "yes" || s == "1" ? tssOn : tssOff;
-
-	s = LowerCase(ini->ReadString("ddraw", "devmode", "false"));
-	DevmodeChk->State = s == "true" || s == "yes" || s == "1" ? tssOff : tssOn;
+	MaintasChk->State = GetBool(ini, "maintas", false) ? tssOn : tssOff;
+	VsyncChk->State = GetBool(ini, "vsync", false) ? tssOn : tssOff;
+	AdjmouseChk->State = GetBool(ini, "adjmouse", false) ? tssOn : tssOff;
+	DevmodeChk->State = GetBool(ini, "devmode", false) ? tssOff : tssOn;
 
 	/* Advanced Display Settings */
 
@@ -98,7 +80,6 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
 		RendererCbx->ItemIndex = 0;
 	}
 
-
 	try
 	{
 		TStringDynArray list = TDirectory::GetFiles(
@@ -116,19 +97,57 @@ void __fastcall TConfigForm::FormCreate(TObject *Sender)
 	{
 	}
 
-
 	int maxfps = ini->ReadInteger("ddraw", "maxfps", -1);
 	MaxfpsChk->State = maxfps != 0 ? tssOn : tssOff;
 
-	s = LowerCase(ini->ReadString("ddraw", "boxing", "false"));
-	BoxingChk->State = s == "true" || s == "yes" || s == "1" ? tssOn : tssOff;
-
-	s = LowerCase(ini->ReadString("ddraw", "border", "false"));
-	BorderChk->State = s == "true" || s == "yes" || s == "1" ? tssOn : tssOff;
+	BoxingChk->State = GetBool(ini, "boxing", false) ? tssOn : tssOff;
+	BorderChk->State = GetBool(ini, "border", false) ? tssOn : tssOff;
 
 	int savesettings = ini->ReadInteger("ddraw", "savesettings", 1);
 	SavesettingsChk->State = savesettings != 0 ? tssOn : tssOff;
 
+	/* Compatibility Settings */
+
+	int maxgameticks = ini->ReadInteger("ddraw", "maxgameticks", 0);
+
+	switch (maxgameticks) {
+	case -1:
+		MaxgameticksCbx->ItemIndex = 0;
+		break;
+	case -2:
+		MaxgameticksCbx->ItemIndex = 1;
+		break;
+	case 1000:
+		MaxgameticksCbx->ItemIndex = 3;
+		break;
+	case 500:
+		MaxgameticksCbx->ItemIndex = 4;
+		break;
+	case 60:
+		MaxgameticksCbx->ItemIndex = 5;
+		break;
+	case 30:
+		MaxgameticksCbx->ItemIndex = 6;
+		break;
+	case 25:
+		MaxgameticksCbx->ItemIndex = 7;
+		break;
+	case 15:
+		MaxgameticksCbx->ItemIndex = 8;
+		break;
+	case 0:
+	default:
+		MaxgameticksCbx->ItemIndex = 2;
+		break;
+	}
+
+
+	NoactivateappChk->State = GetBool(ini, "noactivateapp", false) ? tssOn : tssOff;
+	HookChk->State = ini->ReadInteger("ddraw", "hook", 4) == 2 ? tssOn : tssOff;
+	MinfpsChk->State = ini->ReadInteger("ddraw", "minfps", 0) != 0 ? tssOn : tssOff;
+	FixpitchChk->State = GetBool(ini, "fixpitch", false) ? tssOn : tssOff;
+	NonexclusiveChk->State = GetBool(ini, "nonexclusive", false) ? tssOn : tssOff;
+
 	delete ini;
 
 	Initialized = true;
@@ -143,24 +162,18 @@ void TConfigForm::SaveSettings()
 
 	/* Display Settings */
 
-	switch(PresentationCbx->ItemIndex)
-	{
+	switch(PresentationCbx->ItemIndex) {
 	case 0:
 		ini->WriteString("ddraw", "windowed", "false");
 		ini->WriteString("ddraw", "fullscreen", "false");
 		ini->WriteString("ddraw", "nonexclusive", "false");
 		break;
 	case 1:
-		ini->WriteString("ddraw", "windowed", "false");
-		ini->WriteString("ddraw", "fullscreen", "false");
-		ini->WriteString("ddraw", "nonexclusive", "true");
-		break;
-	case 2:
 		ini->WriteString("ddraw", "windowed", "true");
 		ini->WriteString("ddraw", "fullscreen", "true");
 		ini->WriteString("ddraw", "nonexclusive", "false");
 		break;
-	case 3:
+	case 2:
 		ini->WriteString("ddraw", "windowed", "true");
 		ini->WriteString("ddraw", "fullscreen", "false");
 		ini->WriteString("ddraw", "nonexclusive", "false");
@@ -169,11 +182,6 @@ void TConfigForm::SaveSettings()
 		break;
 	}
 
-	ini->WriteString(
-		"ddraw",
-		"renderer",
-		LowerCase(RendererCbx->Text));
-
 	ini->WriteString(
 		"ddraw",
 		"maintas",
@@ -219,9 +227,77 @@ void TConfigForm::SaveSettings()
 		"savesettings",
 		SavesettingsChk->State == tssOn ? 1 : 0);
 
+	/* Compatibility Settings */
+
+	switch(MaxgameticksCbx->ItemIndex) {
+	case 0:
+		ini->WriteInteger("ddraw", "maxgameticks", -1);
+		break;
+	case 1:
+		ini->WriteInteger("ddraw", "maxgameticks", -2);
+		break;
+	case 2:
+		ini->WriteInteger("ddraw", "maxgameticks", 0);
+		break;
+	case 3:
+		ini->WriteInteger("ddraw", "maxgameticks", 1000);
+		break;
+	case 4:
+		ini->WriteInteger("ddraw", "maxgameticks", 500);
+		break;
+	case 5:
+		ini->WriteInteger("ddraw", "maxgameticks", 60);
+		break;
+	case 6:
+		ini->WriteInteger("ddraw", "maxgameticks", 30);
+		break;
+	case 7:
+		ini->WriteInteger("ddraw", "maxgameticks", 25);
+		break;
+	case 8:
+		ini->WriteInteger("ddraw", "maxgameticks", 15);
+		break;
+	default:
+		break;
+	}
+
+	ini->WriteString(
+		"ddraw",
+		"noactivateapp",
+		NoactivateappChk->State == tssOn ? "true" : "false");
+
+	ini->WriteInteger(
+		"ddraw",
+		"hook",
+		HookChk->State == tssOn ? 2 : 4);
+
+	if (HookChk->State == tssOn)
+		ini->WriteString("ddraw", "renderer", "gdi");
+
+	ini->WriteInteger(
+		"ddraw",
+		"minfps",
+		MinfpsChk->State == tssOn ? -1 : 0);
+
+	ini->WriteString(
+		"ddraw",
+		"fixpitch",
+		FixpitchChk->State == tssOn ? "true" : "false");
+
+	ini->WriteString(
+		"ddraw",
+		"nonexclusive",
+		NonexclusiveChk->State == tssOn ? "true" : "false");
+
 	delete ini;
 }
 
+bool TConfigForm::GetBool(TIniFile *ini, System::UnicodeString key, bool defValue)
+{
+	auto s = LowerCase(ini->ReadString("ddraw", key, defValue ? "true" : "false"));
+	return s == "true" || s == "yes" || s == "1";
+}
+
 void __fastcall TConfigForm::PresentationCbxChange(TObject *Sender)
 {
 	SaveSettings();
@@ -277,3 +353,33 @@ void __fastcall TConfigForm::SavesettingsChkClick(TObject *Sender)
 	SaveSettings();
 }
 
+void __fastcall TConfigForm::MaxgameticksCbxChange(TObject *Sender)
+{
+	SaveSettings();
+}
+
+void __fastcall TConfigForm::NoactivateappChkClick(TObject *Sender)
+{
+	SaveSettings();
+}
+
+void __fastcall TConfigForm::HookChkClick(TObject *Sender)
+{
+	SaveSettings();
+}
+
+void __fastcall TConfigForm::MinfpsChkClick(TObject *Sender)
+{
+	SaveSettings();
+}
+
+void __fastcall TConfigForm::FixpitchChkClick(TObject *Sender)
+{
+	SaveSettings();
+}
+
+void __fastcall TConfigForm::NonexclusiveChkClick(TObject *Sender)
+{
+	SaveSettings();
+}
+
diff --git a/config/ConfigFormUnit.dfm b/config/ConfigFormUnit.dfm
index 286a104..732b59c 100644
--- a/config/ConfigFormUnit.dfm
+++ b/config/ConfigFormUnit.dfm
@@ -2682,149 +2682,6 @@ object ConfigForm: TConfigForm
   OnCreate = FormCreate
   PixelsPerInch = 96
   TextHeight = 13
-  object DisplayPnl: TPanel
-    Left = 191
-    Top = 8
-    Width = 499
-    Height = 465
-    Color = clWhite
-    ParentBackground = False
-    ShowCaption = False
-    TabOrder = 1
-    StyleElements = [seFont, seBorder]
-    object PresentationLbl: TLabel
-      Left = 40
-      Top = 28
-      Width = 87
-      Height = 21
-      Caption = 'Presentation'
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      StyleElements = [seClient, seBorder]
-    end
-    object MaintasLbl: TLabel
-      Left = 40
-      Top = 102
-      Width = 145
-      Height = 21
-      Caption = 'Maintain aspect ratio'
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      StyleElements = [seClient, seBorder]
-    end
-    object VsyncLbl: TLabel
-      Left = 40
-      Top = 162
-      Width = 40
-      Height = 21
-      Margins.Top = 10
-      Caption = 'Vsync'
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      StyleElements = [seClient, seBorder]
-    end
-    object AdjmouseLbl: TLabel
-      Left = 40
-      Top = 222
-      Width = 168
-      Height = 21
-      Margins.Top = 10
-      Caption = 'Adjust mouse sensitivity'
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      StyleElements = [seClient, seBorder]
-    end
-    object DevmodeLbl: TLabel
-      Left = 40
-      Top = 282
-      Width = 186
-      Height = 21
-      Margins.Top = 10
-      Caption = 'Lock cursor within window'
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      StyleElements = [seClient, seBorder]
-    end
-    object PresentationCbx: TComboBox
-      Left = 40
-      Top = 55
-      Width = 185
-      Height = 29
-      BevelEdges = []
-      BevelInner = bvNone
-      BevelOuter = bvSpace
-      Style = csDropDownList
-      Font.Charset = DEFAULT_CHARSET
-      Font.Color = clWindowText
-      Font.Height = -16
-      Font.Name = 'Segoe UI'
-      Font.Style = []
-      ParentFont = False
-      TabOrder = 0
-      OnChange = PresentationCbxChange
-      Items.Strings = (
-        'Fullscreen Exclusive'
-        'Fullscreen'
-        'Borderless'
-        'Windowed')
-    end
-    object MaintasChk: TToggleSwitch
-      Left = 40
-      Top = 129
-      Width = 50
-      Height = 20
-      ShowStateCaption = False
-      TabOrder = 1
-      OnClick = MaintasChkClick
-    end
-    object VsyncChk: TToggleSwitch
-      Left = 40
-      Top = 189
-      Width = 50
-      Height = 20
-      ShowStateCaption = False
-      TabOrder = 2
-      OnClick = VsyncChkClick
-    end
-    object AdjmouseChk: TToggleSwitch
-      Left = 40
-      Top = 249
-      Width = 50
-      Height = 20
-      ShowStateCaption = False
-      TabOrder = 3
-      OnClick = AdjmouseChkClick
-    end
-    object DevmodeChk: TToggleSwitch
-      Left = 40
-      Top = 309
-      Width = 50
-      Height = 20
-      ShowStateCaption = False
-      TabOrder = 4
-      OnClick = DevmodeChkClick
-    end
-  end
   object CompatibilityPnl: TPanel
     Left = 191
     Top = 8
@@ -2836,6 +2693,169 @@ object ConfigForm: TConfigForm
     TabOrder = 3
     Visible = False
     StyleElements = [seFont, seBorder]
+    object MaxgameticksLbl: TLabel
+      Left = 40
+      Top = 28
+      Width = 123
+      Height = 21
+      Caption = 'Limit game speed'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object NoactivateappLbl: TLabel
+      Left = 40
+      Top = 105
+      Width = 129
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Fix broken Alt+Tab'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object HookLbl: TLabel
+      Left = 40
+      Top = 173
+      Width = 281
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Fix broken windowed mode or upscaling'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object MinfpsLbl: TLabel
+      Left = 40
+      Top = 241
+      Width = 350
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Force high FPS / Fix stuttering on Freesync/G-Sync'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object FixpitchLbl: TLabel
+      Left = 40
+      Top = 309
+      Width = 366
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Fix parts of the screen are being displayed diagonally'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object NonexclusiveLbl: TLabel
+      Left = 40
+      Top = 377
+      Width = 301
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Fix videos or other UI elements are invisible'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object MaxgameticksCbx: TComboBox
+      Left = 48
+      Top = 55
+      Width = 289
+      Height = 29
+      BevelEdges = []
+      BevelInner = bvNone
+      BevelOuter = bvSpace
+      Style = csDropDownList
+      DropDownCount = 9
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      TabOrder = 0
+      OnChange = MaxgameticksCbxChange
+      Items.Strings = (
+        'No limit'
+        'Sync with monitor refresh rate'
+        'Emulate 60hz refresh rate monitor'
+        '1000 ticks per second'
+        '500 ticks per second'
+        '60 ticks per second'
+        '30 ticks per second'
+        '25 ticks per second'
+        '15 ticks per second')
+    end
+    object NoactivateappChk: TToggleSwitch
+      Left = 40
+      Top = 132
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 1
+      OnClick = NoactivateappChkClick
+    end
+    object HookChk: TToggleSwitch
+      Left = 40
+      Top = 200
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 2
+      OnClick = HookChkClick
+    end
+    object MinfpsChk: TToggleSwitch
+      Left = 40
+      Top = 268
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 3
+      OnClick = MinfpsChkClick
+    end
+    object FixpitchChk: TToggleSwitch
+      Left = 40
+      Top = 336
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 4
+      OnClick = FixpitchChkClick
+    end
+    object NonexclusiveChk: TToggleSwitch
+      Left = 40
+      Top = 404
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 5
+      OnClick = NonexclusiveChkClick
+    end
   end
   object AdvDisplayPnl: TPanel
     Left = 191
@@ -2864,10 +2884,10 @@ object ConfigForm: TConfigForm
     end
     object SavesettingsLbl: TLabel
       Left = 40
-      Top = 346
+      Top = 386
       Width = 152
       Height = 21
-      Margins.Top = 10
+      Margins.Top = 18
       Caption = 'Save window position'
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -2879,10 +2899,10 @@ object ConfigForm: TConfigForm
     end
     object ShaderLbl: TLabel
       Left = 40
-      Top = 97
+      Top = 105
       Width = 110
       Height = 21
-      Margins.Top = 10
+      Margins.Top = 18
       Caption = 'OpenGL Shader'
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -2894,10 +2914,10 @@ object ConfigForm: TConfigForm
     end
     object MaxfpsLbl: TLabel
       Left = 40
-      Top = 166
+      Top = 182
       Width = 111
       Height = 21
-      Margins.Top = 10
+      Margins.Top = 18
       Caption = 'Limit frame rate'
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -2909,10 +2929,10 @@ object ConfigForm: TConfigForm
     end
     object BorderLbl: TLabel
       Left = 40
-      Top = 286
+      Top = 318
       Width = 149
       Height = 21
-      Margins.Top = 10
+      Margins.Top = 18
       Caption = 'Show window border'
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -2924,10 +2944,10 @@ object ConfigForm: TConfigForm
     end
     object BoxingLbl: TLabel
       Left = 40
-      Top = 226
+      Top = 250
       Width = 220
       Height = 21
-      Margins.Top = 10
+      Margins.Top = 18
       Caption = 'Windowboxing / Integer scaling'
       Font.Charset = DEFAULT_CHARSET
       Font.Color = clWindowText
@@ -2938,7 +2958,7 @@ object ConfigForm: TConfigForm
       StyleElements = [seClient, seBorder]
     end
     object RendererCbx: TComboBox
-      Left = 40
+      Left = 48
       Top = 55
       Width = 185
       Height = 29
@@ -2962,7 +2982,7 @@ object ConfigForm: TConfigForm
     end
     object BorderChk: TToggleSwitch
       Left = 40
-      Top = 313
+      Top = 345
       Width = 50
       Height = 20
       ShowStateCaption = False
@@ -2971,7 +2991,7 @@ object ConfigForm: TConfigForm
     end
     object SavesettingsChk: TToggleSwitch
       Left = 40
-      Top = 373
+      Top = 413
       Width = 50
       Height = 20
       ShowStateCaption = False
@@ -2979,8 +2999,8 @@ object ConfigForm: TConfigForm
       OnClick = SavesettingsChkClick
     end
     object ShaderCbx: TComboBox
-      Left = 40
-      Top = 124
+      Left = 48
+      Top = 132
       Width = 425
       Height = 29
       BevelEdges = []
@@ -2998,7 +3018,7 @@ object ConfigForm: TConfigForm
     end
     object MaxfpsChk: TToggleSwitch
       Left = 40
-      Top = 193
+      Top = 209
       Width = 50
       Height = 20
       ShowStateCaption = False
@@ -3007,7 +3027,7 @@ object ConfigForm: TConfigForm
     end
     object BoxingChk: TToggleSwitch
       Left = 40
-      Top = 253
+      Top = 277
       Width = 50
       Height = 20
       ShowStateCaption = False
@@ -3015,6 +3035,149 @@ object ConfigForm: TConfigForm
       OnClick = BoxingChkClick
     end
   end
+  object DisplayPnl: TPanel
+    Left = 191
+    Top = 8
+    Width = 499
+    Height = 465
+    Color = clWhite
+    ParentBackground = False
+    ShowCaption = False
+    TabOrder = 1
+    StyleElements = [seFont, seBorder]
+    object PresentationLbl: TLabel
+      Left = 40
+      Top = 28
+      Width = 87
+      Height = 21
+      Caption = 'Presentation'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object MaintasLbl: TLabel
+      Left = 40
+      Top = 105
+      Width = 145
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Maintain aspect ratio'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object VsyncLbl: TLabel
+      Left = 40
+      Top = 173
+      Width = 40
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Vsync'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object AdjmouseLbl: TLabel
+      Left = 40
+      Top = 241
+      Width = 168
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Adjust mouse sensitivity'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object DevmodeLbl: TLabel
+      Left = 40
+      Top = 309
+      Width = 186
+      Height = 21
+      Margins.Top = 18
+      Caption = 'Lock cursor within window'
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      StyleElements = [seClient, seBorder]
+    end
+    object PresentationCbx: TComboBox
+      Left = 48
+      Top = 55
+      Width = 185
+      Height = 29
+      BevelEdges = []
+      BevelInner = bvNone
+      BevelOuter = bvSpace
+      Style = csDropDownList
+      Font.Charset = DEFAULT_CHARSET
+      Font.Color = clWindowText
+      Font.Height = -16
+      Font.Name = 'Segoe UI'
+      Font.Style = []
+      ParentFont = False
+      TabOrder = 0
+      OnChange = PresentationCbxChange
+      Items.Strings = (
+        'Fullscreen'
+        'Borderless'
+        'Windowed')
+    end
+    object MaintasChk: TToggleSwitch
+      Left = 40
+      Top = 132
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 1
+      OnClick = MaintasChkClick
+    end
+    object VsyncChk: TToggleSwitch
+      Left = 40
+      Top = 200
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 2
+      OnClick = VsyncChkClick
+    end
+    object AdjmouseChk: TToggleSwitch
+      Left = 40
+      Top = 268
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 3
+      OnClick = AdjmouseChkClick
+    end
+    object DevmodeChk: TToggleSwitch
+      Left = 40
+      Top = 336
+      Width = 50
+      Height = 20
+      ShowStateCaption = False
+      TabOrder = 4
+      OnClick = DevmodeChkClick
+    end
+  end
   object MenuPnl: TPanel
     Left = 0
     Top = 8
@@ -3073,7 +3236,6 @@ object ConfigForm: TConfigForm
       Font.Name = 'Segoe UI'
       Font.Style = [fsBold]
       ParentFont = False
-      Visible = False
       OnClick = CompatibilityBtnClick
     end
   end
diff --git a/config/ConfigFormUnit.h b/config/ConfigFormUnit.h
index 17df031..6b6f34d 100644
--- a/config/ConfigFormUnit.h
+++ b/config/ConfigFormUnit.h
@@ -44,6 +44,18 @@ __published:	// Von der IDE verwaltete Komponenten
 	TToggleSwitch *MaxfpsChk;
 	TLabel *BoxingLbl;
 	TToggleSwitch *BoxingChk;
+	TComboBox *MaxgameticksCbx;
+	TLabel *MaxgameticksLbl;
+	TLabel *NoactivateappLbl;
+	TToggleSwitch *NoactivateappChk;
+	TLabel *HookLbl;
+	TToggleSwitch *HookChk;
+	TLabel *MinfpsLbl;
+	TToggleSwitch *MinfpsChk;
+	TToggleSwitch *FixpitchChk;
+	TLabel *FixpitchLbl;
+	TLabel *NonexclusiveLbl;
+	TToggleSwitch *NonexclusiveChk;
 	void __fastcall DisplayBtnClick(TObject *Sender);
 	void __fastcall AdvDisplayBtnClick(TObject *Sender);
 	void __fastcall CompatibilityBtnClick(TObject *Sender);
@@ -59,8 +71,15 @@ __published:	// Von der IDE verwaltete Komponenten
 	void __fastcall BoxingChkClick(TObject *Sender);
 	void __fastcall BorderChkClick(TObject *Sender);
 	void __fastcall SavesettingsChkClick(TObject *Sender);
+	void __fastcall MaxgameticksCbxChange(TObject *Sender);
+	void __fastcall NoactivateappChkClick(TObject *Sender);
+	void __fastcall HookChkClick(TObject *Sender);
+	void __fastcall MinfpsChkClick(TObject *Sender);
+	void __fastcall FixpitchChkClick(TObject *Sender);
+	void __fastcall NonexclusiveChkClick(TObject *Sender);
 private:	// Benutzer-Deklarationen
 	void SaveSettings();
+	bool GetBool(TIniFile *ini, System::UnicodeString key, bool defValue);
 public:		// Benutzer-Deklarationen
 	__fastcall TConfigForm(TComponent* Owner);
 };