Some Priv (1) hacks if anyone wants em

Storm

Spaceman
A long time ago I wrote some utilities for Privateer 1. I thought I might post them.

Unfortunately I used a DOS compiler (Borland C++ 3.0) to make the EXEcs, I have no idea if they would run under modern OS's (Probably wouldn't. Maybe under DOSBox?).

I run "old games" on a DOS 6.22 machine (Pentium-166 IBM Personal Computer 350, with 2 Gb HD and RAM maxed to the highest possible at 192 Mb. No Modem. Quite an antique.)

*IF* there is interest, an admin can e-mail me or post here or whatever and I can deposit the EXEcs someplace for hosting on the WC... a disclaimer could be stated w/ the download links that these are PURE DOS programs.

Even better, though, I will post the source code. Someone else can turn these into modern-OS utilities, for people who run Privateer in DOSBox. (BTW I have *never* tried DOSBox - always kept a DOS machine for DOS games). (Again, maybe the DOS EXEcs can run under DOSBox(?))

Due to the size of the files, I will post them separately.

=====

One note... the patch that I will post gets rid of asteroids on a NavPoint-by-NavPoint basis; rather then "one old hack" that "SORT-OF" got rid of all asteroids.

The old hack involved searching a file(s) (apparantly in Privateer / SpeechPak / Righteous Fire add-on, you modify PRIVATEER.EXE and PRSO.EXE; for the all-in-one CD version, apparantly you modify PRCD.EXE. The only version I have / have ever had is the CDROM all-in-one version with full speech and Righteous Fire; then later the CD Rom Classics Gold Edition, which I assume is the same thing).

Then you searched for the string
ASTEROID ASTRTYPE ASTROID1 ASTROID2
... then you changed it to:
ASTEROID TRSHTYPE BODYPRT1 BODYPRT2

... this DOES get rid of the rocks (Nothing to run into any more) but NOT the asteroid field. If you try to autopilot out, you get an "Asteroids Near" message and you have to wait to leave the area before you can use autopilot.

The patch I will post removes the asteroid fields themselves from the navpoints by modifying the .TRE files (PRIV.TRE, RF.TRE). Autopilot works. I leave a couple of asteroid fields intact in out of the way places to play with.

(It goes without saying that you have to use the NO-CD configuration for this to work, to get the HD to "see" the .TREs on your hard drive).

Since I am posting the source, of course they can be modified to taste.
====
So I will post the patch readme, the patch source code, and sources for a couple of other utilities. NOTE that these are applicable to the CD ROM Classics Edition of Privateer / Righteous Fire. Modifications might be necessary for other versions. BUT the patch itself does a simple check of the .TRE files.
 
===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
This patch was developed for the CD-ROM CLASSICS GOLD EDITION of Privateer
and Righteous Fire. It modifies data in the two TRE files, changing three
major characteristics of the two games.

It probably would not work with other versions of the two games. A simple
check is performed (using file length) in the program to determine if the
correct versions of the TRE files are being modified.

The patch program can be deleted after you run it.

The "NO CD" hack must be applied before you run the patch; copy PRIV.TRE and
RF.TRE from the CDROM to the hard drive into the C:\PRIVATER directory, and
modify PRIV.CFG and RF.CFG to point to the hard drive versus the CDROM:
(PRIV.CFG) =c:\privater\priv.tre
(RF.CFG) =c:\privater\rf.tre

There is no provision for reversal; to restore the games to the default
state, you must re-copy the TRE files again from the CD-ROM to the game
directory.
===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
(1) ASTEROIDS
Most asteroid fields are disabled on a navpoint-by-navpoint basis in the two
TRE files. The fields that were chosen are based on proximity to Main Plot
Mission locations and routes, even if there was only a remote possibility
that an asteroid field might be on a route or a stopping-off point to a Main
Plot location. If one field in a given system was chosen to be disabled for a
Main Plot Mission or route, then all fields in that system are disabled. If
an asteroid field was disabled for one of the two games (PRIV or RF), then it
was also disabled in the other game (PRIV or RF) for consistancy.

As it happens, this removes most of the asteroid fields from the two games;
40 of 46 fields in 26 systems for Privateer and 46 of 52 fields in 27 systems
for Righteous Fire. A few asteroid fields are left in the games for the
player to experience. These leftover fields will be in rarely visited
locations. The fields that are left over are common to both Privateer and
Righteous Fire.

Systems in which all asteroid fields have been disabled:
17_AR
Blockade Point Alpha (including a new nav point in Righteous Fire/RF.TRE)
Blockade Point Tango
Capella
Crab-12
Famine
Nexus
Nitir
Palan
Pender's Star
Pentonville
Pestilence
Prasepe
Pyrenees
Ragnarok
Regallis
Rikel (including a new one around the jump point to Eden/RF.TRE)
Rygannon
Sherwood
Telar
Delta
Gamma
Beta
Valhalla
War
Xytani
Eden (only in Righteous Fire/RF.TRE)

Asteroid fields retained (these systems totally unmodified in both games):
CM-N1054: Nav 1 jump to Pyrenees
Mah'Rahn: Nav 1 jump to Blockade Point Tango
Tr'Pakh: Hidden Action Sphere
Lisacc: Nav 1 Lisacc Mining Base, Nav 2 jump to Blockade Point Tango
Pollux: Hidden Action Sphere
===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
(2) MODIFIED FLIGHT PERFORMANCE for ALIEN and ENEMY SHIPS
The Steltek Scout that installs the power booster for the player's Steltek
Gun in Privateer constantly "buzzed" the player's ship during the dialogue,
which is nerve wracking. I have personally experienced severe collisions,
even when the player ship was not moving. This patch reduces the speed for
the Scout almost to immobility. The player can safely approach the Scout and
complete the dialogue.

The hostile Steltek Drone in Privateer, and the Salthi ships in Righteous
Fire will have reduced flight performance equivalent to that of a standard
Tarsus, with even more severe reduction to afterburner speed.
===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
(3) PALAN SYSTEM NAV 4, Planet Palan
The infinite waves of Bounty Hunter Demons in orbit around planet Palan,
Nav 4 have been changed to Retro Talons for both games. This does NOT apply
to Lynn Murphy's last mission in Privateer; the mission enemies around Palan
will still be Bounty Hunters. This only applies when you fly to Palan and you
are NOT flying Murphy's last Privateer mission. This was done by altering the
nav point data (NOT the mission data) for both games.

This provides the player with a predictable way to improve reputation. Just
fly to Palan Nav 4 in Privateer or Righteous Fire and destroy some Retro
Talons. Again, there will be infinite waves of them, so at some point you
will have to fly away and then engage the last few that have chased you.
===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== ===== =====
 
Code:
// User patch for CD-ROM CLASSICS GOLD EDITION of Privateer and Righteous 
// Fire. 

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

FILE *FP;

int i;
long FileEnd;

void main (void)
{
cprintf("\r\nChecking the TRE files for Privateer and Righteous Fire ...\r\n");
// Check the two TRE files
// Open PRIV.TRE, display an error and exit if the file is not found
if ((FP=fopen("PRIV.TRE","r+b"))==NULL)
 {
  cprintf("\a\r\nMISSING PRIV.TRE");
  fcloseall();
  exit(0);
 }
// Determine how many bytes are in the file
fseek(FP,0L,SEEK_END);
FileEnd=ftell(FP);
// Check the file size, abort if incorrect
if (FileEnd!=89486108L)
 {
  cprintf("\a\r\nPRIV.TRE MUST BE 89,486,108 BYTES IN LENGTH");
  fcloseall();
  exit (0);
 }
// close the file
fclose (FP);

// Open RF.TRE, display an error and exit if the file is not found
if ((FP=fopen("RF.TRE","r+b"))==NULL)
 {
  cprintf("\a\r\nMISSING RF.TRE");
  fcloseall();
  exit(0);
 }
// Determine how many bytes are in the file
fseek(FP,0L,SEEK_END);
FileEnd=ftell(FP);
// Check the file size, abort if incorrect
if (FileEnd!=72960246L)
 {
  cprintf("\a\r\nRF.TRE MUST BE 72,960,246 BYTES IN LENGTH");
  fcloseall();
  exit (0);
 }
// Close the file
fclose (FP);

// disable asteroids in Privateer
cprintf("\r\nDisabling 40 of the 46 asteroid fields in Privateer ...\r\n");
// Open PRIV.TRE for modifications
if ((FP=fopen("PRIV.TRE","r+b"))==NULL)
  {
   cprintf("\a\r\nERROR in opening PRIV.TRE");
   fcloseall();
   exit(0);
  }
fseek(FP,0x0069F537L,SEEK_SET);  // 17-AR N2
fputc(0,FP);
fseek(FP,0x006A1CEDL,SEEK_SET);  // BP Alpha N2
fputc(0,FP);
fseek(FP,0x006A2D99L,SEEK_SET);  // BP Tango N2
fputc(0,FP);
fseek(FP,0x006A2DD1L,SEEK_SET);  // BP Tango N4
fputc(0,FP);
fseek(FP,0x006A35DBL,SEEK_SET);  // Capella N2 Drake Pirate Base
fputc(0,FP);
fseek(FP,0x006A4C9FL,SEEK_SET);  // Crab-12 Hidden
fputc(0,FP);
fseek(FP,0x006A6133L,SEEK_SET);  // Famine N4
fputc(0,FP);
fseek(FP,0x006B2543L,SEEK_SET);  // Nexus N3 Macabee Mining Base
fputc(0,FP);
fseek(FP,0x006B30D3L,SEEK_SET);  // Nitir N3 
fputc(0,FP);
fseek(FP,0x006B4E43L,SEEK_SET);  // Palan N2 
fputc(0,FP);
fseek(FP,0x006B5695L,SEEK_SET);  // Pender's Star N2 
fputc(0,FP);
fseek(FP,0x006B5CD5L,SEEK_SET);  // Pentonville N1 Oakham Pirate Base 
fputc(0,FP);
fseek(FP,0x006B73E5L,SEEK_SET);  // Pestilence N2 
fputc(0,FP);
fseek(FP,0x006B837BL,SEEK_SET);  // Prasepe N3 Saratov Mining Base 
fputc(0,FP);
fseek(FP,0x006B8FE3L,SEEK_SET);  // Pyrenees N6 Basque Mining Base 
fputc(0,FP);
fseek(FP,0x006B98B3L,SEEK_SET);  // Ragnarok N1 jump to BP Alpha 
fputc(0,FP);
fseek(FP,0x006B98F5L,SEEK_SET);  // Ragnarok N3 Mjolnar Agri Planet 
fputc(0,FP);
fseek(FP,0x006BAD0DL,SEEK_SET);  // Regallis N5 Kroneker Mining Base 
fputc(0,FP);
fseek(FP,0x006BB9CDL,SEEK_SET);  // Rikel N1 Jump to New Detroit 
fputc(0,FP);
fseek(FP,0x006BB9F5L,SEEK_SET);  // Rikel N2 Jump to Midgard 
fputc(0,FP);
fseek(FP,0x006BBA31L,SEEK_SET);  // Rikel N4 Vishnu Mining Base 
fputc(0,FP);
fseek(FP,0x006BBA4BL,SEEK_SET);  // Rikel N5 jump to 44-P-1M 
fputc(0,FP);
fseek(FP,0x006BBA95L,SEEK_SET);  // Rikel H3 Hidden 3  
fputc(0,FP);
fseek(FP,0x006BC0F3L,SEEK_SET);  // Rygannon N3 jump to Delta  
fputc(0,FP);
fseek(FP,0x006BDEA3L,SEEK_SET);  // Sherwood N3 Tuck's Pirate Base  
fputc(0,FP);
fseek(FP,0x006BEFDBL,SEEK_SET);  // Telar N2 Megiddo Pirate Base  
fputc(0,FP);
fseek(FP,0x006C1127L,SEEK_SET);  // Delta N2 
fputc(0,FP);
fseek(FP,0x006C114BL,SEEK_SET);  // Delta N4 
fputc(0,FP);
fseek(FP,0x006C170BL,SEEK_SET);  // Gamma N1 jump to Beta 
fputc(0,FP);
fseek(FP,0x006C1739L,SEEK_SET);  // Gamma N3 
fputc(0,FP);
fseek(FP,0x006C174BL,SEEK_SET);  // Gamma N4 
fputc(0,FP);
fseek(FP,0x006C175DL,SEEK_SET);  // Gamma N5 jump to Delta Prime 
fputc(0,FP);
fseek(FP,0x006C1D15L,SEEK_SET);  // Beta N2 
fputc(0,FP);
fseek(FP,0x006C1D39L,SEEK_SET);  // Beta N4 
fputc(0,FP);
fseek(FP,0x006C1D4FL,SEEK_SET);  // Beta N5 jump to Gamma 
fputc(0,FP);
fseek(FP,0x006C268BL,SEEK_SET);  // Valhalla N1 Valkyrie Mining Base 
fputc(0,FP);
fseek(FP,0x006C3649L,SEEK_SET);  // War N1 jump to Pestilence 
fputc(0,FP);
fseek(FP,0x006C3683L,SEEK_SET);  // War N3 jump to Troy 
fputc(0,FP);
fseek(FP,0x006C3E59L,SEEK_SET);  // Xytani N2 
fputc(0,FP);
fseek(FP,0x006C3E95L,SEEK_SET);  // Xytani Hidden 
fputc(0,FP);
// close PRIV.TRE
fclose (FP);

// disable asteroids in Righteous Fire
cprintf("Disabling 46 of the 52 asteroid fields in Righteous Fire ...\r\n");
// Open RF.TRE for modifications
if ((FP=fopen("RF.TRE","r+b"))==NULL)
 {
  cprintf("\a\r\nERROR in opening RF.TRE");
  fcloseall();
  exit(0);
 }
fseek(FP,0x00771370L,SEEK_SET);  // 17-AR N2
fputc(0,FP);
fseek(FP,0x00773C10L,SEEK_SET);  // BP Alpha N2
fputc(0,FP);
fseek(FP,0x00773C42L,SEEK_SET);  // BP Alpha N4
fputc(0,FP);
fseek(FP,0x00774CE4L,SEEK_SET);  // BP Tango N2
fputc(0,FP);
fseek(FP,0x00774D1CL,SEEK_SET);  // BP Tango N4
fputc(0,FP);
fseek(FP,0x00775526L,SEEK_SET);  // Capella N2 Drake Pirate Base
fputc(0,FP);
fseek(FP,0x00776BEAL,SEEK_SET);  // Crab-12 Hidden
fputc(0,FP);
fseek(FP,0x0077807EL,SEEK_SET);  // Famine N4
fputc(0,FP);
fseek(FP,0x0078448EL,SEEK_SET);  // Nexus N3 Macabee Mining Base
fputc(0,FP);
fseek(FP,0x0078501EL,SEEK_SET);  // Nitir N3 
fputc(0,FP);
fseek(FP,0x00786D8EL,SEEK_SET);  // Palan N2 
fputc(0,FP);
fseek(FP,0x007875E0L,SEEK_SET);  // Pender's Star N2 
fputc(0,FP);
fseek(FP,0x00787C20L,SEEK_SET);  // Pentonville N1 Oakham Pirate Base 
fputc(0,FP);
fseek(FP,0x00789330L,SEEK_SET);  // Pestilence N2 
fputc(0,FP);
fseek(FP,0x0078A2C6L,SEEK_SET);  // Prasepe N3 Saratov Mining Base 
fputc(0,FP);
fseek(FP,0x0078AF2EL,SEEK_SET);  // Pyrenees N6 Basque Mining Base 
fputc(0,FP);
fseek(FP,0x0078B7FEL,SEEK_SET);  // Ragnarok N1 jump to BP Alpha 
fputc(0,FP);
fseek(FP,0x0078B840L,SEEK_SET);  // Ragnarok N3 Mjolnar Agri Planet 
fputc(0,FP);
fseek(FP,0x0078CC6CL,SEEK_SET);  // Regallis N5 Kroneker Mining Base 
fputc(0,FP);
fseek(FP,0x0078D974L,SEEK_SET);  // Rikel N1 jump to New Detroit 
fputc(0,FP);
fseek(FP,0x0078D99CL,SEEK_SET);  // Rikel N2 jump to Midgard 
fputc(0,FP);
fseek(FP,0x0078D9D8L,SEEK_SET);  // Rikel N4 Vishnu Mining Base 
fputc(0,FP);
fseek(FP,0x0078D9F2L,SEEK_SET);  // Rikel N5 jump to 44-P-1M 
fputc(0,FP);
fseek(FP,0x0078DA3CL,SEEK_SET);  // Rikel H3 Hidden 3 
fputc(0,FP);
fseek(FP,0x0078DA52L,SEEK_SET);  // Rikel HJ Hidden jump to Eden 
fputc(0,FP);
fseek(FP,0x0078E0AEL,SEEK_SET);  // Rygannon N3 jump to Delta 
fputc(0,FP);
fseek(FP,0x0078FE5EL,SEEK_SET);  // Sherwood N3 Tuck's Pirate Base 
fputc(0,FP);
fseek(FP,0x00790F96L,SEEK_SET);  // Telar N2 Megiddo Pirate Base 
fputc(0,FP);
fseek(FP,0x007930E2L,SEEK_SET);  // Delta N2 
fputc(0,FP);
fseek(FP,0x00793106L,SEEK_SET);  // Delta N4 
fputc(0,FP);
fseek(FP,0x007936C6L,SEEK_SET);  // Gamma N1 jump to Beta 
fputc(0,FP);
fseek(FP,0x007936F4L,SEEK_SET);  // Gamma N3 
fputc(0,FP);
fseek(FP,0x00793706L,SEEK_SET);  // Gamma N4 
fputc(0,FP);
fseek(FP,0x00793718L,SEEK_SET);  // Gamma N5 jump to Delta Prime 
fputc(0,FP);
fseek(FP,0x00793CD0L,SEEK_SET);  // Beta N2 
fputc(0,FP);
fseek(FP,0x00793CF4L,SEEK_SET);  // Beta N4 
fputc(0,FP);
fseek(FP,0x00793D0AL,SEEK_SET);  // Beta N5 jump to Gamma 
fputc(0,FP);
fseek(FP,0x00794672L,SEEK_SET);  // Valhalla N1 Valkyrie Mining Base 
fputc(0,FP);
fseek(FP,0x00795646L,SEEK_SET);  // War N1 jump to Pestilence 
fputc(0,FP);
fseek(FP,0x00795680L,SEEK_SET);  // War N3 jump to Troy 
fputc(0,FP);
fseek(FP,0x00795E56L,SEEK_SET);  // Xytani N2 
fputc(0,FP);
fseek(FP,0x00795E92L,SEEK_SET);  // Xytani Hidden 
fputc(0,FP);
fseek(FP,0x0079738CL,SEEK_SET);  // Eden Hidden (coded internally as N3) 
fputc(0,FP);
fseek(FP,0x0079739EL,SEEK_SET);  // Eden Hidden (coded internally as N4) 
fputc(0,FP);
fseek(FP,0x007973B0L,SEEK_SET);  // Eden Hidden (coded internally as N5) 
fputc(0,FP);
fseek(FP,0x007973C2L,SEEK_SET);  // Eden Hidden (coded internally as H3) 
fputc(0,FP);
// close RF.TRE
fclose(FP);

// modify ship performance in Privateer
// Open PRIV.TRE for modifications
if ((FP=fopen("PRIV.TRE","r+b"))==NULL)
  {
   cprintf("\a\r\nERROR in opening PRIV.TRE");
   fcloseall();
   exit(0);
  }
// Scout
fseek(FP,0x0092666CL,SEEK_SET);
 fputc(1,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(3,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(1,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(11,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(3,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(5,FP);fputc(0,FP);
cprintf("\r\nPrivateer: Steltek Scout flight performance severely reduced.\r\n");
// Drone
fseek(FP,0x009264A8L,SEEK_SET);
 fputc(19,FP);fputc(1,FP);fputc(0,FP);fputc(0,FP);
 fputc(44,FP);fputc(1,FP);fputc(0,FP);fputc(0,FP);
 fputc(95,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(105,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(97,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(144,FP);fputc(1,FP);
cprintf("Privateer: Steltek Drone flight performance reduced.\r\n");
// close PRIV.TRE
fclose (FP);

// modify ship performance in Righteous Fire
// Open RF.TRE for modifications
if ((FP=fopen("RF.TRE","r+b"))==NULL)
  {
   cprintf("\a\r\nERROR in opening RF.TRE");
   fcloseall();
   exit(0);
  }
// Salthi
fseek(FP,0x009FC22CL,SEEK_SET);
 fputc(19,FP);fputc(1,FP);fputc(0,FP);fputc(0,FP);
 fputc(44,FP);fputc(1,FP);fputc(0,FP);fputc(0,FP);
 fputc(95,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(105,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(97,FP);fputc(0,FP);fputc(0,FP);fputc(0,FP);
 fputc(144,FP);fputc(1,FP);
cprintf("Righteous Fire: Salthi flight performance reduced.\r\n");
// close RF.TRE
fclose (FP);

// modify Palan Nav 4 in Privateer
// Open PRIV.TRE for modifications
if ((FP=fopen("PRIV.TRE","r+b"))==NULL)
  {
   cprintf("\a\r\nERROR in opening PRIV.TRE");
   fcloseall();
   exit(0);
  }
// Change the 12 Bounty Hunter pilots in orbit around palan for PRIV.TRE
 fseek(FP,0x006B4620L,SEEK_SET);
 for (i=1;i<13;i++)
  {
   fprintf(FP,"%s","COM_DF");
   fputc(0,FP);
   fputc(0,FP);
  }
// Change the 12 Demons in orbit around palan for PRIV.TRE
 for (i=0;i<12;i++)
  {
   fseek(FP,(0x006B4A85L+(i*46)),SEEK_SET);
   fprintf(FP,"%s","TALNTYPETALRELIG");
  }
cprintf("\r\nPrivateer: Bounty Hunter Demons at Palan changed to Retro Talons.\r\n");
// close PRIV.TRE
fclose (FP);

// modify Palan Nav 4 in Righteous Fire
// Open RF.TRE for modifications
if ((FP=fopen("RF.TRE","r+b"))==NULL)
  {
   cprintf("\a\r\nERROR in opening RF.TRE");
   fcloseall();
   exit(0);
  }
// Change the 12 Bounty Hunter pilots in orbit around palan for RF.TRE
 fseek(FP,0x0078656BL,SEEK_SET);
 for (i=1;i<13;i++)
  {
   fprintf(FP,"%s","COM_DF");
   fputc(0,FP);
   fputc(0,FP);
  }
// Change the 12 Demons in orbit around palan for RF.TRE
 for (i=0;i<12;i++)
  {
   fseek(FP,(0x007869D0L+(i*46)),SEEK_SET);
   fprintf(FP,"%s","TALNTYPETALRELIG");
  }
cprintf("Righteous Fire: Bounty Hunter Demons at Palan changed to Retro Talons.\r\n");
// close RF.TRE
fclose (FP);

fcloseall();
}
 
Code:
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>

void main (int argc, char *argv[])
{
 FILE *FP;

 cprintf("\r\n");

 int x, i, Flag, MISLByteCount;
 char FileName[13];
 long FileEnd;
 long FilePosition;
 long MISLPOS;
 char Search[5];
 unsigned char MislType;
 unsigned char OldCount;

// Check for command line arguments
 x=argc;
 if (x!=2)
  {
   cprintf("\a\r\nUsage: MISL [[PRIV save name].SAV] or [[RF save name].PRS]");
   cprintf("\r\nThis utility increases all missiles in your inventory to 250 each.");
   exit (0);
  }

// Copy the file name from the command line argument
 strcpy(FileName, argv[1]);

// Open the file, display an error if file not found
 if ((FP=fopen(FileName,"r+b"))==NULL)
  {
   cprintf("\a\r\nCould not open file.");
   fcloseall();
   exit(0);
  }

// Determine how many bytes are in the file
 x=fseek(FP,0L,SEEK_END);
 FileEnd=ftell(FP);
 rewind(FP);

// Set up to scan for 'MISL'
 FilePosition=0;
// Force a null terminator into the last element of the search string
 Search[4]=0;
 Flag=0;

// Scan for 'MISL' record, step through the file one byte at a time
 do
  {
    x=fseek (FP,FilePosition,SEEK_SET);
    for (i=0;i<4;i++)
     {
      Search[i]=fgetc(FP);
     }
    x=fseek(FP,FilePosition,SEEK_SET);
    x=strcmp(Search,"MISL");

// If the above strcmp to MISL was a match then the MISL section was found,
// set Flag to 1 to exit at the end of the loop
    if (x==0)
     {
      Flag=1;
      MISLPOS=FilePosition;
     }

    FilePosition++;

// Search until 10 bytes before the end of file, Flag = -1 indicates that
// the search for MISL has failed. The smallest possible MISL section is
// 11 bytes long.
    if (FilePosition>=(FileEnd-10)) Flag=-1;

  } while (Flag==0);

// If no MISL section found
 if (Flag==-1)
  {
   cprintf("\a\r\nNo MISL section found in savegame.");
   x=fclose(FP);
   exit(0);
  }

// Indirectly aquire the number of missile types via MISL section Byte Count
 x=fseek(FP,MISLPOS+7,SEEK_SET);
 MISLByteCount=fgetc(FP);

// Set the position pointer to the first missile type specifier
 FilePosition=MISLPOS+8;

// Using the Byte Count as a counter that decrements by 3, step through
// the MISL section and set each count to 250 missiles
 while (MISLByteCount!=0)
  {
   x=fseek(FP,FilePosition,SEEK_SET);
   MislType=fgetc(FP);
   OldCount=fgetc(FP);
   FilePosition+=1;
   x=fseek(FP,FilePosition,SEEK_SET);
   x=fputc(250,FP);
   MISLByteCount-=3;
   FilePosition+=2;
   switch(MislType) {
    case 1:cprintf("\nProton Torp");break;
    case 2:cprintf("\nHS Missile");break;
    case 3:cprintf("\nFF Missile");break;
    case 4:cprintf("\nDF Missile");break;
    case 5:cprintf("\nIR Missile");break;
    default:cprintf("\nInvalid Missile Type");
   }
   cprintf(" %s %i %s","increased from",OldCount,"to 250\r");
  }
 
 cprintf("\r\n");
x=fclose(FP);
}
 
Code:
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>

FILE *FP;

int x, i;
char FileName[13];
long FileEnd;
long FilePosition=0;
long PLAYSPos=0;
char SearchPLAYS[9]="";
unsigned char WordLow;
signed char WordHigh; 
unsigned char UWordHigh;
signed int Reputation;
unsigned int Kills;
char RepInd[1]="";

void GetRep (void);

void main (int argc, char *argv[])
{
// Check for command line arguments
 x=argc;
 if (x!=2)
  {
   cprintf("\a\r\nUsage: REPUT [[PRIV save name].SAV] or [[RF save name].PRS]");
   cprintf("\r\nThis utility reports the numerical reputations of the various factions.");
   exit (0);
  }

// Copy the file name from the command line argument
 strcpy(FileName, argv[1]);

// Open the file, display an error if file not found
 if ((FP=fopen(FileName,"r+b"))==NULL)
  {
   cprintf("\a\r\nCould not open file.");
   fcloseall();
   exit(0);
  }

// Determine how many bytes are in the file
 fseek(FP,0L,SEEK_END);
 FileEnd=ftell(FP);
 rewind(FP);

// Scan up to FileEnd-56 chars; look for 'PLAYSCOR'
 do
   {
     fseek(FP,FilePosition,SEEK_SET);
     for (i=0;i<8;i++)
       {
         SearchPLAYS[i]=fgetc(FP);
       }
// Check 8 byte search string for 'PLAYSCOR'      
     x=strcmp(SearchPLAYS,"PLAYSCOR");
     if (x==0) PLAYSPos=FilePosition;
     FilePosition++;
     if (FilePosition>=(FileEnd-56)) PLAYSPos=-1;
   } while (PLAYSPos==0);
 
// Abort if 'PLAYSCOR' not found
 if (PLAYSPos<0)
  {
   cprintf("\a\r\nBAD SAVEGAME");
   fcloseall();
   exit(0);
  }

rewind(FP); 

textcolor(WHITE);
cprintf("\r\nFACTION    %7s %7s","REP","KILLS");

i=0;
GetRep();
cprintf("\r\nMERCHANTS: %7i %7i %3s",Reputation,Kills,RepInd);
i=1;
GetRep();
cprintf("\r\n  HUNTERS: %7i %7i %3s",Reputation,Kills,RepInd);
i=2;
GetRep();
cprintf("\r\n   CONFED: %7i %7i %3s",Reputation,Kills,RepInd);
i=3;
GetRep();
cprintf("\r\n KILRATHI: %7i %7i %3s",Reputation,Kills,RepInd);
i=4;
GetRep();
cprintf("\r\n  MILITIA: %7i %7i %3s",Reputation,Kills,RepInd);
i=5;
GetRep();
cprintf("\r\n  PIRATES: %7i %7i %3s",Reputation,Kills,RepInd);
i=6;
GetRep();
cprintf("\r\nSTL DRONE: %7i %7i %3s",Reputation,Kills,RepInd);
i=7;
GetRep();
cprintf("\r\nSTL SCOUT: %7i %7i %3s",Reputation,Kills,RepInd);
i=8;
GetRep();
cprintf("\r\n   RETROS: %7i %7i %3s\r\n",Reputation,Kills,RepInd);

 textcolor(LIGHTGRAY);
 cprintf(" ");
 fclose(FP);
}

void GetRep (void)
{
fseek(FP,PLAYSPos+12+(i*2),SEEK_SET);
WordLow=fgetc(FP);
WordHigh=fgetc(FP);
Reputation=WordLow+(256*WordHigh);
fseek(FP,PLAYSPos+12+26+(i*2),SEEK_SET);
WordLow=fgetc(FP);
UWordHigh=fgetc(FP);
Kills=WordLow+(256*UWordHigh);
if (Reputation<=-26) 
  {
    strcpy(RepInd,"H");
    textcolor(LIGHTRED);
  }
if (Reputation>=26) 
  {
    strcpy(RepInd,"F");
    textcolor(LIGHTGREEN);
  }
if ( (Reputation>=-25) && (Reputation<=25) ) 
  {
    strcpy(RepInd,"N");
    textcolor(LIGHTGRAY);
  }
}
 
(( NOTE: For this one, take a mission(s), then SAVE, then run the utility against your savegame ))
=====

Code:
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string.h>

int x, i;
char FileName[13];
long FileEnd;
long FilePosition=0;
char RetPIL[7]="COM_DF";
char RetSHP[17]="talntypetalrelig";
char SearchPIL[5]="";
char SearchSHP[15]="";

void main (int argc, char *argv[])
{
 FILE *FP;

 cprintf("\r\n");


// Check for command line arguments
 x=argc;
 if (x!=2)
  {
   cprintf("\a\r\nUsage: MISN [[PRIV save name].SAV] or [[RF save name].PRS]");
   cprintf("\r\nThis utility changes Pirate and Kilrathi random mission enemies into Retros.");
   exit (0);
  }

// Copy the file name from the command line argument
 strcpy(FileName, argv[1]);

// Open the file, display an error if file not found
 if ((FP=fopen(FileName,"r+b"))==NULL)
  {
   cprintf("\a\r\nCould not open file.");
   fcloseall();
   exit(0);
  }

// Determine how many bytes are in the file
 x=fseek(FP,0L,SEEK_END);
 FileEnd=ftell(FP);
 rewind(FP);

// Scan up to FileEnd-20 chars; get 4 byte pilot and 14 byte ship codes
 do
   {
     x=fseek(FP,FilePosition,SEEK_SET);
     for (i=0;i<4;i++)
       {
         SearchPIL[i]=fgetc(FP);
       }
     
     x=fseek(FP,FilePosition,SEEK_SET);
     for (i=0;i<14;i++)
       {
         SearchSHP[i]=fgetc(FP);
       }

// Check 4 byte search string for Pirate Pilot, if so change to Retro      
     x=strcmp(SearchPIL,"PIR_");
     if (x==0)
       {
         cprintf("\nFound Pilot: Pirate; Changing to Retro Fanatic Novice\r");
         x=fseek(FP,FilePosition,SEEK_SET);
         for (i=0;i<6;i++) x=fputc(RetPIL[i],FP);
       }

// Check 4 byte search string for Kilrathi Pilot, if so change to Retro      
     x=strcmp(SearchPIL,"KIL_");
     if (x==0)
       {
         cprintf("\nFound Pilot: Kilrathi; Changing to Retro Fanatic Novice\r");
         x=fseek(FP,FilePosition,SEEK_SET);
         for (i=0;i<6;i++) x=fputc(RetPIL[i],FP);
       }
   
// Check 14 byte search string for Pirate Talon, if so change to Retro Talon      
     x=strcmp(SearchSHP,"talntypetalpir");
     if (x==0)
       {
         cprintf("\nFound Ship: Pirate Talon; Changing to Retro Talon\r");
         x=fseek(FP,FilePosition,SEEK_SET);
         for (i=0;i<16;i++) x=fputc(RetSHP[i],FP);
       }

// Check 14 byte search string for KilDralthi, if so change to RetTalon      
     x=strcmp(SearchSHP,"draltypedralth");
     if (x==0)
       {
         cprintf("\nFound Ship: Kilrathi Dralthi; Changing to Retro Talon\r");
         x=fseek(FP,FilePosition,SEEK_SET);
         for (i=0;i<16;i++) x=fputc(RetSHP[i],FP);
       }

// Check 14 byte search string for KilGothri, if so change to RetTalon      
     x=strcmp(SearchSHP,"gothtypegothri");
     if (x==0)
       {
         cprintf("\nFound Ship: Kilrathi Gothri; Changing to Retro Talon\r");
         x=fseek(FP,FilePosition,SEEK_SET);
         for (i=0;i<16;i++) x=fputc(RetSHP[i],FP);
       }
     
     FilePosition++;
   } while (FilePosition<(FileEnd-20));
 
 fclose(FP);
}
 
(sorry... I should have used CODE tags to those posts... oh, well... the source code can still point the way for those interested)
 
looks interesting! thanks for posting, now to dust off the VC++ and see if i can compile in windoze :p
 
A lot of the stuff has been more or less documented for years. Raw info... to be altered with a hex editor. I just turned it into programs.

I think that turning the BH Demons around Palan into Retro Talons was somewhat new.

My biggest contribution was point-by-point removal of the asteroid fields. That came from staring (thru a hex editor) at the TRE files for a LOT of hours and drinking LOTZ of coffee and doing MANY experiments.
 
Back
Top