mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-25 04:31:52 +00:00
Native::NewPtr clear flag
This commit is contained in:
parent
4f4fde9cfb
commit
1bb0369223
@ -72,7 +72,7 @@ namespace MM
|
||||
|
||||
namespace Native {
|
||||
|
||||
uint16_t NewPtr(uint32_t size, uint32_t &mcptr)
|
||||
uint16_t NewPtr(uint32_t size, bool clear, uint32_t &mcptr)
|
||||
{
|
||||
// native pointers.
|
||||
|
||||
@ -86,6 +86,9 @@ namespace MM
|
||||
return memFullErr;
|
||||
}
|
||||
|
||||
if (clear)
|
||||
std::memset(ptr, 0, size);
|
||||
|
||||
mcptr = ptr - Memory;
|
||||
PtrMap.emplace(std::make_pair(mcptr, size));
|
||||
|
||||
@ -219,17 +222,7 @@ namespace MM
|
||||
|
||||
uint32_t mcptr;
|
||||
uint16_t error;
|
||||
error = Native::NewPtr(size, mcptr);
|
||||
|
||||
if (!error)
|
||||
{
|
||||
if (clear && mcptr)
|
||||
{
|
||||
uint8_t *ptr = memoryPointer(mcptr);
|
||||
std::memset(ptr, 0, size);
|
||||
}
|
||||
|
||||
}
|
||||
error = Native::NewPtr(size, clear, mcptr);
|
||||
|
||||
cpuSetAReg(0, mcptr);
|
||||
return SetMemError(error);
|
||||
|
@ -17,7 +17,7 @@ namespace MM
|
||||
namespace Native
|
||||
{
|
||||
uint16_t NewHandle(uint32_t size, uint32_t &handle);
|
||||
uint16_t NewPtr(uint32_t size, uint32_t &pointer);
|
||||
uint16_t NewPtr(uint32_t size, bool clear, uint32_t &pointer);
|
||||
|
||||
uint16_t DisposeHandle(uint32_t handle);
|
||||
uint16_t DisposePtr(uint32_t pointer);
|
||||
|
Loading…
Reference in New Issue
Block a user