Jump to content

Savegame Hex Editing Format.


Slocket
 Share

Recommended Posts

I managed to figure out alot of the format for the savegame. I edited a special test universe with all else removed (using modified *TB.dat files).

 

I FINIALLY figured out how to change the number of Energy Slots in a savegame. Plus changing ships, people, locations, etc. This only works on a savegame. I can prove you can change the system energy lets say for this example Coruscant from initial 11 Energy to 18 Energy total.

 

Whether the AI would understand these changes is unknown to take advantage of much larger Energy slots available.

 

OK figured out how to get a picture to PAINT. No do you just upload it here somehow.

 

 

http://img354.imageshack.us/img354/7900/energyrp4.th.png

Edited by Slocket
Link to comment
Share on other sites

... I FINIALLY figured out how to change the number of Energy Slots in a savegame...

If you go over four more bytes, that's the location for the number of raw materials. The maximum number of energy or raw materials can be set to 256 (FF in hex), but of course when looking at the sector screen the bar goes out of the sector (it's truncated at the edge of the sector screen). Also, any system to the right is partially blocked by the elongated energy bar. I haven't game tested anything yet, so I'm not sure how the game would handle more than 14 singular items (i.e. 24 shipyards: one hex byte is 16 (0 thru F) so technically it should handle 15 items no problem, but it really depends on the internal coding).

 

I made a spreadsheet last spring to convert the hex of a saved game to decimal. I mapped out approximately 50% of it (I went through the entire file, but there are portions that I couldn't determine what it was for). Vakundok had a utility program that did an excellent job "decoding" the first 10%-25% approximately. I just built on that. It is quite cumbersome to do. I used a small galaxy game at the start (day 2) which was approximately ~300K big (in bytes). This would require 600+ pages if you wanted to print it out! My spreadsheet ended up being over 100 Meg's in size decoding this beast, and that was a small galaxy with minimal data! 8O

 

I've been working on my "Master Plan". Seeing how the saved game is laid out, I have a bit of confidence I could "build" a galaxy to approximate the true SW galaxy at the end of ANH. The first task is a WIP and nearing completion (see Galaxy Configuration). Once I have that done, I need to determine the initial state fo the SW galaxy: which systems were on which side & how much support; which were neutral; then facilities to which system (can anybody say Kuat shipyards :twisted: ); then add specified military forces and such, and finally making sure there are enough mines/refineries to maintain this galaxy configuration. Since I want the Empire to really kick some arse, I initially plan to have this "modified saved game" be a rebel game (hopefully the AI won't mess things up too bad).

 

I also believe I know the reason why the Traitor program doesn't work quite right. This is all hypothetical on my part. The Traitor program changes a "byte" in the saved game for which "side" is to be played, and that's all it changes. I believe that the mission objectives also need to be modified, and some other things "reversed" (Imperial to Alliance, and vice-versa) to make a true "swapping" game. I haven't dug too far into that, but it just came to me when scanning through my saved game spreadsheet. So, someday there might be some slight glimmer of light that a saved game editor could come to pass. But in the meantime, I'll be buying plenty of lottery tickets; I think my odds are better doing that :lol:

 

Keep up the good work Slocket!

Finally, after years of hard work I am the Supreme Sith Warlord! Muwhahahaha!! What?? What do you mean "there's only two of us"?
Link to comment
Share on other sites

Wow, it seems you do have task on your hands! I noticed the Energy and Resource can be modified, but there are two fields of entry. The first changes the actual real ingame used amount, the other set is purely the display information. If they are not both changed correctly at the same time, trouble will happen.

 

I did build a full set of refineries on a planet with 18 energy and it did not crash. It worked as normal for me, I do not know if the AI would build past 14; but I sure could build past 14 and works in game.

 

If you have mapped out a galaxy, how do you know what planet you are messing with? I can see patterns, that have a real effect, but the ID numbers do not behave well. I am using Hexprobe that allows filtered pattern searches of data which is very nice to figure out the format of a savegame.

 

BTY how do you know the planet ID in the save game? Example would be Coruscant for above.

 

Well, here is a format you may have seen. I am using an empty galaxy. Some mines are random 0-5.

 

EE---PT---RR---MM-------64---64---3

 

EE= Total planet Energy

PT= Amount of energy the planet is in use.

RR= Total plant Resource

MM= Number of Mines (displayed)

- is a 00.

 

I think a savegame editor of some sorts can be built by using the pattern recogniztion instead of static hex location to find the data to alter. I need to know the planet ID. The savegame format is one big beast to handle!

 

`Would it be fun to make our own EXE for the game? I have the ASM but it is hardly of use to make source code.`

Link to comment
Share on other sites

Wow, it seems you do have task on your hands! I noticed the Energy and Resource can be modified, but there are two fields of entry. The first changes the actual real ingame used amount, the other set is purely the display information. If they are not both changed correctly at the same time, trouble will happen.

Not quite; the first number is the maximum possible and the second number is the actual amount used in the game.

 

 

BTY how do you know the planet ID in the save game? Example would be Coruscant for above.

See the attached thumbnail

 

http://img143.imageshack.us/img143/5680/savedgamesamplesystemdajq2.th.jpg

 

This is a print from my spreadsheet. The left hand side is the hex data, with the decimal equivalent on the right hand side (I color coded it for an easier explanation).

 

The gray area is the sector information which includes a sector ID number corresponding to the ID numbers in the SECTORSD.DAT file.

 

The yellow area is the system information which includes a system ID number corresponding to the ID numbers in the SYSTEMSD.DAT file. I know there's info in there about system control (Imperial, Alliance or Neutral) and the popular support bar presuming the system is occupied. I just don't remember the fields, but I'll work on that later. You can see the system energy and raw materials info, and there is a field for the number of "items" on the system.

 

The two red and green fields represent Alliance and Imperial fleets, but I'm not sure of the details. I'm guessing the first occurance is for ships in orbit, and the other is for ships enroute.

 

The purple and blue areas are a mine & refinery. This is the area (right after the fleet data) where data for anything on the system is located. This can be fighters, facilities, characters, spec forces, etc.

 

The last three areas (red, orange, blue) I believe represent manufacturing (shipyards, training facilities, construction yards). I'm just not sure of the order, but that can wait until later.

 

The very end is beginning of another system info field (yellow).

 

Now, remember that field for the number of "items" on the system? There are the 4 fleet areas, 1 mine, 1 refinery, and 3 manufacturing areas: 4+1+1+3=9. This minimum number for this field is 7 because every system must have the fleet & manufacturing areas.

 

I hope this helps you out. I would like again to acknowledge that Vakundok laid the ground work for everything I've done.

 

 

I think a savegame editor of some sorts can be built by using the pattern recogniztion instead of static hex location to find the data to alter. I need to know the planet ID. The savegame format is one big beast to handle!

The saved game file changes size as things are built and/or destroyed in the game, therefore static hex locations would never work. Recognizing the header data for items is the only way to go.

Finally, after years of hard work I am the Supreme Sith Warlord! Muwhahahaha!! What?? What do you mean "there's only two of us"?
Link to comment
Share on other sites

:P Thanks for the very imformative post DarthTex! It certainly does help me understand the formats alot better and faster.

 

That is a good start for me to analyze stuff. It would be nice to make a floating format savegame editor.

 

I wonder what Sector ID number corresponds to what planet. Plus the Major and Minor character ID. It would seem the creator of RebED had to know all those data ID. Plus I read old post from Vakundok and he did alot of previous work on this stuff I missed in the past (and the_mask).

 

Do you happen to have the planet ID and / or Character ID ? You seem to have alot of information stored. 8)

 

I have an open source editor for files, I think it could be modified to find these "formats" with inputs. Of course to add or delete items form a system will require the savegame file length to change. It came from the fan made editor used to modify hex files in Silent Hunter III. It has a easy to use modify script to tell how to find a format to edit. Change the script and GUI some and viola Rebellion savegame editor perhaps.

 

------OT some.

It just seems a bit unfair to the Rebels to have such a terrible start position. I thought about giving the Rebels more stuff to start with and some better outer Rim planets. Plus I think the Rebels should have a higher Leadership skill maybe to start riots (after all 'they are' the Rebellion). The Imperials get a huge Leadership bonus which is nice. Maybe just give rebels alot more diplomats...the AI really is that stupid in the game.... :idea: I think it would be nice to write a new program using basic slide show action for missions and ship battles for a start? (no 3d battle engine for starters) several slide shows going back and forth for each phase and battle damage hits. I guess I should put this in another thread. -----

Link to comment
Share on other sites

I wonder what Sector ID number corresponds to what planet. Plus the Major and Minor character ID. It would seem the creator of RebED had to know all those data ID. Plus I read old post from Vakundok and he did alot of previous work on this stuff I missed in the past (and the_mask).

 

Do you happen to have the planet ID and / or Character ID ? You seem to have alot of information stored. 8)

To find out which planet/system goes with what sector; that information is located in the SYSTEMSD.DAT file. The sector ID number there correspondes with the SECTORSD.DAT file. The data contains location data in the TEXTSTRA.DLL file for the names. I haven't yet worked on the character files, so I don't have anything on that.

 

Revolution (the creator of RedEd) supposedly worked on the original game, so he would have a deep knowledge of the files and their structure. Vakundok & The Mask has done alot of research & such to dig out details and such.

 

 

I have an open source editor for files, I think it could be modified to find these "formats" with inputs. Of course to add or delete items form a system will require the savegame file length to change. It came from the fan made editor used to modify hex files in Silent Hunter III. It has a easy to use modify script to tell how to find a format to edit. Change the script and GUI some and viola Rebellion savegame editor perhaps.

That sounds great, I wish you the best of luck. Keep me informed on how that goes. When I get back on the saved game format I'll let you know anything I find out. Oh, and I was off on my saved game spreadsheet file, the size is 250 Megs! 8O

Finally, after years of hard work I am the Supreme Sith Warlord! Muwhahahaha!! What?? What do you mean "there's only two of us"?
Link to comment
Share on other sites

Using help from your data, I am making this post to update with all the System ID names within the savegame file.

 

TP 00 00 00 SY 00 00 00 AL 00 00 00 80 SY

 

TP = type Core 90h (144) or Rim 92h (146)

SY = System ID inside savegame file Hexa

AL = Allegiance. C1 Neutral, 41 Rebel, 81 Empire, A1 Coruscant

 

Corellian

 

140= 8C = Commenor

141= 8D = Corellia

142= 8E = Corfai

143= 8F = Duros

144= 90 = Drall

145= 91 = Selonia

146= 92 = Talus

147= 93 = Tralus

148= 94 = Vagran

149= 95 = Xyquine

 

Sesswenna

 

260= 0401 = Averam

261= 0501 = Bollamora

262= 0601 = Bortras

263= 0701 = Chandrilla

264= 0801 = Corsin

265= 0901 = Coruscant

266= 0A01 = Ghorman

267= 0B01 = Svivern

268= 0C01 = Uvena

269= 0D01 = Yagor Minor

 

Of course more to come as I decipher them. There are 6 Core and 14 Rim sectors. 200 systems! I am sure someone has done this fun stuff before, but I cannot find any post so I am recreating the data. If it does exist, then please let me know. I hope this helps people who like to play with the data files. Also, I have use for this data structure knowledge for a basic rewrite of Reb.exe (3D battle will be a slide show action placeholder for now).

Link to comment
Share on other sites

Oh, look at this old post, probably would help out faster. :oops: I wonder if the numbers are the same in game files and the savegame? It would be MUCH faster to reference out to the string name in resource file Texstrat.dll

 

Good, I am waiting for it. Well, I have a theoretical structure for the systemsd.dat, but I don't have the time to really check it:

 

Header: 1,200,144,152

Structure (11):

1 - number (starting from 100)

2 - unknown (maybe the active flag), allways 1

3 - unknown, allways 0 (since it canot be produced)

4 - unknown, allways 0 (since it canot be produced)

5 - family, usually 146

6 - identifier (actually two WORDs the second is 2 the first can be used directly to get the name from Textstrat.dll)

7 - sector number (starting from 20, since the number of the sectors also starts from 20)

8 - type (picture)

9 - unknown, usually 1

10 - position (actually two WORDs, x and y, not relative to the sector position)

11 - unknown, usually 0

 

The position is very interesting, it is not counted in pixels (maybe it have to be divided by two) and 0,0 does not mean the topleft corner of the screen. I think there is an area larger that we can see during the game and the coordinates are relative to the topleft corner of that area.

The header suggests that there are more families, not only 146, I will check the family of Coruscant and Yavin soon.

 

1 - number (starting from 100) This number is the same as in the savegame. eg Coruscant = 265 = 09 01 HEXA

 

6 - identifier (actually two WORDs the second is 2 the first can be used directly to get the name from Textstrat.dll)

 

From Systemsd.dat Coruscant identifier is 65 2F HEXA but to find inside the Textstrat.dll file you must use Resource Hacker to see it! It is inside folder 759 and shows the decimal 12133 equivalent.

 

I thought directly meant opening the file and looking for that hexa number. Nope, you must use Res hacker to do it.

Link to comment
Share on other sites

  • 10 months later...
1 - number (starting from 100) This number is the same as in the savegame. eg Coruscant = 265 = 09 01 HEXA

 

6 - identifier (actually two WORDs the second is 2 the first can be used directly to get the name from Textstrat.dll)

 

From Systemsd.dat Coruscant identifier is 65 2F HEXA but to find inside the Textstrat.dll file you must use Resource Hacker to see it! It is inside folder 759 and shows the decimal 12133 equivalent.

 

This is probably a strange first post on these forums, but oh well. It is also bumping an older post, but I hope the information helps someone as it has helped me.

 

The same techniques used to convert 09 01 HEXA to 265 will also convert 65 2F into 12133.

 

The simple version:

09 hex = 9 dec
01 hex = 1 dec
1*256 + 9 = 265 

 

65 hex = 101 dec
2f hex = 47 dec
47*256 + 101 = 12133

 

Not so simple version:

Big Endian and Little Endian are not the same. Also, a computer can use one Endian order for bit representation and another Endian order for byte or word representation. The computer says 09 01 and 65 2f while humans will understand it better as 01 09 and 2f 65.

 

Use your hex editor to look at textstra.dll. Look around address 130,256 decimal (01FCD0 Hex) for the Coruscant text string. Many hex editors will show Coruscant as "C.o.r.u.s.c.a.n.t." because of the same issue (periods or dots represent the NULL character, your hex editor may show it as a different symbol, such as @ or #).

 

The utilities found on SWRebellion.com all seem to understand the data formats properly, but most hex editors do not, at least not with default options. I'd be thrilled if anyone knows of a hex editor that will correctly show the Coruscant text string and 12133 hex equivalent.

 

P.S. I still love the game, despite its age. I'm thrilled to find this site appear in a google search. I appreciate the hard work of all those who came before. Thank you.

Link to comment
Share on other sites

Oh it is always good to learn something new or how to do someting in a new way. It can come in handy.

 

Welcome to the forum goryani! :)

 

I am glad you still like SW Rebellion. We all would like to ressurect this good old diamond in the rough game to its greater glory. So it will run on new computers and OS, plus the 5 essentials for gameplay such a decent AI to fight against, and to make in more moddable via XML or in my humble version, text files (custom script but simple to use). You can change constants and scripted events, make your own story scenarios too! 8)

 

I only had a minor in computer science decades ago, but wow this old dog of me can still learn a new trick!

 

I wish we had computers like this back in the 1970's when I grew up. I would have earned a degree in computer science (programming) instead. Alot more money and fun!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

Copyright (c) 1999-2022 by SWRebellion Community - All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Star Wars(TM) is a registered trademark of LucasFilm, Ltd. We are not affiliated with LucasFilm or Walt Disney. This is a fan site and online gaming community (non-profit). Powered by Invision Community

×
×
  • Create New...