Powerpacker Patcher Version 1.0 Copyright (C) 1991, Michael Berg All Rights Reserved --------- INTRODUCTION Ever got tired of having to use PPMore or equivalent to view all those Powerpacked datafiles you have scattered everywhere? Or maybe PPMore doesn't do exactly what you want? Well, this program should solve your problem. It makes PowerPacker datafiles look completely like normal files. In fact, there is now not one thing you can do with normal files, which you cannot do with PowerPacker files. RUNNING PP Powerpacker Patcher runs from either the Workbench or the CLI. If you use it from CLI, you need not RUN it, because it detaches itself from the current CLI process as soon as it is activated. You will notice that a small window pops up when PP is started. This is done so that you have a visual way of determining if PP is running or not. Moreover, it provides a way of terminating PP. Powerpacker datafiles will begin to act as normal files as soon as PP has been activated. Most programs, commercial or PD, will be fooled into thinking that a powerpacked file exists in the form of its decrunched state. When they attempt to load such a file, the decrunched version of the file will be passed allong to the program. STOPPING PP Simple! Just punch the "closewindow" gadget in the PP window. You can't miss it, because it is the only gadget present (at least in this version). When the window disappears, DOS has been restored to its original state, and Powerpacker datafiles will again appear as .. Powerpacker datafiles. SAMPLE APPLICATIONS Well, what is it all good for, then? Here's a small list just to get your juices flowing: o Viewing Powerpacker datafiles (text) Simply use the TYPE command - or bring the text directly into your favourite editor (TxEd, CygnusEd) o Viewing Powerpacker datafiles (pictures) Crunch a typical IFF picture. Then bring it directly into DPaint or equivalent o Icons Yes, that's right. Go ahead and crunch all those icons. Workbench will never know the difference. Remember to retain the names of the icons - DON'T use ".info.pp". Workbench recognizes icons as files with a postfix of ".info". o Include files (header files) Why not go ahead and crunch all your include files for your compiler? THEORY OF OPERATION It's simple, really. PP juggles with a few DOS library vectors, so that future calls to certain DOS functions will be rerouted through PP. When an Open request arrives, PP looks at the file in question in order to determine the filetype. If it is a special file (e.g. CON: or NIL:) a filehandle from the original DOS Open() function is returned. Otherwise, the file is decrunched (or simply loaded) to a memory block, which is then flushed into a temporary file on the RAM disk. A pointer to this new file is then returned. You might think that the RAM disk will be filled with temporary files in a very short time, but PP is intelligent enough to remove them from RAM as they are no longer needed. If PP sees that the temporary file has been changed between the Open and the Close call, the file is rewritten over the original file, if possible. Future attempts to Examine() a file will return the size of the decrunched file in the FileInfoBlock, and not the size of the Powerpacker datafile itself. Why? Imagine an editor trying to load a text file. It does an Examine() to get at the filesize. Then it allocates just enough memory to hold the file. It then loads the file into that memory area. Well, that just won't work if the filesize it receives from Examine() is about 50% too small. Keep in mind that as soon as an Open() attempt is made, the file is decrunched, and will thus have a completely different filesize! For further details on the technique involved, please read the sourcecode -- it's included for just that. CAVEATS Yep, there are a few of these, too. First of all, you have to remember, that PP only works "one way". This means that loading Powerpacker files will work fine, but saving them again will result in a non-crunched file. The powerpacker.library sorely lacks a crunch function. Secondly, when working with crunched icons (or, for that matter, any other type of crunched file), there is a nominal performance reduction caused by the decruncher. Don't expect icons to pop up at the same rate as they used to, or include files to get included as fast as they used to. Use of B.A.D. or Addbuffers is recommended. Thirdly, the DOS library patches aren't done according to the textbook (if there is one on this topic!). I suppose a SumLibrary() call is in order, but its presense or absense seemed to make no difference whatsoever, so I left it out. I admit that the code is more or less tailored for an OS no larger than 1.3. No doubt it would crash a 2.0 system, because AmigaDOS looks quite a lot different on such machines (A3000). The program was tested on an A500 using AmigaDOS 1.2, with .5Mb extra RAM fitted. The overall effect of this program is quite astonishing. I use it all the time. Try it - it is just fantastic to see how *.pp files act as if they were completely normal files! THANKS GO TO... Well, who other than Nico François. Nico's powerpacker.library, and, for that matter, all the other powerpacker tools, are simply brilliant. Credit where credit is due! FUTURE RELEASES This version of PP is pretty much a beta release. There's a multitude of possibilities for improving PP. Some obvious choises: o Let PP create temporary files on other devices than RAM: I'm going to implement this via ENV:ironment variables. Harddisk users will probably welcome this. o More gadgets to control PP. Switching PP on and off while it is running. o Maybe build in a small memorymeter or a clock (or both) (The window is just sitting there, why not use it for something?) SHAREWARE PP is shareware. As you know, this means that I would appreciate a small sum of money if you use it alot. US$ 5+ (or equivalent) will get you free updates of PP as soon as these are ready. FLAMES If you find anything you (dis)like, mail me. Also, the code is still a little shaky, so it is possible that a few insects have survived the initial sprays of TNT. Anyway, here's my address: Michael Berg Sct. Peders Gade 24A, 2th 8900 Randers DENMARK Have fun!