feat: run hook inside a thread

develop
paring 2022-11-05 00:54:42 +09:00
parent 6c5bf6bdd0
commit 15466d165b
Signed by: pikokr
GPG Key ID: 2C097B03E9D823C4
5 changed files with 61 additions and 9 deletions

View File

@ -59,16 +59,32 @@ namespace SkyHook
private void _StartHook() private void _StartHook()
{ {
if (_started) return; var started = false;
Exception exception = null;
var result = SkyHookNative.StartHook(HookCallback);
if (result != null) new Thread(() =>
{
if (_started) return;
var result = SkyHookNative.StartHook(HookCallback);
if (result != null)
{
exception = new SkyHookException(result);
}
_started = true;
started = true;
}).Start();
while (!started && exception == null)
{ {
throw new SkyHookException(result);
} }
_started = true; if (exception != null)
{
throw exception;
}
} }
private void _StopHook() private void _StopHook()

Binary file not shown.

View File

@ -11,17 +11,53 @@ PluginImporter:
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 1
Exclude Linux64: 0
Exclude OSXUniversal: 0
Exclude Win: 0
Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 1 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second: second:
enabled: 0 enabled: 0
settings: settings:
CPU: AnyCPU
DefaultValueInitialized: true DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

Binary file not shown.

View File

@ -6,7 +6,7 @@ PluginImporter:
iconMap: {} iconMap: {}
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 1
isOverridable: 1 isOverridable: 1
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
@ -34,7 +34,7 @@ PluginImporter:
settings: settings:
CPU: AnyCPU CPU: AnyCPU
DefaultValueInitialized: true DefaultValueInitialized: true
OS: Windows OS: AnyOS
- first: - first:
Standalone: Linux64 Standalone: Linux64
second: second: