mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-02 12:31:15 +00:00
RM::ChangedResource
This commit is contained in:
parent
33ba7e076a
commit
6197910e3e
@ -780,6 +780,60 @@ namespace RM
|
|||||||
return SetResError(::ResError());
|
return SetResError(::ResError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t ChangedResource(uint16_t trap)
|
||||||
|
{
|
||||||
|
// PROCEDURE ChangedResource (theResource: Handle);
|
||||||
|
|
||||||
|
uint32_t theResource;
|
||||||
|
|
||||||
|
StackFrame<4>(theResource);
|
||||||
|
|
||||||
|
Log("%04x ChangedResource(%04x)\n", trap, theResource);
|
||||||
|
|
||||||
|
|
||||||
|
// set the resChanged attribute so when UpdateResFile() is called
|
||||||
|
// (or the app exits)
|
||||||
|
// also needs to update the carbon handle/data with the mpw handle
|
||||||
|
// since the data has changed....
|
||||||
|
|
||||||
|
|
||||||
|
auto iter = rhandle_map.find(theResource);
|
||||||
|
if (iter == rhandle_map.end())
|
||||||
|
{
|
||||||
|
return SetResError(MacOS::resNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle nativeHandle = iter->second;
|
||||||
|
|
||||||
|
// check if handle size changed, resync data
|
||||||
|
|
||||||
|
auto info = MM::GetHandleInfo(theResource);
|
||||||
|
if (!info.error()) return SetResError(info.error());
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t nativeSize = ::GetHandleSize(nativeHandle);
|
||||||
|
|
||||||
|
if (nativeSize != info->size) {
|
||||||
|
// resize...
|
||||||
|
// chould get state / unlock / set state ... but that does nothing in OS X.
|
||||||
|
|
||||||
|
::SetHandleSize(nativeHandle, info->size);
|
||||||
|
OSErr err = MemError();
|
||||||
|
if (err) return SetResError(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::memcpy(*nativeHandle, memoryPointer(info->address), info->size);
|
||||||
|
|
||||||
|
::ChangedResource(nativeHandle);
|
||||||
|
|
||||||
|
return SetResError(::ResError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t GetResFileAttrs(uint16_t trap)
|
uint16_t GetResFileAttrs(uint16_t trap)
|
||||||
{
|
{
|
||||||
// FUNCTION GetResFileAttrs (refNum: Integer): Integer;
|
// FUNCTION GetResFileAttrs (refNum: Integer): Integer;
|
||||||
|
@ -45,7 +45,7 @@ namespace RM
|
|||||||
uint16_t SetResAttrs(uint16_t trap);
|
uint16_t SetResAttrs(uint16_t trap);
|
||||||
uint16_t WriteResource(uint16_t trap);
|
uint16_t WriteResource(uint16_t trap);
|
||||||
uint16_t DetachResource(uint16_t trap);
|
uint16_t DetachResource(uint16_t trap);
|
||||||
|
uint16_t ChangedResource(uint16_t trap);
|
||||||
uint16_t RemoveResource(uint16_t trap);
|
uint16_t RemoveResource(uint16_t trap);
|
||||||
|
|
||||||
uint16_t GetResourceSizeOnDisk(uint16_t trap);
|
uint16_t GetResourceSizeOnDisk(uint16_t trap);
|
||||||
|
@ -549,6 +549,10 @@ namespace ToolBox {
|
|||||||
d0 = RM::AddResource(trap);
|
d0 = RM::AddResource(trap);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0xa9aa:
|
||||||
|
d0 = RM::ChangedResource(trap);
|
||||||
|
break;
|
||||||
|
|
||||||
case 0xa9ad:
|
case 0xa9ad:
|
||||||
d0 = RM::RemoveResource(trap);
|
d0 = RM::RemoveResource(trap);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user