using System;
using System.Runtime.InteropServices;
using GTA;
using RageCoop.Client;
using SHVDN;
///
/// Template for generating AOT entrypoints
///
public static class EntryPoint
{
private static void ModuleSetup()
{
Script script = new Main();
Core.RegisterScript(script);
script = new WorldThread();
Core.RegisterScript(script);
script = new DevTool();
Core.RegisterScript(script);
}
[UnmanagedCallersOnly(EntryPoint = "OnInit")]
public unsafe static void OnInit(IntPtr module)
{
try
{
Core.OnInit(module);
ModuleSetup();
}
catch (Exception ex)
{
PInvoke.MessageBoxA((IntPtr)0, ex.ToString(), "Module initialization error", 0u);
throw;
}
}
///
/// Called prior to module unload
///
///
[UnmanagedCallersOnly(EntryPoint = "OnUnload")]
public static void OnUnload(IntPtr module)
{
try
{
Core.OnUnload(module);
}
catch (Exception ex)
{
Logger.Error((ReadOnlySpan)("Module unload error: " + ex.ToString()));
}
}
[UnmanagedCallersOnly(EntryPoint = "OnKeyboard")]
public unsafe static void OnKeyboard(uint key, ushort repeats, bool scanCode, bool isExtended, bool isWithAlt, bool wasDownBefore, bool isUpNow)
{
try
{
Core.DoKeyEvent(key, !isUpNow, (PInvoke.GetAsyncKeyState(17) & 0x8000) != 0, (PInvoke.GetAsyncKeyState(16) & 0x8000) != 0, isWithAlt);
}
catch (Exception ex)
{
Logger.Error((ReadOnlySpan)("Keyboard event error: " + ex.ToString()));
}
}
[UnmanagedCallersOnly(EntryPoint = "OnTick")]
public static void OnTick(IntPtr currentFiber)
{
try
{
Core.DoTick(currentFiber);
}
catch (Exception ex)
{
Logger.Error((ReadOnlySpan)("Tick error: " + ex.ToString()));
}
}
}