diff --git a/cmake/cvars.cmake b/cmake/cvars.cmake index 8e65aa290..72e171d92 100644 --- a/cmake/cvars.cmake +++ b/cmake/cvars.cmake @@ -20,6 +20,26 @@ set(CVAR_GAME_OVERLAY_FONT "gOverlayFont" CACHE STRING "") set(CVAR_MENU_BAR_OPEN "gOpenMenuBar" CACHE STRING "") set(CVAR_PREFIX_CONTROLLERS "gControllers" CACHE STRING "") set(CVAR_PREFIX_ADVANCED_RESOLUTION "gAdvancedResolution" CACHE STRING "") + +set(LUS_DEFAULT_KB_MAPPING_A KbScancode::LUS_KB_X CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_B KbScancode::LUS_KB_C CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_L KbScancode::LUS_KB_E CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_R KbScancode::LUS_KB_R CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_Z KbScancode::LUS_KB_Z CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_START KbScancode::LUS_KB_SPACE CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_STICKUP KbScancode::LUS_KB_W CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_STICKDOWN KbScancode::LUS_KB_S CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_STICKLEFT KbScancode::LUS_KB_A CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_STICKRIGHT KbScancode::LUS_KB_D CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_CUP KbScancode::LUS_KB_ARROWKEY_UP CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_CDOWN KbScancode::LUS_KB_ARROWKEY_DOWN CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_CLEFT KbScancode::LUS_KB_ARROWKEY_LEFT CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_CRIGHT KbScancode::LUS_KB_ARROWKEY_RIGHT CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_DUP KbScancode::LUS_KB_T CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_DDOWN KbScancode::LUS_KB_G CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_DLEFT KbScancode::LUS_KB_F CACHE STRING "") +set(LUS_DEFAULT_KB_MAPPING_DRIGHT KbScancode::LUS_KB_H CACHE STRING "") + add_compile_definitions( CVAR_VSYNC_ENABLED="${CVAR_VSYNC_ENABLED}" CVAR_Z_FIGHTING_MODE="${CVAR_Z_FIGHTING_MODE}" @@ -43,4 +63,23 @@ add_compile_definitions( CVAR_MENU_BAR_OPEN="${CVAR_MENU_BAR_OPEN}" CVAR_PREFIX_CONTROLLERS="${CVAR_PREFIX_CONTROLLERS}" CVAR_PREFIX_ADVANCED_RESOLUTION="${CVAR_PREFIX_ADVANCED_RESOLUTION}" -) \ No newline at end of file + + LUS_DEFAULT_KB_MAPPING_A=${LUS_DEFAULT_KB_MAPPING_A} + LUS_DEFAULT_KB_MAPPING_B=${LUS_DEFAULT_KB_MAPPING_B} + LUS_DEFAULT_KB_MAPPING_L=${LUS_DEFAULT_KB_MAPPING_L} + LUS_DEFAULT_KB_MAPPING_R=${LUS_DEFAULT_KB_MAPPING_R} + LUS_DEFAULT_KB_MAPPING_Z=${LUS_DEFAULT_KB_MAPPING_Z} + LUS_DEFAULT_KB_MAPPING_START=${LUS_DEFAULT_KB_MAPPING_START} + LUS_DEFAULT_KB_MAPPING_STICKUP=${LUS_DEFAULT_KB_MAPPING_STICKUP} + LUS_DEFAULT_KB_MAPPING_STICKDOWN=${LUS_DEFAULT_KB_MAPPING_STICKDOWN} + LUS_DEFAULT_KB_MAPPING_STICKLEFT=${LUS_DEFAULT_KB_MAPPING_STICKLEFT} + LUS_DEFAULT_KB_MAPPING_STICKRIGHT=${LUS_DEFAULT_KB_MAPPING_STICKRIGHT} + LUS_DEFAULT_KB_MAPPING_CUP=${LUS_DEFAULT_KB_MAPPING_CUP} + LUS_DEFAULT_KB_MAPPING_CDOWN=${LUS_DEFAULT_KB_MAPPING_CDOWN} + LUS_DEFAULT_KB_MAPPING_CLEFT=${LUS_DEFAULT_KB_MAPPING_CLEFT} + LUS_DEFAULT_KB_MAPPING_CRIGHT=${LUS_DEFAULT_KB_MAPPING_CRIGHT} + LUS_DEFAULT_KB_MAPPING_DUP=${LUS_DEFAULT_KB_MAPPING_DUP} + LUS_DEFAULT_KB_MAPPING_DDOWN=${LUS_DEFAULT_KB_MAPPING_DDOWN} + LUS_DEFAULT_KB_MAPPING_DLEFT=${LUS_DEFAULT_KB_MAPPING_DLEFT} + LUS_DEFAULT_KB_MAPPING_DRIGHT=${LUS_DEFAULT_KB_MAPPING_DRIGHT} +) diff --git a/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp index 2db048d74..e504edf9c 100644 --- a/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp @@ -80,10 +80,10 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig(uint8_t portIn std::vector> AxisDirectionMappingFactory::CreateDefaultKeyboardAxisDirectionMappings(uint8_t portIndex, Stick stick) { std::vector> mappings = { - std::make_shared(portIndex, stick, LEFT, LUS_KB_A), - std::make_shared(portIndex, stick, RIGHT, LUS_KB_D), - std::make_shared(portIndex, stick, UP, LUS_KB_W), - std::make_shared(portIndex, stick, DOWN, LUS_KB_S) + std::make_shared(portIndex, stick, LEFT, LUS_DEFAULT_KB_MAPPING_STICKLEFT), + std::make_shared(portIndex, stick, RIGHT, LUS_DEFAULT_KB_MAPPING_STICKRIGHT), + std::make_shared(portIndex, stick, UP, LUS_DEFAULT_KB_MAPPING_STICKUP), + std::make_shared(portIndex, stick, DOWN, LUS_DEFAULT_KB_MAPPING_STICKDOWN) }; return mappings; diff --git a/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp b/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp index 3386e52e4..627e259db 100644 --- a/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp +++ b/src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp @@ -75,54 +75,60 @@ ButtonMappingFactory::CreateDefaultKeyboardButtonMappings(uint8_t portIndex, CON switch (bitmask) { case BTN_A: - mappings.push_back(std::make_shared(portIndex, BTN_A, KbScancode::LUS_KB_X)); + mappings.push_back( + std::make_shared(portIndex, BTN_A, LUS_DEFAULT_KB_MAPPING_A)); break; case BTN_B: - mappings.push_back(std::make_shared(portIndex, BTN_B, KbScancode::LUS_KB_C)); + mappings.push_back( + std::make_shared(portIndex, BTN_B, LUS_DEFAULT_KB_MAPPING_B)); break; case BTN_L: - mappings.push_back(std::make_shared(portIndex, BTN_L, KbScancode::LUS_KB_E)); + mappings.push_back( + std::make_shared(portIndex, BTN_L, LUS_DEFAULT_KB_MAPPING_L)); break; case BTN_R: - mappings.push_back(std::make_shared(portIndex, BTN_R, KbScancode::LUS_KB_R)); + mappings.push_back( + std::make_shared(portIndex, BTN_R, LUS_DEFAULT_KB_MAPPING_R)); break; case BTN_Z: - mappings.push_back(std::make_shared(portIndex, BTN_Z, KbScancode::LUS_KB_Z)); + mappings.push_back( + std::make_shared(portIndex, BTN_Z, LUS_DEFAULT_KB_MAPPING_Z)); break; case BTN_START: mappings.push_back( - std::make_shared(portIndex, BTN_START, KbScancode::LUS_KB_SPACE)); + std::make_shared(portIndex, BTN_START, LUS_DEFAULT_KB_MAPPING_START)); break; case BTN_CUP: mappings.push_back( - std::make_shared(portIndex, BTN_CUP, KbScancode::LUS_KB_ARROWKEY_UP)); + std::make_shared(portIndex, BTN_CUP, LUS_DEFAULT_KB_MAPPING_CUP)); break; case BTN_CDOWN: mappings.push_back( - std::make_shared(portIndex, BTN_CDOWN, KbScancode::LUS_KB_ARROWKEY_DOWN)); + std::make_shared(portIndex, BTN_CDOWN, LUS_DEFAULT_KB_MAPPING_CDOWN)); break; case BTN_CLEFT: mappings.push_back( - std::make_shared(portIndex, BTN_CLEFT, KbScancode::LUS_KB_ARROWKEY_LEFT)); + std::make_shared(portIndex, BTN_CLEFT, LUS_DEFAULT_KB_MAPPING_CLEFT)); break; case BTN_CRIGHT: mappings.push_back( - std::make_shared(portIndex, BTN_CRIGHT, KbScancode::LUS_KB_ARROWKEY_RIGHT)); + std::make_shared(portIndex, BTN_CRIGHT, LUS_DEFAULT_KB_MAPPING_CRIGHT)); break; case BTN_DUP: - mappings.push_back(std::make_shared(portIndex, BTN_DUP, KbScancode::LUS_KB_T)); + mappings.push_back( + std::make_shared(portIndex, BTN_DUP, LUS_DEFAULT_KB_MAPPING_DUP)); break; case BTN_DDOWN: mappings.push_back( - std::make_shared(portIndex, BTN_DDOWN, KbScancode::LUS_KB_G)); + std::make_shared(portIndex, BTN_DDOWN, LUS_DEFAULT_KB_MAPPING_DDOWN)); break; case BTN_DLEFT: mappings.push_back( - std::make_shared(portIndex, BTN_DLEFT, KbScancode::LUS_KB_F)); + std::make_shared(portIndex, BTN_DLEFT, LUS_DEFAULT_KB_MAPPING_DLEFT)); break; case BTN_DRIGHT: mappings.push_back( - std::make_shared(portIndex, BTN_DRIGHT, KbScancode::LUS_KB_H)); + std::make_shared(portIndex, BTN_DRIGHT, LUS_DEFAULT_KB_MAPPING_DRIGHT)); break; }