Skip to content

Translator

OsOmE1 edited this page Feb 3, 2021 · 4 revisions

Every struct you want to translate should have the Translator attribute.

[Translator]
public struct YourStruct

This struct is used in your main plugin file in the PostProcessTypeModel function.
To start the translation process call the StartTranslating function.

Translator.StartTranslating(this)

This will locate all the structs with the Translator attribute.
All the fields in your struct should have the TranslatorFieldOffsetAttribute attribute.

[TranslatorFieldOffset(0x0)] static public object YourStaticField;
[TranslatorFieldOffset(0x08)] public int YourPublicInt;

If you want the translator to resolve your field type make sure to specify it as follows.

[TranslatorFieldOffset(0x0)] public YourType YourFieldName;

If you don't want to resolve it use an object as follows.

[TranslatorFieldOffset(0x0)] public object YourFieldName;

Any primitive will be used to create a sequence used for translation e.g.
bool, byte, sbyte, short, ushort, int, uint, long, ulong, IntPtr, UIntPtr, char, double, and float.

Clone this wiki locally