Author Topic: Resource packages  (Read 7747 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Resource packages
« on: August 04, 2012, 07:09:47 PM »
Is it possible to have unique resources between resource packages (resource.000, resource.001, etc)?  I can't seem to find any documentation regarding loading resources from a particular package?  I'm looking to break the 1000 resource number barrier.

I understand that different file packages were really meant to be spread across multiple floppies.  I also understand that this would break the patch resources.  Unless I'm missing something, it seems like we've lost some functionality here because of the lack of disk-swapping.

The resource.map file supports this idea - I could have the same resource number in the map file, but have different package references.


In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Resource packages
« Reply #1 on: August 05, 2012, 01:56:52 AM »
I'm looking to break the 1000 resource number barrier.
Just finish SCI Studio VGA  :P

Seriously, though, I don't think that there would be a way without some serious hack. I am sure that this why Sierra changed their naming convention. If it is a script, perhaps calling a large string from a global variable to populate a basic script? Sometimes Sierra included a smaller secondary MAP file with their patches, so it may be possible to call a 2nd MAP that points to another RESOURCE archive as you suggested.
KQII Remake Pic

Offline gumby

Re: Resource packages
« Reply #2 on: August 05, 2012, 08:13:33 AM »
I came up with some unorthodox solutions.

The first was to manipulate the map file (on disk) in-game.  This didn't work with my tests as it appears to load it up into memory when the game starts & doesn't read it each time it needs to locate a resource.

If it is a script, perhaps calling a large string from a global variable to populate a basic script?
This is similar to what I tried next: manipulating the actual resource package in game.  You can actually do this:

Code: [Select]
     FlushResources()  // blast out any resources in memory

      (if( <> NULL (= hFile FOpen("resource.001" fCREATE)) )
            FPuts(hFile "Hello World!")    // need populate the file with contents from another res package
            FClose(hFile)
      )

      // load a text resource from our newly created resource.001 file.
      FormatPrint("text resource:%s" 000 0)

The above code successfully nukes the resource file.  The next step would be to slurp the contents of a surrogate resource file into a string & replace the existing one, then load the resource from that file that I want.  But there isn't nearly enough memory to do this.  I suppose I could try to store the entire contents of a resource file into a text resource entry so that *maybe* I wouldn't have to load the contents into an in-memory string.  Either way, this solution is ugly and probably slow.  This is pretty close to emulating 'disk-swapping'.

EDIT: Wait, this won't work.  The map file wouldn't be updated (and reloaded into memory) to reflect the correct sizes/locations of the resources in the resource package.  Extremely unlikely that the sizes of all the resources within the package would be the same.

However, this idea might work reasonably well with patch resources.  Using the same technique above, we could dynamically create/replace patches in-game.  Perhaps put different patch files in a sub directory, then use the file operation commands to create the patches into the root directory of the game.
« Last Edit: August 05, 2012, 08:20:36 AM by gumby »
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Collector

Re: Resource packages
« Reply #3 on: August 05, 2012, 03:10:05 PM »
Later versions of SCI allow for a patchDir= in the config file. You can specify multiple paths by separating with semicolons. If there is a conflict by multiple incidences of a given patch, it will use the first one specified. This way the resource archive is last so any external patches override the archive. Sadly, SCI0 does not have patchDir.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.038 seconds with 16 queries.