From 21f93f3923026a75691b30596aa29457c88f85d6 Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:07:08 -0700 Subject: [PATCH 01/11] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..dd84ea782 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 1ee689fd385ef8865d2d191ac17744c75c7c8c57 Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:14:11 -0700 Subject: [PATCH 02/11] Update and rename bug_report.md to bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.md | 38 -------- .github/ISSUE_TEMPLATE/bug_report.yml | 133 ++++++++++++++++++++++++++ 2 files changed, 133 insertions(+), 38 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea782..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000..7de9662a6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,133 @@ +name: Bug Report +description: File a Bug report +title: '[BUG] ' +labels: bug +#assignees: 'anonymous@temp' + +body: + - type: markdown + attributes: + value: | + ## Please fill out forms as cleanly as possible. + #### Make sure that you have + * properly edited & filled in the title of this bug report + - type: dropdown + id: version + attributes: + label: GZDoom version + description: | + What version are you using? + Run `gzdoom --version` + Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing. + multiple: false + options: + - 4.6.1 + - 4.6.0 + - 4.5.0 + - 4.4.2 + - 4.4.1 + - 4.4.0 + - Git + - Other + validations: + required: true + - type: dropdown + id: OS + attributes: + label: What Operating System are you using? + multiple: false + options: + - Windows 11 + - Windows 10 + - Windows 8 + - Windows 7 + - Windows Other + - Mac OS + - Linux x86 + - Linux x86_64 + - Linux ARM (Raspberry Pi) + - Other + validations: + required: false + - type: input + id: other + attributes: + label: If Other OS, please describe + description: Other details + placeholder: "Windows, Mac OSX version, Debian, Ubuntu, Arch, etc." + validations: + required: false + - type: dropdown + id: gameid + attributes: + label: Which game are you running with Raze? + multiple: false + options: + - Doom + - Doom 2 + - Heretic + - Hexen + - Strife + - Other + validations: + required: false + - type: input + id: hardware + attributes: + label: Relevant hardware info + description: Hardware + placeholder: "CPU, GPU, device brand/model: e.g. Intel, AMD, Nvidia, etc" + validations: + required: false + - type: checkboxes + id: checked + attributes: + label: Have you checked that no other similar issue already exists? + description: Searched issues before creating report? + options: + - label: I have searched and not found similar issues. + required: true + - type: textarea + id: description + attributes: + label: A clear and concise description of what the bug is. + description: Describe what happens, what software were you running? _Include screenshot if possible_ + placeholder: "How & When does this occur?" + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce the behaviour. + description: How can we reproduce this? + placeholder: "Explain how to reproduce" + value: | + Explain how to reproduce + 1. + 2. + 3. + validations: + required: false + - type: textarea + id: config_file + attributes: + label: Your configuration + description: | + Share the config file(s) you've been using to run the program. (`raze.ini`) + Please avoid pasting the full config, _use attachments or links_ in a [Gist](https://gist.github.com/) + placeholder: "example: cl_autorun=true" + render: ini # syntax highlighting + validations: + required: false + - type: textarea + id: log + attributes: + label: Provide a Log + description: Please avoid pasting the full log, _use attachments or links_ in a [Gist](https://gist.github.com/) + placeholder: "Copy & paste error log section or provide link" + validations: + required: false + - type: markdown + attributes: + value: | + * Make sure you have properly filled in the title of this bug report From 027676fb4db637d34d15d091e2e154ef96a85ad1 Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:14:49 -0700 Subject: [PATCH 03/11] raze - gzdoom --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7de9662a6..814f6f4ed 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -60,7 +60,7 @@ body: - type: dropdown id: gameid attributes: - label: Which game are you running with Raze? + label: Which game are you running with GZDoom? multiple: false options: - Doom From e0164ccad41b1034496f4c3a09aa97baa1a23a9d Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:17:56 -0700 Subject: [PATCH 04/11] Create feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 116 +++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 000000000..1433ed781 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,116 @@ +name: Feature Request +description: Suggest an idea (a new feature or other improvement) for this project +title: '[Feature] ' +labels: enhancement +#assignees: 'anonymous@temp' + +body: + - type: markdown + attributes: + value: | + ## Please fill out forms as cleanly as possible. + #### Make sure that you have + * properly edited & filled in the title of this bug report + - type: dropdown + id: version + attributes: + label: GZDoom version + description: | + What version are you using? + Run `gzdoom --version` + Make sure to update to latest [release](https://github.com/coelckers/gzdoom/releases) version and test again before continuing. + multiple: false + options: + - 4.6.1 + - 4.6.0 + - 4.5.0 + - 4.4.2 + - 4.4.1 + - 4.4.0 + - Git + - Other + validations: + required: true + - type: dropdown + id: OS + attributes: + label: What Operating System are you using? + multiple: false + options: + - Windows 11 + - Windows 10 + - Windows 8 + - Windows 7 + - Windows Other + - Mac OS + - Linux x86 + - Linux x86_64 + - Linux ARM (Raspberry Pi) + - Other + validations: + required: false + - type: input + id: other + attributes: + label: If Other OS, please describe + description: Other details + placeholder: "Windows, Mac OSX version, Debian, Ubuntu, Arch, etc." + validations: + required: false + - type: dropdown + id: gameid + attributes: + label: Which game are you running with GZDoom? + multiple: false + options: + - Doom + - Doom 2 + - Heretic + - Hexen + - Strife + - Other + validations: + required: false + - type: input + id: hardware + attributes: + label: Relevant hardware info + description: Hardware + placeholder: "CPU, GPU, device brand/model: e.g. Intel, AMD, Nvidia, etc" + validations: + required: false + - type: textarea + id: related + attributes: + label: Is your feature request related to a problem? Please describe. + description: Related + placeholder: "Ex. I'm always frustrated when" + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe the solution you'd like + placeholder: "Ex. How can we make it better?" + validations: + required: false + - type: textarea + id: alternative + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + placeholder: "Similar idea or software" + validations: + required: false + - type: textarea + id: additional + attributes: + label: Add any other context or screenshots about the feature request here. + description: Screenshots or Links? + placeholder: "Ex. Screenshot or Link" + validations: + required: false + - type: markdown + attributes: + value: | + * Make sure you have properly filled in the title of this feature request From a6afcdac94caeaec6f778e5d708a393b841dc683 Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:20:56 -0700 Subject: [PATCH 05/11] raze.ini - gzdoom.ini --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 814f6f4ed..e6850b1a7 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -113,7 +113,7 @@ body: attributes: label: Your configuration description: | - Share the config file(s) you've been using to run the program. (`raze.ini`) + Share the config file(s) you've been using to run the program. (`gzdoom.ini`) Please avoid pasting the full config, _use attachments or links_ in a [Gist](https://gist.github.com/) placeholder: "example: cl_autorun=true" render: ini # syntax highlighting From 5e5f727ba5dd214200e6e448994e7597b86b5099 Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:21:41 -0700 Subject: [PATCH 06/11] move game loc --- .github/ISSUE_TEMPLATE/bug_report.yml | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e6850b1a7..966d2d4da 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -31,6 +31,20 @@ body: - Other validations: required: true + - type: dropdown + id: gameid + attributes: + label: Which game are you running with GZDoom? + multiple: false + options: + - Doom + - Doom 2 + - Heretic + - Hexen + - Strife + - Other + validations: + required: false - type: dropdown id: OS attributes: @@ -57,20 +71,6 @@ body: placeholder: "Windows, Mac OSX version, Debian, Ubuntu, Arch, etc." validations: required: false - - type: dropdown - id: gameid - attributes: - label: Which game are you running with GZDoom? - multiple: false - options: - - Doom - - Doom 2 - - Heretic - - Hexen - - Strife - - Other - validations: - required: false - type: input id: hardware attributes: From 355e367a08309f0c053e49d1f4e6133e6b4fa9be Mon Sep 17 00:00:00 2001 From: arrowgent <57545549+arrowgent@users.noreply.github.com> Date: Tue, 31 Aug 2021 05:22:08 -0700 Subject: [PATCH 07/11] move game loc --- .github/ISSUE_TEMPLATE/feature_request.yml | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 1433ed781..6bf1d971a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -31,6 +31,20 @@ body: - Other validations: required: true + - type: dropdown + id: gameid + attributes: + label: Which game are you running with GZDoom? + multiple: false + options: + - Doom + - Doom 2 + - Heretic + - Hexen + - Strife + - Other + validations: + required: false - type: dropdown id: OS attributes: @@ -57,20 +71,6 @@ body: placeholder: "Windows, Mac OSX version, Debian, Ubuntu, Arch, etc." validations: required: false - - type: dropdown - id: gameid - attributes: - label: Which game are you running with GZDoom? - multiple: false - options: - - Doom - - Doom 2 - - Heretic - - Hexen - - Strife - - Other - validations: - required: false - type: input id: hardware attributes: From 31026402100d14b1fbf47297364fc5202c1c6fe8 Mon Sep 17 00:00:00 2001 From: Alexander Kromm Date: Fri, 3 Sep 2021 22:58:35 +0700 Subject: [PATCH 08/11] fix options search when menus are defined recursively --- .../zscript/engine/ui/menu/search/menu.zs | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/wadsrc/static/zscript/engine/ui/menu/search/menu.zs b/wadsrc/static/zscript/engine/ui/menu/search/menu.zs index 46efc0c6a..17a8a21d3 100644 --- a/wadsrc/static/zscript/engine/ui/menu/search/menu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/search/menu.zs @@ -31,7 +31,8 @@ class os_Menu : OptionMenu addSearchField(text); - bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches); + Dictionary searchedMenus = Dictionary.Create(); + bool found = listOptions(mDesc, "MainMenu", query, "", isAnyTermMatches, searchedMenus); if (!found) { addNoResultsItem(mDesc); } @@ -54,21 +55,29 @@ class os_Menu : OptionMenu string menuName, os_Query query, string path, - bool isAnyTermMatches) + bool isAnyTermMatches, + Dictionary searchedMenus) { + if (searchedMenus.At(menuName).length() > 0) + { + return false; + } + + searchedMenus.Insert(menuName, "1"); + let desc = MenuDescriptor.GetDescriptor(menuName); let listMenuDesc = ListMenuDescriptor(desc); if (listMenuDesc) { - return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches); + return listOptionsListMenu(listMenuDesc, targetDesc, query, path, isAnyTermMatches, searchedMenus); } let optionMenuDesc = OptionMenuDescriptor(desc); if (optionMenuDesc) { - return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches); + return listOptionsOptionMenu(optionMenuDesc, targetDesc, query, path, isAnyTermMatches, searchedMenus); } return false; @@ -78,7 +87,8 @@ class os_Menu : OptionMenu OptionMenuDescriptor targetDesc, os_Query query, string path, - bool isAnyTermMatches) + bool isAnyTermMatches, + Dictionary searchedMenus) { int nItems = sourceDesc.mItems.size(); bool found = false; @@ -92,7 +102,7 @@ class os_Menu : OptionMenu ? makePath(path, StringTable.Localize(textItem.mText)) : path; - found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches); + found |= listOptions(targetDesc, actionN, query, newPath, isAnyTermMatches, searchedMenus); } return found; @@ -102,7 +112,8 @@ class os_Menu : OptionMenu OptionMenuDescriptor targetDesc, os_Query query, string path, - bool isAnyTermMatches) + bool isAnyTermMatches, + Dictionary searchedMenus) { if (sourceDesc == targetDesc) { return false; } @@ -152,7 +163,7 @@ class os_Menu : OptionMenu { string newPath = makePath(path, label); - found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches); + found |= listOptions(targetDesc, item.GetAction(), query, newPath, isAnyTermMatches, searchedMenus); } } From 79cbaf5d4fa052817257ffddd2da4964b34f1dcd Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 5 Sep 2021 08:18:40 -0400 Subject: [PATCH 09/11] - split defcvars parser into its own file --- src/CMakeLists.txt | 1 + src/d_defcvars.cpp | 131 +++++++++++++++++++++++++++++++++++++++++++++ src/d_main.cpp | 94 +------------------------------- 3 files changed, 133 insertions(+), 93 deletions(-) create mode 100644 src/d_defcvars.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f197aa3b..1268b8573 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -810,6 +810,7 @@ set (PCH_SOURCES ct_chat.cpp d_iwad.cpp d_main.cpp + d_defcvars.cpp d_anonstats.cpp d_net.cpp d_netinfo.cpp diff --git a/src/d_defcvars.cpp b/src/d_defcvars.cpp new file mode 100644 index 000000000..0077fa29e --- /dev/null +++ b/src/d_defcvars.cpp @@ -0,0 +1,131 @@ +//----------------------------------------------------------------------------- +// Copyright 1993-1996 id Software +// Copyright 1999-2016 Randy Heit +// Copyright 2002-2016 Christoph Oelckers +// Copyright 2019-2021 Rachael Alexanderson +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +// +// DESCRIPTION: +// defcvars loader split from d_main.cpp +// +//----------------------------------------------------------------------------- + +// HEADER FILES ------------------------------------------------------------ + +#include "doomdef.h" +#include "doomstat.h" +#include "gstrings.h" +#include "filesystem.h" +#include "menu.h" +#include "doommenu.h" +#include "c_console.h" +#include "d_main.h" +#include "version.h" + + +void D_GrabCVarDefaults() +{ + int lump, lastlump = 0; + int lumpversion, gamelastrunversion; + gamelastrunversion = atoi(LASTRUNVERSION); + + while ((lump = fileSystem.FindLump("DEFCVARS", &lastlump)) != -1) + { + // don't parse from wads + if (lastlump > fileSystem.GetLastEntry(fileSystem.GetMaxIwadNum())) + { + // would rather put this in a modal of some sort, but this will have to do. + Printf(TEXTCOLOR_RED "Cannot load DEFCVARS from a wadfile!\n"); + break; + } + + FScanner sc(lump); + + sc.MustGetString(); + if (!sc.Compare("version")) + sc.ScriptError("Must declare version for defcvars! (currently: %i)", gamelastrunversion); + sc.MustGetNumber(); + lumpversion = sc.Number; + if (lumpversion > gamelastrunversion) + sc.ScriptError("Unsupported version %i (%i supported)", lumpversion, gamelastrunversion); + if (lumpversion < 219) + sc.ScriptError("Version must be at least 219 (current version %i)", gamelastrunversion); + + FBaseCVar* var; + FString CurrentFindCVar; + + while (sc.GetString()) + { + if (sc.Compare("set")) + { + sc.MustGetString(); + } + + CurrentFindCVar = sc.String; + if (lumpversion < 220) + { + CurrentFindCVar.ToLower(); + + // these two got renamed + if (strcmp(CurrentFindCVar, "gamma") == 0) + { + CurrentFindCVar = "vid_gamma"; + } + if (strcmp(CurrentFindCVar, "fullscreen") == 0) + { + CurrentFindCVar = "vid_fullscreen"; + } + + // this was removed + if (strcmp(CurrentFindCVar, "cd_drive") == 0) + break; + } + if (lumpversion < 221) + { + // removed cvar + // this one doesn't matter as much, since it depended on platform-specific values, + // and is something the user should change anyhow, so, let's just throw this value + // out. + if (strcmp(CurrentFindCVar, "mouse_sensitivity") == 0) + break; + if (strcmp(CurrentFindCVar, "m_noprescale") == 0) + break; + } + + var = FindCVar(CurrentFindCVar, NULL); + if (var != NULL) + { + if (var->GetFlags() & CVAR_ARCHIVE) + { + UCVarValue val; + + sc.MustGetString(); + val.String = const_cast(sc.String); + var->SetGenericRepDefault(val, CVAR_String); + } + else + { + sc.ScriptError("Cannot set cvar default for non-config cvar '%s'", sc.String); + } + } + else + { + sc.ScriptError("Unknown cvar '%s'", sc.String); + } + } + } +} + diff --git a/src/d_main.cpp b/src/d_main.cpp index 556664662..e1adfe025 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -169,6 +169,7 @@ void D_Cleanup(); void FreeSBarInfoScript(); void I_UpdateWindowTitle(); void S_ParseMusInfo(); +void D_GrabCVarDefaults(); // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -331,99 +332,6 @@ static int pagetic; // CODE -------------------------------------------------------------------- -void D_GrabCVarDefaults() -{ - int lump, lastlump = 0; - int lumpversion, gamelastrunversion; - gamelastrunversion = atoi(LASTRUNVERSION); - - while ((lump = fileSystem.FindLump("DEFCVARS", &lastlump)) != -1) - { - // don't parse from wads - if (lastlump > fileSystem.GetLastEntry(fileSystem.GetMaxIwadNum())) - { - // would rather put this in a modal of some sort, but this will have to do. - Printf(TEXTCOLOR_RED "Cannot load DEFCVARS from a wadfile!\n"); - break; - } - - FScanner sc(lump); - - sc.MustGetString(); - if (!sc.Compare("version")) - sc.ScriptError("Must declare version for defcvars! (currently: %i)", gamelastrunversion); - sc.MustGetNumber(); - lumpversion = sc.Number; - if (lumpversion > gamelastrunversion) - sc.ScriptError("Unsupported version %i (%i supported)", lumpversion, gamelastrunversion); - if (lumpversion < 219) - sc.ScriptError("Version must be at least 219 (current version %i)", gamelastrunversion); - - FBaseCVar* var; - FString CurrentFindCVar; - - while (sc.GetString()) - { - if (sc.Compare("set")) - { - sc.MustGetString(); - } - - CurrentFindCVar = sc.String; - if (lumpversion < 220) - { - CurrentFindCVar.ToLower(); - - // these two got renamed - if (strcmp(CurrentFindCVar, "gamma") == 0) - { - CurrentFindCVar = "vid_gamma"; - } - if (strcmp(CurrentFindCVar, "fullscreen") == 0) - { - CurrentFindCVar = "vid_fullscreen"; - } - - // this was removed - if (strcmp(CurrentFindCVar, "cd_drive") == 0) - break; - } - if (lumpversion < 221) - { - // removed cvar - // this one doesn't matter as much, since it depended on platform-specific values, - // and is something the user should change anyhow, so, let's just throw this value - // out. - if (strcmp(CurrentFindCVar, "mouse_sensitivity") == 0) - break; - if (strcmp(CurrentFindCVar, "m_noprescale") == 0) - break; - } - - var = FindCVar(CurrentFindCVar, NULL); - if (var != NULL) - { - if (var->GetFlags() & CVAR_ARCHIVE) - { - UCVarValue val; - - sc.MustGetString(); - val.String = const_cast(sc.String); - var->SetGenericRepDefault(val, CVAR_String); - } - else - { - sc.ScriptError("Cannot set cvar default for non-config cvar '%s'", sc.String); - } - } - else - { - sc.ScriptError("Unknown cvar '%s'", sc.String); - } - } - } -} - //========================================================================== // // D_ToggleHud From 42d948f2fe6e501afab7592155a0a4e7895f3b90 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 5 Sep 2021 09:40:59 -0400 Subject: [PATCH 10/11] - demote unknown/invalid defcvars to warnings --- src/d_defcvars.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/d_defcvars.cpp b/src/d_defcvars.cpp index 0077fa29e..a53fbe0a3 100644 --- a/src/d_defcvars.cpp +++ b/src/d_defcvars.cpp @@ -35,7 +35,6 @@ #include "d_main.h" #include "version.h" - void D_GrabCVarDefaults() { int lump, lastlump = 0; @@ -118,12 +117,12 @@ void D_GrabCVarDefaults() } else { - sc.ScriptError("Cannot set cvar default for non-config cvar '%s'", sc.String); + sc.ScriptMessage("Cannot set cvar default for non-config cvar '%s'", sc.String); } } else { - sc.ScriptError("Unknown cvar '%s'", sc.String); + sc.ScriptMessage("Unknown cvar '%s' in defcvars", sc.String); } } } From f56ad027162bb16c66bbbfa83b07c155672beb1e Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 5 Sep 2021 10:27:06 -0400 Subject: [PATCH 11/11] - enable cvar blacklisting for defcvars for certain platform variables --- src/d_defcvars.cpp | 29 +++++++++++++++++++++++++++-- src/d_defcvars.h | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 src/d_defcvars.h diff --git a/src/d_defcvars.cpp b/src/d_defcvars.cpp index a53fbe0a3..4d38e57fa 100644 --- a/src/d_defcvars.cpp +++ b/src/d_defcvars.cpp @@ -34,6 +34,8 @@ #include "c_console.h" #include "d_main.h" #include "version.h" +#include "d_defcvars.h" + void D_GrabCVarDefaults() { @@ -104,9 +106,30 @@ void D_GrabCVarDefaults() break; } + bool blacklisted = false; + SHOULD_BLACKLIST(disablecrashlog) + SHOULD_BLACKLIST(gl_control_tear) + SHOULD_BLACKLIST(in_mouse) + SHOULD_BLACKLIST(joy_dinput) + SHOULD_BLACKLIST(joy_ps2raw) + SHOULD_BLACKLIST(joy_xinput) + SHOULD_BLACKLIST(k_allowfullscreentoggle) + SHOULD_BLACKLIST(k_mergekeys) + SHOULD_BLACKLIST(m_swapbuttons) + SHOULD_BLACKLIST(queryiwad_key) + SHOULD_BLACKLIST(vid_gpuswitch) + SHOULD_BLACKLIST(vr_enable_quadbuffered) + var = FindCVar(CurrentFindCVar, NULL); - if (var != NULL) + + if (blacklisted) { + sc.ScriptMessage("Cannot set cvar default for blacklisted cvar '%s'", sc.String); + sc.MustGetString(); // to ignore the value of the cvar + } + else if (var != NULL) + { + if (var->GetFlags() & CVAR_ARCHIVE) { UCVarValue val; @@ -115,14 +138,16 @@ void D_GrabCVarDefaults() val.String = const_cast(sc.String); var->SetGenericRepDefault(val, CVAR_String); } - else + else { sc.ScriptMessage("Cannot set cvar default for non-config cvar '%s'", sc.String); + sc.MustGetString(); // to ignore the value of the cvar } } else { sc.ScriptMessage("Unknown cvar '%s' in defcvars", sc.String); + sc.MustGetString(); // to ignore the value of the cvar } } } diff --git a/src/d_defcvars.h b/src/d_defcvars.h new file mode 100644 index 000000000..73f110c70 --- /dev/null +++ b/src/d_defcvars.h @@ -0,0 +1,27 @@ +//----------------------------------------------------------------------------- +// Copyright 2021 Rachael Alexanderson +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see http://www.gnu.org/licenses/ +// +// +// DESCRIPTION: +// defcvars loader split from d_main.cpp +// +//----------------------------------------------------------------------------- + +#define SHOULD_BLACKLIST(name) \ + if (#name[0]==CurrentFindCVar[0]) \ + if (strcmp(CurrentFindCVar, #name) == 0) \ + blacklisted = true; +