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(),
",");
220 if (std::find(files.begin(), files.end(), filename) == files.end())
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;
Central state/object manager and communications hub.
const char *const ROR_BUILD_DATE
const char *const ROR_VERSION_STRING
const char *const ROR_BUILD_TIME
void formatVertexDeclInfo(RoR::Str< 4000 > &text, Ogre::VertexDeclaration *vertexDeclaration, int j)
void UpdateHash(uint8_t *data, uint32_t len)
Quake-style console variable, defined in RoR.cfg or crated via Console UI and scripts.
std::string const & getStr() const
void setStr(std::string const &str)
Wrapper for classic c-string (local buffer) Refresher: strlen() excludes '\0' terminator; strncat() A...
const char * ToCStr() const
Ogre::String HashData(const char *key, int len)
bool IsDistanceWithin(Ogre::Vector3 const &a, Ogre::Vector3 const &b, float max)
void CvarAddFileToList(CVar *cvar, const std::string &filename)
std::string JoinStrVec(Ogre::StringVector tokens, const std::string &delim)
std::wstring Utf8ToWideChar(std::string input_utf8)
std::string SanitizeUtf8CString(const char *start, const char *end=nullptr)
std::string Sha1Hash(std::string const &data)
std::string SanitizeUtf8String(std::string const &str_in)
void CvarRemoveFileFromList(CVar *cvar, const std::string &filename)
void SplitBundleQualifiedFilename(const std::string &bundleQualifiedFilename, std::string &out_bundleName, std::string &out_filename)
std::string formatBytes(double bytes)
Ogre::String getVersionString(bool multiline=true)
std::string PrintMeshInfo(std::string const &title, Ogre::MeshPtr mesh)
std::string tryConvertUTF(const char *buffer)
Ogre::Real Round(Ogre::Real value, unsigned short ndigits=0)
Ogre::String sha1sum(const char *key, int len)
std::time_t getTimeStamp()