GetNamedResource trap

This commit is contained in:
Kelvin Sherlock 2015-01-21 14:31:03 -05:00
parent 09aa8d0f26
commit 540490d0c5
2 changed files with 29 additions and 0 deletions

View File

@ -260,7 +260,32 @@ namespace RM
return SetResError(d0); return SetResError(d0);
} }
uint16_t GetNamedResource(uint16_t trap)
{
// FUNCTION GetNamedResource (theType: ResType; name: Str255): Handle;
uint32_t sp;
uint32_t theType;
uint32_t name;
sp = StackFrame<8>(theType, name);
std::string sname = ToolBox::ReadPString(name);
Log("%04x GetNamedResource(%08x ('%s'), %s)\n",
trap, theType, TypeToString(theType).c_str(), sname.c_str());
uint32_t resourceHandle;
uint32_t d0;
d0 = Native::LoadResource(theType, resourceHandle,
[theType, name](){
return ::GetNamedResource(theType, memoryPointer(name));
}
);
ToolReturn<4>(sp, resourceHandle);
return SetResError(d0);
}
uint16_t GetResource(uint16_t trap) uint16_t GetResource(uint16_t trap)
{ {

View File

@ -496,6 +496,10 @@ namespace ToolBox {
d0 = RM::GetResource(trap); d0 = RM::GetResource(trap);
break; break;
case 0xa9a1:
d0 = RM::GetNamedResource(trap);
break;
case 0xa9a2: case 0xa9a2:
d0 = RM::LoadResource(trap); d0 = RM::LoadResource(trap);
break; break;