Author Topic: resource manager  (Read 5325 times)

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
resource manager
« on: August 24, 2020, 05:25:03 AM »
would there be a chance to overcome the resourcemanger / resourcemanager API in order to be able to build resourceforks with >16mb?

do resedit and resorcerer use the resourcemanager or is their GUI an abstraction?
insert arbitrary signature here

Offline teroyk

  • Platinum Member
  • *****
  • Posts: 623
  • -
Re: resource manager
« Reply #1 on: August 28, 2020, 06:30:49 AM »
would there be a chance to overcome the resourcemanger / resourcemanager API in order to be able to build resourceforks with >16mb?

Only theoretical speaking: what makes that limit? Is it real with Mac OS 9? Can we use 2 or more resourceforks with interapplication calls?

and I am interested in how you notice that limit?

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #2 on: August 28, 2020, 07:00:21 AM »
Only theoretical speaking: what makes that limit? Is it real with Mac OS 9? Can we use 2 or more resourceforks with interapplication calls?

the resourcemanager is what makes the technical limit for the max. size allowed for resourceforks.

the technical details are unknown terrain for me.

and while i am aware that it is a bullshit project (because files with a bigger resource forks wouldnt work on other systems) but i am somehow curious if you could break the limits - among other things, this could explain why the limit once was made.

Quote
Can we use 2 or more resourceforks with interapplication calls?

yes, exactly, if you needed more you could just use additional files.

there is one classic example where this has been done that way: in cubase 5.x most of the resources went to a "cubase resources" document, probably because they were afraid that the images could get too big.

Quote
and I am interested in how you notice that limit?

i read about it when i was searching something about the HFS+ API, which is completely unreleated. :)

the custom files i create with my apps are usually data fork only.

the only example of a resourcefork where you theoretically want to have unlimited space is the window monkey controlpanel; if you add images to it, they end up in a resource fork. 16 mebibyte are enough for some 10,000 images though, so its really only theoretical.
« Last Edit: August 28, 2020, 07:13:56 AM by IIO »
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #3 on: October 11, 2020, 06:33:18 AM »
There's an open source Resource Manager replacement. You could adapt this, but it would cause problems with programs that don't support it. Disk Doctor would see it as damaged resource fork.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #4 on: October 11, 2020, 12:37:56 PM »
oh really, so somebody did it and it works?

but if it makes trouble in conjunction with other programs then it is useless.

it is already a crazy idea to create files with resourceforks which would only work on my own computer and fail to load on a regular OS9.

but crippling your own machine in addition is too much.^^
insert arbitrary signature here

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: resource manager
« Reply #5 on: October 11, 2020, 03:19:06 PM »
I did some digging in Inside Macintosh. There is indeed a 16MB limit, but not on total file size.

The limit is linked to the total data in the resource file: resource names, IDs, and other metadata don't count to the limit.

As with most tech stuff, there are bizarre edge cases and technicalities. You can have a valid resource file with a single 1GB resource for example. But they are mostly useless and require you to carfully construct your resource forks.

If you want more details go to page I-128 of Inside Macintosh ("format of a resource file").

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #6 on: October 13, 2020, 07:04:36 PM »
i am not sure what that exactly means for the story, but the 16 mb limit "appears" when you use the resourcemanager API from apple, which is what everyone did.

if it would be possible to write an extension to mac os which allows more, one could also start making apps using bigger resourceforks and provide the driver with it.

but what would happen to the file´s resource fork when you use it on the machine prior to installing the OS modification? :P
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #7 on: October 15, 2020, 06:57:36 AM »
It would complain: invalid resource map as soon as you open the resource fork.

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #8 on: October 15, 2020, 07:20:12 AM »
The resource fork size is deliberately limited because when you update the resource fork it has to be written completely. Imagine that you add a 4 byte resource to a resource fork of 2 GB. That would be much overhead.

The normal way to use resources is, when your program starts its resource fork is opened, then the resource fork of its preferences, then the resource fork of the document. If you need a resource, then it looks first in the resource fork of the document, the preferences, the program, and then System. At any time you can switch with UseResFile. This is normal. It was designed for this purpose. If 1 resource fork is not enough, then you open lots of them and place their number (use CurResFile after opening) in a table (first save your application RF number). Then you refer to a resource by refNum, type and ID.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #9 on: October 15, 2020, 09:06:21 PM »
The resource fork size is deliberately limited because when you update the resource fork it has to be written completely.

you can not write bits, bytes, words, arbitrary chunks into a resorce fork? okay, that is half an explanation.

i still think from a todays perspective (or actually form a 2001 perspective) 16 mb is not very much.

one might want to make an app with 30 mb of pictures or sounds and a few other things and then you need to use 2 additional files besides the app. so it would eventually be less work to use a binary file or write it in the data fork - or just put the pictures one by one in a folder.

but i understand that arguments wont help against reality. my request doesnt make much sense.
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #10 on: October 16, 2020, 11:03:59 AM »
It makes sense when the data is structured, because that's what resources are meant for.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #11 on: October 16, 2020, 09:13:33 PM »
the stuff i am working on is for example: a set of small apps which may share a bunch of supporting files / nondynamic media files. the idea was to use a single file in resedit format / resourcefork only (as used in cubase 5)
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #12 on: October 17, 2020, 03:04:35 PM »
Then I wouldn't use resources.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #13 on: October 18, 2020, 06:50:07 PM »
but it is quite difficult for me to combine stuff into a datafork.
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #14 on: October 21, 2020, 08:04:56 AM »
You can save your files as an uncompressed ISO image and use open source to read it.

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #15 on: October 21, 2020, 01:16:21 PM »
yeah, using images is an idea. the path will no longer be relative but in OS9 it is more or less a fixed path.
insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #16 on: October 23, 2020, 07:46:20 AM »
Scan the files and folders that you want to save in your file. Build an index as a hierarchical data structure. Save it to a counting stream to get its length. Calculate the offsets. Save the index and copy all the forks.

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #17 on: December 23, 2020, 04:33:18 AM »
Well, how did it work out? Did you use an existing file format or your own file format?

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: resource manager
« Reply #18 on: December 24, 2020, 06:24:23 AM »
in the given case, i kept using folders with a relative path to the executable.

it is not ideal, but at least it gives me cross platform compatibility with windows OS (as long as i omit certain character limits.)

using a custom format (say like a datafork with 10 aif and 50 picturefiles) would be a good option when it would be easier for me to extract the data later.
atm reading such data in again (e.g. at startup) ist very complicated.

(in maxmsp, you have no direct access to RAM, you are left with classes which can do that or you may transform arbitrary data to a video matrix and use that)

insert arbitrary signature here

Offline OS923

  • Platinum Member
  • *****
  • Posts: 888
Re: resource manager
« Reply #19 on: December 26, 2020, 05:00:56 AM »
ist very complicated
Are you German?