Since posting this guide, I've learned a considerable amount about what these files actually represent. Not only that, but how to modify many other files to create "true" custom content. You can find an example of this in a test save here >>Beta Save<<. Please read the information before using this file to avoid a couple of potential issues. Until I have the time to write an expanded version of this guide, feel free to email me with any questions you might have.
Introduction >> This is a relatively simple guide to hacking the xbox version of Star Wars KotOR. This particular hack does not involve editing save files. Rather, it involves directly hacking specific game files. Because of this, it requires the game to be installed to your xbox HDD. While I wouldn't consider this actual "modding", it does allow for considerable changes to be made in the game, as well as offering access to items which are not available any other way. I should also mention that because this is a guide that covers the entire game, it's virtually impossible to avoid spoilers (so keep that in mind if it's an issue for you).
For the record, I'm no programmer, so it's entirely possible that I've missed things that would be obvious to someone with some programming skill. If you happen to be one of those people, I'd appreciate anything you could add to this guide (with due credit of course). Also, if you have anything to add or suggestions that would improve this guide, please submit them. This is a work in progress, so updates will be forthcoming. I should also mention that this guide only covers the original game and does not include the new content (since I don't have access to it). If you have the new content, and apply this guide to it I'll add anything you care to submit. The following information details the guidelines I've learned to follow in order to keep the game functional.
Whatever the proper terms may be, these are the terms I'll be using in this guide.
area - An area is any single rim file for a given planet or ship. Basically, a location.
byte space - This refers to the size of an item lable in bytes.
common item - In general, a common item can be placed in any area or container type.
container - Containers include footlockers, standing lockers, cylinders, backpacks, corpses, etc.
door - This may seem a no-brainer, but many transitions are referred to as "doorXXX" in the rim file, as well as standard doors.
drops - A drop is an item or items or credits left when an enemy is defeated.
tag list - This list is a sort of default header for almost everything declared in the rim file.
lable - A lable can be anything declared in the rim file. It's the name the game uses to identify items, actors, waypoints, dialogs, etc.
load list - This is the list at the beginning of each rim file. This list contains actors, items, dialogs, triggers, etc.
unique items - A unique item is usually a strictly NPC item or an item not found in any other area. Generally, these items are only placeable in a single area where they've been declared in the load list.
Tools & Setup >>
This is fairly straightforward. You need a modded xbox, ftp access, and KotOR installed to the HDD. The only tools you'll need are basic hex editing tools. Your favorite hex editor will do fine.
You'll be editing the .rim files found in the modules folder of the KotOR directory. Each file represents an area and each area has 2 associated files. If you plan on doing a lot of editing, the most efficient setup is to have 2 folders on your PC. In one you should keep the original, unedited rim files. The other, for edited files. If you happen to make a mistake and the game won't load (or is really screwy if it does) it's a simple matter to replace the bad file with the original. Sometimes this is easier than trying to find the error.
Once you've edited your file, upload it to your xbox and overwrite the matching file. Simple. I usually work in the right column since so much information about what's going on game-wise is there in notes and such left by the devs. It's a relatively simple matter to work out what you're looking at if you're at all familiar with the game.
In the center of almost every rim file is a large, and obvious, debug section. I haven't messed with any of this, but it may be possible to further alter the game by doing so (if you know anything about debug scripts that is).
These files are for the first area on the Endar Spire. The file you want is the one with the "_s" at the end. All areas in the game have 2 such files. The area list specifies the location covered by every file. It should be assumed, unless otherwise stated, that all rim files mentioned throughout this guide are those with the "_s". Leading and trailing bytes :
For the most part, replacing one item with another requires the lable space to be equal. The only time this is not the case is when the item being replaced is at the end of the list. When this happens, the lable space can, and must be altered properly for the item to register. Each item has a leading value byte which defines the size of the item lable. When you change the lable space, you must also change this value and zero any trailing bytes if the item lable takes up fewer spaces than the one being replaced. Saving rule :
One of the more important aspects of using this hack is how the game loads and stores areas. Once an area is loaded and saved, no further changes can be made to that area. If you take a look in the cache folders you can see which areas are already loaded by the save file. Although they use the same file name, the size is different and they're encoded differently. So...
Delete all cache files and the folders listed below while testing or the game will draw it's data from this source first
Enough of the formalities, let's get to editing. The following examples will get you started.
Item replacement >
This first example is basic item replacement. I'll be replacing the equipment Trask comes with, but the same technique applies to replacing items in other containers as well as stores. So let's look at what Trask has to offer.
Load end_m01aa_s.rim into your hex editor. In the illustration you'll see the address and the end of Trasks's tag list. This is a typical actor list and this is where we'll make our changes. Size will vary depending on what the actor is equipped with.
Looking at the common item list we find Trask has basic clothing* and a basic blaster pistol. The leading value bytes are also indicated.
Keeping in mind that Trask's equipment will end up in our inventory when he runs off to be slaughtered by Bandon, it's time to decide what we want. Clothing (g_a_clothes01) and most armor are 13 byte lables, so we have a whole list of armor to choose from. This time we'll go with Mandalorian Assault armor (g_a_class9010). Time for a new weapon. Blaster pistol (g_w_blstrpstl001) is a 16 byte lable, but most other weapons fall into the 14/15 byte lable category, so we're not only going to change the weapon, but the byte space as well.
The Zabrak Disrupter Cannon (g_w_dsrptrfl002) should clear the corridors nicely. Since this is a 15 byte lable we'll have to zero the trailing byte. Once you copy and paste the new lables over the old, things should look like this. Note the trailing byte has been zeroed and the leading value byte has been changed from 16  to 15 [0F].
Once this is done, save your work, upload your edited file to the Star Wars/modules folder on your xbox and start a new game. When Trask runs in he should have the equipment you selected.
This is the most common use for this hack and probably what you'll be doing most of the time. Anywhere you find an item, you can replace it in this way. There are very few exceptions.
* clothing has several variations, but actors will always show their default clothing in spite of changes. For some characters, substituting armor for clothing will still show default clothing, but the armor stats will apply.
Cutscene alteration >
This time around we're going to get rid of a selected cutscene. It goes without saying that eliminating certain scenes can cause problems that may keep you from proceeding further, so care should always be taken with your edits.
I've tested this particular example and can safely say it causes no problems.
On Taris, when you first take the elevator down to the undercity (the Outcast village) you're immediately jumped by a pair of beggars, followed by Shaleena. Annoying, unnecessary and easily fixed. But first, there are a couple of things to keep in mind when dealing with cutscenes.
Disabling : An actor is disabled by altering the item lable in the tag list. Usually this will still load the actor into it's default position but no triggered actions will be taken without PC interaction. By interacting with a disabled actor you may trigger partial or complete actions (depending on how complex those actions are). You may also find yourself stuck in a cutscene that you can't escape from since the game won't be able to reference the actor properly. It's usually a wise idea to avoid interacting with a disabled actor.
Eliminating : An actor is eliminated from from an area by altering the item lable in the load list. This is usually the safest way to go about eliminating cutscenes, but they tend to vary so widely that only experimentation will reveal the best way.
Triggers : Triggers for a variety of things can be found in the load list like anything else. Usually, it isn't very difficult to figure out what each trigger does since many are specifically named for their function with "trigger" as part of the lable. Many cutscenes can be disabled by simply altering the trigger and nothing else.
First off, we check the area list for the Undercity and load up tar_m04_aa_s.rim. Next, we need to find something to indicate which lables refer to the actors involved in the cutscene. The first place to look is the load list. As it turns out, we find Shaleena's lable as tar04_shaleena (not too difficult to figure out). So we have one of the actors, but what about the beggars? Well, the load list has a few entries that refer to "beggar": k_ptar_begrun_en, tar04_beggarext, tar04_begrun
So which do we use? Or do we just disable all of them?
What we do here is a search for "Shaleena". You should end up with 35 instances. By quickly checking each one we end up in a block of code that refers to OutcastMan041 and OutcastMan042 with our beggar references scattered among them. Looks like we've found our victims.
Back up to the load list and a quick scan for outcastman041/42. The closest we find is tar04_outcastm41, tar04_outcastm42. In this case, those are the lables we're looking for. Now that we have all 3 actors, all we have to do to eliminate them is to alter their lables. Changing a single byte in each one will do the job. How you go about this is completely up to you. I generally use an uppercase "X".
Save, upload and test your change. If you've done everything right, you should exit the elevator without being molested. No beggars, no Shaleena, no problem. Eliminating cutscenes is fairly simple, but it's a good idea to scan through the rim file for all of the references to the actors involved. You'll get a good idea of triggers involved and whether or not disabling the scene will screw up your progress.
Doors come is several flavors with several possible functions, some of which may be grouped together.
Standard door : A standard door leads to an area already loaded. It's nothing more than a portal from one room to the next. As a general rule, these doors can be safely eliminated with no other effects.
Transitional door : A transitional door loads an adjacent area when entered. These doors can be tricky to deal with. Disabling a transition door can keep you from passing to the next area.
Trigger door : Trigger doors are linked to another action upon opening, an action that is usually disabled if the door is tampered with (this depends on whether or not the trigger is actually connected to the door, or a trigger zone within the door area). Transitional doors may also belong in this category. In the previous example, the elevator to the undercity not only loads a new area, but triggers the Shaleena/beggars cutscene.
Doors are decalred in the load list of every area. Some are named, some have a simple numeric designation. You may be able to determine where a specific door leads by doing a search as we did for Shaleena. Often, you'll find text that specifies the function of the door. Otherwise, it's trial and error. Some doors have more than one lable depending on their function and these can be a problem to work with.
I haven't done nearly enough work with doors to work out all the bugs, so apart from the above info, you're on your own. In general, eliminating doors is far preferable to disabling them, since that usually leaves the door non-functional and you stuck.
Unique Items >
In this example we're going to get our hands on a couple of the more exotic items in the game. If you take a look at the unique items list you'll see a couple of things listed for the lowercity corridor on Taris (tar_m03aa_s.rim).
Being unique items, these are only placeable in this one area so we need to find a container for them. The load list shows no lockers or containers however there is a Twi'lek corpse @BF47Bh so we're in business (when looking for containers to place items, don't forget to search for "corpse". In some areas this may be your only choice, like now). This particular corpse has specified items in it, unlike some which are random drop containers, so we know we'll be able to pick up anything we drop into it.
This corpse has 2 standard medpacs (g_i_medeqpmnt01) which are 15 byte spaces. The spaces we need for our items are 16 and 11. As with the first example, we could alter the byte space of the 2nd medpac and make it a 16 byte space, but what to do about the other?
This is where it pays to take a look at what the actors in a given area are equipped with. In the triggered cutscene just as you enter the main corridor, there are 3 Black Vulcars fighting with an equal number of Beks. One of those Vulcars always drops a shockstick, in this case it's referred to as "ptar_shockstick". ALthough this is a 15 [0F] byte lable, it's at the end of the item list so once again we can alter it so our 16  byte lable fits.
It goes without saying that this is a dangerous proposition since the Vulkar will be using this weapon against your party after finishing off the Beks. A quick kill is obviously in your best interest. If you can handle this, then you're in business.
First we alter the 2nd medpac lable in the corpse to accomodate our 11 [0B] byte lable for g_w_null007. Don't forget to zero the trailing bytes.
Now you're set. The corpse will contain 1 medpac and 1 blaster pistol: null and the Vulkar will drop the special edition Sith AG. Unique items may also be tempramental about the type of container you place them in; an actor or standard container. If an item doesn't show up in one place, try a different container type (if available). Tip > In this example you'll notice the "Twilek corpse" description following the corpse item list. When altering the some lable spaces, you may find the lable overlaps this text. When this is the case, the text can be safely zeroed to allow for a larger lable.
Random Drops >
Random drops are based on a series of internal rolls that determine what. when, where and how much. The basic items involved in random drops are declared in the area files. These items include utilites, grenades and credits. Since these items are declared, we can change them.
Load tar_m02aa_s.rim in your hex editor and go to offset CFEBh. You'll find a list of items seperated by 1 or 2 lines. Below that, a similar list, and below that another, shorter list. If you scan through the entire rim file, you'll find there are several of these lists scattered throughout. This is pretty standard through the entire game and this is where you make your changes.
Let's say you wanted lots of upari crystals. The lable g_i_sbrcrstl13 is 14 bytes so we have 3 items in the random drop list that we can replace with upari: g_w_fraggren01, g_i_credits015, g_w_stungren01. The more lables you replace with a single item, the better your chances are for large numbers of that item to be dropped.
Credits are a special case. g_i_credits015 has a random value between 1-50. It gives you the potential to aquire up to 50 of a given item in a single drop. Drops are also localized to various sections of, and groups within, any given area.
For example, in tar_m03aa_s (lowercity corridor) I make the following changes:
When I test my changes, the drops follow this pattern:
Drop #1 - After opening cutscene with Vulkars - Durasteel Bonding Alloy x24
Drop #2 - Vulkar guard outside Vulkar base - Vibration Cell x27
Drop #3 - Near Drop #1 when Vulkars respawn in Lowercity apartment entry (both apartments) - Hair Trigger x21/x5
You can see how the items are grouped and localized. Other alterations appear at the other end of the corridor. In areas where there are a fair number of enemy drops this is a worthwhile effort. Because of the randomness of this particular aspect of the game, you may get very little on your first attempt, or it may be just the opposite. Regardless, you can always reload the area and try again since the drops are randomized from one load to the other. Some random drops are scripted for certain items, containers and areas and are not affected by the method.
Using this hack with the 2 Endar Spire rims, I've left the ship with as many as 100+ Fett blasters, 50+ Dominator gauntlets, 40+ Karakan gauntlets, and dozens of upgrades. It's a good way to start out the game with tons of credits since everything sells for more on Taris than any other planet. Tip >
In the undercity apartments where you find Selven (tar_m03ab_s) there is a Vulkar patrol loop that will constantly respawn. The Vulkar Enforcer always drops an energy shield, which you can easily replace with any item you choose. The other two will drop randomly, but if you apply the above method you can exploit this loop for tons of items. Tip >
Using credits with this method usually results in 0 value credit drops due to the way the game calculates random credit values. Credits are better placed in containers, than as replacement items in the random drop list.