From 85a10ee8c725541b694d9e726b8d8c20496b4351 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 24 Jul 2017 22:02:52 +0300 Subject: [PATCH] cathook will now crash with error message if you dont install it properly --- src/hack.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/hack.cpp b/src/hack.cpp index a71cc330..1a4899f3 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -26,6 +26,7 @@ #include "aftercheaders.h" #include +#include // All Hacks #include "hacks/hacklist.h" @@ -154,6 +155,22 @@ void hack::CC_Cat(const CCommand& args) { } void hack::Initialize() { + // Essential files must always exist + { + std::vector essential = { + "shaders/v2f-c4f.frag", "shaders/v2f-c4f.vert", + "shaders/v2f-t2f-c4f.frag", "shaders/v2f-t2f-c4f.vert", + "shaders/v3f-t2f-c4f.frag", "shaders/v3f-t2f-c4f.vert", + "menu.json", "fonts/opensans-bold.ttf" + }; + for (const auto& s : essential) { + std::ifstream exists("cathook/" + 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()); + } + } + } + logging::Info("Initializing..."); srand(time(0)); prctl(PR_SET_DUMPABLE,0,42,42,42);