#pragma once #include #include #include #include #include namespace vl::mixin { enum class At : std::uint8_t { HEAD, RETURN, INVOKE, FIELD_GET, FIELD_PUT }; enum class Side: std::uint8_t { Before, After }; using CallbackId = std::size_t; // Erased ABI for callbacks: Core marshals args and provides a CallbackInfo*. using ErasedCallback = std::function; // --------------------------------------------------------------------- // INVOKE sub-descriptor // --------------------------------------------------------------------- struct InvokeTarget { std::string owner; // internal class name (e.g. net/minecraft/client/Minecraft) std::string name; // method name to match (e.g. "doAttack") std::string desc; // full JVM descriptor (e.g. "(I)Z") }; // --------------------------------------------------------------------- // Injection spec (for all @At types) // --------------------------------------------------------------------- struct InjectionSpec { std::string owner; // the target class where we inject std::string methodName; // the method name where we inject std::string methodDesc; // the method descriptor At at; // HEAD / RETURN / INVOKE / FIELD_GET / FIELD_PUT Side when; // Before / After (for INVOKE etc.) CallbackId cb; // callback id // For INVOKE / FIELD hooks, optional nested target to match the inside call or field InvokeTarget invoke; std::string fieldOwner; std::string fieldName; std::string fieldDesc; }; // --------------------------------------------------------------------- // Other specs unchanged // --------------------------------------------------------------------- struct RedirectSpec { std::string owner; std::string methodName; std::string methodDesc; CallbackId cb; }; struct ModifyConstSpec { enum Kind { Int, Long, Float, Double, String } kind{}; std::string owner; std::string methodName; std::string methodDesc; CallbackId cb; int64_t i64{}; double fp{}; std::string str; }; struct ModifyVarSpec { std::string owner; std::string methodName; std::string methodDesc; CallbackId cb; int varIndex{}; }; // Whole-class mixin description struct MixinSpec { std::string owner; std::vector injections; std::vector redirects; std::vector constants; std::vector vars; bool replaceWholeClass{false}; CallbackId classBodyProvider{}; }; } // namespace vl::mixin