Skip to content

Commit

Permalink
Show multiple lines if no scriptname found and content too short
Browse files Browse the repository at this point in the history
Intercept lib update
  • Loading branch information
dedmen committed Nov 30, 2017
1 parent 0e47743 commit 7236dff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion intercept
5 changes: 5 additions & 0 deletions src/scriptProfiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,15 @@ game_value compileRedirect(uintptr_t, game_value_parameter message) {
} else {
if (str.find("scriptname", 0) != -1) __debugbreak();
auto linebreak = str.find("\n", 0);
if (linebreak < 20) {
auto linebreak2 = str.find("\n", linebreak);
if (linebreak2 > linebreak) linebreak = linebreak2;
}
if (linebreak != -1) {
auto name = std::string(str.begin(), linebreak);
std::transform(name.begin(), name.end(), name.begin(), [](char ch) {
if (ch == '"') return '\'';
if (ch == '\n') return ' ';
return ch;
});
str = r_string("private _scoooope = createProfileScope \""sv) + name + "\"; "sv + str;
Expand Down

0 comments on commit 7236dff

Please sign in to comment.