Skip to content

Commit a902b75

Browse files
committed
xrGame: Avoid all the remaining issues by "#ifndef LINUX"
1 parent 24697f8 commit a902b75

40 files changed

+183
-12
lines changed

src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ inline bool CHashFixedVertexManager::is_opened(const Vertex& vertex) const { ret
6767
TEMPLATE_SPECIALIZATION
6868
inline u32 CHashFixedVertexManager::hash_index(const Index& vertex_id) const
6969
{
70+
#ifdef LINUX // FIXME!!
71+
return 0;
72+
#else
7073
return hash_fixed_vertex_manager::to_u32(vertex_id) % HashSize;
74+
#endif
7175
}
7276

7377
TEMPLATE_SPECIALIZATION

src/xrGame/GameObject.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@
3939
#include "doors.h"
4040
#include "xrNetServer/NET_Messages.h"
4141

42+
#ifndef LINUX // FIXME!!!
4243
#pragma warning(push)
4344
#pragma warning(disable : 4995)
4445
#include <intrin.h>
4546
#pragma warning(pop)
4647

4748
#pragma intrinsic(_InterlockedCompareExchange)
49+
#endif
4850

4951
extern MagicBox3 MagicMinBox(int iQuantity, const Fvector* akPoint);
5052

@@ -109,8 +111,10 @@ void CGameObject::MakeMeCrow()
109111
return;
110112
u32 const device_frame_id = Device.dwFrame;
111113
u32 const object_frame_id = dwFrame_AsCrow;
114+
#ifndef LINUX // FIXME!!!
112115
if ((u32)_InterlockedCompareExchange((long*)&dwFrame_AsCrow, device_frame_id, object_frame_id) == device_frame_id)
113116
return;
117+
#endif
114118
VERIFY(dwFrame_AsCrow == device_frame_id);
115119
Props.crow = 1;
116120
g_pGameLevel->Objects.o_crow(this);

src/xrGame/Level_network.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,8 @@ bool CLevel::Connect2Server(const char* options)
362362
//---------------------------------------------------------------------------
363363
if (psNET_direct_connect)
364364
m_bConnectResultReceived = true;
365+
366+
#ifndef LINUX // FIXME!!!
365367
u32 EndTime = GetTickCount() + ConnectionTimeOut;
366368
while (!m_bConnectResultReceived)
367369
{
@@ -391,6 +393,7 @@ bool CLevel::Connect2Server(const char* options)
391393
}
392394
//-----------------------------------------
393395
}
396+
#endif
394397
Msg("%c client : connection %s - <%s>", m_bConnectResult ? '*' : '!', m_bConnectResult ? "accepted" : "rejected",
395398
m_sConnectResult.c_str());
396399
if (!m_bConnectResult)

src/xrGame/Level_network_Demo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ void CLevel::PrepareToSaveDemo()
1818
R_ASSERT(!m_DemoPlay);
1919
string_path demo_name = "";
2020
string_path demo_path;
21+
#ifndef LINUX // FIXME!!!
2122
SYSTEMTIME Time;
2223
GetLocalTime(&Time);
2324
xr_sprintf(demo_name, "xray_%02d-%02d-%02d_%02d-%02d-%02d.demo", Time.wMonth, Time.wDay, Time.wYear, Time.wHour,
2425
Time.wMinute, Time.wSecond);
26+
#endif
2527
Msg("Demo would be stored in - %s", demo_name);
2628
FS.update_path(demo_path, "$logs$", demo_name);
2729
m_writer = FS.w_open(demo_path);

src/xrGame/MainMenu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,9 @@ void CMainMenu::OnDownloadPatch(CUIWindow*, void*)
608608

609609
string4096 FilePath = "";
610610
char* FileName = NULL;
611+
#ifndef LINUX // FIXME!!!
611612
GetFullPathName(fileName, 4096, FilePath, &FileName);
612-
613+
#endif
613614
string_path fname;
614615
if (FS.path_exist("$downloads$"))
615616
{

src/xrGame/RegistryFuncs.cpp

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
bool ReadRegistryValue(LPCSTR rKeyName, DWORD rKeyType, void* value)
88
{
9+
#ifdef LINUX // FIXME!!!
10+
return true;
11+
#else
912
HKEY hKey = 0;
1013
long res = RegOpenKeyEx(REGISTRY_BASE, REGISTRY_PATH, 0, KEY_READ, &hKey);
1114

@@ -51,10 +54,14 @@ bool ReadRegistryValue(LPCSTR rKeyName, DWORD rKeyType, void* value)
5154

5255
memcpy(value, rBuf, KeyValueSize);
5356
return true;
57+
#endif
5458
};
5559

5660
bool WriteRegistryValue(LPCSTR rKeyName, DWORD rKeyType, const void* value)
5761
{
62+
#ifdef LINUX // FIXME!!!
63+
return true;
64+
#else
5865
HKEY hKey;
5966

6067
long res = RegOpenKeyEx(REGISTRY_BASE, REGISTRY_PATH, 0, KEY_WRITE, &hKey);
@@ -93,14 +100,40 @@ bool WriteRegistryValue(LPCSTR rKeyName, DWORD rKeyType, const void* value)
93100
if (hKey)
94101
RegCloseKey(hKey);
95102
return true;
103+
#endif
96104
};
97105

98-
bool ReadRegistry_StrValue(LPCSTR rKeyName, char* value) { return ReadRegistryValue(rKeyName, REG_SZ, value); }
99-
void WriteRegistry_StrValue(LPCSTR rKeyName, const char* value) { WriteRegistryValue(rKeyName, REG_SZ, value); }
100-
void ReadRegistry_DWValue(LPCSTR rKeyName, DWORD& value) { ReadRegistryValue(rKeyName, REG_DWORD, &value); }
101-
void WriteRegistry_DWValue(LPCSTR rKeyName, const DWORD& value) { WriteRegistryValue(rKeyName, REG_DWORD, &value); }
106+
bool ReadRegistry_StrValue(LPCSTR rKeyName, char* value)
107+
{
108+
#ifdef LINUX // FIXME!!!
109+
return true;
110+
#else
111+
return ReadRegistryValue(rKeyName, REG_SZ, value);
112+
#endif
113+
}
114+
void WriteRegistry_StrValue(LPCSTR rKeyName, const char* value)
115+
{
116+
#ifndef LINUX // FIXME!!!
117+
WriteRegistryValue(rKeyName, REG_SZ, value);
118+
#endif
119+
}
120+
void ReadRegistry_DWValue(LPCSTR rKeyName, DWORD& value)
121+
{
122+
#ifndef LINUX // FIXME!!!
123+
ReadRegistryValue(rKeyName, REG_DWORD, &value);
124+
#endif
125+
}
126+
void WriteRegistry_DWValue(LPCSTR rKeyName, const DWORD& value)
127+
{
128+
#ifndef LINUX // FIXME!!
129+
WriteRegistryValue(rKeyName, REG_DWORD, &value);
130+
#endif
131+
}
102132
u32 const ReadRegistry_BinaryValue(LPCSTR rKeyName, u8* buffer_dest, u32 const buffer_size)
103133
{
134+
#ifdef LINUX // FIXME!!!
135+
return u32(0);
136+
#else
104137
HKEY hKey = 0;
105138
long res = RegOpenKeyEx(REGISTRY_BASE, REGISTRY_PATH, 0, KEY_READ, &hKey);
106139

@@ -127,10 +160,12 @@ u32 const ReadRegistry_BinaryValue(LPCSTR rKeyName, u8* buffer_dest, u32 const b
127160
}
128161

129162
return static_cast<u32>(tmp_buffer_size);
163+
#endif
130164
}
131165

132166
void WriteRegistry_BinaryValue(LPCSTR rKeyName, u8 const* buffer_src, u32 const buffer_size)
133167
{
168+
#ifndef LINUX // FIXME!!!
134169
HKEY hKey;
135170

136171
long res = RegOpenKeyEx(REGISTRY_BASE, REGISTRY_PATH, 0, KEY_WRITE, &hKey);
@@ -150,4 +185,5 @@ void WriteRegistry_BinaryValue(LPCSTR rKeyName, u8 const* buffer_src, u32 const
150185
res = RegSetValueEx(hKey, rKeyName, NULL, REG_BINARY, buffer_src, buffer_size);
151186

152187
RegCloseKey(hKey);
188+
#endif
153189
}

src/xrGame/account_manager_script.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using namespace luabind;
66
using namespace luabind::policy;
77
using namespace gamespy_gp;
88

9+
#ifndef LINUX // FIXME!!!
910
SCRIPT_EXPORT(account_manager, (), {
1011
module(luaState)[class_<account_manager>("account_manager")
1112
.def("suggest_unique_nicks", &account_manager::suggest_unique_nicks)
@@ -65,3 +66,4 @@ SCRIPT_EXPORT(found_email_cb, (), {
6566
.def("bind", &gamespy_gp::found_email_cb::bind)
6667
.def("clear", &gamespy_gp::found_email_cb::clear)];
6768
});
69+
#endif

src/xrGame/alife_simulator_script.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ SCRIPT_EXPORT(CALifeSimulator, (), {
331331
.def("set_interactive",
332332
(void (CALifeSimulator::*)(ALife::_OBJECT_ID, bool))(&CALifeSimulator::set_interactive))
333333
.def("kill_entity", &CALifeSimulator::kill_entity)
334+
334335
.def("kill_entity", &kill_entity0)
335336
.def("kill_entity", &kill_entity1)
336337
.def("add_in_restriction", &add_in_restriction)
@@ -347,8 +348,10 @@ SCRIPT_EXPORT(CALifeSimulator, (), {
347348
.def("actor", &get_actor)
348349
.def("has_info", &has_info)
349350
.def("dont_has_info", &dont_has_info)
351+
#ifndef LINUX // FIXME!!!
350352
.def("switch_distance", &CALifeSimulator::switch_distance)
351353
.def("set_switch_distance", &CALifeSimulator::set_switch_distance) //Alundaio: renamed to set_switch_distance from switch_distance
354+
#endif
352355
//Alundaio: extend alife simulator exports
353356
.def("teleport_object", &teleport_object)
354357
//Alundaio: END

src/xrGame/configs_dumper.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,21 @@ configs_dumper::configs_dumper()
3232

3333
configs_dumper::~configs_dumper()
3434
{
35+
#ifndef LINUX // FIXME!!!
3536
if (m_make_start_event)
3637
{
3738
SetEvent(m_make_start_event);
3839
WaitForSingleObject(m_make_done_event, INFINITE); // thread stoped
3940
CloseHandle(m_make_done_event);
4041
CloseHandle(m_make_start_event);
4142
}
43+
#endif
4244
xr_free(m_buffer_for_compress);
4345
}
4446

4547
void configs_dumper::shedule_Update(u32 dt)
4648
{
49+
#ifndef LINUX // FIXME!!!
4750
DWORD thread_result = WaitForSingleObject(m_make_done_event, 0);
4851
R_ASSERT((thread_result != WAIT_ABANDONED) && (thread_result != WAIT_FAILED));
4952
R_ASSERT(m_state == ds_active);
@@ -53,6 +56,7 @@ void configs_dumper::shedule_Update(u32 dt)
5356
m_state = ds_not_active;
5457
Engine.Sheduler.Unregister(this);
5558
}
59+
#endif
5660
}
5761

5862
struct ExistDumpPredicate
@@ -204,6 +208,7 @@ void configs_dumper::dump_config(complete_callback_t complete_cb)
204208
}
205209

206210
ULONG_PTR process_affinity_mask, tmp_dword;
211+
#ifndef LINUX // FIXME!!!
207212
GetProcessAffinityMask(GetCurrentProcess(), &process_affinity_mask, &tmp_dword);
208213
bool single_core = (btwCount1(static_cast<u32>(process_affinity_mask)) == 1);
209214
if (single_core)
@@ -227,6 +232,7 @@ void configs_dumper::dump_config(complete_callback_t complete_cb)
227232
m_make_done_event = CreateEvent(NULL, FALSE, FALSE, NULL);
228233
thread_spawn(&configs_dumper::dumper_thread, "configs_dumper", 0, this);
229234
Engine.Sheduler.Register(this, TRUE);
235+
#endif
230236
}
231237

232238
void configs_dumper::compress_configs()
@@ -244,6 +250,7 @@ void configs_dumper::compress_configs()
244250
void configs_dumper::dumper_thread(void* my_ptr)
245251
{
246252
configs_dumper* this_ptr = static_cast<configs_dumper*>(my_ptr);
253+
#ifndef LINUX // FIXME!!!
247254
DWORD wait_result = WaitForSingleObject(this_ptr->m_make_start_event, INFINITE);
248255
while ((wait_result != WAIT_ABANDONED) || (wait_result != WAIT_FAILED))
249256
{
@@ -262,6 +269,7 @@ void configs_dumper::dumper_thread(void* my_ptr)
262269
wait_result = WaitForSingleObject(this_ptr->m_make_start_event, INFINITE);
263270
}
264271
SetEvent(this_ptr->m_make_done_event);
272+
#endif
265273
}
266274

267275
void __stdcall configs_dumper::yield_cb(long progress)
@@ -274,8 +282,10 @@ void __stdcall configs_dumper::yield_cb(long progress)
274282

275283
void __stdcall configs_dumper::switch_thread()
276284
{
285+
#ifndef LINUX // FIXME!!!
277286
if (!SwitchToThread())
278287
Sleep(10);
288+
#endif
279289
}
280290

281291
void configs_dumper::realloc_compress_buffer(u32 need_size)

src/xrGame/game_cl_base_weapon_usage_statistic_save.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ void WeaponUsageStatistic::SaveData()
7070
return;
7171

7272
string64 GameType;
73+
#ifndef LINUX // FIXME!!!
7374
SYSTEMTIME Time;
7475
switch (GameID())
7576
{
@@ -82,7 +83,7 @@ void WeaponUsageStatistic::SaveData()
8283
GetLocalTime(&Time);
8384
xr_sprintf(mFileName, "(%s)_(%s)_%02d.%02d.%02d_%02d.%02d.%02d.wus", *(Level().name()), GameType, Time.wMonth,
8485
Time.wDay, Time.wYear, Time.wHour, Time.wMinute, Time.wSecond);
85-
86+
#endif
8687
//---------------------------------------------------------
8788
FS.update_path(mFileName, "$logs$", mFileName);
8889
FILE* SFile = fopen(mFileName, "wb");

0 commit comments

Comments
 (0)