56 std::stringstream result;
57 result << std::hex << FastHash(key, len);
63 std::string str_in(buffer);
70 const char* si_prefix[] = {
"B",
"KB",
"MB",
"GB",
"TB",
"EB",
"ZB",
"YB"};
72 int c = bytes > 0 ? std::min((
int)(
log(bytes) /
log((
float)base)), (
int)
sizeof(si_prefix) - 1) : 0;
73 snprintf(tmp, 128,
"%1.2f %s", bytes / pow((
float)base, c), si_prefix[c]);
74 return std::string(tmp);
87 sprintf(tmp,
"Rigs of Rods\n"
89 " protocol version: %s\n"
90 " build time: %s, %s\n"
111 value = std::floor(value + 0.5f);
113 value = std::ceil(value - 0.5f);
124 utf8::replace_invalid(str_in.begin(), str_in.end(), std::back_inserter(str_out));
132 end = (start + strlen(start));
137 utf8::replace_invalid(start, end, std::back_inserter(str_out));
144 sha1.
UpdateHash((uint8_t *)input.c_str(), (
int)input.length());
152 std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,
wchar_t> convert;
153 std::wstring temp_utf16 = convert.from_bytes(input_utf8);
154 return std::wstring(
reinterpret_cast<const wchar_t*
>(temp_utf16.c_str()));
160 for (String& tok : tokens)
171 return a.squaredDistance(b) <= max * max;
176 const VertexElement* ve = vertexDeclaration->getElement(j);
177 text <<
"\n" <<
"\telement #" << (j) <<
"/" << (vertexDeclaration->getElementCount());
178 text <<
" binding:" << (ve->getSource());
179 text <<
", offset:" << (ve->getOffset());
180 text <<
", type:" << (ve->getType());
181 text <<
", semantic:" << (ve->getSemantic());
182 text <<
", size:" << (ve->getSize());
190 if (mesh->sharedVertexData)
192 text <<
"\n" <<(
"Mesh has Shared Vertices:");
193 VertexData* vt=mesh->sharedVertexData;
194 for (
int j=0; j<(int)vt->vertexDeclaration->getElementCount(); j++)
199 text <<
"\n" <<(
"Mesh has "+
TOSTRING(mesh->getNumSubMeshes())+
" submesh(es)");
200 for (
int i=0; i<mesh->getNumSubMeshes(); i++)
202 SubMesh* submesh = mesh->getSubMesh(i);
203 text <<
"\n" <<(
"SubMesh "+
TOSTRING(i)+
": uses shared?:"+
TOSTRING(submesh->useSharedVertices));
204 if (!submesh->useSharedVertices)
206 VertexData* vt=submesh->vertexData;
207 for (
int j=0; j<(int)vt->vertexDeclaration->getElementCount(); j++)
214 return text.ToCStr();
219 StringVector
files = StringUtil::split(cvar->
getStr(),
",");
222 files.push_back(filename);
229 StringVector
files = StringUtil::split(cvar->
getStr(),
",");
230 auto found = (std::find(
files.begin(),
files.end(), filename));
231 if (found !=
files.end())
241 size_t pos = bundleQualifiedFilename.find(
':');
242 if (pos != std::string::npos)
244 out_bundleName = bundleQualifiedFilename.substr(0, pos);
245 out_filename = bundleQualifiedFilename.substr(pos + 1);
250 out_filename = bundleQualifiedFilename;