From b0b634644a06b17a2d9f12db5aee72e9ec7160cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=BCrzeder?= Date: Thu, 25 Jul 2019 11:59:24 +0200 Subject: [PATCH] Improved debugging experience Cleaned up includes --- .gitignore | 1 + README.md | 9 +++++++++ module/CFunctions.cpp | 9 ++++----- module/Crypto.cpp | 5 +++-- module/Crypto.h | 1 + module/Module.cpp | 3 --- module/Utils.h | 1 + module/premake5.lua | 5 +++++ premake5.lua | 2 +- 9 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 6ae0b97..3d8ff84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Build Bin obj +mta-server diff --git a/README.md b/README.md index 4ade6ba..f153a58 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,15 @@ 2. Launch `premake.bat` 3. Open `Build/JWT.sln` +### Debugging +1. Create a directory junktion to MTA-Server directory in the root of the repo + * `mklink /J mta-server "PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server"` +2. Create a symlink to the build output dll in the modules directory + * `cd PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server\x64\modules` for x64 + * `cd PATH_TO_INSTALL_DIR\MTA San Andreas 1.5\server\mods\deathmatch\modules` for Win32 + * `mklink ml_jwt.dll "PATH_TO_REPO\Bin\Debug\ml_jwt.dll"` +3. Press `F5` in Visual Studio and the MTA-Server should start + ## Installing 1. Put the resulting `Bin/ml_jwt.dll/.so` into your MTA:SA server `modules` folder. 2. Add `` (or `.so` for Linux) to your `mtaserver.conf`. diff --git a/module/CFunctions.cpp b/module/CFunctions.cpp index 08a05a5..7fc2781 100644 --- a/module/CFunctions.cpp +++ b/module/CFunctions.cpp @@ -1,12 +1,11 @@ -#include "CFunctions.h" -#include "include/ILuaModuleManager.h" - -#include "Module.h" #include #include + +#include "Module.h" +#include "CFunctions.h" #include "Utils.h" #include "Crypto.h" - + #ifndef _WIN32 #include #endif diff --git a/module/Crypto.cpp b/module/Crypto.cpp index 7c253a9..e7387b9 100644 --- a/module/Crypto.cpp +++ b/module/Crypto.cpp @@ -1,6 +1,7 @@ -#include "Crypto.h" -#include +#include #include + +#include "Crypto.h" #include "Utils.h" bool Crypto::read_key(lua_State* lua_vm, const std::string& key_path, std::string& key) diff --git a/module/Crypto.h b/module/Crypto.h index ccdf434..465af53 100644 --- a/module/Crypto.h +++ b/module/Crypto.h @@ -1,5 +1,6 @@ #pragma once #include + #include "CFunctions.h" class Crypto diff --git a/module/Module.cpp b/module/Module.cpp index c241f12..e219329 100644 --- a/module/Module.cpp +++ b/module/Module.cpp @@ -1,7 +1,4 @@ #include "Module.h" -#include -#include -#include "include/ILuaModuleManager.h" Module* g_Module = nullptr; diff --git a/module/Utils.h b/module/Utils.h index ccc3e75..b759d74 100644 --- a/module/Utils.h +++ b/module/Utils.h @@ -2,6 +2,7 @@ #include #include #include + #include "ILuaModuleManager.h" class Utils diff --git a/module/premake5.lua b/module/premake5.lua index 235b0b2..6087fe8 100644 --- a/module/premake5.lua +++ b/module/premake5.lua @@ -19,13 +19,18 @@ project "module" "**.h" } + filter { "system:windows" } + debugdir "../mta-server" + filter { "system:windows", "platforms:x86" } links { "lua5.1.lib" } links { "libcrypto.lib" } + debugcommand "../mta-server/MTA Server.exe" filter { "system:windows", "platforms:x64" } links { "lua5.1_64.lib" } links { "libcrypto_64.lib" } + debugcommand "../mta-server/MTA Server64.exe" filter "system:linux" links { "ssl", "crypto" } diff --git a/premake5.lua b/premake5.lua index 0838728..1e7f18a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,7 +1,7 @@ solution "JWT" configurations { "Debug", "Release" } location ( "Build" ) - startproject "test" + startproject "module" targetdir "Bin/%{cfg.buildcfg}" platforms { "x86", "x64" }