@@ -17,7 +17,6 @@ import { type JoystickEvent, EventType, joystickManager, JoystickModel } from '@
1717import { allAvailableAxes , allAvailableButtons } from '@/libs/joystick/protocols'
1818import { modifierKeyActions , otherAvailableActions } from '@/libs/joystick/protocols/other'
1919import {
20- type GamepadToCockpitStdMapping ,
2120 type JoystickProtocolActionsMapping ,
2221 type JoystickState ,
2322 type ProtocolAction ,
@@ -266,36 +265,6 @@ export const useControllerStore = defineStore('controller', () => {
266265 reader . readAsText ( e . target . files [ 0 ] )
267266 }
268267
269- const exportJoysticksMappingsToVehicle = async (
270- vehicleAddress : string ,
271- joystickMappings : { [ key in JoystickModel ] : GamepadToCockpitStdMapping }
272- ) : Promise < void > => {
273- await setKeyDataOnCockpitVehicleStorage ( vehicleAddress , cockpitStdMappingsKey , joystickMappings )
274- Swal . fire ( { icon : 'success' , text : 'Joystick mapping exported to vehicle.' , timer : 3000 } )
275- }
276-
277- const importJoysticksMappingsFromVehicle = async ( vehicleAddress : string ) : Promise < void > => {
278- const newMapping = await getKeyDataFromCockpitVehicleStorage ( vehicleAddress , cockpitStdMappingsKey )
279- if ( ! newMapping ) {
280- Swal . fire ( { icon : 'error' , text : 'No joystick mappings to import from vehicle.' , timer : 3000 } )
281- return
282- }
283- try {
284- Object . values ( newMapping ) . forEach ( ( mapping ) => {
285- if ( ! mapping [ 'name' ] || ! mapping [ 'axes' ] || ! mapping [ 'buttons' ] ) {
286- throw Error ( 'Invalid joystick mapping inside vehicle.' )
287- }
288- } )
289- } catch ( error ) {
290- Swal . fire ( { icon : 'error' , text : `Could not import joystick mapping from vehicle. ${ error } ` , timer : 3000 } )
291- return
292- }
293-
294- // @ts -ignore: We check for the necessary fields in the if before
295- cockpitStdMappings . value = newMapping
296- Swal . fire ( { icon : 'success' , text : 'Joystick mapping imported from vehicle.' , timer : 3000 } )
297- }
298-
299268 const exportFunctionsMapping = ( protocolActionsMapping : JoystickProtocolActionsMapping ) : void => {
300269 const blob = new Blob ( [ JSON . stringify ( protocolActionsMapping ) ] , { type : 'text/plain;charset=utf-8' } )
301270 saveAs ( blob , `cockpit-std-profile-joystick-${ protocolActionsMapping . name } .json` )
@@ -379,8 +348,6 @@ export const useControllerStore = defineStore('controller', () => {
379348 loadProtocolMapping,
380349 exportJoystickMapping,
381350 importJoystickMapping,
382- exportJoysticksMappingsToVehicle,
383- importJoysticksMappingsFromVehicle,
384351 exportFunctionsMapping,
385352 importFunctionsMapping,
386353 exportFunctionsMappingToVehicle,
0 commit comments