diff --git a/mods/src/misc/misc.cpp b/mods/src/misc/misc.cpp index 44d3128..79c8825 100644 --- a/mods/src/misc/misc.cpp +++ b/mods/src/misc/misc.cpp @@ -14,10 +14,11 @@ // Read Asset File static AppPlatform_readAssetFile_return_value AppPlatform_readAssetFile_injection(__attribute__((unused)) unsigned char *app_platform, std::string const& path) { // Read File - std::string full_path("data/"); - full_path.append(path); - std::ifstream stream(full_path); - std::string str((std::istreambuf_iterator(stream)), std::istreambuf_iterator()); + std::ifstream stream("data/" + path, std::ios_base::binary | std::ios_base::ate); + long len = stream.tellg(); + char *buf = new char[len]; + stream.seekg(0, stream.beg); + stream.read(buf, len); // Return String AppPlatform_readAssetFile_return_value ret; ret.length = str.length();