Compare commits

..

No commits in common. "82ecaea7307e27c693ba88b8f7cff10cce7b6456" and "a22bd2ba7eb39f75a76c3893f11e8281b1596a58" have entirely different histories.

9 changed files with 49 additions and 161 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
.DS_Store

View File

@ -1,6 +1,3 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.Events; using UnityEngine.Events;
@ -57,10 +54,8 @@ namespace SkyHook
KeyUpdated.Invoke(ev); KeyUpdated.Invoke(ev);
} }
private void _StartHook() private void StartHook()
{ {
if (_started) return;
var result = SkyHookNative.StartHook(HookCallback); var result = SkyHookNative.StartHook(HookCallback);
if (result != null) if (result != null)
@ -71,7 +66,7 @@ namespace SkyHook
_started = true; _started = true;
} }
private void _StopHook() private void StopHook()
{ {
if (!_started) return; if (!_started) return;
@ -83,23 +78,22 @@ namespace SkyHook
} }
_started = false; _started = false;
_started = false;
} }
public static void StartHook() public static void Start()
{ {
Instance._StartHook(); Instance.StartHook();
} }
public static void StopHook() public static void Stop()
{ {
Instance._StopHook(); Instance.StopHook();
} }
private void OnDestroy() private void OnDestroy()
{ {
_StopHook(); Debug.Log("Destroy");
StopHook();
} }
private void Update() private void Update()

View File

@ -2,16 +2,16 @@ using System.Runtime.InteropServices;
namespace SkyHook namespace SkyHook
{ {
internal static class SkyHookNative internal class SkyHookNative
{ {
public delegate void Callback(SkyHookEvent ev); public delegate void Callback(SkyHookEvent ev);
private const string Lib = "skyhook"; private const string LIB = "skyhook";
[DllImport(Lib, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)] [DllImport(LIB, EntryPoint = "start_hook", CallingConvention = CallingConvention.Cdecl)]
public static extern string StartHook(Callback callback); public static extern string StartHook(Callback callback);
[DllImport(Lib, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)] [DllImport(LIB, EntryPoint = "stop_hook", CallingConvention = CallingConvention.Cdecl)]
public static extern string StopHook(); public static extern string StopHook();
} }
} }

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d364b220d4f544d8d8f84c8a15d27269
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,64 +0,0 @@
fileFormatVersion: 2
guid: 6ec8e172783fb4da5815df3c8c450a1a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 1
Exclude OSXUniversal: 0
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: ARM64
DefaultValueInitialized: true
OS: OSX
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: ARM64
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: x86_64
userData:
assetBundleName:
assetBundleVariant:

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: Windows
- 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

@ -1,69 +0,0 @@
fileFormatVersion: 2
guid: 64e8137adce094429a9428464a954f6a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 0
Exclude Win: 0
Exclude Win64: 0
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: x86_64
DefaultValueInitialized: true
OS: OSX
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: x86_64
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant: