Skip to content

Commit

Permalink
Improved debugging experience
Browse files Browse the repository at this point in the history
Cleaned up includes
  • Loading branch information
Stefan Kürzeder committed Jul 25, 2019
1 parent 4cf751c commit b0b6346
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Build
Bin
obj
mta-server
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<module src="ml_jwt.dll"/>` (or `.so` for Linux) to your `mtaserver.conf`.
Expand Down
9 changes: 4 additions & 5 deletions module/CFunctions.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "CFunctions.h"
#include "include/ILuaModuleManager.h"

#include "Module.h"
#include <jwt-cpp/jwt.h>
#include <sstream>

#include "Module.h"
#include "CFunctions.h"
#include "Utils.h"
#include "Crypto.h"

#ifndef _WIN32
#include <sys/stat.h>
#endif
Expand Down
5 changes: 3 additions & 2 deletions module/Crypto.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Crypto.h"
#include <fstream>
#include <fstream>
#include <jwt-cpp/jwt.h>

#include "Crypto.h"
#include "Utils.h"

bool Crypto::read_key(lua_State* lua_vm, const std::string& key_path, std::string& key)
Expand Down
1 change: 1 addition & 0 deletions module/Crypto.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once
#include <string>

#include "CFunctions.h"

class Crypto
Expand Down
3 changes: 0 additions & 3 deletions module/Module.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "Module.h"
#include <iostream>
#include <chrono>
#include "include/ILuaModuleManager.h"

Module* g_Module = nullptr;

Expand Down
1 change: 1 addition & 0 deletions module/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <unordered_map>
#include <ostream>
#include <sstream>

#include "ILuaModuleManager.h"

class Utils
Expand Down
5 changes: 5 additions & 0 deletions module/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion premake5.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
solution "JWT"
configurations { "Debug", "Release" }
location ( "Build" )
startproject "test"
startproject "module"
targetdir "Bin/%{cfg.buildcfg}"

platforms { "x86", "x64" }
Expand Down

0 comments on commit b0b6346

Please sign in to comment.