This file is used for communication between PLANETS and VCR. More precisely, VCR can be run only if this file exists, otherwise it chains to PLANETS. PLANETS will ignore a password query if VCRINIT.TMP exists and load the given player's data immediately (nice, too ;-).
File Format: +0 WORD Player Number +2 WORD Signature 667 (29Bh) +4 4 BYTEs 0
Invoking the VCR
If a program needs to call VCR, it needs to perform the following steps:
- Generate a VCRx.DAT. The signature may be missing, VCR doesn't perform integrity checks. GENx.DAT is not required.
- Generate a VCRINIT.TMP containing the player number. It is possible to use player number 12 to avoid file name collisions. Generate a PATH.DAT that contains the path to be used (i.e., where you put VCRx.DAT and VCRINIT.TMP). The path must be usable immediately, that is, it must be possible to append a file name and use it ("D:\PATH\", not "D:\PATH").
- Create a copy of VCR.EXE. Check locations 155A3h and 15828h. If they contain the strings "planets" and "PLANETS", you're dealing with the original VCR: patch in the 7-character name (without ".exe") of a program which just terminates itself; you need to supply this program. If the signatures are missing, don't patch. You're then probably dealing with a copy of PVCR.EXE or a compressed VCR.EXE, your patch would happily blast it into pieces. Alternatively, temporarily rename your program `planets.com', so VCR will execute that one when exiting.
- Change to the Planets directory, otherwise VCR can't locate its data files.
- Execute the VCR copy.
- Delete the VCR copy and VCRINIT.TMP, and possibly the temporary program.
Note that implementing a VCR manually is not that hard, so you may want to choose that alternative.
Replacing the VCR
This is harder, because the above method invokes hacking the VCR.EXE file. Ideally, your program would have to be ready-to-patch, but that can usually not be achieved.
If you only want that your program be called when you hit the [V] button in PLANETS.EXE, use the following procedure:
- Write your program as usual, but make it able to handle the PATH.DAT / VCRINIT.TMP conventions.
- If your program finished, chain to PLANETS.EXE, passing it the correct path as argument. You can use a C function of the "exec()" family for this. Implementing such a function is tricky under DOS, so if you don't have it, an alternative is shrinking your program to a minimum stub and spawning PLANETS.EXE as usual, as a sub-process. Note however that this will fill up memory if the user invokes the VCR many times. Even this problem can be avoided by using some kind of a resident PLANETS.EXE loader, but it's probably not worth the trouble.