[Gamepad] How to get DpadCenter value?

I’m working on a game and I need the Android Key DPadCenter.
I already do something like.
The button south works, but I don’t understand how to deal with missing keys.

initListener (): void
    {     
        input.on(Input.EventType.KEY_DOWN, this.OnKeyDown, this);
        input.on(Input.EventType.TOUCH_START, this.touchStart, this);      
        input.on(Input.EventType.GAMEPAD_INPUT, this.GamePadOnKeyDown, this);    
    }

    private GamePadOnKeyDown (event: EventGamepad): void
    {
        if (event.gamepad.buttonSouth.getValue() == 1 )
        {
            this.FlapBird();
        }
      //The DpadCenter is not mapped.
      if(event.gamepad.dpad.center.getValue() == 1)

      //But this values are mapped
     let leftAction = event.gamepad.dpad.left.getValue() == 1;
     let rightAction = event.gamepad.dpad.right.getValue() == 1;
     let upAction = event.gamepad.dpad.up.getValue() == 1;
     let downAction = event.gamepad.dpad.down.getValue() == 1;

    }

The Key I’m looking is this one on the Android Platform.

I’m confused on how can I manually map this key…

Ok I finally found where the Input Data works on Android…Harmony uses other way.

You will need to change the File “AndroidPlatform.cpp”
The location of the file is here “cocos/platform/android/AndroidPlatform.cpp”
Or in the engine location “C:\cocos-engine-3.8.2\native\cocos\platform\android\AndroidPlatform.cpp”

I’m sure with this paths is more easy to locate the the file required to modify.

bool cookGameActivityKeyEvent(GameActivityKeyEvent *keyEvent) {
        if (_gameControllerIndex >= 0) {
            for (const auto &action : INPUT_KEY_ACTIONS) {
                if (action.buttonMask != keyEvent->keyCode) {
                    continue;
                }
                keyboardEvent.action = 0 == keyEvent->action ? cc::KeyboardEvent::Action::PRESS
                                                             : cc::KeyboardEvent::Action::RELEASE;
                keyboardEvent.key = action.actionCode;
                events::Keyboard::broadcast(keyboardEvent);
                return true;
            }
        }
        keyboardEvent.action = 0 == keyEvent->action ? cc::KeyboardEvent::Action::PRESS
                                                     : cc::KeyboardEvent::Action::RELEASE;
        keyboardEvent.key = keyEvent->keyCode;
        auto keyCodeItr = androidKeyCodes.find(keyEvent->keyCode);
        if (keyCodeItr == androidKeyCodes.end()) {
            keyboardEvent.code.clear();
        } else {
            keyboardEvent.code = keyCodeItr->second;
        }
        //If the KEYCODE_DPAD_CENTER (23)
        //Override this value to press the Space Keyboard.
        if(keyEvent->keyCode == 23)
        {           
            keyboardEvent.code = "Space";
        }
        events::Keyboard::broadcast(keyboardEvent);
        return true;
    }

Well in short what is required is this.
Maybe the mapping value is missing, so instead of mapping the values beyond here.
I really don’t know what I need to make this more organized. I mean update the typescript files.

I just swap the key, so when I receive the DPAD_CENTER I just switch to the Space Keyboard.
And I can finally make my game playable on Android TV. I guess we can do the same for other keys like PlayPause, Fast Forward…I think we can still make this better…don’t know what happens after the Keyboard::broadcast :confused:

I will try to improve this better.-*-

        //If the KEYCODE_DPAD_CENTER (23)
        //Override this value to press the Space Keyboard.
        if(keyEvent->keyCode == 23)
        {           
            keyboardEvent.code = "Space";
        }
        events::Keyboard::broadcast(keyboardEvent);