mirror of
https://github.com/HolographicHat/Yae.git
synced 2025-12-06 14:42:52 +08:00
call awake in wndhook
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageId>Yae.Lib</PackageId>
|
<PackageId>Yae.Lib</PackageId>
|
||||||
<Version>5.4.0</Version>
|
<Version>5.4.1</Version>
|
||||||
<Authors>HoloHat</Authors>
|
<Authors>HoloHat</Authors>
|
||||||
<DevelopmentDependency>true</DevelopmentDependency>
|
<DevelopmentDependency>true</DevelopmentDependency>
|
||||||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
|
||||||
|
|||||||
@@ -7,8 +7,13 @@ namespace Yae;
|
|||||||
|
|
||||||
internal static unsafe class Application {
|
internal static unsafe class Application {
|
||||||
|
|
||||||
|
private static bool _initialized;
|
||||||
|
|
||||||
[UnmanagedCallersOnly(EntryPoint = "YaeMain")]
|
[UnmanagedCallersOnly(EntryPoint = "YaeMain")]
|
||||||
private static uint Awake(nint hModule) {
|
private static uint Awake(nint hModule) {
|
||||||
|
if (Interlocked.Exchange(ref _initialized, true)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
Native.RegisterUnhandledExceptionHandler();
|
Native.RegisterUnhandledExceptionHandler();
|
||||||
Log.UseConsoleOutput();
|
Log.UseConsoleOutput();
|
||||||
Log.Trace("~");
|
Log.Trace("~");
|
||||||
@@ -29,6 +34,7 @@ internal static unsafe class Application {
|
|||||||
|
|
||||||
[UnmanagedCallersOnly(EntryPoint = "YaeWndHook")]
|
[UnmanagedCallersOnly(EntryPoint = "YaeWndHook")]
|
||||||
private static nint WndHook(int nCode, nint wParam, nint lParam) {
|
private static nint WndHook(int nCode, nint wParam, nint lParam) {
|
||||||
|
((delegate*unmanaged<nint, uint>) &Awake)(0);
|
||||||
return User32.CallNextHookEx(0, nCode, wParam, lParam);
|
return User32.CallNextHookEx(0, nCode, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ internal static unsafe partial class Kernel32 {
|
|||||||
[return:MarshalAs(UnmanagedType.I4)]
|
[return:MarshalAs(UnmanagedType.I4)]
|
||||||
[LibraryImport("KERNEL32.dll", SetLastError = true)]
|
[LibraryImport("KERNEL32.dll", SetLastError = true)]
|
||||||
internal static partial bool SetConsoleMode(nint hConsoleHandle, uint dwMode);
|
internal static partial bool SetConsoleMode(nint hConsoleHandle, uint dwMode);
|
||||||
|
|
||||||
|
[LibraryImport("KERNEL32.dll", SetLastError = true)]
|
||||||
|
internal static partial nint CreateThread(nint lpThreadAttributes, nint dwStackSize, delegate*unmanaged<nint, uint> lpStartAddress, nint lpParameter, uint dwCreationFlags, uint* lpThreadId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user