diff --git a/CMakeLists.txt b/CMakeLists.txt index e61f2fce0..e80bc3171 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,9 +197,9 @@ if( MSVC ) # Function-level linking # Disable run-time type information if ( HAVE_VULKAN ) - set( ALL_C_FLAGS "/GF /Gy /GR- /permissive- /DHAVE_VULKAN" ) + set( ALL_C_FLAGS "/GF /Gy /permissive- /DHAVE_VULKAN" ) else() - set( ALL_C_FLAGS "/GF /Gy /GR- /permissive-" ) + set( ALL_C_FLAGS "/GF /Gy /permissive-" ) endif() # Use SSE 2 as minimum always as the true color drawers needs it for __vectorcall diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index e0a045216..e35304eab 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -639,7 +639,6 @@ file( GLOB HEADER_FILES # without being compiled. set( NOT_COMPILED_SOURCE_FILES ${OTHER_SYSTEM_SOURCES} - build/src/sdlkeytrans.cpp sc_man_scanner.h common/utility/sc_man_scanner.re ) diff --git a/source/common/console/d_event.cpp b/source/common/console/d_event.cpp index 03b424c8e..aa1772d18 100644 --- a/source/common/console/d_event.cpp +++ b/source/common/console/d_event.cpp @@ -105,8 +105,8 @@ void D_ProcessEvents (void) ev = &events[eventtail]; if (ev->type == EV_None) continue; - if (ev->type == EV_DeviceChange) - (void)0;//UpdateJoystickMenu(I_UpdateDeviceList()); + /*if (ev->type == EV_DeviceChange) + UpdateJoystickMenu(I_UpdateDeviceList());*/ if (C_Responder (ev)) continue; // console ate the event if (M_Responder (ev)) diff --git a/source/common/filesystem/resourcefile.cpp b/source/common/filesystem/resourcefile.cpp index 446db0deb..2773a34c0 100644 --- a/source/common/filesystem/resourcefile.cpp +++ b/source/common/filesystem/resourcefile.cpp @@ -299,7 +299,6 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize) // each one so that we don't risk refiltering already filtered lumps. uint32_t max = NumLumps; - long len; int lastpos = -1; FString file; diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index 6a959e78b..64122bea0 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -283,11 +283,11 @@ int GameMain() // Just let the rest of the function execute. r = exit.Reason(); } + I_ShutdownInput(); G_SaveConfig(); #ifndef NETCODE_DISABLE if (gHaveNetworking) enet_deinitialize(); #endif - I_ShutdownInput(); return r; } diff --git a/source/common/input/i_input.cpp b/source/common/input/i_input.cpp index fa3a94b87..b6b8ce6f9 100644 --- a/source/common/input/i_input.cpp +++ b/source/common/input/i_input.cpp @@ -33,8 +33,8 @@ ** */ -#include #include "compat.h" +#include //#include "doomtype.h" //#include "doomdef.h" @@ -671,6 +671,13 @@ int32_t handleevents_pollsdl(void) case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: +#if 0 // SDL_MAJOR_VERSION >= 2 + if (joystick.isGameController) + break; + fallthrough__; + case SDL_CONTROLLERBUTTONDOWN: + case SDL_CONTROLLERBUTTONUP: +#endif if (!GUICapture) { evt.type = ev.type == SDL_JOYBUTTONDOWN ? EV_KeyDown : EV_KeyUp; diff --git a/source/common/menu/joystickmenu.cpp b/source/common/menu/joystickmenu.cpp index 18a1e5af6..40b0a4136 100644 --- a/source/common/menu/joystickmenu.cpp +++ b/source/common/menu/joystickmenu.cpp @@ -42,11 +42,11 @@ #include "c_bind.h" #include "d_event.h" #include "d_gui.h" +#include "input/m_joy.h" #define NO_IMP #include "optionmenuitems.h" -#if 0 // This requires the entire ZDoom backend to work. static TArray Joysticks; IJoystickConfig *SELECTED_JOYSTICK; @@ -245,10 +245,10 @@ public: mJoy = joy; } - bool Activate() + bool Activate(FName caller) override { UpdateJoystickConfigMenu(mJoy); - return FOptionMenuItemSubmenu::Activate(); + return FOptionMenuItemSubmenu::Activate(caller); } }; @@ -273,51 +273,50 @@ FOptionMenuDescriptor *UpdateJoystickConfigMenu(IJoystickConfig *joy) } if (joy == NULL) { - opt->mTitle = "Configure Controller"; - it = new FOptionMenuItemStaticText("Invalid controller specified for menu", false); + opt->mTitle = "$JOYMNU_TITLE"; + it = new FOptionMenuItemStaticText("$JOYMNU_INVALID"); opt->mItems.Push(it); } else { - opt->mTitle.Format("Configure %s", joy->GetName().GetChars()); + opt->mTitle.Format("%s", joy->GetName().GetChars()); SELECTED_JOYSTICK = joy; - it = new FOptionMenuSliderJoySensitivity("Overall sensitivity", 0, 2, 0.1, 3); + it = new FOptionMenuSliderJoySensitivity("$JOYMNU_OVRSENS", 0, 2, 0.1, 3); opt->mItems.Push(it); - it = new FOptionMenuItemStaticText(" ", false); + it = new FOptionMenuItemStaticText(" "); opt->mItems.Push(it); if (joy->GetNumAxes() > 0) { - it = new FOptionMenuItemStaticText("Axis Configuration", true); + it = new FOptionMenuItemStaticText("$JOYMNU_AXIS"); opt->mItems.Push(it); for (int i = 0; i < joy->GetNumAxes(); ++i) { - it = new FOptionMenuItemStaticText(" ", false); + it = new FOptionMenuItemStaticText(" "); opt->mItems.Push(it); it = new FOptionMenuItemJoyMap(joy->GetAxisName(i), i, "JoyAxisMapNames", false); opt->mItems.Push(it); - it = new FOptionMenuSliderJoyScale("Overall sensitivity", i, 0, 4, 0.1, 3); + it = new FOptionMenuSliderJoyScale("$JOYMNU_OVRSENS", i, 0, 4, 0.1, 3); opt->mItems.Push(it); - it = new FOptionMenuItemInverter("Invert", i, false); + it = new FOptionMenuItemInverter("$JOYMNU_INVERT", i, false); opt->mItems.Push(it); - it = new FOptionMenuSliderJoyDeadZone("Dead Zone", i, 0, 0.9, 0.05, 3); + it = new FOptionMenuSliderJoyDeadZone("$JOYMNU_DEADZONE", i, 0, 0.9, 0.05, 3); opt->mItems.Push(it); } } else { - it = new FOptionMenuItemStaticText("No configurable axes", false); + it = new FOptionMenuItemStaticText("$JOYMNU_NOAXES"); opt->mItems.Push(it); } } opt->mScrollPos = 0; opt->mSelectedItem = -1; opt->mIndent = 0; - opt->mPosition = -25; opt->CalcIndent(); return opt; } @@ -333,6 +332,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected) { FOptionMenuDescriptor *opt = (FOptionMenuDescriptor *)*desc; FOptionMenuItem *it; + for(unsigned i=0;imItems.Size();i++) { delete opt->mItems[i]; @@ -360,9 +360,9 @@ void UpdateJoystickMenu(IJoystickConfig *selected) } // Todo: Block joystick for changing this one. - it = new FOptionMenuItemOption("Enable controller support", "use_joystick", "YesNo", NULL, false); + it = new FOptionMenuItemOption("$JOYMNU_ENABLE", "use_joystick", "YesNo", NULL, false); opt->mItems.Push(it); - #ifdef _WIN32 + #if 0//def _WIN32 it = new FOptionMenuItemOption("Enable DirectInput controllers", "joy_dinput", "YesNo", NULL, false); opt->mItems.Push(it); it = new FOptionMenuItemOption("Enable XInput controllers", "joy_xinput", "YesNo", NULL, false); @@ -371,24 +371,24 @@ void UpdateJoystickMenu(IJoystickConfig *selected) opt->mItems.Push(it); #endif - it = new FOptionMenuItemStaticText(" ", false); + it = new FOptionMenuItemStaticText(" "); opt->mItems.Push(it); if (Joysticks.Size() == 0) { - it = new FOptionMenuItemStaticText("No controllers detected", false); + it = new FOptionMenuItemStaticText("$JOYMNU_NOCON"); opt->mItems.Push(it); if (!use_joystick) { - it = new FOptionMenuItemStaticText("Controller support must be", false); + it = new FOptionMenuItemStaticText("$JOYMNU_DISABLED1"); opt->mItems.Push(it); - it = new FOptionMenuItemStaticText("enabled to detect any", false); + it = new FOptionMenuItemStaticText("$JOYMNU_DISABLED1"); opt->mItems.Push(it); } } else { - it = new FOptionMenuItemStaticText("Configure controllers:", false); + it = new FOptionMenuItemStaticText("$JOYMNU_CONFIG"); opt->mItems.Push(it); for (int i = 0; i < (int)Joysticks.Size(); ++i) @@ -417,7 +417,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected) if (i == (int)Joysticks.Size()) { SELECTED_JOYSTICK = NULL; - if (DMenu::CurrentMenu != NULL && DMenu::CurrentMenu->IsKindOf(RUNTIME_CLASS(DJoystickConfigMenu))) + if (DMenu::CurrentMenu != NULL && dynamic_cast(DMenu::CurrentMenu)) { DMenu::CurrentMenu->Close(); } @@ -425,4 +425,9 @@ void UpdateJoystickMenu(IJoystickConfig *selected) } } -#endif \ No newline at end of file +static TMenuClassDescriptor _im("JoystickConfigMenu"); + +void RegisterJoystickMenus() +{ + menuClasses.Push(&_im); +} diff --git a/source/common/menu/menu.cpp b/source/common/menu/menu.cpp index e1265fd2c..1d893c972 100644 --- a/source/common/menu/menu.cpp +++ b/source/common/menu/menu.cpp @@ -53,6 +53,7 @@ #include "build.h" #include "baselayer.h" #include "statistics.h" +#include "input/m_joy.h" void RegisterDukeMenus(); void RegisterRedneckMenus(); @@ -60,6 +61,8 @@ void RegisterBloodMenus(); void RegisterSWMenus(); void RegisterLoadsaveMenus(); void RegisterOptionMenus(); +void RegisterJoystickMenus(); +void UpdateJoystickMenu(IJoystickConfig* joy); extern bool rotatesprite_2doverride; bool help_disabled, credits_disabled; int g_currentMenu; // accessible by CON scripts - contains the current menu's script ID if defined or INT_MAX if none given. @@ -953,8 +956,10 @@ void M_Init (void) RegisterSWMenus(); RegisterLoadsaveMenus(); RegisterOptionMenus(); + RegisterJoystickMenus(); timerSetCallback(M_Ticker); M_ParseMenuDefs(); + UpdateJoystickMenu(nullptr); } diff --git a/source/common/utility/namedef.h b/source/common/utility/namedef.h index 3fdb641b3..643d1378a 100644 --- a/source/common/utility/namedef.h +++ b/source/common/utility/namedef.h @@ -43,4 +43,7 @@ xx(EndgameMenu) xx(Mididevices) xx(Aldevices) xx(Alresamplers) -xx(AdvSoundOptions) \ No newline at end of file +xx(AdvSoundOptions) +xx(JoystickConfigMenu) +xx(JoystickOptions) + diff --git a/wadsrc/static/demolition/menudef.txt b/wadsrc/static/demolition/menudef.txt index c2a6a68dd..944b77c4e 100644 --- a/wadsrc/static/demolition/menudef.txt +++ b/wadsrc/static/demolition/menudef.txt @@ -945,29 +945,12 @@ OptionMenu "MouseOptions" //protected // //------------------------------------------------------------------------------------------- -OptionMenu "JoystickOptions"//Defaults" //protected +OptionMenu "JoystickOptions" //protected { Title "$JOYMNU_OPTIONS" - Option "$JOYMNU_ENABLE", "use_joystick", "YesNo" - Option "$JOYMNU_NOMENU", "m_blockcontrollers", "YesNo" - /*IfOption(Windows) - { - Option "$JOYMNU_DINPUT", "joy_dinput", "YesNo" - Option "$JOYMNU_XINPUT", "joy_xinput", "YesNo" - Option "$JOYMNU_PS2", "joy_ps2raw", "YesNo" - }*/ - StaticText "" - StaticTextSwitchable "$JOYMNU_NOCON", "$JOYMNU_CONFIG", "ConfigureMessage" - StaticTextSwitchable " ", "$JOYMNU_DISABLED1", "ConnectMessage1" - StaticTextSwitchable " ", "$JOYMNU_DISABLED2", "ConnectMessage2" - - // The rest will be filled in by joystick code if devices get connected or disconnected + // This will be filled in by joystick code if devices get connected or disconnected } -OptionMenu "JoystickOptions1" //protected -{ - Title "$JOYMNU_OPTIONS" -} OptionValue "JoyAxisMapNames" {