mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-08 22:30:25 +00:00
OpenRFPerm
This commit is contained in:
parent
1aebf46653
commit
f6132773db
@ -381,6 +381,49 @@ namespace RM
|
||||
|
||||
|
||||
|
||||
uint16_t OpenRFPerm(uint16_t trap)
|
||||
{
|
||||
// FUNCTION OpenRFPerm (fileName: Str255; vRefNum: Integer;
|
||||
// permission: SignedByte): Integer;
|
||||
ResFileRefNum refNum;
|
||||
FSRef ref;
|
||||
|
||||
uint32_t sp;
|
||||
uint32_t fileName;
|
||||
uint16_t vRefNum;
|
||||
uint16_t permission;
|
||||
OSErr error;
|
||||
|
||||
sp = StackFrame<8>(fileName, vRefNum, permission);
|
||||
|
||||
std::string sname = ToolBox::ReadPString(fileName, true);
|
||||
Log("%04x OpenRFPerm(%s, %04x, %04x)\n",
|
||||
trap, sname.c_str(), vRefNum, permission);
|
||||
|
||||
error = FSPathMakeRef( (const UInt8 *)sname.c_str(), &ref, NULL);
|
||||
if (error != noErr)
|
||||
{
|
||||
ToolReturn<2>(sp, (uint16_t)-1);
|
||||
return SetResError(error);
|
||||
}
|
||||
|
||||
HFSUniStr255 fork = {0,{0}};
|
||||
FSGetResourceForkName(&fork);
|
||||
|
||||
refNum = -1;
|
||||
error = FSOpenResourceFile(&ref,
|
||||
fork.length,
|
||||
fork.unicode,
|
||||
permission,
|
||||
&refNum);
|
||||
|
||||
ToolReturn<2>(sp, (uint16_t)refNum);
|
||||
|
||||
return SetResError(error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// todo -- move since it's not RM related.
|
||||
uint16_t UnloadSeg(uint16_t trap)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ namespace RM
|
||||
uint16_t ResError(uint16_t trap);
|
||||
|
||||
uint16_t OpenResFile(uint16_t trap);
|
||||
uint16_t OpenRFPerm(uint16_t trap);
|
||||
|
||||
uint16_t SetResLoad(uint16_t trap);
|
||||
|
||||
|
@ -310,6 +310,12 @@ namespace ToolBox {
|
||||
d0 = RM::CreateResFile(trap);
|
||||
break;
|
||||
|
||||
// OpenRFPerm (fileName: Str255; vRefNum: Integer;
|
||||
// permission: SignedByte): Integer;
|
||||
case 0xa9c4:
|
||||
d0 = RM::OpenRFPerm(trap);
|
||||
break;
|
||||
|
||||
// UnloadSeg (routineAddr: Ptr);
|
||||
case 0xa9f1:
|
||||
d0 = RM::UnloadSeg(trap);
|
||||
|
Loading…
Reference in New Issue
Block a user