From beca3a935ed29ceab003d3c843a6e5494508ef15 Mon Sep 17 00:00:00 2001 From: elwl Date: Sun, 5 Jul 2015 14:39:25 -1000 Subject: [PATCH 1/6] Use standard locale --- src/wztonx/wztonx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wztonx/wztonx.cpp b/src/wztonx/wztonx.cpp index 5af7f64..4ce4d32 100644 --- a/src/wztonx/wztonx.cpp +++ b/src/wztonx/wztonx.cpp @@ -51,7 +51,7 @@ namespace sys = boost::filesystem; #include #include #include -#include +#include #include #include #include From 04b644e68eca3c991f0ec1ec897cf08c49a79f2c Mon Sep 17 00:00:00 2001 From: Victor Li Date: Sun, 5 Jul 2015 15:12:35 -1000 Subject: [PATCH 2/6] Update README.md build section Added instructions for OS X. --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cc99747..8bf38d3 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,34 @@ If you're using Visual Studio, just go in the sdk folder and read the readme the If you are using any other compiler, good luck getting the dependencies somehow. Usually you'll have some sort of package manager that can get the stuff for you. ## Build System - +### Windows If you are using Visual Studio, just open up the solution. Make sure you switch to release mode and use 64bit mode. -If you are using any other compiler, there are cmake files. -Good luck. + +### Mac OS X +Use [brew](http://brew.sh/) to install the following packages. +* lz4 +* glfw +Because the CMake files are fucked, you'll have to run cmake with an additional parameter, containing the path to the glfw dylib. +``` +cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib +``` +Obviously, change up the version to whichever you brew installed. + +Then, if that went well, run the make command. +if you get the error +``` +/prog/NoLifeStory/src/nx/bitmap.cpp:20:10: fatal error: + 'lz4.h' file not found +#include +``` +or something similar, you probably don't have the include and lib paths defined. +Place the following lines in ~/.bash_profile, and restart your terminal. +``` +export LIBRARY_PATH=/usr/local/lib/ +export CPLUS_INCLUDE_PATH=/usr/local/include/ +``` +Run the make command again, and it should work. ## NX Files From a0128835cc214eadab84b09192fa2dae8c519510 Mon Sep 17 00:00:00 2001 From: Victor Li Date: Sun, 5 Jul 2015 15:14:46 -1000 Subject: [PATCH 3/6] whoops --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8bf38d3..9165a03 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Make sure you switch to release mode and use 64bit mode. Use [brew](http://brew.sh/) to install the following packages. * lz4 * glfw + Because the CMake files are fucked, you'll have to run cmake with an additional parameter, containing the path to the glfw dylib. ``` cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib From 33e38ae1585b15044ccb9fb9d091bd469b9732dc Mon Sep 17 00:00:00 2001 From: elwl Date: Mon, 6 Jul 2015 19:50:16 -1000 Subject: [PATCH 4/6] More fixes for OS X --- README.md | 3 ++- src/wztonx/wztonx.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9165a03..2bbac7e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Use [brew](http://brew.sh/) to install the following packages. * lz4 * glfw -Because the CMake files are fucked, you'll have to run cmake with an additional parameter, containing the path to the glfw dylib. +Because the CMake files are fucked, you'll have to run cmake with an additional parameter. This is because cmake doesn't know where to find the path containing glfwConfig.cmake and the glfw dylib. +Also, even though this might compile successfully, you'll probably need to set to use libcxx. ``` cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib ``` diff --git a/src/wztonx/wztonx.cpp b/src/wztonx/wztonx.cpp index 4ce4d32..a2e3a95 100644 --- a/src/wztonx/wztonx.cpp +++ b/src/wztonx/wztonx.cpp @@ -299,7 +299,7 @@ struct wztonx { std::string str_buf; std::u16string wstr_buf; #ifndef NL_NO_CODECVT - std::wstring_convert, wchar_t> convert; + std::wstring_convert, char16_t> convert; #endif char8_t const * u8key = nullptr; char16_t const * u16key = nullptr; @@ -316,8 +316,7 @@ struct wztonx { // Methods std::string convert_str(std::u16string const & p_str) { #ifndef NL_NO_CODECVT - auto ptr = reinterpret_cast(p_str.c_str()); - return convert.to_bytes(ptr, ptr + p_str.size()); + return convert.to_bytes(p_str); #else std::array buf; std::wstring wbuf{p_str.cbegin(), p_str.cend()}; @@ -327,7 +326,7 @@ struct wztonx { } id_t add_string(std::string str) { if (str.length() > std::numeric_limits::max()) - throw std::runtime_error("String is too long!"); + return add_string("This string was too long. Go fuck yourself."); uint32_t hash = 2166136261u; for (auto c : str) { hash ^= c; @@ -345,6 +344,7 @@ struct wztonx { auto slen = len == 127 ? in.read() : len; auto ows = reinterpret_cast(in.offset); in.skip(slen * 2u); + if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } auto mask = 0xAAAAu; wstr_buf.resize(slen); for (auto i = 0u; i < slen; ++i, ++mask) @@ -355,6 +355,7 @@ struct wztonx { auto slen = len == -128 ? in.read() : -len; auto os = reinterpret_cast(in.offset); in.skip(slen); + if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } auto mask = 0xAAu; str_buf.resize(slen); for (auto i = 0u; i < slen; ++i, ++mask) From 6a19ba6cbe114fcae3da40f7a34bbc18e99cbe37 Mon Sep 17 00:00:00 2001 From: elwl Date: Mon, 6 Jul 2015 20:04:42 -1000 Subject: [PATCH 5/6] Formatting --- src/wztonx/wztonx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wztonx/wztonx.cpp b/src/wztonx/wztonx.cpp index a2e3a95..8d2a8c9 100644 --- a/src/wztonx/wztonx.cpp +++ b/src/wztonx/wztonx.cpp @@ -316,7 +316,7 @@ struct wztonx { // Methods std::string convert_str(std::u16string const & p_str) { #ifndef NL_NO_CODECVT - return convert.to_bytes(p_str); + return convert.to_bytes(p_str); #else std::array buf; std::wstring wbuf{p_str.cbegin(), p_str.cend()}; @@ -344,7 +344,7 @@ struct wztonx { auto slen = len == 127 ? in.read() : len; auto ows = reinterpret_cast(in.offset); in.skip(slen * 2u); - if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } + if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } auto mask = 0xAAAAu; wstr_buf.resize(slen); for (auto i = 0u; i < slen; ++i, ++mask) @@ -355,7 +355,7 @@ struct wztonx { auto slen = len == -128 ? in.read() : -len; auto os = reinterpret_cast(in.offset); in.skip(slen); - if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } + if (slen > std::numeric_limits::max()) { return add_string("This string was too long. Go fuck yourself."); } auto mask = 0xAAu; str_buf.resize(slen); for (auto i = 0u; i < slen; ++i, ++mask) From f67d723678a64c4712064da0882fd15aac527714 Mon Sep 17 00:00:00 2001 From: Victor Li Date: Mon, 6 Jul 2015 20:17:46 -1000 Subject: [PATCH 6/6] oops --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2bbac7e..a94d6fc 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,8 @@ Use [brew](http://brew.sh/) to install the following packages. Because the CMake files are fucked, you'll have to run cmake with an additional parameter. This is because cmake doesn't know where to find the path containing glfwConfig.cmake and the glfw dylib. Also, even though this might compile successfully, you'll probably need to set to use libcxx. ``` -cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib +export glfw_DIR=src/client/CMake/Modules +cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib -USE_LIBCXX ``` Obviously, change up the version to whichever you brew installed.