Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ add_subdirectory(lib)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Activate some compiler / linker options to aid us with diagnosing stack space issues in Debug builds
add_compile_options(-fstack-usage -Wstack-usage=500)
add_compile_options(-fstack-usage -Wstack-usage=500 -Wnull-dereference -Wcast-align -Wimplicit-fallthrough)
add_compile_definitions(PICO_USE_STACK_GUARDS=1)
endif()

Expand Down
4 changes: 2 additions & 2 deletions headers/display/GPGFX_UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class GPGFX_UI {
DisplayOptions getDisplayOptions();
private:
GPGFX* _renderer;
DisplayOptions _displayOptions;
bool _configMode;
DisplayOptions _displayOptions{};
bool _configMode = false;
};

#endif
4 changes: 2 additions & 2 deletions headers/display/GPGFX_UI_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

typedef struct MenuEntry {
std::string label;
uint8_t* icon;
std::vector<MenuEntry>* submenu;
uint8_t* icon = nullptr;
std::vector<MenuEntry>* submenu = nullptr;
std::function<int32_t()> currentValue;
std::function<void()> action;
int32_t optionValue = -1;
Expand Down
2 changes: 1 addition & 1 deletion headers/display/ui/elements/GPWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class GPWidget : public GPGFX_UI {

uint16_t strokeColor = 0;
uint16_t fillColor = 0;
uint16_t _ID;
uint16_t _ID = 0;
uint16_t _priority = 0;
bool _visibility = true;

Expand Down
28 changes: 14 additions & 14 deletions headers/display/ui/screens/ButtonLayoutScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define INPUT_HISTORY_MAX_MODES 12

// Static to ensure memory is never doubled
static const char * displayNames[INPUT_HISTORY_MAX_MODES][INPUT_HISTORY_MAX_INPUTS] = {
static const char * displayNames[INPUT_HISTORY_MAX_MODES][INPUT_HISTORY_MAX_INPUTS] __attribute__((unused)) = {
{ // PS3 - 0
CHAR_UP, CHAR_DOWN, CHAR_LEFT, CHAR_RIGHT,
CHAR_UL, CHAR_UR, CHAR_DL, CHAR_DR,
Expand Down Expand Up @@ -146,35 +146,35 @@ class ButtonLayoutScreen : public GPScreen {
{INPUT_MODE_GENERIC, 11},
};

Gamepad* gamepad;
InputMode inputMode;
std::string statusBar;
std::string footer;
Gamepad* gamepad = nullptr;
InputMode inputMode = INPUT_MODE_XINPUT;
std::string statusBar{};
std::string footer{};

bool isInputHistoryEnabled = false;
uint16_t inputHistoryX = 0;
uint16_t inputHistoryY = 0;
size_t inputHistoryLength = 0;
std::string historyString;
std::deque<std::string> inputHistory;
std::array<bool, INPUT_HISTORY_MAX_INPUTS> lastInput;
std::string historyString{};
std::deque<std::string> inputHistory{};
std::array<bool, INPUT_HISTORY_MAX_INPUTS> lastInput{};

bool bannerDisplay;
bool bannerDisplay = false;
uint8_t bannerDelay = 2;
int bannerDelayStart = 0;
std::string bannerMessage;
std::string bannerMessage{};
uint16_t prevButtonState = 0;
uint8_t prevLayoutLeft = 0;
uint8_t prevLayoutRight = 0;
uint8_t profileNumber = 0;
uint8_t prevProfileNumber = 0;
ButtonLayoutParamsLeft prevLeftOptions;
ButtonLayoutParamsRight prevRightOptions;
ButtonLayoutOrientation prevOrientation;
ButtonLayoutParamsLeft prevLeftOptions{};
ButtonLayoutParamsRight prevRightOptions{};
ButtonLayoutOrientation prevOrientation{};

bool hasTurboAssigned = false;

bool macroEnabled;
bool macroEnabled = false;

bool showInputMode = true;
bool showTurboMode = true;
Expand Down
2 changes: 1 addition & 1 deletion headers/display/ui/screens/DisplaySaverScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DisplaySaverScreen : public GPScreen {
protected:
virtual void drawScreen();
uint16_t prevButtonState = 0;
DisplaySaverMode displaySaverMode;
DisplaySaverMode displaySaverMode{};

// snow screen
uint8_t snowflakeSpeeds[SCREEN_WIDTH][SCREEN_HEIGHT] = {};
Expand Down
58 changes: 30 additions & 28 deletions headers/display/ui/screens/MainMenuScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,16 @@ class MainMenuScreen : public GPScreen {
virtual void drawScreen();
private:
bool isPressed = false;
uint32_t checkDebounce;
std::vector<MenuEntry>* currentMenu;
std::vector<MenuEntry>* previousMenu;
uint32_t checkDebounce = 0;
std::vector<MenuEntry>* currentMenu = nullptr;
std::vector<MenuEntry>* previousMenu = nullptr;
uint16_t prevButtonState = 0;
uint8_t prevDpadState = 0;
Mask_t prevValues;
Mask_t prevValues = 0;
GPMenu* gpMenu = nullptr;
const uint8_t menuLineSize = 4;

GpioAction eventAction;
GpioAction eventAction = GpioAction::NONE;

bool screenIsPrompting = false;
bool promptChoice = false;
Expand All @@ -98,13 +98,13 @@ class MainMenuScreen : public GPScreen {
int8_t exitToScreenBeforePrompt = -1;
int8_t exitToScreen = -1;

GamepadButtonMapping *mapMenuUp;
GamepadButtonMapping *mapMenuDown;
GamepadButtonMapping *mapMenuLeft;
GamepadButtonMapping *mapMenuRight;
GamepadButtonMapping *mapMenuSelect;
GamepadButtonMapping *mapMenuBack;
GamepadButtonMapping *mapMenuToggle;
GamepadButtonMapping *mapMenuUp = nullptr;
GamepadButtonMapping *mapMenuDown = nullptr;
GamepadButtonMapping *mapMenuLeft = nullptr;
GamepadButtonMapping *mapMenuRight = nullptr;
GamepadButtonMapping *mapMenuSelect = nullptr;
GamepadButtonMapping *mapMenuBack = nullptr;
GamepadButtonMapping *mapMenuToggle = nullptr;

void saveOptions();
void resetOptions();
Expand All @@ -118,39 +118,44 @@ class MainMenuScreen : public GPScreen {
std::vector<MenuEntry> inputModeMenu = {
InputMode_VALUELIST(INPUT_MODE_ENTRIES)
};
InputMode prevInputMode;
InputMode updateInputMode;
InputMode prevInputMode{};
InputMode updateInputMode{};

std::vector<MenuEntry> dpadModeMenu = {
DpadMode_VALUELIST(DPAD_MODE_ENTRIES)
};
DpadMode prevDpadMode;
DpadMode updateDpadMode;
DpadMode prevDpadMode{};
DpadMode updateDpadMode{};

std::vector<MenuEntry> socdModeMenu = {
SOCDMode_VALUELIST(SOCD_MODE_ENTRIES)
};
SOCDMode prevSocdMode;
SOCDMode updateSocdMode;
SOCDMode prevSocdMode{};
SOCDMode updateSocdMode{};

std::vector<MenuEntry> profilesMenu = {};
uint8_t prevProfile;
uint8_t updateProfile;
uint8_t prevProfile{};
uint8_t updateProfile{};

std::vector<MenuEntry> focusModeMenu = {
{"Off", NULL, nullptr, std::bind(&MainMenuScreen::currentFocusMode, this), std::bind(&MainMenuScreen::selectFocusMode, this), 0},
{"On", NULL, nullptr, std::bind(&MainMenuScreen::currentFocusMode, this), std::bind(&MainMenuScreen::selectFocusMode, this), 1},
};
bool prevFocus;
bool updateFocus;
bool prevFocus = false;
bool updateFocus = false;

std::vector<MenuEntry> turboModeMenu = {
{"Off", NULL, nullptr, std::bind(&MainMenuScreen::currentTurboMode, this), std::bind(&MainMenuScreen::selectTurboMode, this), 0},
{"On", NULL, nullptr, std::bind(&MainMenuScreen::currentTurboMode, this), std::bind(&MainMenuScreen::selectTurboMode, this), 1},
};
bool prevTurbo;
bool updateTurbo;
bool prevTurbo = false;
bool updateTurbo = false;

std::vector<MenuEntry> saveMenu = {
{"Save & Exit",NULL, nullptr, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::saveAndExit, this), 1},
{"Exit", NULL, nullptr, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::exitOnly, this), 0},
};

std::vector<MenuEntry> mainMenu = {
{"Input Mode", NULL, &inputModeMenu, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::testMenu, this)},
{"D-Pad Mode", NULL, &dpadModeMenu, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::testMenu, this)},
Expand All @@ -161,10 +166,7 @@ class MainMenuScreen : public GPScreen {
{"Exit", NULL, &saveMenu, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::testMenu, this)},
};

std::vector<MenuEntry> saveMenu = {
{"Save & Exit",NULL, nullptr, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::saveAndExit, this), 1},
{"Exit", NULL, nullptr, std::bind(&MainMenuScreen::modeValue, this), std::bind(&MainMenuScreen::exitOnly, this), 0},
};

};

#endif
2 changes: 1 addition & 1 deletion headers/display/ui/screens/RestartScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RestartScreen : public GPScreen {
void setBootMode(uint32_t mode);
protected:
virtual void drawScreen();
uint32_t bootMode;
uint32_t bootMode = 0;
};

#endif
2 changes: 1 addition & 1 deletion headers/display/ui/screens/SplashScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class SplashScreen : public GPScreen {
virtual void drawScreen();
uint16_t prevButtonState = 0;
uint32_t splashStartTime = 0;
bool configMode;
bool configMode = false;
};

#endif
14 changes: 7 additions & 7 deletions headers/display/ui/screens/StatsScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class StatsScreen : public GPScreen {
virtual void drawScreen();
uint16_t prevButtonState = 0;

GPLabel* header;
GPLabel* version;
GPLabel* build;
GPLabel* board;
GPLabel* boardType;
GPLabel* arch;
GPLabel* exit;
GPLabel* header = nullptr;
GPLabel* version = nullptr;
GPLabel* build = nullptr;
GPLabel* board = nullptr;
GPLabel* boardType = nullptr;
GPLabel* arch = nullptr;
GPLabel* exit = nullptr;
};

#endif
4 changes: 2 additions & 2 deletions headers/drivermanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class DriverManager {
bool isConfigMode(){ return (inputMode == INPUT_MODE_CONFIG); }
private:
DriverManager() {}
GPDriver * driver;
InputMode inputMode;
GPDriver * driver = nullptr;
InputMode inputMode = INPUT_MODE_XINPUT;
};

#endif
8 changes: 6 additions & 2 deletions headers/drivers/ps3/PS3Descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@
#define GAMEPAD_ENDPOINT 1
#define GAMEPAD_SIZE 64

#define LSB(n) (n & 255)
#define MSB(n) ((n >> 8) & 255)
#ifndef LSB
#define LSB(n) ((n) & 255)
#endif
#ifndef MSB
#define MSB(n) (((n) >> 8) & 255)
#endif

// HAT report (4 bits)
#define PS3_HAT_UP 0x00
Expand Down
10 changes: 7 additions & 3 deletions headers/drivers/ps4/PS4Descriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
#define GAMEPAD_ENDPOINT 1
#define GAMEPAD_SIZE 64

#define LSB(n) (n & 255)
#define MSB(n) ((n >> 8) & 255)
#ifndef LSB
#define LSB(n) ((n) & 255)
#endif
#ifndef MSB
#define MSB(n) (((n) >> 8) & 255)
#endif

// HAT report (4 bits)
#define PS4_HAT_UP 0x00
Expand Down Expand Up @@ -224,7 +228,7 @@ typedef struct __attribute__((packed)) {

// features
union {
uint8_t featureValue = 0xEF;
//uint8_t featureValue = 0xEF;

struct __attribute__((packed)) {
uint8_t enableController : 1;
Expand Down
6 changes: 3 additions & 3 deletions headers/drivers/shared/xsm3/excrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ extern "C" {
#define SWAP32(i) i
#define SWAP64(i) i
#else
#define SWAP16(i) ((((i) & 0xFF) << 8 | ((i) >> 8) & 0xFF) & 0xFFFF)
#define SWAP32(i) ((((i) & 0xff) << 24) | (((i) & 0xff00) << 8) | (((i) & 0xff0000) >> 8) | (((i) >> 24) & 0xff))
#define SWAP64(i) ((SWAP32((i) & 0xFFFFFFFF) << 32) | (SWAP32(((i) >> 32) & 0xFFFFFFFF)))
#define SWAP16(i) __builtin_bswap16((uint16_t)(i))
#define SWAP32(i) __builtin_bswap32((uint32_t)(i))
#define SWAP64(i) __builtin_bswap64((uint64_t)(i))
#endif

#define U8V(data) ((uint8_t)(data) & 0xFF)
Expand Down
8 changes: 6 additions & 2 deletions headers/drivers/switchpro/SwitchProDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
#define SWITCH_PRO_VENDOR_ID 0x057E
#define SWITCH_PRO_PRODUCT_ID 0x2009

#define LSB(n) (n & 255)
#define MSB(n) ((n >> 8) & 255)
#ifndef LSB
#define LSB(n) ((n) & 255)
#endif
#ifndef MSB
#define MSB(n) (((n) >> 8) & 255)
#endif

// HAT report (4 bits)
#define SWITCH_PRO_HAT_UP 0x00
Expand Down
2 changes: 1 addition & 1 deletion headers/drivers/xbone/XBOneDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static const uint8_t * xbone_get_string_descriptor(int index) {
pico_unique_board_id_t id;
pico_get_unique_board_id(&id);
for(int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; i++) {
uniqueSerial[i] = 'A' + (id.id[i]%25); // some alphanumeric from 'A' to 'Z'
uniqueSerial[i] = 'A' + (id.id[i]%26); // some alphanumeric from 'A' to 'Z'
}
return uniqueSerial;
} else if ( index == 4 ) { // security method used
Expand Down
4 changes: 2 additions & 2 deletions headers/drivers/xboxog/XboxOriginalDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ static const uint8_t *xboxoriginal_string_descriptors[] __attribute__((unused))
xboxoriginal_string_version
};

static const uint8_t *xboxoriginal_device_descriptor = (const uint8_t*)&XID_DESC_DEVICE;
static const uint8_t *xboxoriginal_device_descriptor __attribute__((unused)) = (const uint8_t*)&XID_DESC_DEVICE;

static const uint8_t *xboxoriginal_configuration_descriptor = (const uint8_t*)&XID_DESC_CONFIGURATION;
static const uint8_t *xboxoriginal_configuration_descriptor __attribute__((unused)) = (const uint8_t*)&XID_DESC_CONFIGURATION;
2 changes: 1 addition & 1 deletion headers/events/GPMenuNavigateEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GPMenuNavigateEvent : public GPEvent {

GPEventType eventType() { return this->_eventType; }

GpioAction menuAction;
GpioAction menuAction = GpioAction::NONE;
private:
GPEventType _eventType = GP_EVENT_MENU_NAVIGATE;
};
Expand Down
4 changes: 2 additions & 2 deletions headers/events/GPProfileEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class GPProfileChangeEvent : public GPEvent {

GPEventType eventType() { return this->_eventType; }

uint8_t previousValue;
uint8_t currentValue;
uint8_t previousValue = 0;
uint8_t currentValue = 0;
private:
GPEventType _eventType = GP_EVENT_PROFILE_CHANGE;
};
Expand Down
2 changes: 1 addition & 1 deletion headers/events/GPRestartEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GPRestartEvent : public GPEvent {

GPEventType eventType() { return this->_eventType; }

System::BootMode bootMode;
System::BootMode bootMode = System::BootMode::DEFAULT;
private:
GPEventType _eventType = GP_EVENT_RESTART;
};
Expand Down
2 changes: 1 addition & 1 deletion headers/gamepad.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Gamepad {
/**
* @brief Check for a hotkey combination press. Checks aux, buttons, and dpad.
*/
inline bool __attribute__((always_inline)) pressedHotkey(const HotkeyEntry hotkey) {
inline bool __attribute__((always_inline)) pressedHotkey(const HotkeyEntry &hotkey) {
return (hotkey.action != 0 && pressedButton(hotkey.buttonsMask) &&
pressedDpad(hotkey.dpadMask) && pressedAux(hotkey.auxMask));
}
Expand Down
Loading