mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Merge pull request #1270 from acemod/crossplatformTools
Finalize port of all extensions for cross-platform builds
This commit is contained in:
commit
f121cc9ea9
@ -82,7 +82,7 @@ double calculateRoughnessLength(double posX, double posY) {
|
||||
return 1.6;
|
||||
}
|
||||
|
||||
return roughness_lengths[2 + min(nearBuildings, 6)];
|
||||
return roughness_lengths[2 + std::min(nearBuildings, 6)];
|
||||
}
|
||||
|
||||
return 0.0024;
|
||||
@ -230,7 +230,7 @@ double calculateRetard(int DragFunction, double DragCoefficient, double Velocity
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
}
|
||||
|
||||
void __stdcall RVExtension(char *output, int outputSize, const char *function)
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define MAXCHARACTERS 14
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
std::vector<std::string> splitString(const std::string & input) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
std::string gClipboardData;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "p3d/animation.hpp"
|
||||
#include "read_helpers.hpp"
|
||||
#include "..\simulation\object.hpp"
|
||||
|
||||
namespace ace {
|
||||
namespace p3d {
|
||||
@ -69,4 +68,4 @@ namespace ace {
|
||||
animation::~animation() {
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "compressed.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
@ -41,11 +43,7 @@ namespace ace {
|
||||
if (in.eof()) {
|
||||
in.clear();
|
||||
}
|
||||
#if _MSC_VER == 1800
|
||||
_data = std::make_shared<uint8_t[]>(expected_size + (expected_size % 8));
|
||||
#else
|
||||
_data = std::make_unique<uint8_t[]>(expected_size + (expected_size % 8));
|
||||
#endif
|
||||
_data = std::unique_ptr<uint8_t[]>(new uint8_t[expected_size + (expected_size % 8)]);
|
||||
|
||||
result = _mikero_lzo1x_decompress_safe(buffer, _data.get(), expected_size);
|
||||
if (result < 0) {
|
||||
|
@ -37,34 +37,34 @@ namespace ace {
|
||||
compressed() { }
|
||||
compressed(std::istream &stream_, bool compressed_ = false, bool fill_ = false, uint32_t version = 68)
|
||||
{
|
||||
stream_.read((char *)&size, sizeof(uint32_t));
|
||||
stream_.read((char *)&this->size, sizeof(uint32_t));
|
||||
|
||||
// if(version <)
|
||||
if(fill_)
|
||||
READ_BOOL(fill);
|
||||
READ_BOOL(this->fill);
|
||||
|
||||
assert(size < 4095 * 10);
|
||||
if (size > 0) {
|
||||
if (fill) {
|
||||
assert(this->size < 4095 * 10);
|
||||
if (this->size > 0) {
|
||||
if (this->fill) {
|
||||
T val;
|
||||
stream_.read((char *)&val, sizeof(T));
|
||||
for (int x = 0; x < size; x++) {
|
||||
data.push_back(val);
|
||||
for (int x = 0; x < this->size; x++) {
|
||||
this->data.push_back(val);
|
||||
}
|
||||
} else {
|
||||
if (version >= 64 && compressed_) {
|
||||
READ_BOOL(flag);
|
||||
READ_BOOL(this->flag);
|
||||
}
|
||||
if ( (size * sizeof(T) >= 1024 && compressed_ && version < 64) || (flag && compressed_)) {
|
||||
int32_t result = _decompress_safe(stream_, size * sizeof(T));
|
||||
if ( (this->size * sizeof(T) >= 1024 && compressed_ && version < 64) || (this->flag && compressed_)) {
|
||||
int32_t result = this->_decompress_safe(stream_, this->size * sizeof(T));
|
||||
assert(result > 0);
|
||||
T * ptr = (T *)(_data.get());
|
||||
data.assign(ptr, ptr + size );
|
||||
T * ptr = (T *)(this->_data.get());
|
||||
this->data.assign(ptr, ptr + this->size );
|
||||
} else {
|
||||
for (int x = 0; x < size; x++) {
|
||||
for (int x = 0; x < this->size; x++) {
|
||||
T val;
|
||||
stream_.read((char *)&val, sizeof(T));
|
||||
data.push_back(val);
|
||||
this->data.push_back(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,4 +167,4 @@ namespace ace {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace ace {
|
||||
std::streampos _save = stream_.tellg();
|
||||
file_offset = begin_data_offset + entry->offset;
|
||||
|
||||
use_size = max(entry->size, entry->storage_size);
|
||||
use_size = std::max(entry->size, entry->storage_size);
|
||||
output->data = new uint8_t[use_size];
|
||||
|
||||
bytes_read = 0;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "search.hpp"
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
@ -298,4 +300,6 @@ namespace ace {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared.hpp"
|
||||
@ -24,4 +26,6 @@ namespace ace {
|
||||
};
|
||||
typedef std::shared_ptr<search> search_p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "targetver.h"
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
@ -23,8 +25,11 @@
|
||||
#define EXTENSION_RETURN() return;
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#ifdef _WIN32
|
||||
#define sleep(x) Sleep(x)
|
||||
#else
|
||||
#define _strdup strdup
|
||||
#define strtok_s strtok_r
|
||||
#endif
|
||||
|
||||
namespace ace {
|
||||
@ -40,6 +45,11 @@ namespace ace {
|
||||
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
|
||||
std::vector<std::string> split(const std::string &s, char delim);
|
||||
|
||||
template<typename T, typename... Args>
|
||||
std::unique_ptr<T> make_unique(Args&&... args) {
|
||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
// trim from start
|
||||
static inline std::string <rim(std::string &s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
|
||||
@ -74,4 +84,23 @@ namespace ace {
|
||||
#define ACE_ASSERT assert()
|
||||
#else
|
||||
#define ACE_ASSERT ace::runtime_assert()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#define __stdcall
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// Microsoft
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#define IMPORT __declspec(dllimport)
|
||||
#elif defined(_GCC)
|
||||
// GCC
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#define IMPORT
|
||||
#else
|
||||
// do nothing and hope for the best?
|
||||
#define EXPORT
|
||||
#define IMPORT
|
||||
#pragma warning Unknown dynamic link import/export semantics.
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "simplepipe_win32.hpp"
|
||||
#include <Sddl.h>
|
||||
#include <AccCtrl.h>
|
||||
@ -176,4 +178,6 @@ namespace ace {
|
||||
return NULL;
|
||||
return &buf_[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -55,3 +57,4 @@ namespace ace {
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "object.hpp"
|
||||
#include "p3d\parser.hpp"
|
||||
#include "p3d/parser.hpp"
|
||||
|
||||
|
||||
#include "glm\gtc\matrix_transform.hpp"
|
||||
#include "glm/gtc/matrix_transform.hpp"
|
||||
|
||||
ace::simulation::vertex::vertex(vertex_table & _table, ace::vector3<float> _vertex, uint32_t _id) : table(_table), vertex_id(_id)
|
||||
{
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
#define GLM_PRECISION_HIGHP_FLOAT
|
||||
|
||||
#include "p3d\model.hpp"
|
||||
#include "glm\glm.hpp"
|
||||
#include "glm\vec3.hpp"
|
||||
#include "glm\mat4x4.hpp"
|
||||
#include "p3d/model.hpp"
|
||||
#include "glm/glm.hpp"
|
||||
#include "glm/vec3.hpp"
|
||||
#include "glm/mat4x4.hpp"
|
||||
|
||||
|
||||
namespace ace {
|
||||
@ -218,4 +218,4 @@ namespace ace {
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,17 @@
|
||||
#include "LinearMath\btVector3.h"
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "shared.hpp"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#define sinf(x) sin(x)
|
||||
#define cosf(x) cos(x)
|
||||
#define acosf(x) acos(x)
|
||||
|
||||
#endif
|
||||
|
||||
namespace ace {
|
||||
|
||||
template <typename T> T acos(T n) { return -1; }
|
||||
@ -158,4 +168,4 @@ namespace ace {
|
||||
T _x;
|
||||
T _y;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define RADIANS(X) (X / (180 / M_PI))
|
||||
|
||||
extern "C" {
|
||||
__declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
||||
};
|
||||
|
||||
std::vector<std::string> splitString(std::string input) {
|
||||
|
Loading…
Reference in New Issue
Block a user