mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Extension changes for Medical Rewrite and Linux compilation (#6909)
* Fix Medical HandleDamageWounds memory leak (#6809) * Use strncpy and disable MSVC unsafe warnings (#7171) * Set 64-bit correctly from generator string, Disable SSE2 flag on 64-bit (non-existent) * Tweaks for Linux extensions (#5762) * Tweak CMakeLists for Linux compilation * Conform SQF extensions check for Linux server extensions support * Add *.so to tools * Split extension check into Windows and Linux * Disable Medical extension loading for now * Add client/server separation to extension loading * Add Arma config documentation on extension creation
This commit is contained in:
parent
b8c45c0a57
commit
c426103f23
2
Makefile
2
Makefile
@ -82,7 +82,7 @@ push: commit
|
|||||||
release: clean version commit
|
release: clean version commit
|
||||||
@"$(MAKE)" $(MAKEFLAGS) signatures
|
@"$(MAKE)" $(MAKEFLAGS) signatures
|
||||||
@echo " ZIP $(ZIP)_$(VERSION_S).zip"
|
@echo " ZIP $(ZIP)_$(VERSION_S).zip"
|
||||||
@cp *.dll mod.cpp README.md docs/README_DE.md docs/README_PL.md AUTHORS.txt LICENSE logo_ace3_ca.paa meta.cpp $(BIN)
|
@cp *.dll *.so mod.cpp README.md docs/README_DE.md docs/README_PL.md AUTHORS.txt LICENSE logo_ace3_ca.paa meta.cpp $(BIN)
|
||||||
@zip -qr $(ZIP)_$(VERSION_S).zip $(BIN)
|
@zip -qr $(ZIP)_$(VERSION_S).zip $(BIN)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -20,5 +20,8 @@ class CfgPatches {
|
|||||||
#include "ACE_Settings.hpp"
|
#include "ACE_Settings.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
extensions[] += {"ace_advanced_ballistics"};
|
class ace_advanced_ballistics {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
/*
|
/*
|
||||||
* Author: Ruthberg
|
* Author: Ruthberg
|
||||||
* Initializes the advanced ballistics dll extension with terrain data
|
* Initializes the advanced ballistics extension with terrain data
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* None
|
* None
|
||||||
|
@ -67,9 +67,7 @@ class ACE_Rsc_Control_Base {
|
|||||||
#include "CompassControl.hpp"
|
#include "CompassControl.hpp"
|
||||||
#include "CfgUIGrids.hpp"
|
#include "CfgUIGrids.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {};
|
||||||
extensions[] = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
class ACE_Tests {
|
class ACE_Tests {
|
||||||
vehicleTransportInventory = QPATHTOF(dev\test_vehicleInventory.sqf);
|
vehicleTransportInventory = QPATHTOF(dev\test_vehicleInventory.sqf);
|
||||||
|
@ -67,38 +67,43 @@ if (!(_oldCompats isEqualTo [])) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
// check dlls
|
// check extensions
|
||||||
///////////////
|
///////////////
|
||||||
if (toLower (productVersion select 6) in ["linux", "osx"]) then {
|
private _platform = toLower (productVersion select 6);
|
||||||
INFO("Operating system does not support DLL file format");
|
if (!isServer && {_platform in ["linux", "osx"]}) then {
|
||||||
|
// Linux and OSX client ports do not support extensions at all
|
||||||
|
INFO("Operating system does not support extensions");
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
private _versionEx = _x callExtension "version";
|
private _extension = configName _x;
|
||||||
|
private _isWindows = _platform == "windows" && {getNumber (_x >> "windows") == 1};
|
||||||
|
private _isLinux = _platform == "linux" && {getNumber (_x >> "linux") == 1};
|
||||||
|
private _isClient = hasInterface && {getNumber (_x >> "client") == 1};
|
||||||
|
private _isServer = !hasInterface && {getNumber (_x >> "server") == 1};
|
||||||
|
|
||||||
if (_versionEx == "") then {
|
if ((_isWindows || _isLinux) && {_isClient || _isServer}) then {
|
||||||
private _extension = ".dll";
|
private _versionEx = _extension callExtension "version";
|
||||||
|
if (_versionEx == "") then {
|
||||||
|
private _extensionFile = _extension;
|
||||||
|
if (productVersion select 7 == "x64") then {
|
||||||
|
_extensionFile = format ["%1_x64", _extensionFile];
|
||||||
|
};
|
||||||
|
|
||||||
if (productVersion select 7 == "x64") then {
|
private _platformExt = [".dll", ".so"] select (_platform == "linux");
|
||||||
_extension = "_x64.dll";
|
_extensionFile = format ["%1%2", _extensionFile, _platformExt];
|
||||||
|
|
||||||
|
private _errorMsg = format ["Extension %1 not found.", _extensionFile];
|
||||||
|
ERROR(_errorMsg);
|
||||||
|
|
||||||
|
if (hasInterface) then {
|
||||||
|
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Print the current extension version
|
||||||
|
INFO_2("Extension version: %1: %2",_extension,_versionEx);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (productVersion select 6 == "Linux") then {
|
|
||||||
_extension = ".so";
|
|
||||||
};
|
|
||||||
|
|
||||||
private _errorMsg = format ["Extension %1%2 not found.", _x, _extension];
|
|
||||||
|
|
||||||
ERROR(_errorMsg);
|
|
||||||
|
|
||||||
if (hasInterface) then {
|
|
||||||
["[ACE] ERROR", _errorMsg, {findDisplay 46 closeDisplay 0}] call FUNC(errorMessage);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// Print the current extension version
|
|
||||||
INFO_2("Extension version: %1: %2",_x,_versionEx);
|
|
||||||
};
|
};
|
||||||
false
|
} forEach ("true" configClasses (configFile >> "ACE_Extensions"));
|
||||||
} count getArray (configFile >> "ACE_Extensions" >> "extensions");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////
|
///////////////
|
||||||
|
@ -28,7 +28,10 @@ class CfgPatches {
|
|||||||
#include "CfgOptics.hpp"
|
#include "CfgOptics.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
extensions[] += {"ace_fcs"};
|
class ace_fcs {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_Tests {
|
class ACE_Tests {
|
||||||
|
@ -23,5 +23,12 @@ class CfgPatches {
|
|||||||
#include "ACE_Settings.hpp"
|
#include "ACE_Settings.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
extensions[] += {"ace_break_line", "ace_parse_imagepath"};
|
class ace_break_line {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
|
class ace_parse_imagepath {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -19,5 +19,7 @@ class CfgPatches {
|
|||||||
#include "CfgEventHandlers.hpp"
|
#include "CfgEventHandlers.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
extensions[] += {"ace_medical"};
|
class ace_medical {
|
||||||
|
// Not yet used
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -40,10 +40,7 @@ private _extensionOutput = "ace_medical" callExtension format ["HandleDamageWoun
|
|||||||
TRACE_1("",_extensionOutput);
|
TRACE_1("",_extensionOutput);
|
||||||
|
|
||||||
// these are default values and modified by _extensionOutput
|
// these are default values and modified by _extensionOutput
|
||||||
private _painToAdd = 0;
|
(parseSimpleArray _extensionOutput) params ["_woundsCreated", "_painToAdd"];
|
||||||
private _woundsCreated = [];
|
|
||||||
|
|
||||||
call compile _extensionOutput;
|
|
||||||
|
|
||||||
// todo: Make the pain and bleeding calculations part of the extension again
|
// todo: Make the pain and bleeding calculations part of the extension again
|
||||||
private _woundDamage = _damage / ((count _woundsCreated) max 1); // If the damage creates multiple wounds
|
private _woundDamage = _damage / ((count _woundsCreated) max 1); // If the damage creates multiple wounds
|
||||||
|
@ -30,7 +30,10 @@ class CfgAddons {
|
|||||||
#include "gui\pauseMenu.hpp"
|
#include "gui\pauseMenu.hpp"
|
||||||
|
|
||||||
class ACE_Extensions {
|
class ACE_Extensions {
|
||||||
extensions[] += {"ace_clipboard"};
|
class ace_clipboard {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CfgCommands {
|
class CfgCommands {
|
||||||
|
@ -58,3 +58,36 @@ extensions\
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2.2 Creating a new Extension
|
### 2.2 Creating a new Extension
|
||||||
|
|
||||||
|
#### 2.2.1 Arma Config
|
||||||
|
|
||||||
|
ACE3 loads extensions defined in `ACE_Extensions` root config class and supports the following entries:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// Platform
|
||||||
|
windows = 1; // Load on Windows
|
||||||
|
linux = 1; // Load on Linux
|
||||||
|
|
||||||
|
// Type
|
||||||
|
client = 1; // Load on Client
|
||||||
|
server = 1; // Load on Server
|
||||||
|
```
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
class ACE_Extensions {
|
||||||
|
// Windows Client only extension
|
||||||
|
class tag_extension {
|
||||||
|
windows = 1;
|
||||||
|
client = 1;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Any platform Server extension
|
||||||
|
class tag_extension2 {
|
||||||
|
windows = 1;
|
||||||
|
linux = 1;
|
||||||
|
server = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Combining platform and client/server values is possible to get all combinations currently supported by the game and more.
|
||||||
|
@ -30,7 +30,7 @@ Downloaded ACE3 and have no idea where to start? This page serves as a starting
|
|||||||
|
|
||||||
### 1.2 Issues
|
### 1.2 Issues
|
||||||
|
|
||||||
**Q:** Experiencing DLL errors.
|
**Q:** Experiencing extension errors.
|
||||||
**A:** Start the game once with the Arma 3 Launcher, close it, then start the game with your usual launcher (ArmA3Sync, Play withSix, etc …).
|
**A:** Start the game once with the Arma 3 Launcher, close it, then start the game with your usual launcher (ArmA3Sync, Play withSix, etc …).
|
||||||
|
|
||||||
>The simple explanation is that the BattlEye process wasn't ended properly and is unable to start again properly, launching it with the Arma 3 Launcher is the only known solution to fix it.
|
>The simple explanation is that the BattlEye process wasn't ended properly and is unable to start again properly, launching it with the Arma 3 Launcher is the only known solution to fix it.
|
||||||
|
@ -8,8 +8,8 @@ add_definitions(/DWINVER=0x0600 /D_WIN32_WINNT=0x0600)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX)
|
if (NOT CMAKE_BUILD_TYPE AND CMAKE_COMPILER_IS_GNUCXX)
|
||||||
message(STATUS "No build type selected, default to Debug")
|
message(STATUS "No build type selected, default to Debug")
|
||||||
set(CMAKE_BUILD_TYPE "Debug")
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(DEVEL "DEVEL" OFF)
|
option(DEVEL "DEVEL" OFF)
|
||||||
@ -18,19 +18,29 @@ option(USE_DIRECTX "USE_DIRECTX" OFF)
|
|||||||
option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF)
|
option(USE_64BIT_BUILD "USE_64BIT_BUILD" OFF)
|
||||||
option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON)
|
option(USE_STATIC_LINKING "USE_STATIC_LINKING" ON)
|
||||||
|
|
||||||
|
if(CMAKE_GENERATOR_PLATFORM MATCHES "x64")
|
||||||
|
set(USE_64BIT_BUILD ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive")
|
SET(CMAKE_CXX_FLAGS "-std=c++11 -pedantic -pedantic-errors -march=i686 -m32 -O2 -s -fPIC -fpermissive")
|
||||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")
|
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc -static-libstdc++")
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
message(ERROR "SUPPORT NOT COMPLETE")
|
message(ERROR "SUPPORT NOT COMPLETE")
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /arch:SSE2 /Qpar-report:2")
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS) # Disable MSVC *_s function warnings
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
|
||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG")
|
if(USE_64BIT_BUILD)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2 /Ob2 /D NDEBUG")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /Qpar-report:2") # Default SSE2
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} /MT /Zi /O2 /Ob1 /D NDEBUG")
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /arch:SSE2 /Qpar-report:2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} /D _DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||||
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} /MT /O1 /Ob1 /D NDEBUG")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} /MT /O2 /Ob2 /D NDEBUG")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} /MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories("common")
|
include_directories("common")
|
||||||
|
@ -295,7 +295,7 @@ extern "C"
|
|||||||
|
|
||||||
void __stdcall RVExtensionVersion(char *output, int outputSize)
|
void __stdcall RVExtensionVersion(char *output, int outputSize)
|
||||||
{
|
{
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
||||||
@ -303,7 +303,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
ZERO_OUTPUT();
|
ZERO_OUTPUT();
|
||||||
std::stringstream outputStr;
|
std::stringstream outputStr;
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
// int n = sprintf(output, "%f", retard);
|
// int n = sprintf(output, "%f", retard);
|
||||||
|
|
||||||
outputStr << retard;
|
outputStr << retard;
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
|
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "atmosphericCorrection")) {
|
} else if (!strcmp(mode, "atmosphericCorrection")) {
|
||||||
@ -347,7 +347,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel);
|
ballisticCoefficient = calculateAtmosphericCorrection(ballisticCoefficient, temperature, pressure, humidity, atmosphereModel);
|
||||||
//int n = sprintf(output, "%f", ballisticCoefficient);
|
//int n = sprintf(output, "%f", ballisticCoefficient);
|
||||||
outputStr << ballisticCoefficient;
|
outputStr << ballisticCoefficient;
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "new")) {
|
} else if (!strcmp(mode, "new")) {
|
||||||
unsigned int index = 0;
|
unsigned int index = 0;
|
||||||
@ -453,7 +453,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
bulletDatabase[index].randGenerator.seed(bulletDatabase[index].randSeed);
|
bulletDatabase[index].randGenerator.seed(bulletDatabase[index].randSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy_s(output, outputSize, "", _TRUNCATE);
|
strncpy(output, "", outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "simulate")) {
|
} else if (!strcmp(mode, "simulate")) {
|
||||||
// simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16
|
// simulate:0:[-0.109985,542.529,-3.98301]:[3751.57,5332.23,214.252]:[0.598153,2.38829,0]:28.6:0:0.481542:0:215.16
|
||||||
@ -622,7 +622,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
bulletDatabase[index].bulletVelocityPreviousFrame = bulletVelocityCurrentFrame + velocityOffset;
|
bulletDatabase[index].bulletVelocityPreviousFrame = bulletVelocityCurrentFrame + velocityOffset;
|
||||||
|
|
||||||
outputStr << "[" << velocityOffset.x() << "," << velocityOffset.y() << "," << velocityOffset.z() << "]";
|
outputStr << "[" << velocityOffset.x() << "," << velocityOffset.y() << "," << velocityOffset.z() << "]";
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "set")) {
|
} else if (!strcmp(mode, "set")) {
|
||||||
int height = 0;
|
int height = 0;
|
||||||
@ -637,7 +637,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
map->gridBuildingNums.push_back(numObjects);
|
map->gridBuildingNums.push_back(numObjects);
|
||||||
map->gridSurfaceIsWater.push_back(surfaceIsWater);
|
map->gridSurfaceIsWater.push_back(surfaceIsWater);
|
||||||
|
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "init")) {
|
} else if (!strcmp(mode, "init")) {
|
||||||
int mapSize = 0;
|
int mapSize = 0;
|
||||||
@ -653,7 +653,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
map = &mapDatabase[worldName];
|
map = &mapDatabase[worldName];
|
||||||
if (map->gridHeights.size() == gridCells) {
|
if (map->gridHeights.size() == gridCells) {
|
||||||
outputStr << "Terrain already initialized";
|
outputStr << "Terrain already initialized";
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
map->gridBuildingNums.reserve(gridCells);
|
map->gridBuildingNums.reserve(gridCells);
|
||||||
map->gridSurfaceIsWater.reserve(gridCells);
|
map->gridSurfaceIsWater.reserve(gridCells);
|
||||||
|
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "replicateVanillaZero")) {
|
} else if (!strcmp(mode, "replicateVanillaZero")) {
|
||||||
float zeroRange = strtof(strtok_s(NULL, ":", &next_token), NULL);
|
float zeroRange = strtof(strtok_s(NULL, ":", &next_token), NULL);
|
||||||
@ -676,7 +676,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
float zeroAngle = replicateVanillaZero(zeroRange, initSpeed, airFriction);
|
float zeroAngle = replicateVanillaZero(zeroRange, initSpeed, airFriction);
|
||||||
|
|
||||||
outputStr << DEGREES(zeroAngle);
|
outputStr << DEGREES(zeroAngle);
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "calcZero")) {
|
} else if (!strcmp(mode, "calcZero")) {
|
||||||
double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL);
|
double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL);
|
||||||
@ -687,7 +687,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
double zeroAngle = calculateVanillaZero(zeroRange, initSpeed, airFriction, boreHeight);
|
double zeroAngle = calculateVanillaZero(zeroRange, initSpeed, airFriction, boreHeight);
|
||||||
|
|
||||||
outputStr << DEGREES(zeroAngle);
|
outputStr << DEGREES(zeroAngle);
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
} else if (!strcmp(mode, "calcZeroAB")) {
|
} else if (!strcmp(mode, "calcZeroAB")) {
|
||||||
double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL);
|
double zeroRange = strtod(strtok_s(NULL, ":", &next_token), NULL);
|
||||||
@ -703,9 +703,9 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
|||||||
double zeroAngle = calculateAdvancedZero(zeroRange, muzzleVelocity, boreHeight, temperature, pressure, humidity, ballisticCoefficient, dragModel, atmosphereModel);
|
double zeroAngle = calculateAdvancedZero(zeroRange, muzzleVelocity, boreHeight, temperature, pressure, humidity, ballisticCoefficient, dragModel, atmosphereModel);
|
||||||
|
|
||||||
outputStr << DEGREES(zeroAngle);
|
outputStr << DEGREES(zeroAngle);
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
strncpy_s(output, outputSize, outputStr.str().c_str(), _TRUNCATE);
|
strncpy(output, outputStr.str().c_str(), outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,9 @@ std::string addLineBreaks(const std::vector<std::string> &words) {
|
|||||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||||
ZERO_OUTPUT();
|
ZERO_OUTPUT();
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
} else {
|
} else {
|
||||||
strncpy_s(output, outputSize, addLineBreaks(splitString(function)).c_str(), _TRUNCATE);
|
strncpy(output, addLineBreaks(splitString(function)).c_str(), outputSize);
|
||||||
}
|
}
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
std::strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
result = "GlobalAlloc() failed, GetLastError=" + GetLastError();
|
result = "GlobalAlloc() failed, GetLastError=" + GetLastError();
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
strncpy_s(pClipboardData, gClipboardData.length(), gClipboardData.c_str(), _TRUNCATE);
|
strncpy(pClipboardData, gClipboardData.c_str(), gClipboardData.length());
|
||||||
|
|
||||||
// if success, system owns the memory, if fail, free it from the heap
|
// if success, system owns the memory, if fail, free it from the heap
|
||||||
if (SetClipboardData(CF_TEXT, pClipboardData) == NULL) {
|
if (SetClipboardData(CF_TEXT, pClipboardData) == NULL) {
|
||||||
@ -72,7 +72,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.length() > 1) {
|
if (result.length() > 1) {
|
||||||
strncpy_s(output, outputSize, result.c_str(), _TRUNCATE);
|
strncpy(output, result.c_str(), outputSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
#include "ace_version.hpp"
|
#include "ace_version.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype> //std::isspace
|
#include <cctype> //std::isspace
|
||||||
|
#include <cstring>
|
||||||
|
#include <istream>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define ZERO_OUTPUT() { memset(output, 0x00, outputSize); }
|
#define ZERO_OUTPUT() { memset(output, 0x00, outputSize); }
|
||||||
|
@ -25,12 +25,12 @@ namespace ace {
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class vector3 {
|
class vector3 {
|
||||||
public:
|
public:
|
||||||
constexpr vector3() :
|
vector3() :
|
||||||
_x(0),
|
_x(0),
|
||||||
_y(0),
|
_y(0),
|
||||||
_z(0) {
|
_z(0) {
|
||||||
}
|
}
|
||||||
constexpr vector3(const T x_, const T y_, const T z_) noexcept :
|
vector3(const T x_, const T y_, const T z_) :
|
||||||
_x(x_),
|
_x(x_),
|
||||||
_y(y_),
|
_y(y_),
|
||||||
_z(z_) {
|
_z(z_) {
|
||||||
@ -47,7 +47,7 @@ namespace ace {
|
|||||||
_z = buffer[2];
|
_z = buffer[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr vector3& operator= (const vector3& other) noexcept { _x = other.x(); _y = other.y(); _z = other.z(); return *this; }
|
vector3& operator= (const vector3& other) { _x = other.x(); _y = other.y(); _z = other.z(); return *this; }
|
||||||
/*#ifdef _WIN32 && _DIRECTX
|
/*#ifdef _WIN32 && _DIRECTX
|
||||||
vector3<T> & operator= (const XMFLOAT3& Float3) { _x = Float3.x; _y = Float3.y; _z = Float3.z; return *this; }
|
vector3<T> & operator= (const XMFLOAT3& Float3) { _x = Float3.x; _y = Float3.y; _z = Float3.z; return *this; }
|
||||||
#endif
|
#endif
|
||||||
@ -56,38 +56,38 @@ namespace ace {
|
|||||||
vector3<T> & operator= (const btVector3& bt_vec) { _x = bt_vec.x(); _y = bt_vec.y(); _z = bt_vec.z(); return *this; }
|
vector3<T> & operator= (const btVector3& bt_vec) { _x = bt_vec.x(); _y = bt_vec.y(); _z = bt_vec.z(); return *this; }
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
constexpr vector3 operator * (const T& val) const { return vector3(_x * val, _y * val, _z * val); }
|
vector3 operator * (const T& val) const { return vector3(_x * val, _y * val, _z * val); }
|
||||||
constexpr vector3 operator / (const T& val) const { T invVal = T(1) / val; return vector3(_x * invVal, _y * invVal, _z * invVal); }
|
vector3 operator / (const T& val) const { T invVal = T(1) / val; return vector3(_x * invVal, _y * invVal, _z * invVal); }
|
||||||
constexpr vector3 operator + (const vector3& v) const { return vector3(_x + v.x(), _y + v.y(), _z + v.z()); }
|
vector3 operator + (const vector3& v) const { return vector3(_x + v.x(), _y + v.y(), _z + v.z()); }
|
||||||
constexpr vector3 operator / (const vector3& v) const { return vector3(_x / v.x(), _y / v.y(), _z / v.z()); }
|
vector3 operator / (const vector3& v) const { return vector3(_x / v.x(), _y / v.y(), _z / v.z()); }
|
||||||
constexpr vector3 operator * (const vector3& v) const { return vector3(_x * v.x(), _y * v.y(), _z * v.z()); }
|
vector3 operator * (const vector3& v) const { return vector3(_x * v.x(), _y * v.y(), _z * v.z()); }
|
||||||
constexpr vector3 operator - (const vector3& v) const { return vector3(_x - v.x(), _y - v.y(), _z - v.z()); }
|
vector3 operator - (const vector3& v) const { return vector3(_x - v.x(), _y - v.y(), _z - v.z()); }
|
||||||
constexpr vector3 operator - () const { return vector3(-_x, -_y, -_z); }
|
vector3 operator - () const { return vector3(-_x, -_y, -_z); }
|
||||||
|
|
||||||
constexpr vector3& operator *=(const vector3& v) noexcept { _x *= v._x; _y *= v._y; _z *= v._z; return *this; }
|
vector3& operator *=(const vector3& v) { _x *= v._x; _y *= v._y; _z *= v._z; return *this; }
|
||||||
constexpr vector3& operator *=(T mag) noexcept { _x *= mag; _y *= mag; _z *= mag; return *this; }
|
vector3& operator *=(T mag) { _x *= mag; _y *= mag; _z *= mag; return *this; }
|
||||||
constexpr vector3& operator /=(const vector3& v) noexcept { _x /= v._x; _y /= v._y; _z /= v._z; return *this; }
|
vector3& operator /=(const vector3& v) { _x /= v._x; _y /= v._y; _z /= v._z; return *this; }
|
||||||
constexpr vector3& operator /=(T mag) noexcept { _x /= mag; _y /= mag; _y /= mag; return *this; }
|
vector3& operator /=(T mag) { _x /= mag; _y /= mag; _y /= mag; return *this; }
|
||||||
constexpr vector3& operator +=(const vector3& v) noexcept { _x += v._x; _y += v._y; _z += v._z; return *this; }
|
vector3& operator +=(const vector3& v) { _x += v._x; _y += v._y; _z += v._z; return *this; }
|
||||||
constexpr vector3& operator -=(const vector3& v) noexcept { _x -= v._x; _y -= v._y; _z -= v._z; return *this; }
|
vector3& operator -=(const vector3& v) { _x -= v._x; _y -= v._y; _z -= v._z; return *this; }
|
||||||
|
|
||||||
|
|
||||||
bool operator == (const vector3 &r) const noexcept { return (_x == r.x() && _y == r.y() && _z == r.z()); }
|
bool operator == (const vector3 &r) const { return (_x == r.x() && _y == r.y() && _z == r.z()); }
|
||||||
|
|
||||||
constexpr T magnitude() const noexcept { return sqrt(_x * _x + _y * _y + _z * _z); }
|
T magnitude() const { return sqrt(_x * _x + _y * _y + _z * _z); }
|
||||||
constexpr T magnitude_squared() const noexcept { return _x * _x + _y * _y + _z * _z; }
|
T magnitude_squared() const { return _x * _x + _y * _y + _z * _z; }
|
||||||
constexpr T dot(const vector3& v) const noexcept { return (_x * v.x() + _y * v.y() + _z * v.z()); }
|
T dot(const vector3& v) const { return (_x * v.x() + _y * v.y() + _z * v.z()); }
|
||||||
constexpr T distance(const vector3& v) const noexcept { vector3 dist = (*this - v); dist = dist * dist; return sqrt(dist.x() + dist.y() + dist.z()); }
|
T distance(const vector3& v) const { vector3 dist = (*this - v); dist = dist * dist; return sqrt(dist.x() + dist.y() + dist.z()); }
|
||||||
constexpr vector3 cross(const vector3& v) const noexcept { return vector3(_y * v.z() - _z * v.y(), _z * v.x() - _x * v.z(), _x * v.y() - _y * v.x()); }
|
vector3 cross(const vector3& v) const { return vector3(_y * v.z() - _z * v.y(), _z * v.x() - _x * v.z(), _x * v.y() - _y * v.x()); }
|
||||||
constexpr vector3 normalize() const noexcept { return (*this / abs(magnitude())); };
|
vector3 normalize() const { return (*this / abs(magnitude())); };
|
||||||
constexpr bool zero_distance() const noexcept { return ((_x == 0.0f && _y == 0.0f && _z == 0.0f) ? true : false ); }
|
bool zero_distance() const { return ((_x == 0.0f && _y == 0.0f && _z == 0.0f) ? true : false ); }
|
||||||
|
|
||||||
static float clamp(T x, T a, T b) { return x < a ? a : (x > b ? b : x); }
|
static float clamp(T x, T a, T b) { return x < a ? a : (x > b ? b : x); }
|
||||||
|
|
||||||
static vector3 lerp(const vector3& A, const vector3& B, const T t) noexcept { return A*t + B*(1.f - t); }
|
static vector3 lerp(const vector3& A, const vector3& B, const T t) { return A*t + B*(1.f - t); }
|
||||||
constexpr vector3 lerp(const vector3& B, const T t) const noexcept { return vector3::lerp(*this, B, t); }
|
vector3 lerp(const vector3& B, const T t) const { return vector3::lerp(*this, B, t); }
|
||||||
|
|
||||||
static vector3 slerp(vector3 start, vector3 end, T percent) noexcept {
|
static vector3 slerp(vector3 start, vector3 end, T percent) {
|
||||||
T dot = start.dot(end);
|
T dot = start.dot(end);
|
||||||
dot = vector3::clamp(dot, -1.0f, 1.0f);
|
dot = vector3::clamp(dot, -1.0f, 1.0f);
|
||||||
|
|
||||||
@ -96,13 +96,13 @@ namespace ace {
|
|||||||
relative.normalize();
|
relative.normalize();
|
||||||
return ((start * cos(theta)) + (relative*sin(theta)));
|
return ((start * cos(theta)) + (relative*sin(theta)));
|
||||||
}
|
}
|
||||||
constexpr vector3 slerp(const vector3& B, const T p) const noexcept {
|
vector3 slerp(const vector3& B, const T p) const {
|
||||||
return vector3::slerp(*this, B, p);
|
return vector3::slerp(*this, B, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
const T& x() const noexcept { return _x; }
|
const T& x() const { return _x; }
|
||||||
const T& y() const noexcept { return _y; }
|
const T& y() const { return _y; }
|
||||||
const T& z() const noexcept { return _z; }
|
const T& z() const { return _z; }
|
||||||
|
|
||||||
void x(const T val) { _x = val; }
|
void x(const T val) { _x = val; }
|
||||||
void y(const T val) { _y = val; }
|
void y(const T val) { _y = val; }
|
||||||
|
@ -96,7 +96,7 @@ double getSolution(double initSpeed, double airFriction, double angleTarget, dou
|
|||||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||||
ZERO_OUTPUT();
|
ZERO_OUTPUT();
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
} else {
|
} else {
|
||||||
std::vector<std::string> argStrings = splitString(function);
|
std::vector<std::string> argStrings = splitString(function);
|
||||||
double initSpeed = std::stod(argStrings[0]);
|
double initSpeed = std::stod(argStrings[0]);
|
||||||
@ -109,7 +109,7 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
sstream << result;
|
sstream << result;
|
||||||
|
|
||||||
strncpy_s(output, outputSize, sstream.str().c_str(), _TRUNCATE);
|
strncpy(output, sstream.str().c_str(), outputSize);
|
||||||
}
|
}
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace ace {
|
|||||||
double painToAdd = 0;
|
double painToAdd = 0;
|
||||||
wounds = GetInjuryInfoFor(typeOfDamage, amountOfDamage, selectionN, woundID);
|
wounds = GetInjuryInfoFor(typeOfDamage, amountOfDamage, selectionN, woundID);
|
||||||
|
|
||||||
stream << "_woundsCreated = [";
|
stream << "[[";
|
||||||
for (int i = 0; i < wounds.size(); ++i)
|
for (int i = 0; i < wounds.size(); ++i)
|
||||||
{
|
{
|
||||||
stream << wounds.at(i).AsString();
|
stream << wounds.at(i).AsString();
|
||||||
@ -45,9 +45,9 @@ namespace ace {
|
|||||||
|
|
||||||
painToAdd += wounds.at(i).pain;
|
painToAdd += wounds.at(i).pain;
|
||||||
}
|
}
|
||||||
stream << "];";
|
stream << "],";
|
||||||
|
|
||||||
stream << "_painToAdd = " << painToAdd << ";";
|
stream << painToAdd << "]";
|
||||||
|
|
||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ std::vector<std::string> parseExtensionInput(const std::string& input)
|
|||||||
|
|
||||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -85,6 +85,6 @@ void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy_s(output, outputSize, returnValue.c_str(), _TRUNCATE);
|
strncpy(output, returnValue.c_str(), outputSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,9 @@ std::string getImagePathFromStructuredText(const std::string & input) {
|
|||||||
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
||||||
ZERO_OUTPUT();
|
ZERO_OUTPUT();
|
||||||
if (!strcmp(function, "version")) {
|
if (!strcmp(function, "version")) {
|
||||||
strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE);
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
||||||
} else {
|
} else {
|
||||||
strncpy_s(output, outputSize, getImagePathFromStructuredText(function).c_str(), _TRUNCATE);
|
strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize);
|
||||||
}
|
}
|
||||||
EXTENSION_RETURN();
|
EXTENSION_RETURN();
|
||||||
}
|
}
|
||||||
|
@ -334,11 +334,11 @@ def copy_important_files(source_dir,destination_dir):
|
|||||||
print_error("COPYING IMPORTANT FILES.")
|
print_error("COPYING IMPORTANT FILES.")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Copy all extension DLL's
|
# Copy all extensions
|
||||||
try:
|
try:
|
||||||
os.chdir(os.path.join(source_dir))
|
os.chdir(os.path.join(source_dir))
|
||||||
print_blue("\nSearching for DLLs in {}".format(os.getcwd()))
|
print_blue("\nSearching for DLLs in {}".format(os.getcwd()))
|
||||||
filenames = glob.glob("*.dll")
|
filenames = glob.glob("*.dll") + glob.glob("*.so")
|
||||||
|
|
||||||
if not filenames:
|
if not filenames:
|
||||||
print ("Empty SET")
|
print ("Empty SET")
|
||||||
|
Loading…
Reference in New Issue
Block a user