|
remotemono
|
#include <RMonoAPIFunction_Def.h>


Public Types | |
| typedef RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... > | Self |
| typedef RetT | DefRetType |
| typedef std::tuple< ArgsT... > | DefArgsTuple |
Public Types inherited from remotemono::RMonoAPIFunctionRawBase< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType, RMonoAPIParamTypeAdapter< ABI, ArgsT >::RawType... > | |
| typedef RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType | RawRetType |
| typedef std::tuple< ArgsT... > | RawArgsTuple |
| typedef RMonoAPIFunctionSimple< RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType, ArgsT... > | RawFunc |
Public Types inherited from remotemono::RMonoAPIFunctionAPI< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| typedef RMonoAPIFunctionAPI< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | Self |
Public Member Functions | |
| void | reset () |
| void | init (ABI *abi, RMonoAPIBase *mono, const std::string &name, blackbone::ptr_t rawFuncAddr) |
| void | initInvalid (const std::string &name) |
| asmjit::Label | compile (blackbone::IAsmHelper &a) |
| void | link (blackbone::ptr_t wrapFuncAddr) |
| void | debugDumpSignatures () |
| ABI * | getABI () |
| RMonoAPIBase * | getRemoteMonoAPI () |
| std::string | getName () const |
| operator bool () const | |
Public Member Functions inherited from remotemono::RMonoAPIFunctionRawBase< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType, RMonoAPIParamTypeAdapter< ABI, ArgsT >::RawType... > | |
| void | initRaw (blackbone::ptr_t rawFuncAddr) |
| RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType | invokeRaw (ArgsT... args) |
| blackbone::ptr_t | getRawFuncAddress () const |
Public Member Functions inherited from remotemono::RMonoAPIFunctionWrap< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| RMonoAPIBase * | getRemoteMonoAPI () |
Public Member Functions inherited from remotemono::RMonoAPIFunctionAPI< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| CommonAPIRetType | invokeAPIInternal (CommonAPIArgsTuple &&args) |
Static Public Member Functions | |
| constexpr static bool | isRequired () |
Static Public Member Functions inherited from remotemono::RMonoAPIFunctionWrap< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| constexpr static std::enable_if_t< idx< std::tuple_size_v< DefArgsTuple >, bool > needsWrapFuncArg() { typedef std::tuple_element_t< idx, DefArgsTuple > ArgType;if constexpr(std::is_base_of_v< Variant, typename ArgType::Type >||std::is_base_of_v< VariantArray, typename ArgType::Type >||std::is_base_of_v< std::string_view, typename ArgType::Type >||std::is_base_of_v< std::u16string_view, typename ArgType::Type >||std::is_base_of_v< std::u32string_view, typename ArgType::Type >||std::is_base_of_v< RMonoObjectHandleTag, typename ArgType::Type >||tags::has_param_tag_v< ArgType, tags::ParamOutTag >) { return true;} else { return needsWrapFuncArg< idx+1 >);} } template< size_t idx=0 > constexpr static std::enable_if_t< idx==std::tuple_size_v< DefArgsTuple >, bool > needsWrapFuncArg() { return false;} constexpr static bool needsWrapFunc() { if constexpr(std::is_base_of_v< Variant, typename DefRetType::Type >||std::is_base_of_v< VariantArray, typename DefRetType::Type >||std::is_base_of_v< std::string, typename DefRetType::Type >||std::is_base_of_v< std::u16string, typename DefRetType::Type >||std::is_base_of_v< std::u32string, typename DefRetType::Type >||std::is_base_of_v< RMonoObjectHandleTag, typename DefRetType::Type >) { return true;} else { return needsWrapFuncArg< 0 >);} }public:asmjit::Label compileWrap(blackbone::IAsmHelper &a);protected:void resetWrap() { wrapFunc.reset();}private:void generateWrapperAsm(AsmBuildContext &ctx);template< size_t wrapArgIdx > void genWrapperSpillArgsToStackX64(AsmBuildContext &ctx);void genWrapperReserveStack(AsmBuildContext &ctx);template< size_t wrapArgIdx, typename ArgT, typename... RestT > void genWrapperReserveArgStack(AsmBuildContext &ctx, PackHelper< ArgT >, PackHelper< RestT >... rest);template< size_t wrapArgIdx > void genWrapperReserveArgStack(AsmBuildContext &ctx) {} template< size_t rawArgIdx > void genWrapperCalculateRawArgStackSize(AsmBuildContext &ctx);void genWrapperBuildRawArgs(AsmBuildContext &ctx);template< size_t wrapArgIdx, size_t rawArgIdx, typename ArgT, typename... RestT > void genWrapperBuildRawArg(AsmBuildContext &ctx, PackHelper< ArgT >, PackHelper< RestT >... rest);template< size_t wrapArgIdx, size_t rawArgIdx > void genWrapperBuildRawArg(AsmBuildContext &ctx) {} template< size_t rawArgIdx > void genWrapperMoveStackArgsToRegsX64(AsmBuildContext &ctx);void genWrapperHandleRetAndOutParams(AsmBuildContext &ctx);template< size_t wrapArgIdx, size_t rawArgIdx, typename ArgT, typename... RestT > void genWrapperHandleOutParams(AsmBuildContext &ctx, PackHelper< ArgT >, PackHelper< RestT >... rest);template< size_t wrapArgIdx, size_t rawArgIdx > void genWrapperHandleOutParams(AsmBuildContext &ctx) {} void genGchandleGetTargetChecked(AsmBuildContext &ctx);void genGchandleNewChecked(AsmBuildContext &ctx);void genIsValueTypeInstance(AsmBuildContext &ctx);void genObjectUnbox(AsmBuildContext &ctx);template< size_t argIdx, typename ArgsTupleT > constexpr size_t calcStackArgOffset() { if constexpr(argIdx==0) { return 0;} else { return static_align(sizeof(std::tuple_element_t< argIdx-1, ArgsTupleT >), sizeof(irmono_voidp))+calcStackArgOffset< argIdx-1, ArgsTupleT >);} } template< size_t argIdx > asmjit::X86Mem ptrWrapFuncArg(AsmBuildContext &ctx, size_t partIdx=0, uint32_t size=0) { return asmjit::host::ptr((*ctx.a) ->zbp, int32_t(ctx.stackOffsArgBase+calcStackArgOffset< argIdx, typename RMonoAPIFunctionWrapTraits< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... > >::WrapArgsTuple >)+partIdx *sizeof(irmono_voidp)), size);} template< size_t argIdx > asmjit::X86Mem ptrRawFuncArg(AsmBuildContext &ctx, size_t partIdx=0, uint32_t size=0) { return asmjit::host::ptr((*ctx.a) ->zsp, int32_t(calcStackArgOffset< argIdx, typename RMonoAPIFunctionRawTraits< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... > >::RawArgsTuple >)+partIdx *sizeof(irmono_voidp)), size);}private:ABI *getABI() { return static_cast< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... > * >this) -> | getABI () |
Additional Inherited Members | |
Protected Types inherited from remotemono::RMonoAPIFunctionCommon< ABI > | |
| enum | ParamFlags { ParamFlagMonoObjectPtr = 0x0001, ParamFlagOut = 0x0002, ParamFlagDirectPtr = 0x0004, ParamFlagDisableAutoUnbox = 0x0008, ParamFlagLastArrayElement = 0x8000 } |
| typedef uint16_t | variantflags_t |
Protected Member Functions inherited from remotemono::RMonoAPIFunctionRaw< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| void | resetRaw () |
Protected Member Functions inherited from remotemono::RMonoAPIFunctionAPI< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RetT, ArgsT... > | |
| void | resetAPI () |
Protected Attributes inherited from remotemono::RMonoAPIFunctionRawBase< RMonoAPIFunctionBase< ABI, required, RetT, ArgsT... >, ABI, RMonoAPIReturnTypeAdapter< ABI, RetT >::RawType, RMonoAPIParamTypeAdapter< ABI, ArgsT >::RawType... > | |
| RawFunc | rawFunc |
This clusterfuck of classes (all of the RMonoAPIFunction* classes) is used to represent a Mono API function as it is used by RemoteMono. This class (and RMonoAPIFunction, and everything in between) is the umbrella class, and RMonoAPIFunctionRaw, RMonoAPIFunctionWrap and RMonoAPIFunctionAPI are the components that provide most of the actual functionality. See their respective documentation for more details.
All of these classes take an ABI as template parameter, because they are ABI-specific. RMonoAPIDispatcher and RMonoAPI are used to abstract away to low-level ABI details by selecting the correct ABI-specific instance.
|
inline |
Compile the RMonoAPIFunctionWrap component, i.e. generate the wrapper function's assembly code.
| a | The IAsmHelper to use for assembly generation. |
| void remotemono::RMonoAPIFunctionBase< ABI, required, RetT, ArgsT >::debugDumpSignatures |
Log the signatures of the different function versions (definition, raw, wrap, API).
|
inline |
Return the function's ABI object.
|
inline |
Return the function's full name.
|
inline |
Return the function's RMonoAPI object.
|
inline |
Initialize some general function data and the RMonoAPIFunctionRaw component.
| abi | The ABI object to use for this function. |
| mono | The RMonoAPI instance to use for the function. |
| name | The function's full name. |
| rawFuncAddr | The address to the raw function in remote memory. |
|
inline |
Initialize the function to be invalid. This way, the invalid function can still have its name.
| name | The function's full name. |
|
inline |
Link the RMonoAPIFunctionWrap component, i.e. provide it with the address of the generated wrapper function in remote memory.
| wrapFuncAddr | The wrapper function's remote address. |
|
inline |
Determine if the function is valid, i.e. if at least a valid remote raw function address was provided with init().
|
inline |
Reset all the function pointers and start over as if creating a fresh object.