merge
This commit is contained in:
parent
80f485311b
commit
0f5de9b9bd
|
@ -1,8 +0,0 @@
|
|||
leoservermod
|
||||
============
|
||||
|
||||
An Arma 3 dynamic map server.
|
||||
|
||||
<img src="./screenshot.png" />
|
||||
|
||||
Thanks to Jack Zhang.
|
|
@ -1,21 +0,0 @@
|
|||
set(CURL_LIBRARY "-lcurl")
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
add_library(leoext SHARED lib.c)
|
||||
|
||||
include_directories(${CURL_INCLUDE_DIR})
|
||||
target_link_libraries(leoext ${CURL_LIBRARIES})
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
set(CMAKE_C_FLAGS "-m32 -L/usr/lib32")
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
|
||||
set(CMAKE_C_COMPILER gcc)
|
||||
set(CMAKE_C_FLAGS -m32)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/lib32)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
72
c/lib.c
72
c/lib.c
|
@ -1,72 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
__attribute__((dllexport)) void RVExtension(char *output, int outputSize, const char *function);
|
||||
__attribute__((dllexport)) int RVExtensionArgs(char *output, int outputSize, const char *function, const char **argv, int argc);
|
||||
__attribute__((dllexport)) void RVExtensionVersion(char *output, int outputSize);
|
||||
|
||||
int strncpy_safe(char *output, const char *src, int size)
|
||||
{
|
||||
int i;
|
||||
size--;
|
||||
for (i = 0; i < size && src[i] != '\0'; i++)
|
||||
{
|
||||
output[i] = src[i];
|
||||
}
|
||||
output[i] = '\0';
|
||||
return i;
|
||||
}
|
||||
|
||||
void RVExtension(char *output, int outputSize, const char *function)
|
||||
{
|
||||
strncpy_safe(output, function, outputSize);
|
||||
printf("RVExtention: test call\n");
|
||||
}
|
||||
|
||||
int RVExtensionArgs(char *output, int outputSize,
|
||||
const char *function,
|
||||
const char **argv, int argc)
|
||||
{
|
||||
if(argc < 1) {
|
||||
printf("leoext: need at least 1 argument to post\n");
|
||||
return 101; // SYNTAX_ERROR_WRONG_PARAMS_SIZE
|
||||
}
|
||||
|
||||
const char* output_string = argv[0];
|
||||
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
|
||||
/* get a curl handle */
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
/* First set the URL that is about to receive our POST. This URL can
|
||||
just as well be a https:// URL if that is what should receive the
|
||||
data. */
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:5000/post-arma3-info");
|
||||
/* Now specify the POST data */
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, output_string);
|
||||
|
||||
struct curl_slist *headers = NULL;
|
||||
headers = curl_slist_append(headers, "Expect:");
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
|
||||
/* Perform the request, res will get the return code */
|
||||
res = curl_easy_perform(curl);
|
||||
/* Check for errors */
|
||||
if(res != CURLE_OK)
|
||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",
|
||||
curl_easy_strerror(res));
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RVExtensionVersion(char *output, int outputSize)
|
||||
{
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
printf("leoext loaded!\n");
|
||||
strncpy_safe(output, "leoext v0.1", outputSize);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
\leoservermod
|
|
@ -1,32 +0,0 @@
|
|||
class CfgPatches
|
||||
{
|
||||
class leoservermod
|
||||
{
|
||||
// Meta information for editor
|
||||
name = "leoservermod";
|
||||
author = "leo";
|
||||
url = "https://leosongwei.github.io/";
|
||||
|
||||
requiredVersion = 1.69;
|
||||
|
||||
requiredAddons[] = {};
|
||||
|
||||
units[] = {};
|
||||
weapons[] = {};
|
||||
// init = "diag_log 'loading leoext...'; call compile preprocessFileLineNumbers '\leoservermod\init.sqf'";
|
||||
};
|
||||
};
|
||||
|
||||
class CfgFunctions
|
||||
{
|
||||
class leoservermod
|
||||
{
|
||||
class functions
|
||||
{
|
||||
class leoservermodInit {
|
||||
file="\leoservermod\init.sqf";
|
||||
postInit=1;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
diag_log "leoext: try to initialize...";
|
||||
|
||||
leoext_stop = false;
|
||||
|
||||
_return = "libleoext" callExtension "foooo";
|
||||
execVM "\leoservermod\marker.sqf";
|
||||
|
||||
diag_log format ["leoext: initialize complete! return: %1", _return];
|
|
@ -1,42 +0,0 @@
|
|||
leoext_map_markers_information = {
|
||||
private _info_list = [];
|
||||
{
|
||||
private _text = markerText _x;
|
||||
private _icon_type = markerType _x; // "Empty" == not icon
|
||||
private _pos = markerPos _x;
|
||||
private _color = markerColor _x;
|
||||
|
||||
private _marker_info = [_text, _icon_type, _color, _pos];
|
||||
if (_icon_type != "") then {
|
||||
_info_list pushBack _marker_info;
|
||||
};
|
||||
} forEach allMapMarkers;
|
||||
|
||||
_info_list;
|
||||
};
|
||||
|
||||
leoext_units_pos = {
|
||||
private _units_pos = [];
|
||||
{
|
||||
private _side = str (side _x);
|
||||
private _pos = position _x;
|
||||
|
||||
private _unit = [_side, _pos];
|
||||
_units_pos pushBack _unit;
|
||||
} forEach allUnits;
|
||||
|
||||
_units_pos;
|
||||
};
|
||||
|
||||
leoext_markers_start = {
|
||||
[] spawn {
|
||||
while {!leoext_stop} do {
|
||||
sleep 1;
|
||||
private _markers = call leoext_map_markers_information;
|
||||
private _units = call leoext_units_pos;
|
||||
"libleoext" callExtension ["foo", [[_markers, _units]]];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
call leoext_markers_start;
|
BIN
screenshot.png
BIN
screenshot.png
Binary file not shown.
Before Width: | Height: | Size: 192 KiB |
Loading…
Reference in New Issue