From d76c25bd7a21cdd29e2c47293693ef04e56eac87 Mon Sep 17 00:00:00 2001 From: lzwdgc Date: Wed, 1 Jul 2015 13:12:35 +0300 Subject: [PATCH] Fix OS X build. --- .gitignore | 3 ++- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 2 +- src/obj_extractor/obj_extractor.cpp | 3 ++- src/tm_converter/tm_converter.cpp | 2 +- src/unpaker/pak.cpp | 4 ++++ 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index acd2451..64ba00c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -win* \ No newline at end of file +win* +build \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e1da9f1..edfc4cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,6 +17,8 @@ if (MSVC) #set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") #set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") endif(MSVC) include_directories(dep/dbmgr/include) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1c9fada..63ad19f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,9 @@ include_directories(common) +if (WIN32) file(GLOB unpaker_src "unpaker/*") add_executable(unpaker ${unpaker_src}) -if (WIN32) file(GLOB db_extractor_src "db_extractor/*") add_executable(db_extractor ${db_extractor_src}) target_link_libraries(db_extractor common) diff --git a/src/obj_extractor/obj_extractor.cpp b/src/obj_extractor/obj_extractor.cpp index 6e1e7af..a00b9ff 100644 --- a/src/obj_extractor/obj_extractor.cpp +++ b/src/obj_extractor/obj_extractor.cpp @@ -63,9 +63,10 @@ struct storage storage read_mmo(string fn) { + buffer f(readFile(fn)); storage s; s.name = fn; - s.load(buffer(readFile(fn))); + s.load(f); return s; } diff --git a/src/tm_converter/tm_converter.cpp b/src/tm_converter/tm_converter.cpp index 5788065..a1403cb 100644 --- a/src/tm_converter/tm_converter.cpp +++ b/src/tm_converter/tm_converter.cpp @@ -66,7 +66,7 @@ void tm2tga(string fn) dst.write(uint8_t((hi << 4) | hi)); } - transform(fn.begin(), fn.end(), fn.begin(), tolower); + transform(fn.begin(), fn.end(), fn.begin(), ::tolower); fn = fn.substr(0, fn.rfind(".tm")) + ".tga"; writeFile(fn, dst.getBuf()); } diff --git a/src/unpaker/pak.cpp b/src/unpaker/pak.cpp index 51738d1..a949d50 100644 --- a/src/unpaker/pak.cpp +++ b/src/unpaker/pak.cpp @@ -124,15 +124,19 @@ void segment::decompress(int segment_id) load_segment(); if (flags & 0xC) + { if (flags & 0x4) decode_f1((char*)decoded, size2, (char*)encoded); else decode_f2((char*)decoded, size2, (char*)encoded); + } if (flags & 0x3) + { if (flags & 0x1) decode_f3((char*)encoded, size1, (char*)decoded); else decode_f4((char*)encoded, size1, (char*)decoded, segment_id * header_size); + } } void pak::load(FILE *f)