diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 132661b92..ae49cfadb 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -40,6 +40,7 @@ Include additional headers for multiplayer purposes */ +#include #include #include #include @@ -219,6 +220,34 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat End of tes3mp change (minor) */ + /* + Start of tes3mp addition + + Check for unmodified tes3mp-credits file; this makes it so people can't repackage official releases with + their own made-up credits, though it obviously has no bearing on unofficial releases that change + the checksum below + */ + boost::filesystem::path folderPath(boost::filesystem::initial_path()); + folderPath = boost::filesystem::system_complete(boost::filesystem::path(argv[0])).remove_filename(); + std::string creditsPath = folderPath.string() + "/tes3mp-credits"; + + unsigned int expectedChecksumInt = Utils::hexStrToInt(TES3MP_CREDITS_CHECKSUM); + bool hasValidCredits = Utils::doesFileHaveChecksum(creditsPath + ".md", expectedChecksumInt); + + if (!hasValidCredits) + hasValidCredits = Utils::doesFileHaveChecksum(creditsPath + ".txt", expectedChecksumInt); + + if (!hasValidCredits) + { + LOG_MESSAGE_SIMPLE(Log::LOG_FATAL, "The client is shutting down"); + LOG_APPEND(Log::LOG_FATAL, "- %s", TES3MP_CREDITS_ERROR); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "tes3mp", TES3MP_CREDITS_ERROR, 0); + return false; + } + /* + End of tes3mp addition + */ + engine.setGrabMouse(!variables["no-grab"].as()); // Font encoding settings