Skip to content

Commit

Permalink
代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ale committed Dec 7, 2022
1 parent c16e1fb commit b804675
Show file tree
Hide file tree
Showing 51 changed files with 1,635 additions and 1,631 deletions.
2 changes: 1 addition & 1 deletion LuaProfiler/Tools/InjectLua/InjectLua/Parse/LLex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ public int Length

public void Replace(int start, int end, string value)
{
LoadInfo.Replace(start, end + 1 - start, value);
LoadInfo.Replace(start, end - start, value);
}

public string ReadString(int start, int end)
Expand Down
5 changes: 2 additions & 3 deletions LuaProfiler/Tools/InjectLua/InjectLua/Parse/Parse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,8 @@ static void InsertSample(LLex l, ref int lastPos, ref int nextPos, int tokenType
{
lastPos = lastPos - 1;

string returnStr = l.ReadString(insertPos, lastPos - 1);
returnStr = " return miku_unpack_return_value(" + returnStr.Substring(6, returnStr.Length - 6) + ") ";
l.Replace(insertPos, lastPos - 1, returnStr);
l.Replace(insertPos, insertPos + 6, " return miku_unpack_return_value(");
l.InsertString(lastPos , ") ");

nextPos = l.pos;
if (tokenType == (int)TK.END)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ public final class ShadowHook {

private static final ILibLoader defaultLibLoader = null;
private static final int defaultMode = Mode.UNIQUE.getValue();
private static final boolean defaultDebuggable = true;
private static final boolean defaultDebuggable = false;

public static int init() {
if (inited) {
return initErrno;
}

return init(new ConfigBuilder().build());
return init(null);
}

public static synchronized int init(Config config) {
Expand All @@ -56,6 +52,11 @@ public static synchronized int init(Config config) {

long start = System.currentTimeMillis();

if (config == null) {
//use default parameters
config = new ConfigBuilder().build();
}

if (!loadLibrary(config)) {
initErrno = ERRNO_LOAD_LIBRARY_EXCEPTION;
initCostMs = System.currentTimeMillis() - start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static LuaDeepProfilerSetting Instance
{
if (instance == null)
{
instance = new LuaDeepProfilerSetting();
instance = Load();
}
return instance;
}
Expand Down Expand Up @@ -315,7 +315,7 @@ public static LuaDeepProfilerSetting Load()

try
{
JsonUtility.FromJson<LuaDeepProfilerSetting>(json);
result = JsonUtility.FromJson<LuaDeepProfilerSetting>(json);
}
catch
{
Expand Down
Loading

0 comments on commit b804675

Please sign in to comment.