Test with generated hooks

This commit is contained in:
max
2024-09-08 20:58:13 +02:00
parent bd76fc1b25
commit 09089c35b9
9 changed files with 214 additions and 3 deletions

View File

@ -72,6 +72,7 @@ public static class Engine
AudioDevice = new AudioDevice();
OnInitialize?.Invoke();
Nerfed.Runtime.Generator.Hook.InvokeHooks();
while (!quit)
{

View File

@ -0,0 +1,7 @@
namespace Nerfed.Runtime.Hook
{
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public class HookAttribute : Attribute
{
}
}

View File

@ -0,0 +1,11 @@
namespace Nerfed.Runtime.Hook
{
public static class HookTest
{
[Hook]
public static void Test()
{
Log.Info("Hook!");
}
}
}

View File

@ -11,6 +11,7 @@
<IsPackable>false</IsPackable>
<Configurations>Debug;Test;Release</Configurations>
<Platforms>x64</Platforms>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup>
@ -40,4 +41,10 @@
<Compile Include="Libraries\ImGui.NET\src\ImGui.NET\**\*.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nerfed.Runtime.Generator\Nerfed.Runtime.Generator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>