exotic_catalyst_builder.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. };
  33. /** @return The generated facts pinned to Destiny 2 build 86657.20.08.23. */
  34. [[nodiscard]] Facts generated_facts() noexcept;
  35. /**
  36. * @param build Installed executable identity.
  37. * @param facts Build-scoped catalyst facts.
  38. * @return True when the facts apply to the installed executable.
  39. */
  40. [[nodiscard]] bool supports_build(const BuildIdentity& build, const Facts& facts) noexcept;
  41. /**
  42. * Derives all released and placeholder catalyst records without display text.
  43. * On failure, count is zero and no partial record is visible.
  44. * @param source Installed build domains and executable identity.
  45. * @param facts Build-scoped role and release facts.
  46. * @param output Fixed storage that receives the complete catalog.
  47. * @param count Receives the number of used output rows.
  48. * @param report Receives counts and the first unsafe released relation.
  49. * @return True when all released relations are clear and the catalog fits.
  50. */
  51. [[nodiscard]] bool derive(const Source& source,
  52. const Facts& facts,
  53. std::span<Definition> output,
  54. std::size_t& count,
  55. Report& report) noexcept;
  56. /**
  57. * Re-derives a catalog and compares every row with a stored candidate.
  58. * @param source Installed build domains and executable identity.
  59. * @param facts Build-scoped role and release facts.
  60. * @param definitions Candidate catalog to verify.
  61. * @return True when the candidate exactly matches one safe derivation.
  62. */
  63. [[nodiscard]] bool matches_derived(const Source& source,
  64. const Facts& facts,
  65. std::span<const Definition> definitions) noexcept;
  66. /**
  67. * Rebuilds package-only transient relations from a stored catalog, then re-derives it.
  68. * The stored acquisition and completion flag rows must still name installed items.
  69. * Conflicting rows fail closed.
  70. * @param source Installed cache domains. Its transient spans are ignored.
  71. * @param facts Build-scoped role and release facts.
  72. * @param definitions Stored candidate catalog.
  73. * @return True when one fresh derivation exactly matches the stored catalog.
  74. */
  75. [[nodiscard]] bool matches_cached(const Source& source,
  76. const Facts& facts,
  77. std::span<const Definition> definitions) noexcept;
  78. } // namespace sunrise::state::build_data::items::catalysts