-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
224 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
#include "ll/api/utils/PluginOwnData.h" | ||
|
||
#include "minwindef.h" | ||
#include <string_view> | ||
|
||
std::unordered_map<HMODULE, std::unordered_map<std::string, void*>> ll_PluginOwnData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <functional> | ||
#include <iostream> | ||
#include <utility> | ||
|
||
namespace ll::redirect { | ||
struct StreamRedirector { | ||
StreamRedirector(const StreamRedirector&) = delete; | ||
StreamRedirector& operator=(const StreamRedirector&) = delete; | ||
|
||
StreamRedirector(std::ostream& stream, std::streambuf* rdbuf) : stream(stream), rdbuf_old(stream.rdbuf()) { | ||
stream.set_rdbuf(rdbuf); | ||
} | ||
|
||
~StreamRedirector() { stream.set_rdbuf(rdbuf_old); } | ||
|
||
private: | ||
std::ostream& stream; | ||
std::streambuf* rdbuf_old; | ||
}; | ||
|
||
struct functionbuf : public std::streambuf { | ||
|
||
explicit functionbuf(std::function<void(std::string_view)> function) : function(std::move(function)) { | ||
setp(buffer, buffer + sizeof(buffer) - 1); | ||
} | ||
|
||
private: | ||
char buffer[1024]{}; | ||
std::function<void(std::string_view)> function; | ||
|
||
int_type overflow(int_type c) override { | ||
if (!traits_type::eq_int_type(c, traits_type::eof())) { | ||
*this->pptr() = traits_type::to_char_type(c); | ||
pbump(1); | ||
} | ||
|
||
return sync() ? traits_type::not_eof(c) : traits_type::eof(); | ||
} | ||
|
||
int_type sync() override { | ||
if (pbase() != pptr()) { | ||
function(std::string_view(pbase(), pptr())); | ||
|
||
setp(pbase(), epptr()); | ||
} | ||
|
||
return 0; | ||
} | ||
}; | ||
|
||
struct ofuncstream : private virtual functionbuf, public std::ostream { | ||
explicit ofuncstream(const std::function<void(std::string_view)>& function) | ||
: functionbuf(function), | ||
std::ostream(static_cast<std::streambuf*>(this)) { | ||
setf(std::ios_base::unitbuf); | ||
} | ||
}; | ||
} // namespace ll::redirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.