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

Code before:
        // Some games such as Cave Story+ set invalid values for the ControllerSupportMode so use argSize to derive it if necessary (from yuzu)
        if (argPrivate.mode >= ControllerSupportMode::MaxControllerSupportMode) {
            switch (argPrivate.argSize) {
                case sizeof(ControllerSupportArgOld):
                case sizeof(ControllerSupportArgNew):
                    argPrivate.mode = ControllerSupportMode::ShowControllerSupport;
                    break;
                default:
                    // TODO: when we support other modes make sure to add them here too
                    break;
            }
        }

        std::scoped_lock lock{inputDataMutex};
        switch (argPrivate.mode) {
            case ControllerSupportMode::ShowControllerSupport:
                HandleShowControllerSupport(argPrivate.styleSet, appletVersion, normalInputData.front()->GetSpan());
                normalInputData.pop();
                break;
            default:
                Logger::Warn("Controller applet mode {} is unimplemented", static_cast<u32>(argPrivate.mode));
                normalInputData.pop();

                // Return empty result
                PushNormalDataAndSignal(std::make_shared<service::am::ObjIStorage<Result>>(state, manager, Result{}));
                break;
        }

        // Notify the guest that we've finished running
        onAppletStateChanged->Signal();
        return {};
    };

    Result ControllerApplet::GetResult() {
        return {};
    }

    void ControllerApplet::PushNormalDataToApplet(std::shared_ptr<service::am::IStorage> data) {
        std::scoped_lock lock{inputDataMutex};
        normalInputData.emplace(std::move(data));
    }

    void ControllerApplet::PushInteractiveDataToApplet(std::shared_ptr<service::am::IStorage> data) {}
}


Review comment (suggestion):
```suggestion
                PushNormalDataAndSignal(std::make_shared<service::am::ObjIStorage<Result>>
```

Code after:
        // Some games such as Cave Story+ set invalid values for the ControllerSupportMode so use argSize to derive it if necessary (from yuzu)
        if (argPrivate.mode >= ControllerSupportMode::MaxControllerSupportMode) {
            switch (argPrivate.argSize) {
                case sizeof(ControllerSupportArgOld):
                case sizeof(ControllerSupportArgNew):
                    argPrivate.mode = ControllerSupportMode::ShowControllerSupport;
                    break;
                default:
                    // TODO: when we support other modes make sure to add them here too
                    break;
            }
        }

        std::scoped_lock lock{normalInputDataMutex};
        switch (argPrivate.mode) {
            case ControllerSupportMode::ShowControllerSupport:
                HandleShowControllerSupport(argPrivate.styleSet, appletVersion, normalInputData.front()->GetSpan());
                normalInputData.pop();
                break;
            default:
                Logger::Warn("Controller applet mode {} is unimplemented", static_cast<u32>(argPrivate.mode));
                normalInputData.pop();

                // Return empty result
                PushNormalDataAndSignal(std::make_shared<service::am::ObjIStorage<Result>>(state, manager, Result{}));
                break;
        }

        // Notify the guest that we've finished running
        onAppletStateChanged->Signal();
        return {};
    }

    Result ControllerApplet::GetResult() {
        return {};
    }

    void ControllerApplet::PushNormalDataToApplet(std::shared_ptr<service::am::IStorage> data) {
        PushNormalInput(data);
    }

    void ControllerApplet::PushInteractiveDataToApplet(std::shared_ptr<service::am::IStorage> data) {}
}