cinematic_incident.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. #include <span>
  5. namespace sunrise::middleware::bap::activity_message::cinematic_incident {
  6. /** Global SObject row emitted after a cinematic was accepted by the local runtime. */
  7. inline constexpr std::uint32_t kStartedTarget = 5'239;
  8. /** Global SObject row emitted for start failure or when the runtime stops owning the resource. */
  9. inline constexpr std::uint32_t kTerminatedTarget = 1'685;
  10. /** Global SObject row emitted when the player asks to skip a cinematic. */
  11. inline constexpr std::uint32_t kSkipTarget = 3'338;
  12. /** Effective type-17 incident metadata schema selected by the three cinematic SObject rows. */
  13. inline constexpr std::uint32_t kSchema = 0x808087BFU;
  14. /** The native schema consumes 486 meaningful bits and two zero padding bits. */
  15. inline constexpr std::size_t kPayloadBits = 486;
  16. inline constexpr std::size_t kPayloadBytes = 61;
  17. enum class Signal : std::uint8_t {
  18. started,
  19. terminated,
  20. skipRequested,
  21. };
  22. /** Exact Type-6 source ClientRef and runtime values retained from one cinematic incident. */
  23. struct Payload final {
  24. std::uint32_t registryKey{};
  25. std::uint64_t runtimeObjectId{};
  26. float eventValue{};
  27. std::int16_t slotIndex{-1};
  28. std::int8_t slotType{-1};
  29. };
  30. /** Maps one exact global SObject row to its cinematic signal. */
  31. [[nodiscard]] bool signal_for_target(std::uint32_t target, Signal& output) noexcept;
  32. /** Decodes the fixed schema-0x808087BF payload, including its required zero padding. */
  33. [[nodiscard]] bool decode(std::span<const std::byte> input, Payload& output) noexcept;
  34. } // namespace sunrise::middleware::bap::activity_message::cinematic_incident