Fexty12573 / SharpPluginLoader

A C# plugin loader for Monster Hunter World
MIT License
32 stars 2 forks source link

Improved Internal Calls #19

Closed Fexty12573 closed 6 months ago

Fexty12573 commented 7 months ago

Previously InternalCalls were limited in that they could only be bound to a function defined in a native dll. And while this could also be a game function this was still somewhat cumbersome.

This PR aims to alleviate that by adding new options to the InternalCallAttribute.

The currently planned API looks something this:

[InternalCall(Address = 0x141A5A3E0)]
public static partial MtObject CreateNewMonster(MtObject sEnemy, MonsterType type, uint variant, bool unk);

[InternalCall(Pattern = "33 C0 48 8D 4F 38 0F 1F 00", Offset = -119, Cache = true)]
public static partial MtObject CreateNewMonster2(MtObject sEnemy, MonsterType type, uint variant, bool unk);

This PR will also introduce automatic marshaling for any type that inherits from SharpPluginLoader.Core.NativeWrapper. The marshaling process is realized simply by passing the Instance member.

Fexty12573 commented 6 months ago

Remaining questions: