DATA_PATH
This commit is contained in:
parent
1993baf84c
commit
4301a41d09
18
.cproject
18
.cproject
@ -35,7 +35,7 @@
|
||||
<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">
|
||||
<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 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"/>
|
||||
@ -129,21 +129,15 @@
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<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 moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="TF2"/>
|
||||
<configuration configurationName="Lilac"/>
|
||||
<configuration configurationName="Default">
|
||||
<resource resourceType="PROJECT" workspacePath="/cathook"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Main">
|
||||
<resource resourceType="PROJECT" workspacePath="/kathook"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
|
||||
</configuration>
|
||||
<configuration configurationName="HL2DM"/>
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/UranHack"/>
|
||||
<resource resourceType="PROJECT" workspacePath="/cathook"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
|
4
makefile
4
makefile
@ -1,6 +1,6 @@
|
||||
ifndef CLANG
|
||||
CXX=$(shell sh -c "which g++-6 || which g++")
|
||||
CC=$(shell sh -c "which gcc-6 || which gcc")
|
||||
CXX=$(shell sh -c "which g++-7 || which g++-6 || which g++")
|
||||
CC=$(shell sh -c "which gcc-7 || which gcc-6 || which gcc")
|
||||
LD=$(CXX)
|
||||
else
|
||||
CXX=clang++
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839
|
||||
Subproject commit df6808ca29840f2b1f47d256c59a24b0b4ea4709
|
@ -34,7 +34,7 @@ public:
|
||||
if (pw) {
|
||||
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) {
|
||||
if (stream.bad() or not stream.is_open()) {
|
||||
|
@ -43,7 +43,7 @@ void Initialize() {
|
||||
mat4_set_orthographic(&projection, 0, draw::width, draw::height, 0, -1, 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);
|
||||
{
|
||||
glUniformMatrix4fv(glGetUniformLocation(shader_v2fc4f, "model"), 1, 0, model.data);
|
||||
@ -51,7 +51,7 @@ void Initialize() {
|
||||
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);
|
||||
{
|
||||
glUniform1i(glGetUniformLocation(shader_v2ft2fc4f, "texture"), 0);
|
||||
|
@ -40,7 +40,7 @@ void FTGL_PreInit() {
|
||||
mat4_set_identity(&view);
|
||||
mat4_set_identity(&model);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ void FTGL_Init() {
|
||||
logging::Info("Done...");
|
||||
glGenTextures(1, &atlas->id);
|
||||
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");
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ void FTGL_NewFrame() {
|
||||
|
||||
void FTGL_ChangeFont(texture_font_t** font, const char* newfont) {
|
||||
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) {
|
||||
texture_font_delete(*font);
|
||||
*font = replacement;
|
||||
|
@ -116,7 +116,7 @@ void TraverseList(const ListEntry_List* list) {
|
||||
CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() {
|
||||
main_list_array.clear();
|
||||
try {
|
||||
std::ifstream in("cathook/menu.json", std::ios::in);
|
||||
std::ifstream in(DATA_PATH "/menu.json", std::ios::in);
|
||||
nlohmann::json jo("[]");
|
||||
if (in.good()) {
|
||||
jo = jo.parse(in);
|
||||
|
@ -173,9 +173,9 @@ void hack::Initialize() {
|
||||
"menu.json", "fonts/opensans-bold.ttf"
|
||||
};
|
||||
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) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -205,13 +205,13 @@ void DrawText() {
|
||||
#define BINARY_FILE_READ(handle, data) handle.read(reinterpret_cast<char*>(&data), sizeof(data))
|
||||
|
||||
void Save(std::string filename) {
|
||||
DIR* cathook_directory = opendir("cathook/skinchanger");
|
||||
DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
|
||||
if (!cathook_directory) {
|
||||
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);
|
||||
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);
|
||||
size_t size = modifier_map.size();
|
||||
BINARY_FILE_WRITE(file, size);
|
||||
@ -235,13 +235,13 @@ void Save(std::string filename) {
|
||||
}
|
||||
|
||||
void Load(std::string filename, bool merge) {
|
||||
DIR* cathook_directory = opendir("cathook/skinchanger");
|
||||
DIR* cathook_directory = opendir(DATA_PATH "/skinchanger");
|
||||
if (!cathook_directory) {
|
||||
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);
|
||||
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;
|
||||
BINARY_FILE_READ(file, file_serialize);
|
||||
if (file_serialize != SERIALIZE_VERSION) {
|
||||
|
@ -225,13 +225,13 @@ void Save(std::string filename) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
DIR* walkbot_dir = opendir("cathook/walkbot");
|
||||
DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
|
||||
if (!walkbot_dir) {
|
||||
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);
|
||||
}
|
||||
std::string path = format("cathook/walkbot/", GetLevelName());
|
||||
std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
|
||||
{
|
||||
DIR* level_dir = opendir(path.c_str());
|
||||
if (!level_dir) {
|
||||
@ -267,13 +267,13 @@ void Save(std::string filename) {
|
||||
|
||||
bool Load(std::string filename) {
|
||||
{
|
||||
DIR* walkbot_dir = opendir("cathook/walkbot");
|
||||
DIR* walkbot_dir = opendir(DATA_PATH "/walkbot");
|
||||
if (!walkbot_dir) {
|
||||
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);
|
||||
}
|
||||
std::string path = format("cathook/walkbot/", GetLevelName());
|
||||
std::string path = format(DATA_PATH "/walkbot/", GetLevelName());
|
||||
{
|
||||
DIR* level_dir = opendir(path.c_str());
|
||||
if (!level_dir) {
|
||||
|
@ -39,7 +39,7 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
|
||||
logging::Info("Already connected!");
|
||||
return;
|
||||
}
|
||||
peer = new peer_t("cathook_followbot_server", false, false);
|
||||
peer = new peer_t(std::string(server_name.GetString()), false, false);
|
||||
try {
|
||||
peer->Connect();
|
||||
logging::Info("peer count: %i", peer->memory->peer_count);
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
#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)
|
||||
#define ENABLE_GUI false
|
||||
|
@ -30,13 +30,13 @@ bool ShouldSave(const userdata& data) {
|
||||
}
|
||||
|
||||
void Save() {
|
||||
DIR* cathook_directory = opendir("cathook");
|
||||
DIR* cathook_directory = opendir(DATA_PATH);
|
||||
if (!cathook_directory) {
|
||||
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?");
|
||||
mkdir("cathook", S_IRWXU | S_IRWXG);
|
||||
logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
|
||||
return;
|
||||
} else closedir(cathook_directory);
|
||||
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));
|
||||
int size = 0;
|
||||
for (const auto& item : data) {
|
||||
@ -57,13 +57,13 @@ void Save() {
|
||||
|
||||
void Load() {
|
||||
data.clear();
|
||||
DIR* cathook_directory = opendir("cathook");
|
||||
DIR* cathook_directory = opendir(DATA_PATH);
|
||||
if (!cathook_directory) {
|
||||
logging::Info("[WARNING] cathook data directory doesn't exist! How did the cheat even get injected?");
|
||||
mkdir("cathook", S_IRWXU | S_IRWXG);
|
||||
logging::Info("[ERROR] cathook data directory doesn't exist! How did the cheat even get injected?");
|
||||
return;
|
||||
} else closedir(cathook_directory);
|
||||
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;
|
||||
file.read(reinterpret_cast<char*>(&file_serialize), sizeof(file_serialize));
|
||||
if (file_serialize != SERIALIZE_VERSION) {
|
||||
|
@ -20,7 +20,7 @@ TextFile::TextFile()
|
||||
|
||||
bool TextFile::TryLoad(std::string name) {
|
||||
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);
|
||||
if (!file) {
|
||||
return false;
|
||||
@ -34,7 +34,7 @@ bool TextFile::TryLoad(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);
|
||||
if (file.bad()) {
|
||||
logging::Info("Could not open the file: %s", filename.c_str());
|
||||
|
Reference in New Issue
Block a user