activity_catalog.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <array>
  3. #include <cstdint>
  4. #include <span>
  5. #include <string_view>
  6. namespace sunrise::state::build_data::activities {
  7. inline constexpr std::size_t kCapacity = 4095;
  8. inline constexpr std::size_t kContentCount = 23, kExperienceKindCount = 7;
  9. struct NativeText {
  10. std::array<char, 96> text{};
  11. // Bank ordinal, or direct native string-container tag for Director style labels.
  12. std::uint32_t bank{0xFFFF}, hash{0x811C9DC5};
  13. };
  14. struct MenuText {
  15. std::array<NativeText, kContentCount> content{};
  16. std::array<NativeText, kExperienceKindCount> kinds{};
  17. };
  18. /** Optional runtime localization. Classification tables never supply display text. */
  19. [[nodiscard]] bool publish_menu_text(const MenuText& value) noexcept;
  20. /** @return Published labels, or an empty immutable value while extraction is pending. */
  21. [[nodiscard]] const MenuText& menu_text() noexcept;
  22. struct Definition {
  23. std::uint16_t index{};
  24. std::uint32_t hash{};
  25. std::uint32_t gameplaySettingsHash{};
  26. std::uint8_t nativeType{};
  27. std::uint8_t destination{};
  28. std::array<char, 40> package{};
  29. [[nodiscard]] std::string_view name() const noexcept {
  30. return package.data();
  31. }
  32. };
  33. struct Presentation {
  34. std::array<char, 160> title{};
  35. std::array<char, 1024> description{};
  36. std::array<char, 64> type{};
  37. std::array<char, 64> expansion{};
  38. std::uint32_t nativeStyle{};
  39. std::uint16_t experience{0xFFFF};
  40. std::uint8_t experienceKind{};
  41. /** Original release index; releases::unresolved when not established. */
  42. std::uint8_t contentGroup{};
  43. std::uint8_t classificationSource{}; // 4 explicit local activity-hash release map
  44. };
  45. /** Optional, immutable Director text. Kept outside the persistent scenario cache. */
  46. [[nodiscard]] bool publish_presentations(std::span<const Presentation> rows) noexcept;
  47. /** @return The indexed presentation, or an empty immutable value when unavailable. */
  48. [[nodiscard]] const Presentation& presentation(std::uint16_t index) noexcept;
  49. /** Immutable process-local public activity table, independent of the persistent scenario cache. */
  50. [[nodiscard]] bool ready() noexcept;
  51. /** @return True when extraction failed and no catalog was published during this process. */
  52. [[nodiscard]] bool extraction_failed() noexcept;
  53. /** Optional menu data must not keep core investment startup waiting. */
  54. void note_extraction_failure() noexcept;
  55. /** Publishes validated dense identities once from the investment worker. Never replaces rows. */
  56. [[nodiscard]] bool publish(std::span<const Definition> rows) noexcept;
  57. /** @return Immutable process-lifetime identities, or an empty span before publication. */
  58. [[nodiscard]] std::span<const Definition> entries() noexcept;
  59. } // namespace sunrise::state::build_data::activities