1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Read-from-memory fixes, render target improvements

This commit is contained in:
Brian Fiete 2025-02-06 08:45:21 -08:00
parent 818ca48759
commit 60988fda8f
13 changed files with 87 additions and 17 deletions

View file

@ -1380,9 +1380,11 @@ void Beefy::BFFatalError(const char* message, const char* file, int line)
BFFatalError(String(message), String(file), line);
}
bool Beefy::ParseMemorySpan(const StringImpl& str, void*& outPtr, int& outSize)
bool Beefy::ParseMemorySpan(const StringImpl& str, void*& outPtr, int& outSize, StringImpl* outKey)
{
#ifndef BF_SMALL
static int anonymousIdx = 0;
if (str.StartsWith("@"))
{
int colon = (int)str.IndexOf(':');
@ -1390,6 +1392,21 @@ bool Beefy::ParseMemorySpan(const StringImpl& str, void*& outPtr, int& outSize)
String lenStr = str.Substring(colon + 1);
outPtr = (void*)(intptr)strtoll(addrStr.c_str(), NULL, 16);
outSize = (int)strtol(lenStr.c_str(), NULL, 10);
if (outKey != NULL)
{
int nextColon = (int)str.IndexOf(':', colon + 1);
if (nextColon > 0)
{
*outKey = str.Substring(nextColon + 1);
}
else
{
int dotPos = (int)str.IndexOf('.', colon + 1);
*outKey = StrFormat("ANON_%d", anonymousIdx++) + str.Substring(dotPos);
}
}
return true;
}
#endif