Repository: skyline-emu/skyline
File: app/src/main/cpp/skyline/input/npad_device.cpp (C++)

Code before:
            case NpadControllerType::JoyconDual:
                return section.dualController;
            case NpadControllerType::JoyconLeft:
                return section.leftController;
            case NpadControllerType::JoyconRight:
                return section.rightController;
            default:
                throw exception("Cannot find corresponding section for ControllerType: {}", type);
        }
    }

    void NpadDevice::WriteNextEntry(NpadControllerInfo &info, NpadControllerState entry) {
        auto &lastEntry{info.state.at(info.header.currentEntry)};

        info.header.timestamp = util::GetTimeTicks();
        info.header.entryCount = std::min(static_cast<u8>(info.header.entryCount + 1), constant::HidEntryCount);
        info.header.maxEntry = info.header.entryCount - 1;
        info.header.currentEntry = (info.header.currentEntry < info.header.maxEntry) ? info.header.currentEntry + 1 : 0;

        auto &nextEntry{info.state.at(info.header.currentEntry)};

        nextEntry.globalTimestamp = globalTimestamp;
        nextEntry.localTimestamp = lastEntry.localTimestamp + 1;
        nextEntry.buttons = entry.buttons;
        nextEntry.leftX = entry.leftX;
        nextEntry.leftY = entry.leftY;
        nextEntry.rightX = entry.rightX;
        nextEntry.rightY = entry.rightY;
        nextEntry.status.raw = connectionState.raw;
    }

    void NpadDevice::WriteEmptyEntries() {
        NpadControllerState emptyEntry{};

        WriteNextEntry(section.fullKeyController, emptyEntry);
        WriteNextEntry(section.handheldController, emptyEntry);
        WriteNextEntry(section.leftController, emptyEntry);
        WriteNextEntry(section.rightController, emptyEntry);
        WriteNextEntry(section.palmaController, emptyEntry);
        WriteNextEntry(section.dualController, emptyEntry);
        WriteNextEntry(section.defaultController, emptyEntry);

        globalTimestamp++;
    }

    void NpadDevice::ResetDeviceProperties() {
        // Don't reset assignment mode or ring lifo entries these values are persistent
        section.header.type = NpadControllerType::None;
        section.header.singleColor = {};
        section.header.leftColor = {};
        section.header.rightColor = {};

Review comment (suggestion):
```suggestion
                if (id == MotionId::right)
```

Code after:
    }

    NpadControllerInfo &NpadDevice::GetControllerInfo() {
        switch (type) {
            case NpadControllerType::ProController:
                return section.fullKeyController;
            case NpadControllerType::Handheld:
                return section.handheldController;
            case NpadControllerType::JoyconDual:
                return section.dualController;
            case NpadControllerType::JoyconLeft:
                return section.leftController;
            case NpadControllerType::JoyconRight:
                return section.rightController;
            default:
                throw exception("Cannot find corresponding section for ControllerType: {}", type);
        }
    }

    NpadSixAxisInfo &NpadDevice::GetSixAxisInfo(MotionId id) {
        switch (type) {
            case NpadControllerType::ProController:
                return section.fullKeySixAxis;
            case NpadControllerType::Handheld:
                return section.handheldSixAxis;
            case NpadControllerType::JoyconDual:
                if (id == MotionId::Right)
                    return section.dualRightSixAxis;
                return section.dualLeftSixAxis;
            case NpadControllerType::JoyconLeft:
                return section.leftSixAxis;
            case NpadControllerType::JoyconRight:
                return section.rightSixAxis;
            default:
                throw exception("Cannot find corresponding section for ControllerType: {}", type);
        }
    }

    void NpadDevice::WriteNextEntry(NpadControllerInfo &info, NpadControllerState entry) {
        auto &lastEntry{info.state.at(info.header.currentEntry)};

        info.header.timestamp = util::GetTimeTicks();
        info.header.entryCount = std::min(static_cast<u8>(info.header.entryCount + 1), constant::HidEntryCount);
        info.header.maxEntry = info.header.entryCount - 1;
        info.header.currentEntry = (info.header.currentEntry < info.header.maxEntry) ? info.header.currentEntry + 1 : 0;

        auto &nextEntry{info.state.at(info.header.currentEntry)};

        nextEntry.globalTimestamp = globalTimestamp;
        nextEntry.localTimestamp = lastEntry.localTimestamp + 1;
        nextEntry.buttons = entry.buttons;