diff --git a/src/xrCore/CMakeLists.txt b/src/xrCore/CMakeLists.txt index 0792f7a65f7..f9b7f45c5e2 100644 --- a/src/xrCore/CMakeLists.txt +++ b/src/xrCore/CMakeLists.txt @@ -3,11 +3,12 @@ set(SOURCES cpuid.cpp crc32.cpp dump_string.cpp - file_stream_reader.cpp - FileSystem.cpp - FileSystem_borland.cpp +# file_stream_reader.cpp +# FileSystem.cpp +# FileSystem_borland.cpp +## FileSystem_posix.cpp FMesh.cpp - FS.cpp +# FS.cpp FTimer.cpp LocatorAPI.cpp LocatorAPI_auth.cpp @@ -36,43 +37,6 @@ set(SOURCES _math.cpp _sphere.cpp _std_extensions.cpp -# clsid.cpp -# cpuid.cpp -# crc32.cpp -# doug_lea_allocator.cpp -# dump_string.cpp -# FMesh.cpp -# FS.cpp -# FTimer.cpp -# LocatorAPI.cpp -# LocatorAPI_auth.cpp -# LocatorAPI_defs.cpp -# log.cpp -# LzHuf.cpp -# memory_allocation_stats.cpp -# memory_monitor.cpp -# memory_usage.cpp -# Model.cpp -# NET_utils.cpp -# os_clipboard.cpp -# ppmd_compressor.cpp -# stdafx.cpp -# string_concatenations.cpp -# xrCore.cpp -# ModuleLookup.cpp -# xrDebug.cpp -# xrMemory.cpp -# xrMemory_debug.cpp -# xrMemory_POOL.cpp -# xrsharedmem.cpp -# xrstring.cpp -# Xr_ini.cpp -# xr_shared.cpp -# xr_trims.cpp -# _compressed_normal.cpp -# _math.cpp -# _sphere.cpp -# _std_extensions.cpp ) set(HEADERS @@ -110,7 +74,7 @@ set(HEADERS PPMdType.h resource.h stdafx.h - Stream_Reader.h + stream_reader.h stream_reader_inline.h string_concatenations.h string_concatenations_inline.h diff --git a/src/xrCore/FS.cpp b/src/xrCore/FS.cpp index 3fc1efa53a7..6f03c822c8e 100644 --- a/src/xrCore/FS.cpp +++ b/src/xrCore/FS.cpp @@ -1,14 +1,27 @@ #include "stdafx.h" #pragma hdrstop -#include "fs_internal.h" +#include "FS_internal.h" #pragma warning(push) #pragma warning(disable : 4995) +#ifdef WINDOWS #include #include #include #include +#else +/* +#include + +long _filelength(char *f) +{ + struct stat st; + stat(f, &st); + return st.st_size; +} +*/ +#endif #pragma warning(pop) #ifdef M_BORLAND diff --git a/src/xrCore/FS_internal.h b/src/xrCore/FS_internal.h index 9b8ec515885..03317179ecd 100644 --- a/src/xrCore/FS_internal.h +++ b/src/xrCore/FS_internal.h @@ -3,10 +3,12 @@ #pragma once #include "lzhuf.h" +#ifdef WINDOWS #include #include #include #include +#endif void* FileDownload(LPCSTR fn, u32* pdwSize = NULL); void FileCompress(const char* fn, const char* sign, void* data, u32 size); @@ -46,12 +48,14 @@ class CFileWriter : public IWriter { fclose(hf); // release RO attrib +#ifdef WINDOWS DWORD dwAttr = GetFileAttributes(fName.c_str()); if ((dwAttr != u32(-1)) && (dwAttr & FILE_ATTRIBUTE_READONLY)) { dwAttr &= ~FILE_ATTRIBUTE_READONLY; SetFileAttributes(fName.c_str(), dwAttr); } +#endif // Probably not needed. } } // kernel diff --git a/src/xrCore/FileSystem.cpp b/src/xrCore/FileSystem.cpp index 3c11d8ef0c2..838992bc16c 100644 --- a/src/xrCore/FileSystem.cpp +++ b/src/xrCore/FileSystem.cpp @@ -5,9 +5,11 @@ #include "stdafx.h" #pragma hdrstop +#ifdef WINDOWS #include "cderr.h" #include "commdlg.h" #include "vfw.h" +#endif std::unique_ptr xr_EFS; //---------------------------------------------------- diff --git a/src/xrCore/FileSystem_borland.cpp b/src/xrCore/FileSystem_borland.cpp index 6e2b3fb511e..0b6f177f4b1 100644 --- a/src/xrCore/FileSystem_borland.cpp +++ b/src/xrCore/FileSystem_borland.cpp @@ -7,11 +7,13 @@ #include "FileSystem.h" +#ifdef WINDOWS #include #include #include #include +#endif //#pragma comment(lib, "OSDialogB.lib") diff --git a/src/xrCore/LocatorAPI.cpp b/src/xrCore/LocatorAPI.cpp index 75e455fbcf7..3336839a835 100644 --- a/src/xrCore/LocatorAPI.cpp +++ b/src/xrCore/LocatorAPI.cpp @@ -7,9 +7,11 @@ #pragma warning(push) #pragma warning(disable : 4995) +#ifdef WINDOWS #include #include #include +#endif #pragma warning(pop) #include "FS_internal.h" diff --git a/src/xrCore/Stream_Reader.h b/src/xrCore/stream_reader.h similarity index 100% rename from src/xrCore/Stream_Reader.h rename to src/xrCore/stream_reader.h diff --git a/src/xrCore/stream_reader_inline.h b/src/xrCore/stream_reader_inline.h index 9af5f02a7b3..e45db267259 100644 --- a/src/xrCore/stream_reader_inline.h +++ b/src/xrCore/stream_reader_inline.h @@ -16,7 +16,14 @@ IC CStreamReader& CStreamReader::operator=(const CStreamReader&) } IC const HANDLE& CStreamReader::file_mapping_handle() const { return (m_file_mapping_handle); } -IC void CStreamReader::unmap() { UnmapViewOfFile(m_current_map_view_of_file); } +IC void CStreamReader::unmap() +{ +#ifdef WINDOWS + UnmapViewOfFile(m_current_map_view_of_file); +#else +#warning TODO: Port CStreamReader::unmap() +#endif +} IC void CStreamReader::remap(const u32& new_offset) { unmap();