mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- made joystick configuration menu operational.
This commit is contained in:
parent
6c1a8fb8c2
commit
957d997353
10 changed files with 53 additions and 52 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#include "compat.h"
|
||||
#include <SDL.h>
|
||||
|
||||
//#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;
|
||||
|
|
|
@ -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<IJoystickConfig *> 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;i<opt->mItems.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<DJoystickConfigMenu*>(DMenu::CurrentMenu))
|
||||
{
|
||||
DMenu::CurrentMenu->Close();
|
||||
}
|
||||
|
@ -425,4 +425,9 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
static TMenuClassDescriptor<DJoystickConfigMenu> _im("JoystickConfigMenu");
|
||||
|
||||
void RegisterJoystickMenus()
|
||||
{
|
||||
menuClasses.Push(&_im);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,3 +44,6 @@ xx(Mididevices)
|
|||
xx(Aldevices)
|
||||
xx(Alresamplers)
|
||||
xx(AdvSoundOptions)
|
||||
xx(JoystickConfigMenu)
|
||||
xx(JoystickOptions)
|
||||
|
||||
|
|
|
@ -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"
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue