Skip to content

Commit 4742925

Browse files
committed
more linux port. Some files of FileSystem part was disabled in cmake
1 parent 1dbd731 commit 4742925

File tree

8 files changed

+38
-44
lines changed

8 files changed

+38
-44
lines changed

src/xrCore/CMakeLists.txt

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ set(SOURCES
33
cpuid.cpp
44
crc32.cpp
55
dump_string.cpp
6-
file_stream_reader.cpp
7-
FileSystem.cpp
8-
FileSystem_borland.cpp
6+
# file_stream_reader.cpp
7+
# FileSystem.cpp
8+
# FileSystem_borland.cpp
9+
## FileSystem_posix.cpp
910
FMesh.cpp
10-
FS.cpp
11+
# FS.cpp
1112
FTimer.cpp
1213
LocatorAPI.cpp
1314
LocatorAPI_auth.cpp
@@ -36,43 +37,6 @@ set(SOURCES
3637
_math.cpp
3738
_sphere.cpp
3839
_std_extensions.cpp
39-
# clsid.cpp
40-
# cpuid.cpp
41-
# crc32.cpp
42-
# doug_lea_allocator.cpp
43-
# dump_string.cpp
44-
# FMesh.cpp
45-
# FS.cpp
46-
# FTimer.cpp
47-
# LocatorAPI.cpp
48-
# LocatorAPI_auth.cpp
49-
# LocatorAPI_defs.cpp
50-
# log.cpp
51-
# LzHuf.cpp
52-
# memory_allocation_stats.cpp
53-
# memory_monitor.cpp
54-
# memory_usage.cpp
55-
# Model.cpp
56-
# NET_utils.cpp
57-
# os_clipboard.cpp
58-
# ppmd_compressor.cpp
59-
# stdafx.cpp
60-
# string_concatenations.cpp
61-
# xrCore.cpp
62-
# ModuleLookup.cpp
63-
# xrDebug.cpp
64-
# xrMemory.cpp
65-
# xrMemory_debug.cpp
66-
# xrMemory_POOL.cpp
67-
# xrsharedmem.cpp
68-
# xrstring.cpp
69-
# Xr_ini.cpp
70-
# xr_shared.cpp
71-
# xr_trims.cpp
72-
# _compressed_normal.cpp
73-
# _math.cpp
74-
# _sphere.cpp
75-
# _std_extensions.cpp
7640
)
7741

7842
set(HEADERS
@@ -110,7 +74,7 @@ set(HEADERS
11074
PPMdType.h
11175
resource.h
11276
stdafx.h
113-
Stream_Reader.h
77+
stream_reader.h
11478
stream_reader_inline.h
11579
string_concatenations.h
11680
string_concatenations_inline.h

src/xrCore/FS.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
#include "stdafx.h"
22
#pragma hdrstop
33

4-
#include "fs_internal.h"
4+
#include "FS_internal.h"
55

66
#pragma warning(push)
77
#pragma warning(disable : 4995)
8+
#ifdef WINDOWS
89
#include <io.h>
910
#include <direct.h>
1011
#include <fcntl.h>
1112
#include <sys\stat.h>
13+
#else
14+
/*
15+
#include <sys/stat.h>
16+
17+
long _filelength(char *f)
18+
{
19+
struct stat st;
20+
stat(f, &st);
21+
return st.st_size;
22+
}
23+
*/
24+
#endif
1225
#pragma warning(pop)
1326

1427
#ifdef M_BORLAND

src/xrCore/FS_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
#pragma once
44

55
#include "lzhuf.h"
6+
#ifdef WINDOWS
67
#include <io.h>
78
#include <fcntl.h>
89
#include <sys\stat.h>
910
#include <share.h>
11+
#endif
1012

1113
void* FileDownload(LPCSTR fn, u32* pdwSize = NULL);
1214
void FileCompress(const char* fn, const char* sign, void* data, u32 size);
@@ -46,12 +48,14 @@ class CFileWriter : public IWriter
4648
{
4749
fclose(hf);
4850
// release RO attrib
51+
#ifdef WINDOWS
4952
DWORD dwAttr = GetFileAttributes(fName.c_str());
5053
if ((dwAttr != u32(-1)) && (dwAttr & FILE_ATTRIBUTE_READONLY))
5154
{
5255
dwAttr &= ~FILE_ATTRIBUTE_READONLY;
5356
SetFileAttributes(fName.c_str(), dwAttr);
5457
}
58+
#endif // Probably not needed.
5559
}
5660
}
5761
// kernel

src/xrCore/FileSystem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
#include "stdafx.h"
66
#pragma hdrstop
77

8+
#ifdef WINDOWS
89
#include "cderr.h"
910
#include "commdlg.h"
1011
#include "vfw.h"
12+
#endif
1113

1214
std::unique_ptr<EFS_Utils> xr_EFS;
1315
//----------------------------------------------------

src/xrCore/FileSystem_borland.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77

88
#include "FileSystem.h"
99

10+
#ifdef WINDOWS
1011
#include <io.h>
1112
#include <fcntl.h>
1213
#include <sys\stat.h>
1314

1415
#include <Shlobj.h>
16+
#endif
1517

1618
//#pragma comment(lib, "OSDialogB.lib")
1719

src/xrCore/LocatorAPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
#pragma warning(push)
99
#pragma warning(disable : 4995)
10+
#ifdef WINDOWS
1011
#include <direct.h>
1112
#include <fcntl.h>
1213
#include <sys/stat.h>
14+
#endif
1315
#pragma warning(pop)
1416

1517
#include "FS_internal.h"
File renamed without changes.

src/xrCore/stream_reader_inline.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@ IC CStreamReader& CStreamReader::operator=(const CStreamReader&)
1616
}
1717

1818
IC const HANDLE& CStreamReader::file_mapping_handle() const { return (m_file_mapping_handle); }
19-
IC void CStreamReader::unmap() { UnmapViewOfFile(m_current_map_view_of_file); }
19+
IC void CStreamReader::unmap()
20+
{
21+
#ifdef WINDOWS
22+
UnmapViewOfFile(m_current_map_view_of_file);
23+
#else
24+
#warning TODO: Port CStreamReader::unmap()
25+
#endif
26+
}
2027
IC void CStreamReader::remap(const u32& new_offset)
2128
{
2229
unmap();

0 commit comments

Comments
 (0)