mirror of
https://github.com/ksherlock/mpw.git
synced 2024-12-22 00:29:18 +00:00
WritePString
This commit is contained in:
parent
db68aea8b1
commit
8bde718b83
@ -97,5 +97,20 @@ namespace ToolBox {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
bool WritePString(uint32_t address, const std::string &s)
|
||||
{
|
||||
int length = s.length();
|
||||
if (length > 255) return false;
|
||||
if (address == 0) return false;
|
||||
|
||||
uint8_t *ptr = memoryPointer(address);
|
||||
*ptr++ = (uint8_t)length;
|
||||
for (char c : s)
|
||||
{
|
||||
*ptr++ = (uint8_t)c;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -10,6 +10,8 @@ namespace ToolBox
|
||||
|
||||
std::string ReadCString(uint32_t address);
|
||||
std::string ReadPString(uint32_t address);
|
||||
bool WritePString(uint32_t address, const std::string &s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user