mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-14 02:06:09 +00:00
RE COutput/InputStream and friends and migrate over
This branch is probably still horribly broken, but it's a good first step to migrating away from having hecl embedded in the runtime
This commit is contained in:
21
Runtime/CStringExtras.cpp
Normal file
21
Runtime/CStringExtras.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "Runtime/CStringExtras.hpp"
|
||||
#include "Runtime/CInputStream.hpp"
|
||||
|
||||
namespace metaforce {
|
||||
std::string CStringExtras::ReadString(CInputStream& in) {
|
||||
u32 strLen = in.ReadLong();
|
||||
std::string ret;
|
||||
u32 readLen = 512;
|
||||
char tmp[512] = {};
|
||||
for (; strLen > 0; strLen -= readLen) {
|
||||
readLen = 512;
|
||||
if (strLen <= 512) {
|
||||
readLen = strLen;
|
||||
}
|
||||
in.ReadBytes(tmp, readLen);
|
||||
ret.append(tmp, readLen);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user