Compare commits
	
		
			2 Commits 
		
	
	
		
			a22bd2ba7e
			...
			82ecaea730
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 82ecaea730 | |
|  | c98e1400a2 | 
|  | @ -0,0 +1 @@ | ||||||
|  | .DS_Store | ||||||
|  | @ -1,3 +1,6 @@ | ||||||
|  | using System; | ||||||
|  | using System.Threading; | ||||||
|  | using System.Threading.Tasks; | ||||||
| using UnityEngine; | using UnityEngine; | ||||||
| using UnityEngine.Events; | using UnityEngine.Events; | ||||||
| 
 | 
 | ||||||
|  | @ -54,8 +57,10 @@ 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) | ||||||
|  | @ -66,7 +71,7 @@ namespace SkyHook | ||||||
|             _started = true; |             _started = true; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void StopHook() |         private void _StopHook() | ||||||
|         { |         { | ||||||
|             if (!_started) return; |             if (!_started) return; | ||||||
| 
 | 
 | ||||||
|  | @ -78,22 +83,23 @@ namespace SkyHook | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             _started = false; |             _started = false; | ||||||
|  | 
 | ||||||
|  |             _started = false; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static void Start() |         public static void StartHook() | ||||||
|         { |         { | ||||||
|             Instance.StartHook(); |             Instance._StartHook(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public static void Stop() |         public static void StopHook() | ||||||
|         { |         { | ||||||
|             Instance.StopHook(); |             Instance._StopHook(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void OnDestroy() |         private void OnDestroy() | ||||||
|         { |         { | ||||||
|             Debug.Log("Destroy"); |             _StopHook(); | ||||||
|             StopHook(); |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private void Update() |         private void Update() | ||||||
|  |  | ||||||
|  | @ -2,16 +2,16 @@ using System.Runtime.InteropServices; | ||||||
| 
 | 
 | ||||||
| namespace SkyHook | namespace SkyHook | ||||||
| { | { | ||||||
|   internal class SkyHookNative |   internal static 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(); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | @ -0,0 +1,8 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: d364b220d4f544d8d8f84c8a15d27269 | ||||||
|  | folderAsset: yes | ||||||
|  | DefaultImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,64 @@ | ||||||
|  | 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:  | ||||||
|  | @ -11,53 +11,17 @@ 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: 0 |       enabled: 1 | ||||||
|       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.
										
									
								
							|  | @ -0,0 +1,69 @@ | ||||||
|  | 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:  | ||||||
		Reference in New Issue