Skip to content

Commit

Permalink
修复 注入后 路径不对的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
leinlin committed Jun 19, 2020
1 parent 0b0ae9c commit ef007cd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
25 changes: 17 additions & 8 deletions LuaProfiler/example/Assets/LuaProfiler/Core/LuaHookSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,24 @@ public static void OnStartGame()
if (!Application.isPlaying) return;
#endif
#if UNITY_EDITOR_WIN
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true);
System.Diagnostics.StackFrame sf = st.GetFrame(0);
string path = sf.GetFileName();

path = path.Replace("Core\\LuaHookSetup.cs", "Plugins\\EasyHook64.bin");
IntPtr ptr = LoadLibrary(path);
if (ptr == null)
string path = null;
var files = System.IO.Directory.GetFiles(Application.dataPath, "EasyHook64.bin", System.IO.SearchOption.AllDirectories);
if (files.Length > 0)
{
path = files[0];
}
if (!string.IsNullOrEmpty(path))
{
IntPtr ptr = LoadLibrary(path);
if (ptr == null)
{
Debug.LogError("dont't move dll file to other place");
return;
}
}
else
{
Debug.LogError("dont't move dll file to other place");
Debug.LogError("no EasyHook64.bin");
return;
}
#endif
Expand Down
26 changes: 13 additions & 13 deletions LuaProfiler/example/Assets/LuaProfiler/Plugins/EasyHook.dll.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef007cd

Please sign in to comment.