RM::GetResourceSizeOnDisk

This commit is contained in:
Kelvin Sherlock 2013-06-30 13:08:26 -04:00
parent 9ef1bba18d
commit 457c045ebe
3 changed files with 32 additions and 1 deletions

View File

@ -755,6 +755,33 @@ namespace RM
return SetResError(::ResError());
}
uint16_t GetResourceSizeOnDisk(uint16_t trap)
{
// FUNCTION GetResourceSizeOnDisk (theResource: Handle): LongInt;
uint32_t sp;
uint32_t theResource;
sp = StackFrame<4>(theResource);
Log("%04x GetResourceSizeOnDisk(%08x)\n", trap, theResource);
auto iter = rhandle_map.find(theResource);
if (iter == rhandle_map.end())
{
ToolReturn<4>(sp, (uint32_t)0);
return SetResError(MacOS::resNotFound);
}
Handle nativeHandle = iter->second;
uint32_t size = ::GetResourceSizeOnDisk(nativeHandle);
ToolReturn<4>(sp, size);
return SetResError(::ResError());
}
// todo -- move since it's not RM related.

View File

@ -47,6 +47,7 @@ namespace RM
uint16_t RemoveResource(uint16_t trap);
uint16_t GetResourceSizeOnDisk(uint16_t trap);
}

View File

@ -335,7 +335,10 @@ namespace ToolBox {
d0 = RM::ReleaseResource(trap);
break;
case 0xa9a5:
d0 = RM::GetResourceSizeOnDisk(trap);
break;
case 0xa9a6:
d0 = RM::GetResAttrs(trap);
break;