Skip to content

Commit dffff9d

Browse files
authored
Merge pull request #1 from Cybermals/linux-compat
Linux compat
2 parents 2a0917a + e14ebd6 commit dffff9d

734 files changed

Lines changed: 194792 additions & 83 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Game/CMakeLists.txt

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ if(UNIX)
4747
PUBLIC
4848
include
4949
../config
50-
../deps/linux/amd64/gcc/Ogre/include/OGRE
51-
../deps/linux/amd64/gcc/Ogre/include/OIS
52-
../deps/linux/amd64/gcc/PagedGeometry/include/PagedGeometry
50+
../deps/linux/amd64/gcc9/Ogre/include/OGRE
51+
../deps/linux/amd64/gcc9/Ogre/include/OIS
52+
../deps/linux/amd64/gcc9/PagedGeometry/include
5353
../deps/linux/amd64/all/fmod/include
54-
../deps/linux/amd64/gcc/zziplib/include
55-
../deps/linux/amd64/gcc/RakNet/include
54+
../deps/linux/amd64/gcc9/zziplib/include
55+
../deps/linux/amd64/gcc9/RakNet/include
5656
../Game/include
5757
)
5858
endif(UNIX)
@@ -88,10 +88,11 @@ if(UNIX)
8888
target_link_directories(
8989
Game
9090
PUBLIC
91-
../deps/linux/amd64/gcc/Ogre/bin/release
92-
../deps/linux/amd64/gcc/PagedGeometry/lib
93-
../deps/linux/amd64/all/fmod/bin
94-
../deps/linux/amd64/gcc/RakNet/bin
91+
../deps/linux/amd64/gcc9/Ogre/lib
92+
../deps/linux/amd64/gcc9/PagedGeometry/lib
93+
../deps/linux/amd64/all/fmod/lib
94+
../deps/linux/amd64/gcc9/zziplib/lib
95+
../deps/linux/amd64/gcc9/RakNet/lib
9596
)
9697
endif(UNIX)
9798

@@ -133,9 +134,9 @@ set(
133134
src/MagixUnitManager.cpp
134135
src/MagixWorld.cpp
135136
src/main.cpp
136-
src/movabletextoverlay.cpp
137-
src/ogremagixApp.cpp
138-
src/ogremagixFrameListener.cpp
137+
src/MovableTextOverlay.cpp
138+
src/OgreMagixApp.cpp
139+
src/OgreMagixFrameListener.cpp
139140
src/SoundManager.cpp
140141
)
141142

@@ -189,6 +190,7 @@ if(UNIX)
189190
target_link_libraries(
190191
Game
191192
${LIBS}
193+
fmod
192194
)
193195
endif(UNIX)
194196

@@ -199,6 +201,10 @@ if(MINGW)
199201
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-stdcall-fixup")
200202
endif(MINGW)
201203

204+
if(UNIX)
205+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
206+
endif(UNIX)
207+
202208
if(MSVC10)
203209
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /TP")
204210
endif(MSVC10)
@@ -235,17 +241,25 @@ endif(WIN32)
235241
if(UNIX)
236242
file(
237243
GLOB DEPS
238-
../deps/linux/amd64/gcc/Ogre/bin/release/*
239-
../deps/linux/amd64/gcc/PagedGeometry/docs/LICENSE*
240-
../deps/linux/amd64/all/fmod/bin/*
241-
../deps/linux/amd64/gcc/RakNet/bin/*
244+
../deps/linux/amd64/gcc9/Ogre/lib/*
245+
../deps/linux/amd64/gcc9/PagedGeometry/docs/LICENSE*
246+
../deps/linux/amd64/all/fmod/lib/*
247+
../deps/linux/amd64/gcc9/RakNet/lib/*
242248
)
243249
file(COPY ${DEPS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
244250
endif(UNIX)
245251

246252
#Copy data files
247253
file(COPY ../data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
248-
file(GLOB CONFIG ../static/client/config/*)
254+
255+
if(WIN32)
256+
file(GLOB CONFIG ../static/client/config/windows/*)
257+
endif(WIN32)
258+
259+
if(UNIX)
260+
file(GLOB CONFIG ../static/client/config/linux/*)
261+
endif(UNIX)
262+
249263
file(COPY ${CONFIG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
250264
file(GLOB DAT ../static/client/default/*)
251265
file(COPY ${DAT} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -254,4 +268,5 @@ file(COPY ${DAT} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
254268
install(TARGETS Game DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)
255269
install(FILES ${DEPS} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)
256270
install(DIRECTORY ../data DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)
257-
install(FILES ${CONFIG} ${DAT} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)
271+
install(FILES ${CONFIG} ${DAT} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)
272+
install(DIRECTORY ../static/client/screenshots DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/client)

Game/include/MagixApplication.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MagixApplication
2828
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
2929
mResourcePath = macBundlePath() + "/Contents/Resources/";
3030
#else
31-
mResourcePath = "";
31+
mResourcePath = "./";
3232
#endif
3333
}
3434

Game/include/MagixExternalDefinitions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#include <OgreStreamSerialiser.h>
77
#include <OgreException.h>
88

9+
#ifdef __linux__
10+
#define _unlink unlink
11+
#endif
12+
913
//using namespace std;
1014
using namespace Ogre;
1115

Game/src/DebugTrace.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
#include <stdarg.h>
44
#include <string.h>
55
#include <iomanip>
6-
#include <Windows.h>
7-
#include <DbgHelp.h>
6+
7+
#ifdef __WIN32__
8+
#include <Windows.h>
9+
#include <DbgHelp.h>
10+
#endif
811

912
#include "DebugTrace.h"
1013

@@ -14,16 +17,21 @@
1417

1518
volatile long *allocateLineCount()
1619
{
20+
#ifdef __WIN32__
1721
static volatile long *lineCount;
1822

1923
lineCount = (long*)_aligned_malloc(sizeof(long), 32);
2024
*lineCount = 0;
2125
return lineCount;
26+
#else
27+
return NULL;
28+
#endif
2229
}
2330

2431

2532
void printStack()
2633
{
34+
#ifdef __WIN32__
2735
unsigned int i;
2836
void * stack[100];
2937
volatile unsigned short frames;
@@ -55,11 +63,13 @@ void printStack()
5563

5664
debugTraceVars("STACK %s", buffer);
5765
free(symbol);
66+
#endif
5867
}
5968

6069

6170
void debugTraceStr(const std::wstringstream& item)
6271
{
72+
#ifdef __WIN32__
6373
static volatile long *lineCount = allocateLineCount();
6474
FILETIME timestamp;
6575
GetSystemTimeAsFileTime(&timestamp);
@@ -72,16 +82,19 @@ void debugTraceStr(const std::wstringstream& item)
7282
<< L" " << item.str() << std::endl;
7383

7484
OutputDebugStringW(debug.str().c_str());
85+
#endif
7586
}
7687

7788

7889
void debugTraceVars(const char *format, ...)
7990
{
91+
#ifdef __WIN32__
8092
va_list args;
8193
va_start(args, format);
8294
char buffer[500];
8395
vsprintf_s<500>(buffer, format, args);
8496
std::wstringstream result;
8597
result << buffer;
8698
debugTraceStr(result);
99+
#endif
87100
}

Game/src/MagixAlertBox.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void MagixAlertBox::showAlert(const String &caption, Real left, Real top,
101101
//compute text width/height
102102
const Font *pFont = dynamic_cast<Ogre::Font*>(Ogre::FontManager::getSingleton().getByName(DEFAULT_FONT).getPointer());
103103

104-
vector<String>::type tText = StringUtil::split(caption, "\n");
104+
vector<String>::type tText = StringUtil::split(caption, "\r\n");
105105
Real tLongestWidth = 0;
106106

107107
for(int i = 0; i<int(tText.size()); i++)

Game/src/MagixAnimated.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
#include "MagixConst.h"
33
#include "DebugTrace.h"
44

5+
#ifdef __WIN32__
56
#define DBOUT( s ) \
67
{ \
78
std::ostringstream os_; \
89
os_ << s; \
910
OutputDebugString( os_.str().c_str() ); \
1011
}
12+
#else
13+
#define DBOUT(s)
14+
#endif
1115

1216

1317
//Animated Object Functions

Game/src/MagixApplication.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void MagixApplication::setupResources(void)
198198
delete[] tBuffer;
199199

200200
const vector<String>::type tLine = StringUtil::split(tData,
201-
"\n#");
201+
"\r\n#");
202202

203203
for(int j = 0; j < (int)tLine.size(); j++)
204204
{

Game/src/MagixCharScreenManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ void MagixCharScreenManager::updateChar(const String &data)
18651865
static_cast<MagixPlayer*>(mUnit)->reset();
18661866
}
18671867

1868-
const vector<String>::type tString = StringUtil::split(data, "|\n", 2);
1868+
const vector<String>::type tString = StringUtil::split(data, "|\r\n", 2);
18691869

18701870
//Loaded successfully
18711871
if(tString.size() > 0)

0 commit comments

Comments
 (0)