-e TEXTMODE_STDIN=1

This commit is contained in:
nullifiedcat 2017-07-31 07:42:57 +03:00
parent 4404e8393e
commit 52fe1a8205
4 changed files with 15 additions and 1 deletions

View File

@ -13,6 +13,7 @@ DEFINES=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO RAD_TELEMETRY_DISA
WARNING_FLAGS=-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef
COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native -mtune=native
ifdef CLANG
COMMON_FLAGS+=-Wno-c++11-narrowing
endif
@ -66,6 +67,10 @@ DEFINES += TEXTMODE=1
#OUT_NAME := libcathook-textmode.so
endif
ifdef TEXTMODE_STDIN
DEFINES+=-DTEXTMODE_STDIN
endif
SRC_DIR = src
RES_DIR = res
TARGET_DIR = bin

View File

@ -401,6 +401,12 @@ void FrameStageNotify_hook(void* _this, int stage) {
}
if (stage == FRAME_START) {
#if IPC_ENABLED
static Timer nametimer {};
if (nametimer.test_and_set(1000 * 10)) {
if (ipc::peer) {
ipc::StoreClientData();
}
}
static Timer ipc_timer {};
if (ipc_timer.test_and_set(1000)) {
if (ipc::peer) {
@ -419,12 +425,14 @@ void FrameStageNotify_hook(void* _this, int stage) {
hack::command_stack().pop();
}
}
#if defined(TEXTMODE) and defined(TEXTMODE_STDIN)
static auto last_stdin = std::chrono::system_clock::from_time_t(0);
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - last_stdin).count();
if (ms > 500) {
UpdateInput();
last_stdin = std::chrono::system_clock::now();
}
#endif
}
#ifndef TEXTMODE
if (cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {

View File

@ -164,7 +164,6 @@ void UpdateTemporaryData() {
void StoreClientData() {
UpdateServerAddress();
peer_t::MutexLock lock(peer);
user_data_s& data = peer->memory->peer_user_data[peer->client_id];
data.friendid = g_ISteamUser->GetSteamID().GetAccountID();
strncpy(data.name, g_ISteamFriends->GetPersonaName(), sizeof(data.name));

View File

@ -34,11 +34,13 @@ CatCommand fixvac("fixvac", "Lemme in to secure servers", []() {
#ifdef TEXTMODE
InitRoutine init([]() {
#ifdef TEXTMODE_STDIN
logging::Info("[TEXTMODE] Setting up input handling");
int flags = fcntl(0, F_GETFL, 0);
flags |= O_NONBLOCK;
fcntl(0, F_SETFL, flags);
logging::Info("[TEXTMODE] stdin is now non-blocking");
#endif
EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG();
});
#endif