generated from SteamDeckHomebrew/decky-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create + fix up controllers slice * add backend methods for controller settings * remap action dropdown successfully saving to redux * bootstrap current game profile values to store * persist controller mappings to backend * start setting up controller remap sync * enable updating hardware button remappings * add per-game controller map toggle * immediately save per-game controller maps to backend + update debounce time * update labels on components
- Loading branch information
1 parent
48cf2cd
commit 9503ae4
Showing
10 changed files
with
355 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { | ||
controllerSlice, | ||
selectButtonRemapAction, | ||
selectControllerPerGameProfilesEnabled, | ||
selectControllerProfileDisplayName | ||
} from '../redux-modules/controllerSlice'; | ||
import { RemapActions, RemappableButtons } from '../backend/constants'; | ||
|
||
export const useControllerPerGameEnabled = () => { | ||
const controllerPerGameEnabled = useSelector( | ||
selectControllerPerGameProfilesEnabled | ||
); | ||
const dispatch = useDispatch(); | ||
|
||
const setControllerPerGameEnabled = (enabled: boolean) => { | ||
return dispatch(controllerSlice.actions.setPerGameProfilesEnabled(enabled)); | ||
}; | ||
|
||
return { controllerPerGameEnabled, setControllerPerGameEnabled }; | ||
}; | ||
|
||
export const useRemapAction = (btn: RemappableButtons) => { | ||
const remapAction = useSelector(selectButtonRemapAction(btn)); | ||
const dispatch = useDispatch(); | ||
|
||
const setRemapAction = (remapAction: RemapActions) => { | ||
return dispatch( | ||
controllerSlice.actions.remapButton({ button: btn, remapAction }) | ||
); | ||
}; | ||
|
||
return { remapAction, setRemapAction }; | ||
}; | ||
|
||
export const useControllerProfileDisplayName = () => { | ||
return useSelector(selectControllerProfileDisplayName); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.