Porting to Linux
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -19,6 +19,11 @@ gmon.out
|
|||||||
*.pdb
|
*.pdb
|
||||||
*.sln
|
*.sln
|
||||||
*.vcproj
|
*.vcproj
|
||||||
|
.ignore
|
||||||
|
|
||||||
|
Integration.code-workspace
|
||||||
|
Makefile
|
||||||
|
|
||||||
Source/Integration/lpx-*.hpp
|
Source/Integration/lpx-*.hpp
|
||||||
Source/Integration/lpx-*.cpp
|
Source/Integration/lpx-*.cpp
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ int64 FlxLockedWrapper::GetActor() {
|
|||||||
IdView FlxLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
IdView FlxLockedWrapper::GetNear(int64 id, double rx, double ry, double rz) {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
int64* data;
|
int64* data;
|
||||||
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, &data);
|
Lockable.Wrapper.get_tangibles_near(Get(), id, rx, ry, rz, &size, (int64_t**)&data);
|
||||||
return IdView(data, size);
|
return IdView(data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ StringViewVec FlxLockedWrapper::GetAnimationQueues(IdView ids) {
|
|||||||
const char** StrBuf = Lockable.AQStrBuffer.GetData();
|
const char** StrBuf = Lockable.AQStrBuffer.GetData();
|
||||||
|
|
||||||
// Get the animation queues into the static buffers.
|
// Get the animation queues into the static buffers.
|
||||||
Lockable.Wrapper.get_animation_queues(Get(), num, ids.GetData(), LenBuf, StrBuf);
|
Lockable.Wrapper.get_animation_queues(Get(), num, (const int64_t *)ids.GetData(), LenBuf, StrBuf);
|
||||||
|
|
||||||
// Transfer data from static buffers into an array of string_view
|
// Transfer data from static buffers into an array of string_view
|
||||||
StringViewVec result;
|
StringViewVec result;
|
||||||
|
|||||||
@@ -23,9 +23,13 @@ THIRD_PARTY_INCLUDES_START
|
|||||||
THIRD_PARTY_INCLUDES_END
|
THIRD_PARTY_INCLUDES_END
|
||||||
#undef UI
|
#undef UI
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
#else
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
@@ -241,6 +245,26 @@ public:
|
|||||||
//
|
//
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
inline static void strerror_helper(int status, int errnum, char errbuf[256]) {
|
||||||
|
if (status != 0) {
|
||||||
|
snprintf(errbuf, 256, "unknown errno %d", errnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static void strerror_helper(const char *result, int errnum, char errbuf[256]) {
|
||||||
|
if (result != errbuf) {
|
||||||
|
snprintf(errbuf, 256, "%s", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string strerror_str(int errnum) {
|
||||||
|
char buf[256];
|
||||||
|
auto rval = strerror_r(errnum, buf, 256);
|
||||||
|
strerror_helper(rval, errnum, buf);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#else
|
||||||
static std::string strerror_str(int errnum) {
|
static std::string strerror_str(int errnum) {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
int status = strerror_s(buf, 256, errnum);
|
int status = strerror_s(buf, 256, errnum);
|
||||||
@@ -250,6 +274,8 @@ static std::string strerror_str(int errnum) {
|
|||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static FSocket* OpenConnection(ISocketSubsystem *subsys, const std::string& host, const std::string& port, std::string& err)
|
static FSocket* OpenConnection(ISocketSubsystem *subsys, const std::string& host, const std::string& port, std::string& err)
|
||||||
{
|
{
|
||||||
@@ -401,6 +427,12 @@ static SSL_CTX* SSLNewContext(int verify, const SSL_METHOD *method, BIO *tracebi
|
|||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
static std::string SSLLoadCertificateAuthorities(SSL_CTX* ctx) {
|
||||||
|
check(SSL_CTX_set_default_verify_paths(ctx) == 1);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
#else
|
||||||
static std::string SSLLoadCertificateAuthorities(SSL_CTX* ctx) {
|
static std::string SSLLoadCertificateAuthorities(SSL_CTX* ctx) {
|
||||||
HCERTSTORE hStore = CertOpenSystemStoreW(0, L"ROOT");
|
HCERTSTORE hStore = CertOpenSystemStoreW(0, L"ROOT");
|
||||||
|
|
||||||
@@ -427,6 +459,7 @@ static std::string SSLLoadCertificateAuthorities(SSL_CTX* ctx) {
|
|||||||
CertCloseStore(hStore, 0);
|
CertCloseStore(hStore, 0);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static std::string SSLUseCertificateString(SSL_CTX* ctx, const char* str) {
|
static std::string SSLUseCertificateString(SSL_CTX* ctx, const char* str) {
|
||||||
SSLClearErrors();
|
SSLClearErrors();
|
||||||
@@ -747,7 +780,7 @@ void FLpxChannel::Advance()
|
|||||||
AdvanceReadWrite();
|
AdvanceReadWrite();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
checkf(false, L"EChanState is invalid");
|
checkf(false, TEXT("EChanState is invalid"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ rm -f Source/Integration/lpx-*.cpp
|
|||||||
rm -f Binaries/Linux/luprexlib.so
|
rm -f Binaries/Linux/luprexlib.so
|
||||||
mkdir -p Binaries/Linux
|
mkdir -p Binaries/Linux
|
||||||
|
|
||||||
ln -s $LUPREX/ext/base-writer.hpp Source/Integration/lpx-basewriter.hpp
|
echo '#include "'$LUPREX'/ext/base-writer.hpp"' > Source/Integration/lpx-basewriter.hpp
|
||||||
ln -s $LUPREX/cpp/drv/drvutil.hpp Source/Integration/lpx-drvutil.hpp
|
echo '#include "'$LUPREX'/cpp/drv/drvutil.hpp"' > Source/Integration/lpx-drvutil.hpp
|
||||||
ln -s $LUPREX/cpp/drv/drvutil.cpp Source/Integration/lpx-drvutil.cpp
|
echo '#include "'$LUPREX'/cpp/drv/drvutil.cpp"' > Source/Integration/lpx-drvutil.cpp
|
||||||
ln -s $LUPREX/cpp/core/enginewrapper.hpp Source/Integration/lpx-enginewrapper.hpp
|
echo '#include "'$LUPREX'/cpp/core/enginewrapper.hpp"' > Source/Integration/lpx-enginewrapper.hpp
|
||||||
|
|
||||||
ln -s $LUPREX/build/linux/luprexlib.so Binaries/Linux/luprexlib.so
|
ln -s $LUPREX/build/linux/luprexlib.so Binaries/Linux/luprexlib.so
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user