Quantcast
Channel: General Discussion (Spoiler Warning!) — Beamdog Forums
Viewing all articles
Browse latest Browse all 12398

Android Game-Data Editing Tutorial (Hex Style)

$
0
0
It seems, once again, as far as convenience, we Android users are left out in the cold. Specifically, I am referring to the Beamdog Infinity Engine game ports' modding and console cheats. I don't blame Beamdog in the least (in fact, I both praise them for their efforts and applaud them for their accomplishments), but it would be nice if we could enjoy the same benefits as players of other OSs! As a side note, I'm trying to get together a master list of mods that work on Beamdog's Android IWD:EE, so if you are interested in participating, take a look here.

I find it highly unlikely Android users will ever be able to load most Infinity Engine game mods or that all users will be able to get to the console. To help close the gap just a little, I've decided to write a couple tutorials on editing saved games. This is essentially what a saved-game editor does, we're just going to do it manually and, we're going to do it all on Android itself (these same techniques work perfectly well on other OSs, but there are usually much easier methods for those). Theoretically, you can change nearly all values associated with your characters (any dynamic game data, for that matter), but it can get very complicated. I'm going to keep the tutorials fairly simple. My goal is not to show you how to change every modifiable value in your game, but to give you the knowledge and techniques necessary to do this for yourself. For sanity's sake, though, I would suggest using these procedures for nothing more than simple game tweaks.

Be aware, you will be editing the games' raw data. Even keeping it simple, it's easy to get confused (hopefully not with this tutorial, though), I still do and I've been doing this stuff for over 35 years! Always make a backup (you only need to copy the files to somewhere safe). Also, be aware, sometimes problems won't show up until much later; simple changes can have unexpected and catastrophic consequences and sometimes, a cascading effect. If you have problems with your Beamdog Infinity Engine game after editing one of its files, do not (I repeat, do not) blame me or Beamdog or, bother them with bug reports (unless you can reproduce the problem with a clean game). You are on your own! Take responsibility for your own actions. OK, this was actually the disclaimer, but if I put "disclaimer" at the beginning, no one would read this paragraph!

If you are not technically inclined, stop here or proceed with extreme caution (I don't give specific spep-by-step instructions on what I consider to be prerequisite knowledge, think twice before attempting this if you cannot even find the files). At a minimum, you will need to be able to manipulate hexadecimal values, though Hex Editor Pro does allow you to work in decimal format. If you decide to do this, you need insure you have access to a couple Android apps (for my recommendations, see the app links below). If you are not comfortable with these procedures, you can try transferring the data to your PC and editing it with a saved-game editor (I haven't tried this, but it should work fine).

The apps needed (or something similar) are:
  • A hexadecimal calculator (I use NeoCal*, but there are alternatives)
  • A hexadecimal editor (I use Hex Editor Pro*, but there may be alternatives, though I haven't found one)
*I link to and use the Pro version of these apps because I believe people should be paid for their work (and I hate ads), but some do offer a free and or ad-supported version.

I also suggest bookmarking the following sites:
  • BGII item code list (many of these item codes work across all Beamdog's Enhanced Editions as they share the same engine, in theory)
  • IWD item code list (Sorcerer's Place)
  • Infinity Engine game data file formats, which give you a rough idea of where to look, what to look for, and its format and size (in this tutorial we're specifically interested in the CRE layout)
Don't worry if all this looks intimidating, this tutorial should, at the least, get you through editing your ability scores and manipulating inventory items. After that, you should be knowledgeable enough to proceed on your own.


Editing Ability Scores

This procedure can be used on both saved game files (BALDUR.gam) and character files (*.chr). One thing you need to be aware of (you can see this by examining the CRE file format linked above) is that ability scores are in a different order than they are presented in-game. Instead of: Str, Dex, Con, Int, Wis, then Cha, the data files store them as: Str, Str Bonus, Int, Wis, Dex, Con, then Cha. Since we will be using the ability scores to locate specific characters in the BALDUR.gam file (character names are not necessarily stored with their data), I suggest you write them down in the data file's order (translating them to hex at this point can save time). If you happen to have more than one character with the same ability scores, examine the data beneath the scores to help determine which toon you are viewing.

In this tutorial, we will be editing the Strength Bonus ability score in a BALDUR.gam file. Editing ability scores is quite easy. I will be using the following scores in the example (you will use your own toon's scores for your game, that's why we wrote them down earlier), most likely, your values will be different. I'm only using example values here:

AbilityDecimalHexadecimal
Strength1812
Strength Bonus311f
Intelligence100a
Wisdom110b
Dexterity1610
Constitution1812
Charisma808

Lets say this is a Dwarven fighter and we want the strength bonus to be 100% (hex 64). We need to change the 31 (0x1f) to 100 (0x64).
  1. Open the BALDUR.gam file you want to edit in Hex Editor Pro
  2. Search for the hex value 121f0a0b from the hexadecimal column of the example scores above (these are not all the ability scores, but you'll seldom need more than a few to uniquely identify a toon) and verify the rest to make sure you are working on the correct character (you will use your toon's ability scores here, instead of the example's) and don't forget to use the data file's ability score order
  3. Tap the highlighted 1f entry in Hex Editor Pro's left pane (remember, 1f is hexadecimal for 31): don't forget, you will use your toon's scores instead of the example's
  4. In the resulting dialog box, confirm the value 1f and change it to 64 (or whatever your values are)
  5. Tap the disk icon in the dialog box to commit your changes
  6. Tap the disk icon in the menu bar to save the file
Open the game and verify your new ability score. That's it! If the toon's score is not what you expected, restore your backup and try again.


Manipulating an Inventory Item

In this next (and final) tutorial, we are going to add a Bag of Holding (BAG31) to our inventory! Personally, I use this same procedure to add a Find Familiar scroll (SCRL6D) to my main magic user so I don't have to worry about finding the spell or wasting a slot.

Rather than trying to calculate exactly where each inventory space's index begins in the data file, which is fraught with danger, I'm going to teach you a much easier method. The best way I've found to insure I'm editing the right address is to put a cheap, unique item into an empty slot before saving the game. I don't recommend using a stackable item, like arrows, though I've successfully used them in the past. If you do, make sure there is only one and not a stack.

For our example, we will assume our Dwarven fighter above does not normally carry a dagger. Grab an ordinary dagger (DAGG01) from somewhere in the game and put it into one of your character's inventory slots, then save the game.
  1. Open the BALDUR.gam file you want to edit in Hex Editor Pro
  2. Search for the hex value 12640a0b like we did in the previous tutorial (notice the 64 now, instead of 1f) and verify the rest of the ability scores to make sure you are editing the correct toon
  3. Look for DAGG01 (in Hex Editor Pro's right pane) below the ability scores (if you examine the CRE format, you'll see a character's inventory items are below the ability scores), it shouldn't be too far down
  4. In the left pane, tap on 44, the capital letter D's hexadecimal value, and you will get Hex Editor Pro's Edit Value dialog box
  5. In the dialog box, tap the small white down arrow and select the ASCII radio button (the 44 on the edit line will change to 'D')
  6. Change the 'D' to a 'B' and to get to the next byte, tap the '>' icon in the dialog box (Item codes are case-sensitive: there are a few Bag of Holding codes, but from my experience, BAG31 is the only one that works right)
  7. Continue changing DAGG01 to BAG31 until you get to the final '1' and as the Bag of Holding code is shorter than the dagger's item code, be sure to replace the final '1' in DAGG01 with 00 (do not use the space bar, either switch back to hex or just delete the value altogether, this final value must be 00 in the left pane); in right pane, "DAGG01" should now be replaced with "BAG31." and in the left pane, "44 41 47 47 30 31" should now be "42 41 47 33 31 00"
  8. Tap the disk icon in the dialog box to commit your changes
  9. Tap the disk icon in the menu bar to save the file
Open the game and verify your new Bag of Holding. That's it! If something did not work, restore your backup and try again.

Please, do not try to add quest items with this method - it will not work (no triggers activated) and will usually result in a corrupt game. You've been warned.


I hope this helps! Remember, with knowledge comes responsibility. Be careful as you can easily make the game boring by over-powering your party.

If any part of these tutorials is unclear or if you find a mistake, please send me a PM so I can correct it.

Have fun!

Please note, this entire post was constructed on my tablet and I will be correcting, rewriting, and formatting it for next couple of weeks. If you notice any grammatical or formatting errors, please bring them to my attention via a PM. Thanks....

Viewing all articles
Browse latest Browse all 12398

Trending Articles