Space Rogue Save File Editing v1.00
Copyright 2009 by Vanshilar
If you find any bugs or errors, or have any comments or anything to add
(especially if there are any quests that you know of that's not listed here),
please look for me on the Abandonia.com forums. This is written for the PC
version of the game.

This may be not be reproduced under any circumstances except for personal,
private use. It may not be placed on any web site or otherwise distributed
publicly without advance written permission. Use of this guide on any other web
site or as a part of any public display is strictly prohibited, and a violation
of copyright. If you want permission, look for me on Abandonia.com.

SAVE FILE EDITING
-----------------
The save files are stored in the same directory as the executable, with the
name that you gave during saving plus a ".SAV" suffix. You can edit the save
file with any regular hex editor, or any other program that can read ASCII
values (0-255) from files. The save file is a fixed-length file, always 1151
bytes long. Any value that uses two bytes to store (such as number of credits)
means the value of the second byte should be multiplied by 256. For all byte
locations in this document, the index starts from 1, not 0, so the first byte
is byte 1, not byte 0. Rather than try to cover the whole save file (because
most of the data just involved the ship positions and so forth), this'll be
about the more important stuff.

Byte 7 is whether or not your components are damaged. This is stored with each
bit representing each component, so:
32 = ECM
16 = fore shields
8 = aft shields
4 = engine
2 = laser
1 = missile launcher
These values are additive. So a value of 21 (16 + 4 + 1) means that your fore
shields, engine, and missile launcher are damaged.

Bytes 283 and 284 determine how much armor you currently have.

Byte 619 determines which ship you have:
0 = Sunracer
1 = Wasp
2 = Dart
3 = Cruiser
4 = Vulture
5 = Corsair
6 = Titan
7 = Scow
8 = Tanker
9-11 = SM-1, Nova, and plasma, but you continually lose armor and then die
12 = Hunter
For the implications of using different ships, see my general walkthrough.

Bytes 983 to 994 determine your name, in regular ASCII characters.

Byte 995 determines which star system you're in:
0 = Karonus
1 = Deneb
2 = Gryphon
3 = Arcturus
4 = Nar'See
5 = Bassruti
6 = Sigure
7 = Zed N27
9 = Ja-Karn

Bytes 996 and 997 are your position in the map. Byte 996 is your X-axis (left-
right) position, starting with 0 on the left, while byte 997 is your Y-axis
(up-down) position, starting with 0 on the bottom.

Bytes 1004 and 1005 are the bounty on you.

Bytes 1006 and 1007 are the number of credits you have. Note that because only
two bytes are used to store your number of credits, it's capped by the game at
65535.

Byte 1008 is your repute:
0 = unknown
1 = pesky
2 = fierce
3 = deadly
4 = ace
5 = invincible

Bytes 1010 and 1011 are your desired map coordinates (where you want to move
to). Byte 1010 is your X-axis and byte 1011 is your Y-axis.

Bytes 1012 to 1015 are your relations with pirate, guild (merchant), Imperium,
and Manchi, respectively:
254 = hated
255 = disliked
0 = neutral
1 = liked
2 = ally
Although not shown, you start out as hated by the Manchi, but this can be
changed by editing the save file.

Bytes 1016 to 1018 are the number of Nova, SM-1, and plasma that you have.
0-127 are positive amounts, while 128-255 are negative amounts. Meaning if the
value is 250, then you really have -6 missiles. If you have negative missiles,
you can fire them for free, each time adding another -1 to your amount.

Bytes 1019 and 1020 are the maximum amount of armor you can have.

Byte 1021 is your amount of ECM.

Bytes 1022 and 1024 are your fore and aft shields.

Byte 1023 is the laser that you have:
0 = none
1 = garnet
2 = beryl
3 = sapphire
4 = particle
5 = invisible, but you do 58 damage each shot. Basically triple damage beyond
what particle beam gives you.
Note that this will change only if you're using the Sunracer. Otherwise, the
laser is based on whichever ship you have.

Byte 1026 is the multiplier on your acceleration. 250 is your standard amount.
251 will double your acceleration, and is toggled when you buy a turbo
thruster. 252 will double your acceleration compared with 251, so forth and so
on. At 255, you're basically as fast as you can adjust your speed via the
keyboard. You can set it to 0, 1, etc. as well for even faster accelerations.
Works only if you're using the Sunracer, not if you're using other ships.

Bytes 1027 to 1031 are the onboard items:
1027 = stealth box (from Sir Eld or Prosk)
1028 = beam lock (from Duchess Avenstar)
1029 = turbo thruster (note that this is the item only, the actual effect is
from adjusting byte 1026)
1030 = repair droid (from LUX-23A/Chi-Sha quest)
1031 = null damper (from Free Guild or Prosk)

Bytes 1032 to 1047 are the items on your person:
1032 = key card (from Cebak's room or Robocrook)
1033 = Manchi egg (from Trochal)
1034 = CRC-07 form (from Orellian)
1035 = transmutation coil (from ISS Koth)
1036 = NS Booster (from Bassruti Station)
1037 = statuette (from Sir Eld)
1038 = Malir artifact (from Dr. Felsane)
1039 = ruby cube (from Robocrook)
1040 = Tiwa's letter (from Tiwa)
1041 = psionic shield (from Omas Tyran or MiCon IV)
1042 = microchip (from Flitch)
1043 = pilot's license (from Orellian)
1044 = forged cargo papers (from Robocrook)
1045 = amoebic lenses (from Veda)
1046 = blog globe (from Veda)
1047 = dilithium gem (from Ross Station)

Bytes 1048 to 1068 are whether or not you've already picked up the above (ship
and person) items from bases, for the ones where you could, in the respective
slots:
1052 = null damper (from Free Guild)
1053 = key card (from Karonus)
1054 = Manchi egg (from Trochal)
1056 = transmutation coil (from ISS Koth)
1057 = NS Booster (from Bassruti Station)
1062 = psionic shield (from MiCon IV)
1068 = dilithium gem (from Ross Station)

Bytes 1069 to 1076 are the cargo that you're carrying:
0 = X-rated holos
1 = explosives
2 = forged CRs
3 = anagathics
4 = shunt valves
5 = 1GB RAMs
6 = antibiotics
7 = supercomputer
8 = methane
9 = titanium
10 = radioactives
11 = dilithium
12 = manure
13 = seaweed
14 = solvent grey
15 = hybrid grain
16 = souvenirs
17 = video games
18 = brandy
19 = exotic pets
20 = spoiled
255 = empty

Bytes 1077 to 1084 are the prices you paid for the cargo.

Byte 1085 is how many cargo slots you can carry.

Byte 1086 is the chance of a ship appearing. It's not out of 100 though; I'm
not sure what the denominator is. This value is taken from the MAPS file for
the star system that you're in.

Bytes 1087 to 1091 are how the relative chances of a Hunter, pirate, merchant,
Imperium, or Manchi ship appearing, respectively. Note that these five bytes
add up to 100. These values are taken from the MAPS file for the star system
that you're in.

Byte 1093 is whether or not you can enter the base:
0 = Can enter
1 = Can't enter because you fired on it
2 = Can't enter because of trouble-making while on base

Bytes 1106 to 1137 are RPG toggles (mostly 0 = not yet and 1 = completed) for
the plots and quests:
1106 = If you've talked to Duchess Avenstar
1107 = If Duchess Avenstar's told you about Captain Targon
1108 = If someone's tried to assassinate Duchess Avenstar and she's left
1109 = If you've injected Captain Targon with NSB and been told about Koth
1110 = If you've talked to Priestness Vilanie
1111 = If you've told Gut about why the Manchi egg is important, and he'll go
attack Trochal while you take the egg
1112 = If you've told Gut about Koth's plot, but you don't know why the egg is
important, so you need to find Ichiki
1113 = If Ichiki has told you about the Manchi
1114 = If you've used the warp drive to go to Ja-Karn
1115 = If you've offered to find a transmutation coil for Prosk
1116 = If you've given the transmutation coil to Prosk
1117 = If you've told Prosk about the egg and he's installed the warp drive,
but you need the coordinates
1118 = If Omar's approved you to talk to Gut
1119 = If you still need to plunder a merchant ship to talk to Gut
1120 = If you still need to kill a Titan to talk to Gut
1121 = Omas and his wife quest (0 = haven't started, 1 = you've asked Omas for
help, 2 = you've offered to help find his wife, 3 = you've talked to Sister
Nycene about Omas)
1122 = If you've let Dr. Elanius Ferah touch your face
1123 = Dr. Felsane's alien research quest (0 = haven't started, 1 = you've
accepted the quest, 2 = you've told Borf "Rakbit" successfully, 3 = you've
returned to Dr. Felsane with the results)
1124 = If Flitch has given you a microchip for Chi-Sha
1125 = Unknown (if anyone knows, please let me know and I'll credit you!)
1126 = If you've given the statuette to Orellian (0 = not yet, 1 = you failed
(said was bribe), 2 = you succeeded (said wasn't bribe)
1127 = LUX-23A quest (0 = haven't started, 1 = you've accepted LUX-23A's quest,
2 = you've returned Chi-Sha to LUX-23A)
1128 = Sir Eld's statuette quest (0 = haven't started, 1 = received statuette
from Sir Eld, 2 = failed so Sir Eld doesn't like you, 3 = succeeded and Sir
Eld's given you stealth box)
1129 = If Janus has tried to bribe you
1130 = Tiwa's letter quest (0 = haven't started, 1 = you've given the letter to
Cebak, 2 = Tiwa's told you about the key card)
1131 = If you've bought Geul Barnet a drink
1132 = If you've been burned by HAL9K (this allows Veda to see your scar)
1133 = Whom Toom has already talked about, doesn't increase if you've talked to
him today already (0 = haven't started, 1 = Avenstar, 2 = Flitch, 3 = Dr.
Elanius Ferah, 4 and above = Vilanie)
1134 to 1137 = unknown or not used

Bytes 1138 to 1151 are whether or not you've talked to these people today,
usually so they won't say anything meaningful until you revisit them (1 means
you've talked to them, reset to 0 at the beginning of every day):
1138 = unknown
1139 = Dr. Felsane
1140 = Borf
1141 = Chi-Sha
1142 = LUX-23A
1143 = Robocrook
1144 = Drak Stephons
1145 = Sir Eld
1146 = Blutous
1147 = Omas Tyran
1148 = unknown
1149 = Kale when you have a bounty on you, and you've paid him off
1150 = Veda
1151 = Toom

GAME FILE EDITING
-----------------
MAPS:
This file contains the data for all the maps, each map in a 1346-byte chunk.
The data for each map starts at:
Byte  Map
1     Hiathra
1347  MiCon I
2693  Denebprime
4039  Ross
5385  ConVecEast
6731  ISS Koth
8077  MiCon II
9423  Lagrange
10769 Free Guild
12115 Bassruti
13461 Trochal
14807 MiCon IV
16153 Karonus
17499 Deneb
18845 Gryphon
20191 Arcturus
21537 Nar'see
22883 Bassruti
24229 Sigure
25575 Zed N27
26921 Ja-Karn
28267 HIVE! map

For each map, the first 1024 bytes are taken up by the actual 32x32 map itself,
in rows starting from the upper left corner. To figure out which byte value
maps to which icon, you can just compare the values to the map of the bases or
stars.

Byte 1025 is the type of map (0 = star map, 1 = base map, 2 = HIVE! map)

Bytes 1026 to 1029 are empty (zero).

Bytes 1030 to 1039 are the name of the map (in ASCII).

Byte 1040 is empty (zero).

Bytes 1041 to 1072 are the X-coordinates (starting from left) of objects or
characters.

Bytes 1073 to 1104 are the Y-coordinates (starting from bottom) of objects or
characters.

The rest (bytes 1105 to 1346) depends on the type of map.

For base maps (i.e. maps in overhead view):
Bytes 1105 to 1136 are the type of movement that the object has:
128 = stays still
129 or 130 = wanders
131 = chases you from anywhere on the map (used for the monster on Bassruti)
132 = chases you once on screen (i.e. Vilanie and Vengor)

Bytes 1137 to 1168 are the object icon to use.

Bytes 1169 to 1200 are the type of object or character:
0 = Duchess Avenstar
1 = Captain Targon
2 = Priestess Vilanie
3 = Sir Droughton Gut
4 = Professor Prosk
5 = Vengor
6 = Ichiki
7 = Omar
8 = Sister Nycene
9 = Dr. Felsane
10 = Flitch
11 = Borf
12 = Orellian
13 = Chi-Sha
14 = LUX-23A
15 = Robocrook
16 = Imperial Trooper (on ISS Koth)
17 = Drak Stephons
18 = Sir Eld
19 = Teb
20 = Blutous
21 = Janus
22 = Omas Tyran
23 = Dr. Elanius Ferah
24 = Cebak
25 = Tiwa
26 = Geul Barnet
27 = HAL9K
28 = Kale
29 = Somar Tan
30 = Veda
31 = Toom
32 = Cargo Merchant
33 = Guard
34 = Outfitter
35 = Supply and Repairs
36 = Bartender
128 = stealth box
129 = beam lock
130 = turbo thruster
131 = repair droid
132 = null dampe
133 = key card
134 = Manchi egg
135 = CRC-07 form
136 = transmutation coil
137 = NS Booster
138 = statuette
139 = Malir artifact
140 = ruby cube
141 = Tiwa's letter
142 = psionic shield
143 = microchip
144 = pilot's license
145 = forged cargo papers
146 = amoebic lenses
147 = blog globe
148 = dilithium gem
160 = locked door
161 = safe

Bytes 1201 to 1232 determine, for the locked doors, whether or not the key card
can open the door:
0 = key card can open, or not a locked door
1 = key card does not fit locked door (can only pick door)

Bytes 1233 to 1296 determine which text to use for the signs. Note that each
object receives two bytes (in a row) rather than one. The two bytes give the
location in STRAD that gives the right location in STRINGS to find the text.

Byte 1297 is the type of base. This affects the message that you get when you
land on a base, and how hard the base will expel you when you undock:
16 = Station
17 = Carrier
18 = Outpost
19 = Starbase

Bytes 1298 and 1299 are the X- and Y-coordinates for the random character.

Bytes 1300 to 1304 are empty (zeros).

Bytes 1305 to 1336 are the type of object or character:
0 = your entrance point
2 = your exit point
37 = initiates conversation on contact(Vengor, Vilanie)
84 = alarm plate
131 = HIVE! game
133 = character
134 = Door or Safe
135 = Item that you can get
136 = Sign
199 = Transmutation coil

Bytes 1337 to 1341 are the base values for cargo (contraband, high-tech, raw
materials, agriculture, luxury goods). Please see my general walkthrough for
how these values are converted to cargo prices.

Bytes 1342 to 1346 are the relative likelihoods of the five types of cargo
being available for sale.

For star maps:
Bytes 1105 to 1136 are how the objects move. For example, ion storms have a
value of 1, planets have values of 3 or 4, etc.

Bytes 1137 to 1168 are the icons for the objects.

Bytes 1169 to 1200 are the type of object:
13 = Planetoid (in Sigure)
14 = Terrestrial Planet
15 = Gas Giant
16 = Station
17 = Carrier
18 = Outpost
19 = Starbase
20 = Malir Gate
21 = Black Hole
100 = Ion Storm

The purpose of bytes 1201 to 1232 for star maps is not yet known.

Bytes 1233 to 1296 determine which text to use for the log entries and other
messages in the navigation panel. As with the base maps, each entry receives
two consecutive bytes.

The purpose of bytes 1297 and 1298 for star maps is not yet known.

Byte 1299 is the likelihood of a ship encounter. However, it's not out of 100;
I'm not sure what it's out of. Bytes 1300 through 1304 are the relative chances
of a Hunter, pirate, merchant, Imperium, or Manchi ship, respectively, when a
ship appears. These are the values that the save file will save for your
current system. The values for each system are:
Star     Karonus Deneb Gryphon Arcturus Nar'see Bassruti Sigure ZedN27 Ja-Karn
Chance     40     53     38       30      45       45      30     30     85
Hunter     10     10     10       10      10       10      10     10      0
pirate     10     10     20        5      20       30      25     20      0
merchant   45     45     40       45      40       35      30     35      0
Imperium   30     30     25       35      20       10      10     10      0
Manchi      5      5      5        5      10       15      25     25     100

Bytes 1305 to 1312 are empty (zeros).

Bytes 1313 to 1320 are most likely related to the bases, but I haven't
researched them yet.

Bytes 1321 to 1328 are empty (zeros).

Bytes 1329 to 1344 are the info for the Malir gates, in 4-byte sections. The
first byte is the destination of the Malir gate:
0 = Karonus
1 = Deneb
2 = Gryphon
3 = Arcturus
4 = Nar'See
5 = Bassruti
6 = Sigure
7 = Zed N27
9 = Ja-Karn
The next two bytes are the X- and Y-coordinates of your destination,
respectively. The last byte is how far you have to travel to reach your
destination, basically how many rings you have to travel through when going
through a Malir gate. Each light year is basically 4 rings. Note that there's a
small bug here; you have to travel 11 light years to go from Nar'see to
Bassruti, but only 10 to go from Bassruti to Nar'see.

Bytes 1345 to 1346 are empty (zeros).

STRINGS
-------
This file encodes most of the text in the game. However, it's in compressed
form. I haven't decoded how the compression works yet, but I know it's pretty
efficient. For example, the beginning text of when you meet Duchess Avenstar
takes up 226 bytes on screen, but only 133 bytes in the file -- an average of
4.7 bits per letter. It does seem to be some sort of replacement code, because
changing individual bytes will only affect that particular location in the
text, but not simply ASCII transcription. Also, text may begin in the middle of
a byte, furthering enhancing the effectiveness of the compression.

STRAD
-----
Although STRINGS encodes the text, each page of text, as well as each option
that you can choose, has an entry in STRAD. This file points to the correct
location in STRINGS for the game to display. Each "pointer" consists of three
bytes. The first, plus 256 * the second, is the byte location in STRINGS to
begin. The third is the bit within the byte to start reading. By changing these
values, you can read through all the text in STRINGS. Just (for example) save
your game so that you're about to meet Duchess Avenstar for the first time,
then change the first three bytes of STRAD (which points to where in STRINGS to
display for this) to whichever location in STRINGS you want to read.

Each character in the game takes up at most 64 pages, with empty "filler" pages
(that just point to half-byte blank pages in STRINGS) to fill the rest if
unused. The list is below; note that this is the same order as for the
characters in MAPS:
Byte Character
1    Duchess Avenstar
193  Captain Targon
385  Priestess Vilanie
577  Sir Droughton Gut
769  Professor Prosk
961  Vengor
1153 Ichiki
1345 Omar
1537 Sister Nycene
1729 Dr. Felsane
1921 Flitch
2113 Borf
2305 Orellian
2497 Chi-Sha
2689 LUX-23A
2881 Robocrook
3073 Imperial Trooper (on ISS Koth)
3265 Drak Stephons
3457 Sir Eld
3649 Teb
3841 Blutous
4033 Janus
4225 Omas Tyran
4417 Dr. Elanius Ferah
4609 Cebak
4801 Tiwa
4993 Geul Barnet
5185 HAL9K
5377 Kale
5569 Somar Tan
5761 Veda
5953 Toom

Then there are a lot of empty "filler" pages, until bytes 11071 to 11130 which
are the text for the signs on bases. The rest are other similar subsidiary game
text, such as the names of the items, the ship/onboard screens, death messages,
and so forth.

To give an example for how all this works, the sign outside Hiathra's office
has the values (106, 14) in the MAPS file. This corresponds to 106 + 14*256 =
3690. The 3690th entry in STRAD (starting from 0, since the game index starts
from 0) are bytes 11071 to 11073 (since 3690*3 = 11070). These byte values
(114, 184, 1) give the location in STRINGS to look for the text (byte 114 +
184*256 = 47241, starting at the first bit). The text here, once decoded, is
what you see when you read the sign: "Office of the Imperial Representative".

UNRESOLVED ISSUES
-----------------
Currently, how the RPG plots actually work is unknown. I suspect the TALK file
to be involved, but I don't know how. Figuring that out would help in
determining if there are any plots that aren't listed here, especially what
byte 1025 of the save file refers to.
