diff --git a/src/menu/joystickmenu.cpp b/src/menu/joystickmenu.cpp index f1015b79c..9b16b90f4 100644 --- a/src/menu/joystickmenu.cpp +++ b/src/menu/joystickmenu.cpp @@ -138,9 +138,13 @@ DEFINE_ACTION_FUNCTION(IJoystickConfig, GetNumAxes) void UpdateJoystickMenu(IJoystickConfig *selected) { DMenuDescriptor **desc = MenuDescriptors.CheckKey(NAME_JoystickOptions); + DMenuDescriptor **ddesc = MenuDescriptors.CheckKey("JoystickOptionsDefaults"); + if (ddesc == nullptr) return; // without any data the menu cannot be set up and must remain empty. if (desc != NULL && (*desc)->IsKindOf(RUNTIME_CLASS(DOptionMenuDescriptor))) { DOptionMenuDescriptor *opt = (DOptionMenuDescriptor *)*desc; + DOptionMenuDescriptor *dopt = (DOptionMenuDescriptor *)*ddesc; + if (dopt == nullptr) return; DMenuItemBase *it; int i; @@ -162,11 +166,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected) } } } -#ifdef _WIN32 - opt->mItems.Resize(8); -#else - opt->mItems.Resize(5); -#endif + opt->mItems = dopt->mItems; it = opt->GetItem("ConfigureMessage"); if (it != nullptr) it->SetValue(0, !!Joysticks.Size()); diff --git a/src/menu/menu.h b/src/menu/menu.h index 68367e701..d272fe242 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -112,7 +112,7 @@ class DMenuDescriptor : public DObject public: FName mMenuName; FString mNetgameMessage; - PClass *mClass; + PClass *mClass = nullptr; virtual size_t PropagateMark() { return 0; } }; diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index ec1ae12b5..8afed617e 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -950,9 +950,9 @@ void M_ParseMenuDefs() } } } - DefaultListMenuClass = DefaultListMenuSettings->GetClass(); + DefaultListMenuClass = DefaultListMenuSettings->mClass; DefaultListMenuSettings = nullptr; - DefaultOptionMenuClass = DefaultOptionMenuSettings->GetClass(); + DefaultOptionMenuClass = DefaultOptionMenuSettings->mClass; DefaultOptionMenuSettings = nullptr; } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 3fba5fd6a..d90d1851c 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -558,7 +558,7 @@ OptionMenu "MouseOptions" // //------------------------------------------------------------------------------------------- -OptionMenu "JoystickOptions" +OptionMenu "JoystickOptionsDefaults" { Title "$JOYMNU_OPTIONS" Option "$JOYMNU_ENABLE", "use_joystick", "YesNo" @@ -576,6 +576,11 @@ OptionMenu "JoystickOptions" // The rest will be filled in by joystick code if devices get connected or disconnected } +OptionMenu "JoystickOptions" +{ + Title "$JOYMNU_OPTIONS" +} + OptionValue "JoyAxisMapNames" { -1, "$OPTVAL_NONE"