[comp.sys.mac.programmer] Strange _GetPicture head patch and minimal 6.0.7

marc@Apple.COM (Mark Dawson) (11/06/90)

try this on earlier versions like 6.0.4): if my program ran on a regular
version, everything was fine.  If I ran on a minimally-installed version of
the system, then it would crash with a bus error.  I traced what the
_GetPicture trap did, and found that it did a _GetResource call with 'PICT'
as the type (that's news?).  By calling _GetResource ('PICT'), in my patch,
the bus error went away.  This seems really strange.  Does anyone have any
idea why a call to _GetResource would be needed from a _GetPicture trap ONLY
on a minimally-installed system?

Mark

ps: I didn't want to patch the system, but I couldn't figure out another way.
    If someone else can, I'd really appreciate it.  My world: all of my 'PICT'
    resources are compressed (they all exist under a different resource name).
    I have alerts ('ALRT') that reference these pictures, so I somehow must
    get the system to use the decompressed pictures (which are 'real' PICTs).
    I know when I'm going to call an alert; at this point I used to decompress
    the picture, then do an AddResouce(), putting it in the resource map.
    The alerts happily used them.  My problem occured when the user launched
    from a locked disk (a valid configuration); AddResource() won't work when
    the resource fork is locked.

    At the same spot I used to do the AddResource() I now log the picture
    handle into an array that my _GetPicture trap can use.  Everytime
    _GetPicture is called, my patch searchs for a matching PICT_id from its
    array; if it finds one, it returns the stored picture handle (otherwise it
    just calls the next _GetPicture routine in the chain).

    Do any of you have any suggestions on avoiding a patch?  The situation
    that seems to warrant it is when I'm running off of a locked disk, and
    I can't figure out how to get an alert to use my decompresed picture.


-- 
---------------------------------
Mark Dawson                Service Diagnostic Engineering
AppleLink: Dawson.M

Apple says what it says; I say what I say.  We're different
---------------------------------

peirce@outpost.UUCP (Michael Peirce) (11/07/90)

In article <46338@apple.Apple.COM>, marc@Apple.COM (Mark Dawson) writes:
> 
>     Do any of you have any suggestions on avoiding a patch?  The situation
>     that seems to warrant it is when I'm running off of a locked disk, and
>     I can't figure out how to get an alert to use my decompresed picture.

How about using UserItems?  Set a procedure for these UserItems that
does what you want (draw the compressed pictures)...

-- michael



--  Michael Peirce         --   {apple,decwrl}!claris!outpost!peirce
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--         and Consulting  --   (408) 244-6554