exotic_catalyst_builder.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #include <cstddef>
  3. #include <cstdint>
  4. #include <span>
  5. #include "../../definition.h"
  6. #include "../details/definition.h"
  7. #include "../item_catalog.h"
  8. #include "../socket_plugs/definition.h"
  9. #include "definition.h"
  10. namespace sunrise::state::build_data::items::catalysts {
  11. /** Build-scoped facts that package structure cannot identify safely. */
  12. struct Facts {
  13. std::uint32_t imageTimestamp{};
  14. std::uint32_t imageSize{};
  15. /** Historical release state is not present in the installed Season 11 item relations. */
  16. std::span<const std::uint32_t> releasedWeaponHashes;
  17. };
  18. /** Installed domains used to derive exact item, socket, and completed-plug relations. */
  19. struct Source {
  20. BuildIdentity build;
  21. std::span<const items::Definition> items;
  22. std::span<const details::Definition> details;
  23. std::span<const socket_plugs::Rule> socketPlugRules;
  24. std::span<const socket_plugs::Pool> socketPlugPools;
  25. std::span<const socket_plugs::Member> socketPlugMembers;
  26. /** Dense item-indexed completion conditions read from item definition expressions. */
  27. std::span<const CompletionCondition> completionConditions;
  28. /** Dense socket-type-indexed acquired-state gates read from socket type definitions. */
  29. std::span<const AcquisitionGate> acquisitionGates;
  30. /** Dense objective-indexed completion values read from the installed objective table. */
  31. std::span<const std::int32_t> objectiveCompletionValues;
  32. /** Package account-flag mapping; slot identities are not account array indices. */
  33. std::span<const AccountFlagMapping> accountFlagMappings;
  34. };
  35. /** @return The generated facts pinned to Destiny 2 build 86657.20.08.23. */
  36. [[nodiscard]] Facts generated_facts() noexcept;
  37. /**
  38. * @param build Installed executable identity.
  39. * @param facts Build-scoped catalyst facts.
  40. * @return True when the facts apply to the installed executable.
  41. */
  42. [[nodiscard]] bool supports_build(const BuildIdentity& build, const Facts& facts) noexcept;
  43. /**
  44. * Derives all released and placeholder catalyst records without display text.
  45. * On failure, count is zero and no partial record is visible.
  46. * @param source Installed build domains and executable identity.
  47. * @param facts Build-scoped role and release facts.
  48. * @param output Fixed storage that receives the complete catalog.
  49. * @param count Receives the number of used output rows.
  50. * @param report Receives counts and the first unsafe released relation.
  51. * @return True when all released relations are clear and the catalog fits.
  52. */
  53. [[nodiscard]] bool derive(const Source& source,
  54. const Facts& facts,
  55. std::span<Definition> output,
  56. std::size_t& count,
  57. Report& report) noexcept;
  58. /**
  59. * Re-derives a catalog and compares every row with a stored candidate.
  60. * @param source Installed build domains and executable identity.
  61. * @param facts Build-scoped role and release facts.
  62. * @param definitions Candidate catalog to verify.
  63. * @return True when the candidate exactly matches one safe derivation.
  64. */
  65. [[nodiscard]] bool matches_derived(const Source& source,
  66. const Facts& facts,
  67. std::span<const Definition> definitions) noexcept;
  68. /**
  69. * Rebuilds package-only transient relations from a stored catalog, then re-derives it.
  70. * The stored acquisition and completion flag rows must still name installed items.
  71. * Conflicting rows fail closed.
  72. * @param source Installed cache domains. Its transient spans are ignored.
  73. * @param facts Build-scoped role and release facts.
  74. * @param definitions Stored candidate catalog.
  75. * @return True when one fresh derivation exactly matches the stored catalog.
  76. */
  77. [[nodiscard]] bool matches_cached(const Source& source,
  78. const Facts& facts,
  79. std::span<const Definition> definitions) noexcept;
  80. } // namespace sunrise::state::build_data::items::catalysts