Skip to content

WithLithum/native-wrapper-gen

Repository files navigation

Native Wrapper Generator

The improved piece of software that generates native wrappers for Script Hook V .NET (SHVDN).

Improvements over the generator used for NativeFx.Interop that was written all the way back 3 years ago includes faster generation speed (the actual generator cost less than half a second and the whole process only takes a few seconds), generated code compiles without <LangVersion>latest</LangVersion>, and the usage of pre-cached Hash casted instances. Release and NativeAOT builds are even faster.

Usage

Synopsis

WithLithum.NativeWrapperGen [--natives-file natives-json-file] [--config-file config-json-file] [--file-name-format file-name-format] [--namespace namespace] [--class-name class-name] [--count-time]

Options

  • natives-file: --natives-file <natives-json-file>

    Specifies a natives.json file. The file must be conforming to the format as provided in the alloc8or nativedb-data.

    Defaults to the bundled data file.

  • config-file: --config-file <config-file>

    Specifies the configuration file. For an example, see the default settings tailored for SHVDN.

    Defaults to read the included settings.

  • file-name-format: --file-name-format <file-name-format>

    Specifies the file name format. {0} gets replaced with the native namespace name. For example, Natives.{0}.cs becomes Natives.Misc.cs, and so on.

    Path can be included as well. Defaults to Natives.{0}.cs.

  • namespace: --namespace <namespace>

    The namespace for the generated file. Defaults to WithLithum.NativeWrapperGen.Artefact.

  • class-name: --class-name <class-name>

    The class name for the generated file. Defaults to Natives.

  • count-time: --count-time

    If specified, counts the time used to run the generator.

Building

You need .NET SDK that can target 8.0. Any OS can build and run the generator, but GTA V doesn't work on anywhere outside of Windows without Wine or Proton.

When building, do not build the entire Solution, the build will fail. Build the WithLithum.NativeWrapperGen project instead.

To build the NativeWrapper, run the ps1 script first.

Licence

Apache-2.0