DATA_PATH

This commit is contained in:
nullifiedcat 2017-08-13 22:54:41 +03:00
parent 1993baf84c
commit 4301a41d09
14 changed files with 44 additions and 48 deletions

View File

@ -35,7 +35,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder arguments="-e GAME=tf2 NOIPC=1 BUILD_DEBUG=1 TEXTMODE=1 NO_WARNINGS=1 CC=gcc-7 CXX=g++-7" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/> <builder arguments="-e GAME=tf2 BUILD_DEBUG=1 NO_WARNINGS=1" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> <tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
@ -129,21 +129,15 @@
</cconfiguration> </cconfiguration>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="UranHack.cdt.managedbuild.target.gnu.exe.1493648584" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/> <project id="cathook.null.2129761708" name="cathook"/>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/> <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2"> <storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="TF2"/> <configuration configurationName="Default">
<configuration configurationName="Lilac"/> <resource resourceType="PROJECT" workspacePath="/cathook"/>
</configuration>
<configuration configurationName="Main"> <configuration configurationName="Main">
<resource resourceType="PROJECT" workspacePath="/kathook"/> <resource resourceType="PROJECT" workspacePath="/cathook"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
</configuration>
<configuration configurationName="HL2DM"/>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
</configuration> </configuration>
</storageModule> </storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/> <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>

View File

@ -1,6 +1,6 @@
ifndef CLANG ifndef CLANG
CXX=$(shell sh -c "which g++-6 || which g++") CXX=$(shell sh -c "which g++-7 || which g++-6 || which g++")
CC=$(shell sh -c "which gcc-6 || which gcc") CC=$(shell sh -c "which gcc-7 || which gcc-6 || which gcc")
LD=$(CXX) LD=$(CXX)
else else
CXX=clang++ CXX=clang++

@ -1 +1 @@
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 Subproject commit df6808ca29840f2b1f47d256c59a24b0b4ea4709

View File

@ -34,7 +34,7 @@ public:
if (pw) { if (pw) {
uname = std::string(pw->pw_name); uname = std::string(pw->pw_name);
} }
stream.open("cathook/chat-" + uname + ".log", std::ios::out | std::ios::app); stream.open(DATA_PATH "/chat-" + uname + ".log", std::ios::out | std::ios::app);
} }
void log(const std::string& msg) { void log(const std::string& msg) {
if (stream.bad() or not stream.is_open()) { if (stream.bad() or not stream.is_open()) {

View File

@ -43,7 +43,7 @@ void Initialize() {
mat4_set_orthographic(&projection, 0, draw::width, draw::height, 0, -1, 1); mat4_set_orthographic(&projection, 0, draw::width, draw::height, 0, -1, 1);
//view.m11 = -1; //view.m11 = -1;
shader_v2fc4f = shader_load("cathook/shaders/v2f-c4f.vert", "cathook/shaders/v2f-c4f.frag"); shader_v2fc4f = shader_load(DATA_PATH "/shaders/v2f-c4f.vert", DATA_PATH "/shaders/v2f-c4f.frag");
glUseProgram(shader_v2fc4f); glUseProgram(shader_v2fc4f);
{ {
glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "model"), 1, 0, model.data); glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "model"), 1, 0, model.data);
@ -51,7 +51,7 @@ void Initialize() {
glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "projection"), 1, 0, projection.data); glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "projection"), 1, 0, projection.data);
} }
shader_v2ft2fc4f = shader_load("cathook/shaders/v2f-t2f-c4f.vert", "cathook/shaders/v2f-t2f-c4f.frag"); shader_v2ft2fc4f = shader_load(DATA_PATH "/shaders/v2f-t2f-c4f.vert", DATA_PATH "/shaders/v2f-t2f-c4f.frag");
glUseProgram(shader_v2ft2fc4f); glUseProgram(shader_v2ft2fc4f);
{ {
glUniform1i(glGetUniformLocation(shader_v2ft2fc4f, "texture"), 0); glUniform1i(glGetUniformLocation(shader_v2ft2fc4f, "texture"), 0);

View File

@ -40,7 +40,7 @@ void FTGL_PreInit() {
mat4_set_identity(&view); mat4_set_identity(&view);
mat4_set_identity(&model); mat4_set_identity(&model);
mat4_set_orthographic(&projection, 0, draw::width, 0, draw::height, -1, 1); mat4_set_orthographic(&projection, 0, draw::width, 0, draw::height, -1, 1);
fonts::ftgl_ESP = ftgl::texture_font_new_from_file(atlas, 14, "cathook/fonts/opensans-bold.ttf"); fonts::ftgl_ESP = ftgl::texture_font_new_from_file(atlas, 14, DATA_PATH "/fonts/opensans-bold.ttf");
logging::Info("Pre-Init done %d %d", draw::width, draw::height); logging::Info("Pre-Init done %d %d", draw::width, draw::height);
} }
@ -50,7 +50,7 @@ void FTGL_Init() {
logging::Info("Done..."); logging::Info("Done...");
glGenTextures(1, &atlas->id); glGenTextures(1, &atlas->id);
logging::Info("Loading shaders..."); logging::Info("Loading shaders...");
shader = shader_load("cathook/shaders/v3f-t2f-c4f.vert", "cathook/shaders/v3f-t2f-c4f.frag"); shader = shader_load(DATA_PATH "/shaders/v3f-t2f-c4f.vert", DATA_PATH "/shaders/v3f-t2f-c4f.frag");
logging::Info("Done init"); logging::Info("Done init");
} }
@ -113,7 +113,7 @@ void FTGL_NewFrame() {
void FTGL_ChangeFont(texture_font_t** font, const char* newfont) { void FTGL_ChangeFont(texture_font_t** font, const char* newfont) {
texture_atlas_clear(atlas); texture_atlas_clear(atlas);
texture_font_t* replacement = texture_font_new_from_file(atlas, 14, strfmt("cathook/fonts/%s.ttf", newfont)); texture_font_t* replacement = texture_font_new_from_file(atlas, 14, strfmt(DATA_PATH "/fonts/%s.ttf", newfont));
if (replacement) { if (replacement) {
texture_font_delete(*font); texture_font_delete(*font);
*font = replacement; *font = replacement;

View File

@ -116,7 +116,7 @@ void TraverseList(const ListEntry_List* list) {
CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() { CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() {
main_list_array.clear(); main_list_array.clear();
try { try {
std::ifstream in("cathook/menu.json", std::ios::in); std::ifstream in(DATA_PATH "/menu.json", std::ios::in);
nlohmann::json jo("[]"); nlohmann::json jo("[]");
if (in.good()) { if (in.good()) {
jo = jo.parse(in); jo = jo.parse(in);

View File

@ -173,9 +173,9 @@ void hack::Initialize() {
"menu.json", "fonts/opensans-bold.ttf" "menu.json", "fonts/opensans-bold.ttf"
}; };
for (const auto& s : essential) { for (const auto& s : essential) {
std::ifstream exists("cathook/" + s, std::ios::in); std::ifstream exists(DATA_PATH "/" + s, std::ios::in);
if (not exists) { if (not exists) {
Error("Missing essential file: cathook/%s\nYou MUST run update-data script to finish installation", s.c_str()); Error("Missing essential file: " DATA_PATH "/%s\nYou MUST run update-data script to finish installation", s.c_str());
} }
} }
} }

View File

@ -205,13 +205,13 @@ void DrawText() {
#define BINARY_FILE_READ(handle, data) handle.read(reinterpret_cast<char*>(&data), sizeof(data)) #define BINARY_FILE_READ(handle, data) handle.read(reinterpret_cast<char*>(&data), sizeof(data))
void Save(std::string filename) { void Save(std::string filename) {
DIR* cathook_directory = opendir("cathook/skinchanger"); DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
if (!cathook_directory) { if (!cathook_directory) {
logging::Info("Skinchanger directory doesn't exist, creating one!"); logging::Info("Skinchanger directory doesn't exist, creating one!");
mkdir(strfmt("cathook/skinchanger"), S_IRWXU | S_IRWXG); mkdir(DATA_PATH "/skinchanger", S_IRWXU | S_IRWXG);
} else closedir(cathook_directory); } else closedir(cathook_directory);
try { try {
std::ofstream file("cathook/skinchanger/" + filename, std::ios::out | std::ios::binary); std::ofstream file(DATA_PATH "/skinchanger/" + filename, std::ios::out | std::ios::binary);
BINARY_FILE_WRITE(file, SERIALIZE_VERSION); BINARY_FILE_WRITE(file, SERIALIZE_VERSION);
size_t size = modifier_map.size(); size_t size = modifier_map.size();
BINARY_FILE_WRITE(file, size); BINARY_FILE_WRITE(file, size);
@ -235,13 +235,13 @@ void Save(std::string filename) {
} }
void Load(std::string filename, bool merge) { void Load(std::string filename, bool merge) {
DIR* cathook_directory = opendir("cathook/skinchanger"); DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
if (!cathook_directory) { if (!cathook_directory) {
logging::Info("Skinchanger directory doesn't exist, creating one!"); logging::Info("Skinchanger directory doesn't exist, creating one!");
mkdir(strfmt("cathook/skinchanger"), S_IRWXU | S_IRWXG); mkdir(DATA_PATH "/skinchanger", S_IRWXU | S_IRWXG);
} else closedir(cathook_directory); } else closedir(cathook_directory);
try { try {
std::ifstream file("cathook/skinchanger/" + filename, std::ios::in | std::ios::binary); std::ifstream file(DATA_PATH "/skinchanger/" + filename, std::ios::in | std::ios::binary);
unsigned file_serialize = 0; unsigned file_serialize = 0;
BINARY_FILE_READ(file, file_serialize); BINARY_FILE_READ(file, file_serialize);
if (file_serialize != SERIALIZE_VERSION) { if (file_serialize != SERIALIZE_VERSION) {

View File

@ -225,13 +225,13 @@ void Save(std::string filename) {
return; return;
} }
{ {
DIR* walkbot_dir = opendir("cathook/walkbot"); DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
if (!walkbot_dir) { if (!walkbot_dir) {
logging::Info("Walkbot directory doesn't exist, creating one!"); logging::Info("Walkbot directory doesn't exist, creating one!");
mkdir("cathook/walkbot", S_IRWXU | S_IRWXG); mkdir(DATA_PATH "/walkbot", S_IRWXU | S_IRWXG);
} else closedir(walkbot_dir); } else closedir(walkbot_dir);
} }
std::string path = format("cathook/walkbot/", GetLevelName()); std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
{ {
DIR* level_dir = opendir(path.c_str()); DIR* level_dir = opendir(path.c_str());
if (!level_dir) { if (!level_dir) {
@ -267,13 +267,13 @@ void Save(std::string filename) {
bool Load(std::string filename) { bool Load(std::string filename) {
{ {
DIR* walkbot_dir = opendir("cathook/walkbot"); DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
if (!walkbot_dir) { if (!walkbot_dir) {
logging::Info("Walkbot directory doesn't exist, creating one!"); logging::Info("Walkbot directory doesn't exist, creating one!");
mkdir("cathook/walkbot", S_IRWXU | S_IRWXG); mkdir(DATA_PATH "/walkbot", S_IRWXU | S_IRWXG);
} else closedir(walkbot_dir); } else closedir(walkbot_dir);
} }
std::string path = format("cathook/walkbot/", GetLevelName()); std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
{ {
DIR* level_dir = opendir(path.c_str()); DIR* level_dir = opendir(path.c_str());
if (!level_dir) { if (!level_dir) {

View File

@ -39,7 +39,7 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
logging::Info("Already connected!"); logging::Info("Already connected!");
return; return;
} }
peer = new peer_t("cathook_followbot_server", false, false); peer = new peer_t(std::string(server_name.GetString()), false, false);
try { try {
peer->Connect(); peer->Connect();
logging::Info("peer count: %i", peer->memory->peer_count); logging::Info("peer count: %i", peer->memory->peer_count);

View File

@ -7,7 +7,9 @@
#pragma once #pragma once
#define DATA_PATH "/opt/cathook-data" #ifndef DATA_PATH
# define DATA_PATH "/opt/cathook-data"
#endif
#if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE) #if defined(NOGUI) and NOGUI == 1 or defined(TEXTMODE)
#define ENABLE_GUI false #define ENABLE_GUI false

View File

@ -30,13 +30,13 @@ bool ShouldSave(const userdata& data) {
} }
void Save() { void Save() {
DIR* cathook_directory = opendir("cathook"); DIR* cathook_directory = opendir(DATA_PATH);
if (!cathook_directory) { if (!cathook_directory) {
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?"); logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
mkdir("cathook", S_IRWXU | S_IRWXG); return;
} else closedir(cathook_directory); } else closedir(cathook_directory);
try { try {
std::ofstream file("cathook/plist", std::ios::out | std::ios::binary); std::ofstream file(DATA_PATH "/plist", std::ios::out | std::ios::binary);
file.write(reinterpret_cast<const char*>(&SERIALIZE_VERSION), sizeof(SERIALIZE_VERSION)); file.write(reinterpret_cast<const char*>(&SERIALIZE_VERSION), sizeof(SERIALIZE_VERSION));
int size = 0; int size = 0;
for (const auto& item : data) { for (const auto& item : data) {
@ -57,13 +57,13 @@ void Save() {
void Load() { void Load() {
data.clear(); data.clear();
DIR* cathook_directory = opendir("cathook"); DIR* cathook_directory = opendir(DATA_PATH);
if (!cathook_directory) { if (!cathook_directory) {
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?"); logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
mkdir("cathook", S_IRWXU | S_IRWXG); return;
} else closedir(cathook_directory); } else closedir(cathook_directory);
try { try {
std::ifstream file("cathook/plist", std::ios::in | std::ios::binary); std::ifstream file(DATA_PATH "/plist", std::ios::in | std::ios::binary);
int file_serialize = 0; int file_serialize = 0;
file.read(reinterpret_cast<char*>(&file_serialize), sizeof(file_serialize)); file.read(reinterpret_cast<char*>(&file_serialize), sizeof(file_serialize));
if (file_serialize != SERIALIZE_VERSION) { if (file_serialize != SERIALIZE_VERSION) {

View File

@ -20,7 +20,7 @@ TextFile::TextFile()
bool TextFile::TryLoad(std::string name) { bool TextFile::TryLoad(std::string name) {
if (name.length() == 0) return false; if (name.length() == 0) return false;
std::string filename = format("cathook/", name); std::string filename = format(DATA_PATH "/", name);
std::ifstream file(filename, std::ios::in); std::ifstream file(filename, std::ios::in);
if (!file) { if (!file) {
return false; return false;
@ -34,7 +34,7 @@ bool TextFile::TryLoad(std::string name) {
} }
void TextFile::Load(std::string name) { void TextFile::Load(std::string name) {
std::string filename = format("cathook/", name); std::string filename = format(DATA_PATH "/", name);
std::ifstream file(filename, std::ios::in); std::ifstream file(filename, std::ios::in);
if (file.bad()) { if (file.bad()) {
logging::Info("Could not open the file: %s", filename.c_str()); logging::Info("Could not open the file: %s", filename.c_str());