Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,41 @@ 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
* glew
* glfw3
* portaudio
* mpg123
* boost

Because the CMake files are a bit messed up, 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.
```
export glfw_DIR=src/client/CMake/Modules
cmake . -DGLFW_LIBRARY=/usr/local/lib/libglfw3.3.1.dylib -DUSE_LIBCXX=ON
```
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 <lz4.h>
```
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

Expand All @@ -41,7 +71,7 @@ If you're using Visual Studio, keep in mind that the working directory for any g

## Troubleshooting

* If NoLifeClient is crashing for whatever reason, open up the file NoLifeClient.log and at the very bottom should be information on what went wrong.
* When running NoLifeClient, if no music is playing and no sprites are being displayed, then you forgot to pass the -client flag to NoLifeWzToNx
* On macs in particular, sometimes the max texture size reported by the OpenGL drivers is not actually a valid texture size. This results in a black screen, although the music is still playing. To fix this, just manually lower the atlas size in the config (unless you're using GCC <4.9 in which case you have to modify the config code to just override the default with something smaller and recompile).
* If NoLifeClient is crashing for whatever reason, open up the file NoLifeClient.log. If you're on Windows, there should be some useful information on what went wrong.
* When running NoLifeClient, if no music is playing and no sprites are being displayed, then you forgot to pass the -client flag to NoLifeWzToNx.
* On macs in particular, sometimes the max texture size reported by the OpenGL drivers is not actually a valid texture size. This results in a black screen, although the music is still playing. To fix this, just manually lower the atlas size in NoLifeClient.cfg to something like 8000 (unless you're using GCC <4.9 in which case you have to modify the config code to just override the default with something smaller and recompile).
* If you can't find the log or config, remember that NoLifeClient stores those files in the working directory, not necessarily the directory the program is in.
11 changes: 6 additions & 5 deletions src/wztonx/wztonx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace sys = boost::filesystem;
#include <fstream>
#include <iomanip>
#include <iostream>
#include <locale>
#include <clocale>
#include <map>
#include <numeric>
#include <regex>
Expand Down Expand Up @@ -318,7 +318,7 @@ struct wztonx {
std::string str_buf;
std::u16string wstr_buf;
#ifndef NL_NO_CODECVT
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> convert;
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
#endif
char8_t const * u8key = nullptr;
char16_t const * u16key = nullptr;
Expand All @@ -335,8 +335,7 @@ struct wztonx {
// Methods
std::string convert_str(std::u16string const & p_str) {
#ifndef NL_NO_CODECVT
auto ptr = reinterpret_cast<wchar_t const *>(p_str.c_str());
return convert.to_bytes(ptr, ptr + p_str.size());
return convert.to_bytes(p_str);
#else
std::array<char, 0x10000> buf;
std::wstring wbuf{p_str.cbegin(), p_str.cend()};
Expand All @@ -346,7 +345,7 @@ struct wztonx {
}
id_t add_string(std::string str) {
if (str.length() > std::numeric_limits<uint16_t>::max())
throw std::runtime_error("String is too long!");
return add_string("This string was too long.");
uint32_t hash = 2166136261u;
for (auto c : str) {
hash ^= c;
Expand All @@ -364,6 +363,7 @@ struct wztonx {
auto slen = len == 127 ? in.read<uint32_t>() : len;
auto ows = reinterpret_cast<char16_t const *>(in.offset);
in.skip(slen * 2u);
if (slen > std::numeric_limits<uint16_t>::max()) { return add_string("This string was too long."); }
auto mask = 0xAAAAu;
wstr_buf.resize(slen);
for (auto i = 0u; i < slen; ++i, ++mask)
Expand All @@ -374,6 +374,7 @@ struct wztonx {
auto slen = len == -128 ? in.read<uint32_t>() : -len;
auto os = reinterpret_cast<char8_t const *>(in.offset);
in.skip(slen);
if (slen > std::numeric_limits<uint16_t>::max()) { return add_string("This string was too long."); }
auto mask = 0xAAu;
str_buf.resize(slen);
for (auto i = 0u; i < slen; ++i, ++mask)
Expand Down