Re: Shandalar Deck Injector
Posted: 17 Jul 2011, 08:57
Good to hear someone else is looking into this game and hex editing in general. It's a pretty good one to get started with as it has some easy values to find such as food and money as you've discovered, some medium ones, and harder ones such as health which sadly isn't stored in just a numeric value.Osquou wrote:Any luck on adding health? Did you ever figure out what the offset is for it? I was working on learning hex before I found your program and figured out money and food on my own. BTW though you can type in FF FF FF FF on money and food, neither are acceptable values. I've managed to get FF FF FF FD on money, haven't played around enough on food but it's MUCH lower. Anyways, health and gems would be nice if you've got the offsets I can edit them on my own. Thanks for the great program and all your hard work!
I'm hoping to update my site tonight as I have finally finished the new version! so want to get it up as soon as possible so people can try it out and I can get the latest bugs reported and fixed. When I do update the site I'll add in the new download and all the information I have recently found.
However for your specific questions/comments there are a couple of things that you may be aware of but I'll point them out anyway. First off the data is stored little endian meaning although you are reading FF FF FF FD in your editor the game actually reads that as FD FF FF FF. This makes a big difference when changing/searching for things because if we wanted our hero to have 1 gold we'd probably think we should enter 00 00 00 01 when actually it should be 01 00 00 00. There is a terribly complicated wikipedia article on it here but as long as you remember things can appear back to front you should get used to it.
Second you'll find that food and health both use a sign bit as they can show negitive numbers. This means rather than 00 to FF meaning 0 to 255 it actually shows -128 to +127. If you convert the number to binary and find the left most bit is a 1 then the number is negitive but remember that windows calculator and most other programs drop any preceding 0s so make sure the number of bits equals what you expect. This means the highest value 4 bytes can show is 7F FF FF FF because after this (80 00 00 00) the sign bit is flipped to a 1 and the numbers become negitive. Of course entering 7F FF FF FF into the hex editor will give you a really low value because of the damn endianness I'll leave you to figure out what you need to enter for the highest possible value.
Finally the values you were looking for, Gems (Amulets) start at offset 21D0C and have 4 bytes each. Health is tied in with manalinks and so is more complicated. I've only looked at it breifly but by comparing 2 saves, one just before going into a town to get a manalink and one after getting it, I've found that the point the data changed was offset 20980 (hex) but I'm not sure if that will be the same across all saves as I think each town has a bit of memory that stores its data such as cards available, missions available and so on along with if you have that towns manalink or no. This gives us a good news / bad news situation. Good news, manalink is probably just a flag set in the town data; Bad news, towns probably change on each map so god knows if the data stays in the same place. Best case secenaro the data for each town stays in the same place each time and there is a bit of its memory that stores its location (I know this is true to an extent because I accidently obliterated a town from the map when playing around with the data once!)
Sorry for the wall of text, this is what happens when I start talking shop! Hopefully some of it is useful to you.
TL:DR - New version of the deck injector is ready and just needs uploaded. Gems offset - 21D0C. Health offset - Linked in with indivdual town data which is unknown, yet.
EDIT - Oops put up the offsets wrong fixed now.