Skip to content

Commit 0351957

Browse files
committed
fix some linux compilation errors, hide xrSASH under WINDOWS define (OpenAutomate dont build on linux), remove Device_wndproc
1 parent afc05bd commit 0351957

19 files changed

+76
-58
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_subdirectory(utils)
22
add_subdirectory(Layers)
3-
#add_subdirectory(xr_3da)
3+
add_subdirectory(xr_3da)
44
#add_subdirectory(xrMisc)
55
add_subdirectory(xrAICore)
66
add_subdirectory(xrCDB)

src/Include/editor/engine.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class property_holder_base;
1919
class engine_base
2020
{
2121
public:
22-
virtual bool on_message(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& result) = 0;
2322
virtual void on_idle() = 0;
2423
virtual void on_resize() = 0;
2524
virtual void pause(bool const& value) = 0;

src/xrCore/CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
project(xrCore)
22

33
list(APPEND DIRS
4-
"."
5-
"Animation"
6-
"Compression"
7-
"Containers"
8-
"Crypto"
9-
"Math"
10-
"Media"
11-
"PostProcess"
12-
"Text"
13-
"Threading"
14-
"XML"
15-
)
4+
"."
5+
"Animation"
6+
"Compression"
7+
"Containers"
8+
"Crypto"
9+
"Math"
10+
"Media"
11+
"PostProcess"
12+
"Text"
13+
"Threading"
14+
"XML"
15+
)
1616

1717
add_dir("${DIRS}")
1818

1919
include_directories(
2020
${CMAKE_CURRENT_SOURCE_DIR}/..
2121
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/pugixml/src
22-
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
22+
${CRYPTO++_INCLUDE_DIR}
23+
#${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
2324
${SDL_INCLUDE_DIR}
2425
)
2526

@@ -30,4 +31,4 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
3031
#this is a temporary solution until find_package will not be fixed
3132
set(TBB_LIBRARIES tbb tbbmalloc_proxy tbbmalloc)
3233

33-
target_link_libraries(${PROJECT_NAME} ${SDL_LIBRARIES} ${LZO_LIBRARY} ${CRYPTO++_LIBRARIES} ${PUGIXML_LIBRARY} ${TBB_LIBRARIES})
34+
target_link_libraries(${PROJECT_NAME} ${SDL_LIBRARIES} ${LZO_LIBRARY} crypto++ ${PUGIXML_LIBRARY} ${TBB_LIBRARIES})

src/xrCore/_std_extensions.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ IC int xr_sprintf(char* dest, size_t sizeOfBuffer, const char* format, ...)
6161
#if defined(LINUX)
6262
IC int vsnprintf_s(char* buffer, size_t size, size_t count, const char* format, va_list list)
6363
{
64-
//TODO add bound check
65-
return vsnprintf(buffer, size, format, list);
64+
//TODO add bound check
65+
return vsnprintf(buffer, size, format, list);
6666
}
6767
#endif
6868

@@ -216,11 +216,21 @@ inline int __cdecl xr_sprintf(char (&destination)[count], LPCSTR format_string,
216216
}
217217
#else // #ifndef MASTER_GOLD
218218

219+
inline int xr_strcpy(LPSTR destination, LPCSTR source)
220+
{
221+
return strcpy(destination, source);
222+
}
223+
219224
inline int xr_strcpy(LPSTR destination, size_t const destination_size, LPCSTR source)
220225
{
221226
return strncpy_s(destination, destination_size, source, destination_size);
222227
}
223228

229+
inline int xr_strcat(LPSTR destination, LPCSTR source)
230+
{
231+
return strcat(destination, source);
232+
}
233+
224234
inline int xr_strcat(LPSTR destination, size_t const buffer_size, LPCSTR source)
225235
{
226236
size_t const destination_length = xr_strlen(destination);

src/xrCore/xrDebug.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ SStringVec xrDebug::BuildStackTrace(u16 maxFramesCount)
342342
{
343343
CONTEXT currentThreadCtx = {};
344344

345-
RtlCaptureContext(&currentThreadCtx); /// GetThreadContext can't be used on the current thread
345+
RtlCaptureContext(&currentThreadCtx); /// GetThreadContext can't be used on the current thread
346346
currentThreadCtx.ContextFlags = CONTEXT_FULL;
347347

348348
return BuildStackTrace(&currentThreadCtx, maxFramesCount);
@@ -756,7 +756,7 @@ void _terminate()
756756
exit(-1);
757757
#endif
758758
string4096 assertionInfo;
759-
xrDebug::GatherInfo(assertionInfo, DEBUG_INFO, nullptr, "Unexpected application termination");
759+
xrDebug::GatherInfo(assertionInfo,sizeof(assertionInfo), DEBUG_INFO, nullptr, "Unexpected application termination");
760760
xr_strcat(assertionInfo, "Press OK to abort execution\r\n");
761761
xrDebug::ShowMessage("Fatal Error", assertionInfo);
762762
exit(-1);

src/xrEngine/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
project(xrEngine)
22

33
list(APPEND DIRS
4-
"."
5-
)
4+
"."
5+
)
66

77
add_dir("${DIRS}")
88

99
include_directories(
10-
${CMAKE_CURRENT_SOURCE_DIR}/..
11-
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/OpenAutomate/inc
12-
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
10+
${CMAKE_CURRENT_SOURCE_DIR}/..
11+
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/OpenAutomate/inc
12+
${CMAKE_CURRENT_SOURCE_DIR}/../../sdk/include
1313
${CMAKE_CURRENT_SOURCE_DIR}/../../Externals/luabind
1414
${SDL_INCLUDE_DIR}
15-
)
15+
)
1616

1717
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.cpp")
1818
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./editor_environment_manager_properties.cpp")
1919
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console.cpp")
2020
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console_WndProc.cpp")
21+
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./Device_wndproc.cpp")
22+
list(REMOVE_ITEM ${PROJECT_NAME}__SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/./xrSASH.cpp")
2123

2224
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./tntQAVI.h")
2325
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./Text_Console.h")
26+
list(REMOVE_ITEM ${PROJECT_NAME}__INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/./xrSASH.h")
2427

2528
add_definitions(-DENGINE_BUILD)
2629
add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}__SOURCES} ${${PROJECT_NAME}__INCLUDES})
2730

2831
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
29-
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrCDB xrPhysics openal lockfile ${SDL_LIBRARIES})
32+
target_link_libraries(${PROJECT_NAME} xrCore luabind xrAPI xrSound xrScriptEngine luajit theora ${OGG_LIBRARIES} xrCDB xrPhysics freeimage openal lockfile ${SDL_LIBRARIES})

src/xrEngine/Device_Initialize.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void CRenderDevice::initialize_weather_editor()
2222

2323
m_editor_finalize = (finalize_function_ptr)m_editor_module->GetProcAddress("finalize");
2424
VERIFY(m_editor_finalize);
25-
2625
m_engine = new engine_impl();
2726
m_editor_initialize(m_editor, m_engine);
2827
VERIFY(m_editor);
@@ -50,7 +49,7 @@ void CRenderDevice::Initialize()
5049
SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL;
5150

5251
m_sdlWnd = SDL_CreateWindow("S.T.A.L.K.E.R.: Call of Pripyat", 0, 0, 640, 480, flags);
53-
52+
5453
R_ASSERT3(m_sdlWnd, "Unable to create SDL window", SDL_GetError());
5554
SDL_SetWindowHitTest(m_sdlWnd, WindowHitTest, nullptr);
5655
SDL_SetWindowMinimumSize(m_sdlWnd, 256, 192);

src/xrEngine/FDemoPlay.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ CDemoPlay::CDemoPlay(const char* name, float ms, u32 cycles, float life_time)
2121
{
2222
Msg("*** Playing demo: %s", name);
2323
Console->Execute("hud_weapon 0");
24+
#if !defined(LINUX)
2425
if (g_bBenchmark || g_SASH.IsRunning())
2526
Console->Execute("hud_draw 0");
26-
27+
#endif
2728
fSpeed = ms;
2829
dwCyclesLeft = cycles ? cycles : 1;
2930

@@ -75,8 +76,10 @@ CDemoPlay::~CDemoPlay()
7576
xr_delete(m_pMotion);
7677
xr_delete(m_MParam);
7778
Console->Execute("hud_weapon 1");
79+
#if !defined(LINUX)
7880
if (g_bBenchmark || g_SASH.IsRunning())
7981
Console->Execute("hud_draw 1");
82+
#endif
8083
}
8184

8285
void CDemoPlay::stat_Start()

src/xrEngine/IPhysicsShell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22
#include "xrCore/_types.h"
3+
#include "xrCore/vector.h"
34

45
// fwd. decl.
56
template <class T> struct _vector3;

src/xrEngine/device.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ void CRenderDevice::End(void)
108108
g_bRendering = FALSE;
109109
// end scene
110110
// Present goes here, so call OA Frame end.
111+
#if !defined(LINUX)
111112
if (g_SASH.IsBenchmarkRunning())
112113
g_SASH.DisplayFrame(Device.fTimeGlobal);
114+
#endif
113115
GEnv.Render->End();
114116

115117
if (load_finished && m_editor)
@@ -244,8 +246,10 @@ void CRenderDevice::on_idle()
244246

245247
const auto frameStartTime = TimerGlobal.GetElapsed_ms();
246248

249+
#if !defined(LINUX)
247250
if (!Device.dwPrecacheFrame && !g_SASH.IsBenchmarkRunning() && g_bLoaded)
248251
g_SASH.StartBenchmark();
252+
#endif
249253

250254
FrameMove();
251255

0 commit comments

Comments
 (0)