Skip to content

Commit

Permalink
chore: Remove unused code linked with USE_NEW_REFRESH
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk committed Nov 24, 2024
1 parent 611832c commit b2df6df
Showing 1 changed file with 15 additions and 51 deletions.
66 changes: 15 additions & 51 deletions src/inputdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include <QTime>
#include <QTimer>

#define USE_NEW_REFRESH

InputDaemon::InputDaemon(QMap<SDL_JoystickID, InputDevice *> *joysticks, AntiMicroSettings *settings, bool graphical,
QObject *parent)
: QObject(parent)
Expand Down Expand Up @@ -180,7 +178,6 @@ void InputDaemon::refreshJoysticks()

for (int i = 0; i < SDL_NumJoysticks(); i++)
{
#ifdef USE_NEW_REFRESH
int index = i;

// Check if device is considered a Game Controller at the start.
Expand Down Expand Up @@ -251,38 +248,6 @@ void InputDaemon::refreshJoysticks()
if (joystick != nullptr)
emit deviceAdded(joystick);
}

#else
SDL_Joystick *joystick = SDL_JoystickOpen(i);
if (joystick != nullptr)
{
QString temp = QString();
SDL_JoystickGUID tempGUID = SDL_JoystickGetGUID(joystick);
char guidString[65] = {'0'};
SDL_JoystickGetGUIDString(tempGUID, guidString, sizeof(guidString));
temp = QString(guidString);

bool disableGameController = m_settings->value(QString("%1Disable").arg(temp), false).toBool();

if (SDL_IsGameController(i) && !disableGameController)
{
SDL_GameController *controller = SDL_GameControllerOpen(i);
GameController *damncontroller = new GameController(controller, i, m_settings, this);
connect(damncontroller, &GameController::requestWait, eventWorker, &SDLEventReader::haltServices);
SDL_Joystick *sdlStick = SDL_GameControllerGetJoystick(controller);
SDL_JoystickID joystickID = SDL_JoystickInstanceID(sdlStick);
m_joysticks->insert(joystickID, damncontroller);
trackcontrollers.insert(joystickID, damncontroller);
} else
{
Joystick *curJoystick = new Joystick(joystick, i, m_settings, this);
connect(curJoystick, &Joystick::requestWait, eventWorker, &SDLEventReader::haltServices);
SDL_JoystickID joystickID = SDL_JoystickInstanceID(joystick);
m_joysticks->insert(joystickID, curJoystick);
trackjoysticks.insert(joystickID, curJoystick);
}
}
#endif
}

m_settings->endGroup();
Expand Down Expand Up @@ -710,23 +675,22 @@ void InputDaemon::firstInputPass(QQueue<SDL_Event> *sdlEventQueue)
{
if (Logger::isDebugEnabled())
{
const QMap<Uint32, QString> STRING_MAP = {
{SDL_JOYBUTTONDOWN, "SDL_JOYBUTTONDOWN"},
{SDL_JOYBUTTONUP, "SDL_JOYBUTTONUP"},
{SDL_JOYAXISMOTION, "SDL_JOYAXISMOTION"},
{SDL_JOYHATMOTION, "SDL_JOYHATMOTION"},
{SDL_CONTROLLERAXISMOTION, "SDL_CONTROLLERAXISMOTION"},
{SDL_CONTROLLERBUTTONDOWN, "SDL_CONTROLLERBUTTONDOWN"},
{SDL_CONTROLLERBUTTONUP, "SDL_CONTROLLERBUTTONUP"},
{SDL_JOYDEVICEREMOVED, "SDL_JOYDEVICEREMOVED"},
{SDL_JOYDEVICEADDED, "SDL_JOYDEVICEADDED"},
{SDL_CONTROLLERDEVICEREMOVED, "SDL_CONTROLLERDEVICEREMOVED"},
{SDL_CONTROLLERDEVICEADDED, "SDL_CONTROLLERDEVICEADDED"},
const QMap<Uint32, QString> STRING_MAP = {{SDL_JOYBUTTONDOWN, "SDL_JOYBUTTONDOWN"},
{SDL_JOYBUTTONUP, "SDL_JOYBUTTONUP"},
{SDL_JOYAXISMOTION, "SDL_JOYAXISMOTION"},
{SDL_JOYHATMOTION, "SDL_JOYHATMOTION"},
{SDL_CONTROLLERAXISMOTION, "SDL_CONTROLLERAXISMOTION"},
{SDL_CONTROLLERBUTTONDOWN, "SDL_CONTROLLERBUTTONDOWN"},
{SDL_CONTROLLERBUTTONUP, "SDL_CONTROLLERBUTTONUP"},
{SDL_JOYDEVICEREMOVED, "SDL_JOYDEVICEREMOVED"},
{SDL_JOYDEVICEADDED, "SDL_JOYDEVICEADDED"},
{SDL_CONTROLLERDEVICEREMOVED, "SDL_CONTROLLERDEVICEREMOVED"},
{SDL_CONTROLLERDEVICEADDED, "SDL_CONTROLLERDEVICEADDED"},
#if SDL_VERSION_ATLEAST(2, 0, 14)
{SDL_CONTROLLERSENSORUPDATE, "SDL_CONTROLLERSENSORUPDATE"},
{SDL_CONTROLLERTOUCHPADDOWN, "SDL_CONTROLLERTOUCHPADDOWN"},
{SDL_CONTROLLERTOUCHPADMOTION, "SDL_CONTROLLERTOUCHPADMOTION"},
{SDL_CONTROLLERTOUCHPADUP, "SDL_CONTROLLERTOUCHPADUP"}
{SDL_CONTROLLERSENSORUPDATE, "SDL_CONTROLLERSENSORUPDATE"},
{SDL_CONTROLLERTOUCHPADDOWN, "SDL_CONTROLLERTOUCHPADDOWN"},
{SDL_CONTROLLERTOUCHPADMOTION, "SDL_CONTROLLERTOUCHPADMOTION"},
{SDL_CONTROLLERTOUCHPADUP, "SDL_CONTROLLERTOUCHPADUP"}
#endif
};

Expand Down

0 comments on commit b2df6df

Please sign in to comment.