mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-21 09:30:55 +00:00
HDelete
This commit is contained in:
parent
3f4dd56d78
commit
dba511a103
@ -569,26 +569,63 @@ namespace OS
|
||||
|
||||
uint16_t Delete(uint16_t trap)
|
||||
{
|
||||
enum {
|
||||
/* FileParam */
|
||||
_qLink = 0,
|
||||
_qType = 4,
|
||||
_ioTrap = 6,
|
||||
_ioCmdAddr = 8,
|
||||
_ioCompletion = 12,
|
||||
_ioResult = 16,
|
||||
_ioNamePtr = 18,
|
||||
_ioVRefNum = 22,
|
||||
_ioFRefNum = 24,
|
||||
_ioFVersNum = 26,
|
||||
_filler1 = 27,
|
||||
_ioFDirIndex = 28,
|
||||
_ioFlAttrib = 30,
|
||||
_ioFlVersNum = 31,
|
||||
_ioFlFndrInfo = 32,
|
||||
_ioFlNum = 48,
|
||||
_ioFlStBlk = 52,
|
||||
_ioFlLgLen = 54,
|
||||
_ioFlPyLen = 58,
|
||||
_ioFlRStBlk = 62,
|
||||
_ioFlRLgLen = 64,
|
||||
_ioFlRPyLen = 68,
|
||||
_ioFlCrDat = 72,
|
||||
_ioFlMdDat = 76,
|
||||
|
||||
// HFileParam
|
||||
_ioDirID = 48,
|
||||
};
|
||||
|
||||
bool htrap = trap & 0x0200;
|
||||
const char *func = htrap ? "HDelete" : "Delete";
|
||||
|
||||
uint32_t d0;
|
||||
|
||||
uint32_t parm = cpuGetAReg(0);
|
||||
|
||||
Log("%04x Delete(%08x)\n", trap, parm);
|
||||
Log("%04x %s(%08x)\n", trap, func, parm);
|
||||
|
||||
//uint32_t ioCompletion = memoryReadLong(parm + 12);
|
||||
uint32_t namePtr = memoryReadLong(parm + 18);
|
||||
|
||||
//uint16_t ioVRefNum = memoryReadWord(parm + 22);
|
||||
//uint8_t ioFVersNum = memoryReadByte(parm + 26);
|
||||
uint32_t namePtr = memoryReadLong(parm + _ioNamePtr);
|
||||
|
||||
std::string sname = ToolBox::ReadPString(namePtr, true);
|
||||
|
||||
if (!sname.length())
|
||||
{
|
||||
memoryWriteWord(MacOS::bdNamErr, parm + 16);
|
||||
memoryWriteWord(MacOS::bdNamErr, parm + _ioResult);
|
||||
return MacOS::bdNamErr;
|
||||
}
|
||||
Log(" Delete(%s)\n", sname.c_str());
|
||||
|
||||
if (htrap)
|
||||
{
|
||||
uint32_t ioDirID = memoryReadLong(parm + _ioDirID);
|
||||
sname = FSSpecManager::ExpandPath(sname, ioDirID);
|
||||
}
|
||||
|
||||
Log(" %s(%s)\n", func, sname.c_str());
|
||||
|
||||
int ok = ::unlink(sname.c_str());
|
||||
if (ok < 0)
|
||||
@ -596,10 +633,12 @@ namespace OS
|
||||
else
|
||||
d0 = 0;
|
||||
|
||||
memoryWriteWord(d0, parm + 16);
|
||||
memoryWriteWord(d0, parm + _ioResult);
|
||||
return d0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint16_t GetEOF(uint16_t trap)
|
||||
{
|
||||
uint32_t d0;
|
||||
|
@ -128,7 +128,8 @@ namespace ToolBox {
|
||||
d0 = OS::Create(trap);
|
||||
break;
|
||||
|
||||
case 0xa009:
|
||||
case 0xa009: // Delete
|
||||
case 0xa209: // HDelete
|
||||
d0 = OS::Delete(trap);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user