The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 13, 2024, 11:51:55 am
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  General UQM Discussion (Moderator: Death 999)
| | |-+  Editing saved games
« previous next »
Pages: [1] Print
Author Topic: Editing saved games  (Read 12821 times)
Tog
Zebranky food
*
Offline Offline

Posts: 10



View Profile
Editing saved games
« on: January 21, 2011, 02:02:37 am »

Hello again, everyone!

I know there are a couple of saved game editors around, but I haven't found a way to edit the melnorme credits. Does anyone know how this can be done?

Also, does anyone have any info about what offsets contain which settings when using a hex editor? I checked the save.c file, but I couldn't figure out how to translate this into the offset of a particular value.

Thanks!
Logged
Novus
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1938


Fot or not?


View Profile
Re: Editing saved games
« Reply #1 on: January 21, 2011, 10:32:50 am »

The saved games are compressed to save disk space, making it very hard to hex edit most of the game state. The easiest solution is probably to modify the save or load code.

Annoyingly, the Melnorme credits are also stored in uncompressed form (used to display the summary of the game state in the load menu), but this is not the version used by the game.
Logged

RTFM = Read the fine manual.
RTTFAQ = Read the Ur-Quan Masters Technical FAQ.
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: Editing saved games
« Reply #2 on: January 21, 2011, 11:16:02 pm »

If you are that interested in cheating the game, you can try memory editors, like scanmem for Linux or ArtMoney for Windows.
I know it works, cause I did it myself Smiley
No weird searches like multiples or the -1 stuff, just the exact number on display in the cargo menu.
Logged
Tog
Zebranky food
*
Offline Offline

Posts: 10



View Profile
Re: Editing saved games
« Reply #3 on: January 22, 2011, 09:21:06 pm »

Thanks.

I tried a couple of memory editors while talking to a Melnorme ship. When I search for the number of credits in my inventory, it comes up with hundreds of hits on every integer/float type. I did have a little bit of fun manipulating the dialogue in real time, though Smiley Searching for strings seems to be a lot easier than numbers. I did find a string value for MCredit, but not MCreditHi or MCreditLo. Unfortunately, I don't know how to edit a variable directly from memory.
Logged
Alvarin
Enlightened
*****
Offline Offline

Gender: Male
Posts: 799



View Profile
Re: Editing saved games
« Reply #4 on: January 23, 2011, 04:30:57 am »

Not credits - bioforms are the way to go.
Logged
jucce
Frungy champion
**
Offline Offline

Posts: 95



View Profile
Re: Editing saved games
« Reply #5 on: January 25, 2011, 10:22:44 am »

Hello again, everyone!

I know there are a couple of saved game editors around, but I haven't found a way to edit the melnorme credits. Does anyone know how this can be done?
I made an editor you can modify the credits with here:
http://forum.uqm.stack.nl/index.php?topic=4890.0

Also, does anyone have any info about what offsets contain which settings when using a hex editor? I checked the save.c file, but I couldn't figure out how to translate this into the offset of a particular value.

Thanks!
I also did a save game editor previously, I can take a look at what offsets it uses and post them. Stand by.

Thanks.

I tried a couple of memory editors while talking to a Melnorme ship. When I search for the number of credits in my inventory, it comes up with hundreds of hits on every integer/float type. I did have a little bit of fun manipulating the dialogue in real time, though Smiley Searching for strings seems to be a lot easier than numbers. I did find a string value for MCredit, but not MCreditHi or MCreditLo. Unfortunately, I don't know how to edit a variable directly from memory.
The credits aren't stored in a straight forward fashion in the memory. They way my memory editor reads them is to first read 4 bytes at a specific offset. Then it uses that data, plus an offset, as the next memory location to read to find the actual credits.

It basically finds the location using a pointer. A program called "Cheat Engine" has good support for this.

So it reads 4 bytes from this new location. Then it right shifts the data by 3 (eliminating the last 3 bits). Finally it zeros the two leftmost bytes. And the resulting data is the credits.

Writing the credits is also tricky because you have to change only specific bits in the 4 bytes of credit data.
Logged
jucce
Frungy champion
**
Offline Offline

Posts: 95



View Profile
Re: Editing saved games
« Reply #6 on: January 25, 2011, 10:41:57 am »

Ok, these are the save game offsets you can write to and have the game accept the changes (changes to credits and lander stats etc. are ignored):

Code:
//Ship
Captain name 0x5A 12
Ship name 0x4A 10
Crew 0x10 2
Fuel 0x0C 4
R.U. 0x08 4
Bio Data 0x14 2
Landers 0x39 1

//Resources
Common 0x3A 2
Corrosive 0x3C 2
Base Metal 0x3E 2
Noble Gas 0x40 2
Rare Earth 0x42 2
Precious 0x44 2
Radioactive 0x46 2
Exotic 0x48 2
Cargo Space 0x12 2

//Position
X 0x00 4
Y 0x04 4

//Ship outfit *
Modules 16-1 0x16 16
Thrusters 11-1 0x26 11
Jets 8-1 0x31 8

* Modules
0x16 = Empty Module
0x00 = Lander
0x01 = Antimat Thruster
0x02 = Turning Jets
0x03 = Crew Pod
0x04 = Storage Bay
0x05 = Fuel Tank
0x06 = High-Ef Fuelsys
0x07 = Dynamo Unit
0x08 = Shiva Furnace
0x09 = Ion-Bolt Gun
0x0A = Fusion Blaster
0x0B = Hellbore Cannon
0x0C = Tracking System
0x0D = Point Defense
0x0E-0x0F = Bomb Parts
0x10-0x13 = Crystal Parts
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Editing saved games
« Reply #7 on: January 25, 2011, 11:16:15 pm »

If you want to know the details, look at save.c or load.c. The description of the 'GameState' can be found in globdata.h.
This is relatively easy code to understand.
But note that parts of the saved games are compressed (the stuff written with 'cwrite()' and variants), and that part you shouldn't try to understand. The compression/decompression routines for this are in src/libs/decomp/src/libs/decomp, for the sadistic.

Jucce: The credits are actually part of the compressed part of the saved games; your method of finding it may fail when the data around it changes. I'm actually surprised that you managed to get it like this at all.
« Last Edit: January 25, 2011, 11:28:28 pm by meep-eep » Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
onpon4
Enlightened
*****
Offline Offline

Gender: Male
Posts: 709


Sharing is good.


View Profile WWW
Re: Editing saved games
« Reply #8 on: January 26, 2011, 12:38:51 am »

The compression/decompression routines for this are in src/libs/decomp/src/libs/decomp, for the sadistic.

Sadistic? Does that mean... fiddling with it will give you power? Hm... yeah, that sounds about right. Never mind. Tongue
Logged

jucce
Frungy champion
**
Offline Offline

Posts: 95



View Profile
Re: Editing saved games
« Reply #9 on: January 26, 2011, 01:22:16 am »

Jucce: The credits are actually part of the compressed part of the saved games; your method of finding it may fail when the data around it changes. I'm actually surprised that you managed to get it like this at all.

I just want to clarify that I got it from reading the UQM.exe process memory and not from the save game. And in the memory it seems to be stored in a consistent way at the same (relative) location.
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Editing saved games
« Reply #10 on: January 26, 2011, 07:02:41 am »

The compression/decompression routines for this are in src/libs/decomp/src/libs/decomp, for the sadistic.

Sadistic? Does that mean... fiddling with it will give you power? Hm... yeah, that sounds about right. Never mind. Tongue
You're right. That should have been "masochistic".

Jucce: The credits are actually part of the compressed part of the saved games; your method of finding it may fail when the data around it changes. I'm actually surprised that you managed to get it like this at all.
I just want to clarify that I got it from reading the UQM.exe process memory and not from the save game. And in the memory it seems to be stored in a consistent way at the same (relative) location.
Ah. Yes, it would be. I should have read better.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!