Page 1 of 3

Hex Editing savegames

Posted: Mon Jul 19, 2004 9:24 pm
by purple1
I downloaded a hex editor (HexEdit 1.7.4) for Mac OS 9. I have opened up a save file to edit. Can someone help me get started editing my save data?

Specifically, I'm looking for the locations of items in inventories. The Mac version may be different than the PC (I'm sure it is)

Posted: Mon Jul 19, 2004 11:07 pm
by beowuuf
There is an breakdown of the DM listing available somewhere, but even then that's the dungeon, NOT the saved game - but will let you see the rough format it used to use - i think I recall it still uses a similar format

Can I suggest you save a game, pick up an object, save the game, then check out all the changes between the two.
Preferably do it right at the start, when there is less monsters around and events going on...this should give you much less changes to track down
I dont' know how much use it owuld be, but the hex guide i did had hex codes for items, etc (based on Dmute values). This might let you spot items better - for examle a potion or weapon - example, potions are usually an eight digit hex, in couplets, ID, 20 (potion), power, potion type (90 - 99 i think)

Sorry, that might get you started (on the wrong track?) until some real talent can come along : )

In DM, there was a four digit word for the checksum - any change you make in the dungeon had to then alter this checksum number
So for example if you altered a text by deducting 20 from somewhere, then you had to deduct 20 from this chcksum at the end.

Good luck!

Posted: Mon Jul 19, 2004 11:19 pm
by purple1
I was hoping someone had already figured out the numbers for items and stuff. But thank you! I hope I can find the checksum and deal with it!

Posted: Mon Jul 19, 2004 11:34 pm
by purple1
I started a fresh game and saved immediately. I took 1 step forward and saved again, and then compared the two side-by-side with HexEdit. I hit my first stumbling block: one small step causes large amounts of information in the save to become offset by 4 hex characters. Other large areas of data all drop by 1 digit for an unknown reason. Finding the exact area that tells x/y coordinates might take forever.

Posted: Mon Jul 19, 2004 11:51 pm
by beowuuf
As I said, the DM - DM2 numbers might not be so differnet, so if you check out my hex guide, then you can get object numbers. The encyclopaedia - it's in technical info, data format - has a very good break down, so might let you see the format for items lists at the start - it shouldnt' change too radically to start with

I guess the next step would be dropping a coin out of your inventory and checkign that instead

The huge changes could be counters, etc all starting up the second you move or start...

Oh well, good luck! In such small steps did things liek Dmute and therefore RTC come about!

Posted: Tue Jul 20, 2004 3:58 am
by cowsmanaut
I found on the net one day a tool to edit DM2 save games. Characters only. all of their stats. Not sure where it is these days.. I think it was called DM2edit.exe.. (shrug)

Posted: Tue Jul 20, 2004 6:46 am
by purple1
I'm currently exploring Pandora's Box (a hex editor) as an alternative. It hacks into memory while programs are running, and it is built for my operating system setup (Classic mode in OS X). I've found ALL the stat values for Torham and changed them, minus stamina.

MANA and HEALTH max at 999 displayable, I think. I doubt they actually go higher.
STR, DEX, VIT, WIS, ANTI-FIRE, ANTI-MAGIC max at 220 displayable. I don't think they can go higher, either.

I can't find stamina. Displayed stamina is not the same as actual stamina
All stats share the first 5 same memory address characters: 087C6---.
EE2 - current health
EE4 - max health
EE6 - ?
EE8 - ?
EEA - current mana
EEC - max mana

EF9 - current strength
EFA - max strength
EFB - current dexterity
EFC - max dexterity
EFD - current wisdom
EFE - max wisdom
EFF - current vitality
F01 - max vitality
F02 - current anti-magic
F03 - max anti-magic
F04 - current anti-fire
F05 - max anti-fire

Posted: Tue Jul 20, 2004 8:35 am
by beowuuf
Stamina is 10(dec) x the value - it's like 100 = 10.0, etc
Nice work finding stuff! Keep it up : )

Posted: Tue Jul 20, 2004 5:35 pm
by purple1
I strongly reccomend modifying stats to their max only AFTER you are done leveling up. Otherwise, the stats become unidentifiable. Eg. 999->900, 220/220 -> 220/10, etc.

My program will not let me browse the memory addresses, so I have to search for numbers. I've found the first digit of the stamina, and each increment raises stamina by 26... I don't get it.

Posted: Tue Jul 20, 2004 5:44 pm
by beowuuf
lol, me either! somehthing's going on...at least you can increment it though!
hmm, 26 is 25.5 rounded up, which is could mean what you think is the first digit of stamina isn't...it's the second. So you are effectively going 10(hex), 20(hex) etc which would be 256(dec), 512(dec) etc which = 25.6 and 51.2 stamina respectively...does this correspond?
Just a thought...

Posted: Tue Jul 20, 2004 6:28 pm
by purple1
Hmm. EE6 is the first digit for the hex (it's 2 bytes long).
If EE6 raises it by 26,
Then what does EE7 do?
I need to find the values again, and I'll check your theory.

Posted: Tue Jul 20, 2004 6:38 pm
by purple1
The max for stamina must be 999. 999(dec) is 03DD(hex).
What must be happening is they record everything 1 digit over and throw in a decimal.
3DD0 = 999.0?

Posted: Tue Jul 20, 2004 6:38 pm
by beowuuf
Oops, yeah, i meant 01 00 (hex)
The data file stats at http://dmweb.free.fr/FFDungeon.htm say it's big endian, does that have any baring?

Posted: Tue Jul 20, 2004 6:42 pm
by purple1
Torham starts at 77 Stamina, so it must round up from 76.8, using this model (even though I don't really know if I'm doing it right...).

76.8 is 3*25.6
What would this look like in hex as we are theorizing? In 4 digits, please!

Posted: Tue Jul 20, 2004 6:47 pm
by purple1
Aaack! After selecting 4 people, the memory addresses are different! Instead of 087C6, its 08790!
I've found all 4 characters' stat addresses and written them down. I do not believe they are affected by what character you are using. However, they may be affected by how many people are in your party.

Posted: Tue Jul 20, 2004 6:57 pm
by beowuuf
Never mind, missed your post, and of course it doesn't have a bearing

Hmm, that's just weird then! So they are multiplying it by 16 after convertion? Very odd. As you say, maybe creating a decimal (lol, decimal points in a hex system...) so it should be read 3DD.0 = 999.0

Posted: Tue Jul 20, 2004 7:02 pm
by purple1
Whoops! 999=03E7! My bad!
So, if Stamina has a hidden decimal point in it, then, like you said, 999 would be 999.0.
In hex, there are no decimal points (duh) so they simulate one by multiplying by 16.
999->9990, 03E7->3E70.

I really don't remember the difference between big and little endian, but I think I'm understanding how this is working. I just need to find Torham's stamina stat again and see if we are right.

Posted: Tue Jul 20, 2004 7:03 pm
by zoom
Maybe memory addresses are likely to be never the same and they could save the values backwards(hex wise)
6f780000 would then be 0000786f! I donno... good luck.

Posted: Tue Jul 20, 2004 7:03 pm
by beowuuf
Soryr, distracted so missing posts when I type replies

76.8 -> 04CD?

Posted: Tue Jul 20, 2004 7:09 pm
by purple1
Actually, I found a conversion calculator.
999 -> 03E7, so 999 is really 3E70
768 -> 0300, so 768 is really 3000
How do I divide by 10?

Posted: Tue Jul 20, 2004 7:12 pm
by purple1
Nevermind, I think you've got it. I'm just confused.

Posted: Tue Jul 20, 2004 7:15 pm
by purple1
I converted that back.
The game shows 77. We think it is 76.8. We also think that the first 3 digits are the number, and the last is a decimal place. 76.8 would be 04C.D (the .D is the decimal, being 8.) and turned into a decimal number, we get 717. So my hex editor sees 717 when the game sees 76.8 and rounds up. This is what I think is going on.

Actually, I just looked and that's not true. it isn't 04CD. We think in decimal. The real number must be 0030? I'm checking that.

Posted: Tue Jul 20, 2004 7:15 pm
by beowuuf
lol, you don't easily, you need to divide by 16s : )

So are these figures tying up ok?

Posted: Tue Jul 20, 2004 7:17 pm
by beowuuf
Ah, ok - then you are managing to break it! Nice one!

Posted: Tue Jul 20, 2004 7:18 pm
by purple1
Okay, I lost myself again.

Posted: Tue Jul 20, 2004 7:23 pm
by purple1
I'm getting all these numbers wrong. I think.
This may take awhile. I just switched computers. I need to start everything up again and rethink this.

Posted: Tue Jul 20, 2004 7:28 pm
by beowuuf
I guess the question is what hex values are you inputing to get values out?
Can you manage to make changes lower than steps of 26 yet? I'm sure that stamina values start out multiplied, so that it should be 76.8(d) -> 768 (d) -> 0300 (h), rather than 76.8 -> xx.x(h)

Posted: Tue Jul 20, 2004 7:35 pm
by purple1
No, I can't. At one point, I had on my list of values, the location of one hex digit of the max stamina value. I couldn't search for the other one. My program does not allow free browsing, so I have to input the decimal number I'm looking for and then go down the list. I know where the values should be, but I am having trouble seeing what the decimal translation of the hex version of the actual stamina is.

I think that you are right, and Torham's starting stamina is recorded as 0300(h), which would be 768 decimal. Now I need to search for 768 and hope I find it as a match for his max stamina.

Posted: Tue Jul 20, 2004 7:37 pm
by purple1
I just looked for 768, and I didn't get a match for 4 digit hex.
I could try 2 digits, and then I would need to find 03, which is 3 in decimal.

Posted: Tue Jul 20, 2004 7:38 pm
by purple1
I got a hit! Woohoo! Torham's first digits are 03! Now I need to find the second ones, and this mystery will be solved.