ResourceMgr Release Notes
First created on: 3/16/92 3:53:17 PM

----------------------------------------------------------•----------------------------------------------------------

3/16/92 3:53:24 PM

File: ROvr.a,8
Owner: Dean Yu     
Project: MainProj∫Tidbits∫

File: ResourceMgrPatches.a,21
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1024511

> Release notes for this change:

Moved read only zone cutback code from Rovr.a to ResourceMgrPatches.a.  Apparently the code
wasn’t working in Rovr.a, but it worked in ResourceMgrPatches.a which is where it was originally.
This saves several hundred bytes of memory in ci class machines.


> What was tested:

The zone is cut back correctly, and there is no longer a “!” next to the zone when doing a “hz” in
MacsBug.

----------------------------------------------------------•----------------------------------------------------------
3/17/92 3:32:43 PM

File: ResourceMgrExtensions.a,39
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1024085

> Release notes for this change:

IsThisASystemResourceMap returns an error for ROM resources because 1 is not a valid file
reference number.  Add a special bailout case for the ROM resource map so the error is not
generated.

> What was tested:

RGetResource no longer returns an error.


----------------------------------------------------------•----------------------------------------------------------
3/23/92 6:59:27 PM

File: ResourceOverridePatches.a,31
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1025075

> Release notes for this change:

Before Gibblies, calling CountResources or GetIndResource on a resource that was in both an
application and the system would return both resources.  With a Gibbly in place, the one in the
system would not be found because of the dontCountOrIndexDuplicates behaviour.  Added code
which would make this case work.  For each potential duplicate resource, compare the resource
map of the original and the resource map of the duplicate.  If one is an override map of the other,
then the duplicate should be ignored.  If one is not an override map of the other, both instances
should be counted.


> What was tested:

Opened the active System file with ResEdit.  Resources that in both the System and the Gibbly only
show up once, as is correct.  Fonts in the Fonts folder only show up once, which is correct.  When
the code is changed to look at only the overrideNextMap bit instead of all the bits, fonts show up
twice.  This is the desired behaviour.

----------------------------------------------------------•----------------------------------------------------------
3/25/92 5:54:16 PM

File: ResourceMgrExtensions.a,41
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1024844

> Release notes for this change:

Inserting an override map over the a resource map that already has an override map causes the
machine to hang.  This was due to a bug which moved the override map incorrectly in the resource
chain.  Instead of trying to be clever and do everything in one loop, be more sedate and use two
loops to remove and insert the override map in the proper place.


> What was tested:

Ran ResourceMgr TE test cases and watched them pass.


----------------------------------------------------------•----------------------------------------------------------
3/30/92 5:54:17 PM

File: ResourceMgrPriv.a,13
Owner: Dean Yu     
Project: MainProj∫Internal∫Asm∫

File: ResourceMgrExtensions.a,42
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

File: ResourceMgrPatches.a,22
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

File: ResourceOverridePatches.a,33
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1025140

> Release notes for this change:

Resource Override Code Review cleanup.  Shave some bytes, fix some bugs, remove some patches.

> What was tested:

Made sure that GetIndResource still returns nil if the resource is not found, now that the patch that
does that is gone.  Made sure the override bits were still being set properly now that several bset
instructions have been merged into one or instruction.  Made sure mask values did not change now
that labels are being used instead of hard coded numbers.  Made sure stack frames did not change
because of the new stack frame macros.


----------------------------------------------------------•----------------------------------------------------------
3/30/92 7:50:13 PM

File: ResourceOverridePatches.a,34
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1025277

> Release notes for this change:

Invalidate the resources cached for GetIndResource and CountResources calls if ROMMapInsert has
a different value than it did when the cache was built.

> What was tested:

Broke on the CacheResource routine and watched the cache get invalidated when ROMMapInsert
is different than it was when the cache was built.


----------------------------------------------------------•----------------------------------------------------------
4/4/92 11:11:36 PM

File: ResourceOverridePatches.a,35
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1026179

> Release notes for this change:

Invalidate the cache if override maps are not being scanned, and they were scanned when the cache
was formed, and vice versa.

> What was tested:

Watched cache get invalidated when override map scanning is turned off.


----------------------------------------------------------•----------------------------------------------------------
4/6/92 6:03:51 PM

File: ResourceMgrExtensions.a,43
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1026612

> Release notes for this change:

Changes from Fonts Folder code review.  Use _CmpString instead of _IUMagString since we know
that the fonts belong to the same script at this point.


> What was tested:

Made sure that the correct branch was taken after returning from _CmpString.

----------------------------------------------------------•----------------------------------------------------------
4/10/92 2:56:51 PM

File: ResourceMgrExtensions.a,44
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

> Release notes for this change:

•BLT:  Gibblies were not being made resident.  This was caused by a typo introduced with the last change.  The
override attributes were being set off of A0 instead of A1.

> What was tested:

Gibblies now stay resident with this change.  My sample Gibbly, which contains my screen configuration and
desktop pattern did not kick in with the bug.  With this change, I get my nice blue desktop pattern, and my
two monitors.

----------------------------------------------------------•----------------------------------------------------------
4/14/92 11:53:34 AM

File: ResourceOverridePatches.a,36
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1026179

> Release notes for this change:

Bill and I had different interpreations about what turning override maps on and off meant.  Of
course, Bill’s idea was right.  Make additions to the last change so that when override map
scanning is off, blindly add resources to the cache on CountResources and GetIndResource calls.
This will result in duplicate resources in the cache, but that’s what you get for turning overrides
off.

> What was tested:

Bill has a test case which does CountResources on a resource type that’s in a Gibbly and in the
System.  When override scanning is on, as is the default, only the resource in the Gibbly is
counted.  When override scanning is off, both instance of the resource are found.


----------------------------------------------------------•----------------------------------------------------------
4/21/92 4:40:43 PM

File: Traps.a,75
Owner: Dean Yu     
Project: MainProj∫Interfaces∫AIncludes∫

File: Resources.h,12
Owner: Dean Yu     
Project: MainProj∫Interfaces∫CIncludes∫

File: Resources.p,8
Owner: Dean Yu     
Project: MainProj∫Interfaces∫PInterfaces∫

File: ResourceMgrExtensions.a,45
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1018901

> Release notes for this change:

With the Fonts folder, a font family can be split across several files.  This is a new
behaviour, and
programs that assume that a ‘FOND’ will contain information about all the fonts belonging
to that
font family will be in for a surprise.  Provide a new call, GetNextFOND, which will take
a handle to
a ‘FOND’ resource as a parameter, and it will return the next ‘FOND’ resource in the
resource chain
belonging to the same family.  The LaserWriter driver is currently the only client of
this call.

> What was tested:

The bug states that MacWrite II’s ReadMe file does not print correctly under Cube-E.
This was due
to the fact that the LaserWriter driver was looking for a style mapping table in the
first Gevena
‘FOND’ it found.  This is the one in the system file, which does not have a style mapping
table.
Because it does not find a style mapping table, it tries to download a bitmapped font.
Instead, the
LaserWriter driver should look for another Geneva ‘FOND’.
The LaserWriter driver has been changed to call the new routine GetNextFOND to look for
another
‘FOND’ for the same family if the ‘FOND’ it has does not have a style mapping table.
With this fix,
MacWrite II can print it’s ReadMe document without any problems, whereas it would print
in
Courier without the fix.
GetNextFOND also has code which checks to see if the ‘FOND’ is in an override map.  If it
is,
GetNextFOND will search for the map after the first non-override map after the override
map, so
that the same ‘FOND’ resource will not be returned all the time.  To test this, I placed
a copy of
the Geneve ‘FOND’, and the ‘NFNT’s in the System into a Gibbly and tried to print the
ReadMe file.
This also printed correctly.

----------------------------------------------------------•----------------------------------------------------------
4/21/92 8:21:58 PM

File: ResourceOverridePatches.a,37
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1027940

> Release notes for this change:

The original GetIndResource uses the Resource Manager HandleScan cache in low memory to
stash the resource it returns.  A subsequent GetResInfo would use the information in the
cache to find the resource instead of searching all the maps again.  In Cube-E,
GetIndResource is completely patched out, and each resource that was fetched was not
stored in this cache.  Change GetIndexedResourceOverride so that each resource it gets is
saved in this cache.

> What was tested:

Bill’s test tool calls GetIndResource with ROMMapInsert set to true.  A subsequent
GetResInfo would fail because the resource was not saved in the HandleScan cache, and the
ROM map was no longer in the resource chain.  GetResInfo would first look at the
HandleScan cache, see that the resource in the cache was not that resource that we’re
looking for information about, try to find the ROM map in the resource chain, fail to
find that, and return an error.  With this fix, GetResInfo successfully finds the
resource handle in the cache, so it can get the information about the resource even
though the ROM map is not in the resource chain.  Resource Manager sucks.

----------------------------------------------------------•----------------------------------------------------------
4/22/92 12:05:58 PM

File: ResourceMgrExtensions.a,46
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1027036

> Release notes for this change:

Strange things were happening in the Finder when you option copy a font from a suitcase
in the Fonts folder into the Fonts folder, because the ResolveIDConflicts routine would
detach and dispose of font handles out from underneath the Finder.  Change the routine to
determine whether or not we loaded the font handle, or if it was loaded before
ResolveIDConflicts was called.  If it was already loaded, don’t deallocate the resource.
In effect, only font resources from file that was passed to ResolveIDConflicts are
detached and released now.

> What was tested:

I put a debugger break in my routine which releases the font resource.  Without the
change, the routine would just go ahead and release the font resource that was passed to
it.  In some cases, this would release the handle out from underneath the Finder.  With
the change, the routine now checks to see if the handle was loaded by us or by someone
else.  If the resource was loaded by someone else, the resource is not detached or
released.
----------------------------------------------------------•----------------------------------------------------------
4/24/92 7:22:26 PM

File: ResourceOverridePatches.a,38
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1028323

> Release notes for this change:

When _InitAllPacks is called to initializes all the ‘PACK’ resources, it sets
ROMMapInsert to be true to get ROM ‘PACK’s, like ‘PACK’ 7.  If a Gibbly is active, and
the current resource map happens to be the system map, ROM ‘PACK’s aren’t found.  The
Resource Manager always puts the ROM resource map above the resource map in SysMapHndl.
The Resource Override mechanism puts the Gibbly in SysMapHndl for all Resource Manager
calls that have ROMMapInsert on so that the Gibbly is not cut out of the resource chain.
(This is why Brian McGhie is so cynical.)  The Resource Manager decides whether or not to
make the ROM map the current resource map by seeing if CurMap equals SysMap.  The
override code changes SysMap, but not CurMap, so the Resource Manager winds up not
looking in the ROM resource map for any resources.  (How did this ever work?)  Change the
override code to change CurMap as well if CurMap equals SysMap.

> What was tested:

Some machines wouldn’t boot with build 44, if a Gibbly was active, because AppleTalk now
calls Pack7.  This winds up causing a SysErr 24, which is Pack 7 not present.  With this
change, all machines now successfully boot.
----------------------------------------------------------•----------------------------------------------------------
4/27/92 7:48:37 PM

File: ResourceOverridePatches.a,39
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #100850

> Release notes for this change:

SyncTopOverrideMap trashes a1, which is a no no for Resource Manager routines.  Use a0
instead of a1, since that register is saved off.

> What was tested:

The symptom of this bug was that Mode32 was not being installed properly under CubeE,
because it kept the handle to its special ‘boot’ resource in a1, then called Unique1ID,
which wound up trashing a1, so it did a half bail out of its code.  With this fix, a1 is
no longer trashed, and Mode32 installs and runs properly.

----------------------------------------------------------•----------------------------------------------------------
4/30/92 4:48:34 PM

File: ResourceOverridePatches.a,41
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1028807

> Release notes for this change:

When emScanOverrideMaps is false, all override attributes should be ignored.  At first,
only the override next map attribute was ignored, then dontCountOrIndexDuplicates was
ignored too.  Now ignore the twoDeep attribute on resource maps.

> What was tested:

Whether the twoDeep attribute is ignored or not produces different resource counts in
Bill’s test tool.  We theorized the count that should be returned in both cases.  With
the change, the count returned by the test tool is the count that we expected in theory.
----------------------------------------------------------•----------------------------------------------------------
5/5/92 1:59:02 PM

File: ResourceOverridePatches.a,42
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1028857

> Release notes for this change:

The Resource Override mechanism fails if a one deep resource manager call is made on an
application resource map that is overriden, and ROMMapInsert is set.

Because the ROM map will never have any of the resource override attribute bits set, all
the resource override routines try to call the original routines if the ROM map would
become the current resource map, for one deep calls.  (Since the ROM map never has the
twoDeep bit set, there is no need for the overhead of setting the chain up for the two
deep behaviour.)  However, this check was done incorrectly, so that resource overriding
would never happen on one deep calls if ROMMapInsert is set.  While this is fine in the
current situation, since the system file is the only file that has an override map, if we
ever decide to put an override map on top of an application, resource overriding would
not work.

Change the resource override code so that the override behaviours is only skipped when
ROMMapInsert is set AND the current resource map is the system file.


> What was tested:

Bill wrote a test application that inserts an override map over itself, then tries to get
an overriden resource.  It should get the resource from the override map, but gets the
one from the application itself, with the current system.  With the change, the resource
is correctly fetched from the override map.
----------------------------------------------------------•----------------------------------------------------------
5/8/92 6:08:51 PM

File: ResourceMgrExtensions.a,47
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1029162

> Release notes for this change:

Change the interface of OpenResFileUnderSysteMap so that the Dictionary Manager can use
this call to open dictionaries with different permissions.

> What was tested:

The routine that opens font files at startup had to be changed to pass an extra parameter
to OpenResFileUnderSystemMap.  Made sure that all font files were opened with read write
permissions.  Also stepped through OpenResFileUnderSysteMap to make sure the right byte
on the stack is being passed to FSpOpenResFile.
----------------------------------------------------------•----------------------------------------------------------
5/14/92 8:59:40 AM

File: ResourceMgrPriv.a,14
Owner: Dean Yu     
Project: MainProj∫Internal∫Asm∫

File: ResourceMgrPriv.h,10
Owner: Dean Yu     
Project: MainProj∫Internal∫C∫

File: ResourceMgrExtensions.a,48
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1028722  (This was a bogus bug number.  But I changed it.)

> Release notes for this change:

OK, that’s not a real bug number.  I don’t know what the real bug number is.  But I know
I’m supposed to fix this.  The bug stated that if you added fonts to the Fonts folder,
then took them out, then added them back in, and kept doing this, eventually, the Finder
would say that you’re not allowed to add any more fonts, even though there are way less
than 128 files in the Fonts folder.  This is because the Finder decided to start closing
the font files as they got pulled out of the Fonts folder.  However, an internal count is
kept of how many font files are opene, and this count is not decremented when the Finder
closes font files, but is incremented every time a file is added to the Fonts folder.  So
the count keeps going up and up and up until it gets to 128.  Since the count is really
internal to the Fonts folder code, rather than having the Finder change this count, we
decided to have the converse call to OpenResFileUnderSystemMap which is used to open font
files.  This change adds the routine CloseResFileUnderSystemMap.  This routine closes
resource files that were opened under the system map, and if it’s a font file in the
Fonts folder, decrements the count of open font files.

> What was tested:

Added some debugging code to OpenResFileUnderSystemMap to close the files as soon as they
have been opened so I could watch CloseResFileUnderSystemMap in action.  The code works,
and the count decrements properly.  At the end of the boot sequence, no fonts were open,
and the count was 0.

----------------------------------------------------------•----------------------------------------------------------
5/18/92 10:49:16 AM

File: ResourceMgrExtensions.a,51
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1030232

> Release notes for this change:

OpenResFileUnderSystemMode uses a local stack variable to remember if the Process Manager
has launched yet to determine if it’s OK to call _BeginSystemMode and _EndSystemMode.
However, this stack variable was never initialized, so whether _EndSystemMode wound up
being called or not depended on the luck of the stack being 0 at that location.
Initialize this variable before it’s ever used.  This bug caused WorldScript II to crash
because it now calls OpenResFileUnderSystemMap at boot time.


> What was tested:

WorldScript II doesn’t crash any more.

----------------------------------------------------------•----------------------------------------------------------
5/21/92 3:33:01 PM

File: ResourceMgrExtensions.a,52
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1030292

> Release notes for this change:

The change that checks to see if a font resource was already loaded to decide whether or
not to unload that resource during ResolveIDConflicts leaves ‘FOND’s locked in memory.
This happens because three routines share a single flag which determines whether or not a
font should be released.  In some cases, the flag will be re-used before the first user
of the flag has gotten far enough to try to release the font resource.  Added code which
saves and restores the value of this flag in FindNewFamilyNumber and
ValidateFontResources so that no one steps on each other’s toes.

> What was tested:

The ‘FOND’ resources which were left locked in memory are actually unloaded now.

----------------------------------------------------------•----------------------------------------------------------
5/26/92 4:33:34 PM

File: ResourceOverridePatches.a,43
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1030806

> Release notes for this change:

RmveResource fails for resources that are located in an override map.  This is because
RmveResource sucks, and only allows resources to be removed from the current resource
map.  Since an overriden resource comes from an override map, and not the current
resource map, RmveResource would fail.  Add a pre-flight to RmveResource to see if the
resource handle comes from the current resource map.  If it doesn’t, see if the map it
comes from is an override map of the current resource map, and if THAT is true, then set
CurMap to be the override map for the duration of the call to RmveResource.

> What was tested:

Bill’s cornucopia of test cases found this bug.  The result was that RmveResource would
return rmvResFailed.  With this fix, the resource is successfully removed, and no error
is returned from RmveResource.
----------------------------------------------------------•----------------------------------------------------------
5/26/92 8:25:34 PM

File: ResourceMgrExtensions.a,53
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1027036

> Release notes for this change:

<46> Revisited.  The change which checked to see if a resource was already loaded so that
ResolveIDConflicts would know whether or not to unload a font resource didn’t take purged
handles into account, so ResolveIDConflicts would still release purged resources out from
under the Finder.  Add a patch to CheckLoad which sets a bit in BrianBits in low memory
for every resource fetch.  This bit will be set to 1 if this call to CheckLoad will
allocate the master pointer for the resource, or 0 if the master pointer was previously
allocated.  ResolveIDConflicts checks this bit after each resource call for a resource it
might want to dispose.

> What was tested:

The bug said that the Finder would start closing windows if you copied a font from a
suitcase in the Fonts folder into the Fonts folder, because it got confused.  We had some
difficulty reproducing this consistently, but we would get it to happen eventually.  With
this fix, we couldn’t get this to happen at all, after copying fonts for the better part
of half an hour.
----------------------------------------------------------•----------------------------------------------------------
5/27/92 11:50:30 AM

File: ResourceOverridePatches.a,44
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1030811

> Release notes for this change:

People who put 1 into CurMap to get to the ROM resource map suck, and I hate them all.
Change <42> short circuits all the resource override code if the ROM resource map would
become the current resource map, since the ROM resource map will not have any override
bits set.  The check to make this determination was if ROMMapInsert was set, and if
CurMap equaled SysMap.  Of course, if CurMap was 1, then it would go on and execute all
the override code which would fail to find the ROM resource map in the resource chain,
and bail with an error.  This caused the RAM Disk panel of the Memory control panel to
not show up on the Terror/Horror machines, because the call in Memory that determines
whether or not to show that panel slams 1 into CurMap, then calls Get1NamedResource to
find the EDisk driver in ROM.

> What was tested:

The RAM disk panel shows up on a Terror ROM machine (Quadra 950) in Memory with this fix.

----------------------------------------------------------•----------------------------------------------------------
5/27/92 5:28:34 PM

File: ResourceMgrPatches.a,23
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1008888

> Release notes for this change:

Suitcase II and Cube-E have a hard time together because they’re both fighting over who
gets control of the Resource Manager.  A patch was introduced in Cube-E a3 or a4 to keep
Suitcase II 1.2.10 working.  This patch checksums the patch routine that Suitcase is
trying to install, and if it matches the checksum we keep around, it doesn’t install
Suitcase’s patch.  This checksum changed between versions of Suitcase, so additional
checksums were needed.  Checksums for 1.2.11, and 1.2.12 were added.

> What was tested:

Versions that fail the checksum test cause the machine to hang as Suitcase tries to load.
Versions that pass the checksum test continue to boot normally.  Verified checksum values
for Suitcase II versions 1.2.10 through 1.2.12.
----------------------------------------------------------•----------------------------------------------------------
6/1/92 7:25:36 PM

File: ResourceOverridePatches.a,45
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031101

> Release notes for this change:

A previous change made RmveResource work with override maps.  (RmveResource only removes
resource from the current resource map, so it had to be patched to change the current map
in case the resource came from an override map.)  The same thing needed to be done for
font files in the Fonts folder.

Add an additional call to IsThisASystemResourceMap to determine if the resource map is an
override map or a font map in one fell swoop.  Then call DoesCachedMapOverrideThisMap in
case we have an application override map.

> What was tested:

Ran through Bill’s RmveResource test cases, and all the tests were passed.
----------------------------------------------------------•----------------------------------------------------------
6/2/92 12:09:45 PM

File: ResourceOverridePatches.a,46
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031021

> Release notes for this change:

When UpdateResFile is called, changed override maps should be updated as well.  If the
system map is being updated, font maps should be updated as well.  Add a patch to
UpdateResFile that does all this.

> What was tested:

Changed a resource in the system file, and a resource in a Gibbly.  Before this change,
the Gibbly’s resource map would not be updated.  With this change, both the system file
and the Gibbly are updated.

One bug that was found with this change was that when a resource in a Gibbly is changed,
but no change was made to any system file resources, the Gibbly will not be updated
because the mapChanged bit was never set on the system map.  But that’s left for another
bug and another release note.

----------------------------------------------------------•----------------------------------------------------------
6/4/92 11:04:58 AM

File: ResourceMgrExtensions.a,54
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031494

> Release notes for this change:

When making an override map from ROM, the new override map was never placed in the
resource chain, so override resources would not be found.  This occurred because I was
stupid, and forgot to put the override map at the top of the chain, after I pointed it’s
next map field at the current top.  Add this line.

> What was tested:

Faked up a ROM override map by forcing the code to get the ‘rovm’ resource from the
system, and made an override map with just the Brass Horn sound in ROM.  This sound then
shows up in the Sound Control panel.
----------------------------------------------------------•----------------------------------------------------------
6/4/92 2:48:43 PM

File: ResourceOverridePatches.a,47
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031589, 1031590, 1031591

> Release notes for this change:

#1031589 & #1031591:  These two were actually the same bug.  The change to this file that
fixed the RmveResource bug started to use D1 in a routine that didn’t use it before.
Other routines that call this routine used D1 for other things, so D1 was trashed.  Just
add D1 to the list of registers to save at the beginning of the routine.

#1031590:  This bug was actually seperate from the other two, but was uncovered by the
other one.  The routine DoesCachedMapOverrideCurrentMap used to scan the resource chain
for duplicates until it finds a map that doesn’t have any override attributes set.  The
theory was that a string of resource maps with override attributes set are associated
with each other, like Gibblies and the System, or the System and font files.  This test
was too generic, and fails in the case where an application has an override map, and the
map below the application is a Gibbly or the System.  In this case, resources in the
System and the application override that have the same type and ID are considered
duplicates of each other, which isn’t right.  Now, just look at the two deep bit on
resource maps to determine if one is associated with another.


> What was tested:

The symptom of these three bugs was that counting and indexing through resources did not
work in all cases.  With this change, all of Bill’s GetIndResource and CountResources
test cases succeed.  (It’s pretty impressive watching all the test cases pass, I must
say.)
----------------------------------------------------------•----------------------------------------------------------
6/5/92 6:01:16 PM

File: ResourceMgrExtensions.a,55
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031210

> Release notes for this change:

The last font file in the resource chain has the twoDeep bit set.  This will allows one
deep searches on the system file to continue into any third party resource maps, which is
not desireable.  This happens because OpenResFileUnderSystemMap sets this bit as it puts
a file underneath the system map.  However, it should not set this bit if it’s the first
map being inserted.  Conversely, if the last font file in the resource chain (usually the
first one alphabetically) is being removed from the Fonts folder, the two deep bit should
be cleared from the resource map above it.

> What was tested:

This bug was fixed in two steps, first the change to OpenResFileUnderSystemMap, then the
change to CloseResFileUnderSystemMap.  Before either change was made, opening the Sound
control panel will find all the sounds in a file I keep at the bottom of the resource
chain for an extension I’m working on.  It shouldn’t find these sounds at all.  With the
change to OpenResFileUnderSystemMap, that is fixed.  However, if you take the first
alphabetical font out of the Fonts folder at this time, and open the Sound control panel
again, you’ll see these sounds, because the two deep bit on the map above this font has
not been cleared.  With the change to CloseResFileUnderSystemMap, the sounds from my file
at the bottom of the resource chain never show up in the Sound control panel.  Also
checked to make sure that the two deep bit was still set on all the other font files in
the resource chain.

----------------------------------------------------------•----------------------------------------------------------
6/7/92 3:13:06 PM

File: ResourceOverridePatches.a,49
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1031361

> Release notes for this change:

Some applications check the mapChanged bit in a resource map to determine whether or not
it needs to call _UpdateResFile for that map.  If that map has an override map with
changed resources, but the application doesn’t know about the override map, chances are
that the changes in the override map will not get saved because the application thinks
that no resources have changed.  Modify AddResource, RmveResource, ChangedResource, and
SetResAttrs to set the mapChanged bit of a resource map if that map has an override map
with changed resources.

> What was tested:

If you have an active Gibbly, and you edit a Gibbly resource by opening the system file
with ResEdit, the changes that were made to the Gibbly resources will not be saved
because the mapChanged bit of the system map is not set.  With the change, ResEdit will
ask if you want to save the changes you made if you change or remove a Gibbly resource in
this manner.  Also ran all the Resource Manager tests that deal with these four calls,
and they all succeeded.

----------------------------------------------------------•----------------------------------------------------------
6/12/92 3:14:19 PM

File: ResourceMgrPatches.a,24
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1032324

> Release notes for this change:

RGetResource starts searching for resources from the current resource map. However, if
the call to RGetResource inside of MakeITable is made when FMSwapFont calls MakeITable,
chances are the current resource map will be below the system file, and the call to
RGetResource to get the ‘mitq’ resource from the system file will fail.

Inside Macintosh Volume V states that RGetResource “searches the chain of open resouce
files (including the System Resource File) for the given resource”.  I’m taking artistic
license and interpretting this to mean that it searches from the top of the resource
chain instead of from the current resource map.  Making this change in interpretation
will allow the RGetResource call in MakeITable to always succeed.


> What was tested:

Without this change, the call to RGetResource in MakeITable will fail because the current
resource map is below the system map, so the ‘mitq’ resource cannot be found.  The result
of this is that if you have SuperClock installed, and you switch from 256 to 16 colors in
Monitors, the switch will take about 30 seconds to complete.  With this change, the
switch occurs immediately.
----------------------------------------------------------•----------------------------------------------------------
6/12/92 3:23:48 PM

File: ResourceMgrExtensions.a,56
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

File: ResourceOverridePatches.a,50
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1032065

> Release notes for this change:

The Finder has a strange bug where if you take a font out of the Fonts folder, then
immediately double click on it to open it, the Finder thinks that the font is still open,
and tries to get resources out of a closed file.  Inside the Resource Manager, a routine
is trying to get the resource map handle of the current resource map, which isn’t in the
resource chain because this is the file that the Finder is deal with.  A bus error
eventually occurs because the Resource Manager is using a nil handle.  Added a check to
the SyncTopOverrideMap routine to make sure that it gets a valid resource map handle for
the current resource map before continuing.  The two deep routines will bail early if
this is the case, since they all mess with the resource chain.

> What was tested:

In the scenario stated above, when you double click on the font file, you’ll get a bus
error.  With this change, the bus error doesn’t occur, and the Finder just opens up an
empty window.
----------------------------------------------------------•----------------------------------------------------------
6/15/92 11:48:24 PM

File: ResourceMgrExtensions.a,57
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1032647

> Release notes for this change:

ResolveIDConflicts will renumber all the font resources referenced in a ‘FOND’ resource.
However, if more than one ‘FOND’ resource references the same ‘FONT’,’NFNT’, or ‘sfnt’
resource, that resource will be renumbered for the first ‘FOND’, but does not update the
entry in other ‘FOND’s that reference that font resource.  This is because
ResolveIDConflicts does not remember what it’s renumbered so far.  ResolveIDConflicts
needs to remember this so that when it finds a font association table entry that points
off into the weeds because the font resource was renumbered out from under this ‘FOND’,
the entry can be changed to reference the new resource ID.

This is the bug that’s been freaking Don Showen out on his Quadra, and why MacWrite II
was having fits with those Garamond Italic fonts.

Added some code to ResolveIDConflicts that remembers the old ID of a font resource it
renumbered, and the new ID it was renumbered to.  For subsequent ‘FOND’s in the file, if
ResolveIDConflicts fails to find a font resource specified in the font association table,
it looks in this table to see if this ID was renumbered.  If this is the case, then the
font association table entry is changed to reference the new ID.


> What was tested:

Go into MacWrite II, type some junk in Helvetica, and save the document.  If you get a
suitcase that had these dangling ‘FOND’s and toss it into the Fonts folder, then open the
MacWrite II document again, MacWrite II will complain about not finding fonts.  Nothing
will be checked in MacWrite’s Font menu either.  This is because the dangling ‘FOND’
confused the hell out of it.  With this change, MacWrite is all happy and keen, and
Helvetica will be checked in the Font menu like it should be.

----------------------------------------------------------•----------------------------------------------------------
6/23/92 4:34:28 PM

File: ResourceMgrExtensions.a,58
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1033397

> Release notes for this change:

Resources in a second override map were not being found.  The Resource Override patches
have some cached information.  When a second override map was added on top of the system
map, the cache was not being invalidated, so the new override map was never searched.
Blow away the cache when InsertOverrideMap is called.

> What was tested:

After inserting a second override map on the system, resources from this new map would
not be found.  By invalidating the cache, the routine that sets up the override maps for
the Resource Manager is forced to resynchronize the override maps, including the new one,
so that resources from this map would then be found.

----------------------------------------------------------•----------------------------------------------------------
6/24/92 4:39:19 PM

File: ResourceOverridePatches.a,51
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1033758

> Release notes for this change:

The Resource Manager has a mechanism to allow a program to search only the ROM resource
map for resources.  This is done by setting ROMMapInsert, making the system resource map
the current map, and doing a one deep Resource Manager call.  The Resource Override patch
on CountTypes clears ResOneDeep before calling through to the real CountTypes to emulate
one deep calls across several maps.  However, it should not clear ResOneDeep if
ROMMapInsert is true, and the system map is the current resource map.  Added a check to
the CountTypesOverride routine to skip clearing ResOneDeep if both of these conditions
are met.

> What was tested:

Because ResOneDeep was being cleared, a call to Count1Types with ROMMapInsert true, and a
Gibbly as the current resource file would count all the resource types in ROM, the
system, the Gibbly, and the font files instead of just the ROM.  By adding this check,
only ROM resources are counted in this instance.

----------------------------------------------------------•----------------------------------------------------------
7/8/92 1:57:14 AM

File: Lomem.h,4
Owner: Greg Marriott     
Project: MainProj∫ProcessMgr∫

File: ResourceMgrPatches.c,8
Owner: Greg Marriott     
Project: MainProj∫ProcessMgr∫

File: ResourceOverridePatches.a,52
Owner: Greg Marriott     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1035120

> Release notes for this change:

Fix the resource manager so it wouldn’t cause problems for the font manager when
disposing or releasing a resource being referred to in the LastFOND global.  If the file
containing the FOND was closed, or the resource released, then a dangling handle would be
left in LastFOND.  A patch to ReleaseResource now clears LastFOND if the resource being
released is also referred to in LastFOND.  A patch to CloseResFile now clears LastFOND if
the file being closed contains any fonts (FONT, NFNT, and FOND).

> What was tested:

Run the crashing case from 1035120 and verify that it doesn’t crash any more.  Also, pop
into the debugger and watch the patches zero the low memory global when appropriate.
----------------------------------------------------------•----------------------------------------------------------
7/20/92 11:03:57 AM

File: ResourceMgrExtensions.a,60
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1035813

> Release notes for this change:

The routine IsThisASystemResourceMap used to call the File Manager to get the contents of
the parallel FCB array to determine the process that opened a file.  The reasoning behind
this was to keep knowledge of private File Manager structures isolated to the File
Manager, and avoid code duplication.  The problem is that IsThisASystemResourceMap is
called quite frequently by the Process Manager’s GetResource patch to determine whether a
resource should be loaded in the system heap or the application heap.  This means that
the file system queue will almost always have something queued up, preventing the disk
from spinning down on PowerBooks, thus wasting battery life.  Changed
IsThisASystemResourceMap to look in the parallel FCB array itself without going through
the File Manager.

> What was tested:

This was mostly a copy and paste job, so I made sure that IsThisASystemResourceMap was
still looking in the right place in the parallel FCB array.  I’m leaving it up to people
who care about PowerBook battery life to verify that this actually does allow the disk to
spin down.

----------------------------------------------------------•----------------------------------------------------------
7/30/92 4:11:58 PM

File: ResourceOverridePatches.a,53
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: #1038101

> Release notes for this change:

In GetIndexedResource, save ResOneDeep and ROMMapInsert around the call to CheckLoad in
case floppies need to be switched, and another Resource Manager call gets made.  This
would reset ResOneDeep and ROMMapInsert, which GetIndexedResource isn’t done using yet.

> What was tested:

If you’re doing a floppy install, and you launch the installer with an alias to the
Installer script which is on another floppy, the Resource Manager will crash with a bus
error when the Installer tries to get the ‘incd’ resource.  This happens because when the
floppy is ejected, the Installer gets called and makes another Resource Manager call.  By
saving and restoring ResOneDeep and ROMMapInsert, the state of the world remains the way
GetIndexedResource expects it, so the installation can be completed successfully.
----------------------------------------------------------•----------------------------------------------------------
9/2/92 12:05:29 PM

File: fontPrivate.a,29     
Owner: Dean Yu     
Project: MainProj∫Internal∫Asm∫

File: FontMgr.a,70     
Owner: Dean Yu     
Project: MainProj∫Toolbox∫FontMgr∫

File: ResourceMgrExtensions.a,61     
Owner: Dean Yu     
Project: MainProj∫Toolbox∫ResourceMgr∫

Radar bug: 

> Release notes for this change:

Converting some equates into record structures.

> What was tested:

No object change.

----------------------------------------------------------•----------------------------------------------------------
