#pragma once #include #include #include #include #include #include #include "../../../state/activity_sdk/format.h" namespace sunrise::state::activity_sdk { class Catalog; } namespace sunrise::client::content::activity::sdk_generation::lua_artifacts { namespace format = state::activity_sdk::format; /** Direct Lua declarations derived from one generated-world scenario shard. */ struct ScenarioWorldSource final { std::uint32_t scenarioTag{}; std::string source{}; }; /** Generation and publication outcomes stay stable for worker diagnostics. */ enum class Status : std::uint8_t { ready, invalidInput, unsupportedAbi, buildFailure, directoryFailure, writeFailure, }; /** Borrowed named mission rows used to write direct Lua source modules. */ struct Source final { std::array sdkBuildSha256{}; std::array sdkPayloadSha256{}; std::array contentKeySha256{}; std::array logicalIrSha256{}; std::span strings{}; std::span activities{}; std::span scenarios{}; std::span bubbles{}; std::span states{}; std::span objects{}; std::span occurrences{}; std::span slots{}; std::span squads{}; std::span squadMembers{}; std::span squadAnchors{}; std::span authoredSceneResources{}; std::span authoredSceneSquadEdges{}; std::span taskTargets{}; std::span dialogueCueTexts{}; std::span directiveElements{}; std::span behaviorPrograms{}; std::span behaviorInputs{}; std::span behaviorChannelWrites{}; std::span behaviorOwners{}; std::span behaviorActivityBindings{}; std::span actorClasses{}; std::span actorMessageSchemas{}; std::span actorCommandDefinitions{}; std::span actorBehaviorProfiles{}; std::span simulationEventDefinitions{}; std::span runtimeSchemas{}; std::span runtimeFields{}; std::span runtimeTypeDefinitions{}; std::span sobjectRsats{}; std::span sobjectRsatDescriptors{}; std::span entityTypeDefinitions{}; std::span sobjectRsatFieldBindings{}; std::span actorStateNames{}; std::span actorSequenceTables{}; std::span actorSequenceEntries{}; std::span actorSequenceBindings{}; std::span scenarioWorldSources{}; std::span combatObjectiveGroups{}; std::span actorAbilities{}; std::span authoredSceneEventKeys{}; }; /** One readable generated Lua module with a filesystem-safe canonical name. */ struct SourceModule final { std::string stem{}; std::string source{}; }; /** Complete in-memory transaction before any artifact path changes. */ struct Bundle final { std::string activityIndex{}; std::string missionIndex{}; std::string activitySdkModule{}; std::string behaviorModule{}; std::string manifestJson{}; /** The mission Lua API schema, rendered from the table the VM dispatches from. */ std::string missionApiJson{}; std::vector activityModules{}; std::vector missionModules{}; }; /** Counts and bytes returned only after the index commit file is published. */ struct Result final { std::uint32_t activityCount{}; std::uint32_t fileCount{}; std::uint64_t byteCount{}; }; /** @return Stable text for one native Lua artifact result. */ [[nodiscard]] const char* status_name(Status value) noexcept; /** Builds every declaration in memory without touching the artifact tree. */ [[nodiscard]] Status build(const Source& source, Bundle& output) noexcept; /** Publishes complete files below sdkDirectory/lua and commits activities.lua last. */ [[nodiscard]] Status publish_bundle(const wchar_t* sdkDirectory, const Bundle& bundle, Result& output) noexcept; /** @return True when the committed Lua manifest exactly matches the loaded SDK. */ [[nodiscard]] bool is_current(const wchar_t* sdkDirectory, const state::activity_sdk::Catalog& catalog) noexcept; } // namespace sunrise::client::content::activity::sdk_generation::lua_artifacts