I ended up on this forum while trying to search for ways to modify AI decks. Unfortunately, I couldn't get as far as to modify character appearances as OP g00dman desired, but I did manage to change AI decklists and deck names and so I'll leave my method here for anyone else who is curious. This isn't some optimal method or anything close to one, but it was sufficient for changing decklists (including fusion decks) and deck names. Obviously the AI isn't the smartest player around, but replacing weak AI decks can make the game more entertaining since you no longer auto-win due to the AI playing a bunch of do-nothing cards. You can see how the AI performs with a custom decklist in the Recipe Duel mode anyway.
[Required software]
- a hexadecimal editor with addresses and a search capability
- a ROM opener/editor
I used Tinke for the ROM editor and Visual Studio Code with some random Hexadecimal editor plugin for general hexadecimal editing. I don't know if these are optimal/safe/secure but they're what worked for me. I'm also unfamiliar with different versions of the WC2008 ROM and how these various versions might affect the deck changing process.
[Relevant files within ROM]
- root/Data_arc_pac/deck.pac - where CPU decklists are stored
- root/Data_arc_pac/bin2.pac - where CPU deck names are stored
[Relevant files elsewhere]
- Your game save file (don't forget to make backups)
[Things to remember]
- Within the game files, each individual card is represented using four hexadecimal characters, such as 7C 13 for Dust Tornado. Therefore, a deck that has three copies of Dust Tornado will contain the sequence 7C 13 7C 13 7C 13 when represented in the game's files. Each line of hexadecimal contains thirty-two characters, and each card requires four characters, so each line of hexadecimal stores eight full cards, i.e. the four characters for a card aren't split over multiple lines. Be careful that, when you're looking for a particular card, you don't accidentally count the end of one card and the start of the next as being your desired card. For example, 7C 13 7C 13 is two Dust Tornado, but you might accidentally use the 13 7C between those cards and think it's a card that you are looking for. Again, each line contains eight full cards of four characters each, so use the position of the characters to ensure that you're not grabbing the end of one card and the start of the next.
============================================================
1. Create a recipe containing the deck that you want the AI to use. You can use up to 80 cards and up to 20 fusion cards. I don't know if decks with fewer than 40 cards are possible. You can't include a side deck to my knowledge. Save it under a name that you'll remember.
=== Finding the Location of a Specific CPU Deck in the ROM files ===
2. Decide which existing CPU deck you want to replace, e.g. Dark Zane's Underworld Deck. Testing to see whether your modifications are successful is easy for the 13 or so pages of opponents listed under CPU duel since the game will freeze on the opponent selection screen if you make a mistake. I don't know if something similar exists for other AI in the game. AI deck names have different length limits within the game files. The length limit is similar to the existing name for that deck.
3. Find a text-based compilation of all the CPU decklists online. I don't know if external links are allowed here, but if you search for "Yu-Gi-Oh! World Championship 2008 – CPU Opponent Deck List" you should be able to find one by someone called Munckeyz.
4. Identify a group of cards that is unique to the deck that you want to replace. This group of cards will be used to isolate the deck within the game files, so the group of cards must be sufficient to identify the deck when it's alongside every other AI deck. The overall process is simpler if you find the smallest group of cards that is unique to the deck.
For example, only two decks contain the card "Cyberdark Impact!" - the Armed Dragons deck of Cyberdark Dragon and Dark Zane's Underworld Deck. However, Dark Zane's deck also contains Dust Tornado whereas the Armed Dragons deck does not. In other words, there is only one AI deck that contains both Cyberdark Impact AND Dust Tornado. Therefore, the cards Cyberdark Impact and Dust Tornado are sufficient to identify Dark Zane's deck in the game files.
If there is a card that is only contained within a particular deck, such as Silver Fang in Stray Lambs' Like Two Heads deck, then only that single card is needed. However, if a deck doesn't contain many unique cards and instead only contains a bunch of generic staples like Heavy Storm, Bottomless Trap Hole, Call of the Haunted, etc, then you may need to determine several cards before that group of cards is unique to the deck that you want to change. Again, using the lowest quantity of cards makes this easier, so it would be better to represent Dark Zane's deck using the two cards Cyberdark Impact and Dust Tornado instead of the four cards Cyber End Dragon, Dust Tornado, Crush Card Virus and Mechanicalchaser.
5. Create and save a deck recipe containing the unique identifier cards. Since you won't be able to tell which card is which within the save file (they're represented in hexadecimal), I recommend including one copy of the first card, two copies of the second card, three copies of the third card, and repeating this in another recipe for additional cards. Unlike the card names, the recipe names will be readable in the save file, so name the recipes something you will recognize. When the recipes are created, save your game.
6. Open (a copy of) your save file using your hexadecimal editor and scroll to address ~00010000 which is where your deck recipes are stored. Your hexadecimal editor should have the titles of your recipes visible. Recipes are separated by a chunk of FF FF FF FF. The first few lines contain the recipe name and some other unneeded data. The end of the fourth line for each recipe contains the first two cards of the deck, such as 9B 11 9B 11. After all of the cards in the deck are listed, there is a bunch of 00 00 00, followed by the fusion deck if one is in the recipe. More on that later. For now, find the recipe containing your unique cards, and using the amount of times each card is listed (e.g. once, twice, three times), determine the four characters that represent each of the unique cards.
7. Using the ROM editor, enter the game files and open root/Data_arc_pac/deck.pac as a hexadecimal file. Decks are stored somewhat similar to in the save file, i.e. in blocks. Using the search functionality, search for the least common of the unique cards using the hexadecimal characters from the previous step. Once you've found a deck that contains one of the unique cards, note the approximate address of the deck. Then, search for the next least common unique card and see if it is also present in this deck. Continue to use the unique cards in this way until you find the deck that contains all of the unique cards. Write down the approximate starting address of this deck, and also record the starting address of the next deck in case you accidentally move it later.
=== Replacing the CPU Deck ===
8. In your save file, find the hexadecimal section that corresponds to the deck that you want to replace the AI deck with. Again, the actual cards start being listed at the end of the fourth line for the deck, whereas the first three lines and the start of the fourth line are used for other data that isn't needed yet. Two cards (eight characters total) are positioned at the end of the fourth line, whereas each line after contains up to eight cards (thirty-two characters total). After the maindeck cards, there's a buffer of 00 00 00 00, followed by the fusion deck. Take a mental note of where the maindeck and fusion deck are, since these will be copied over the respective sections in the AI decklist file.
9. Back in the AI deck file, where you found the section of hexadecimal that contains the AI deck that you want to replace, the data is stored a little differently to the save file. It's stored in the format:
XX XX XX XX XX XX XX XX NN 00 C1 C1 C2 C2 C3 C3
XX XX etc is not needed. NN is where the deck length is stored in hexadecimal. 28 is a deck size of 40 cards, 29 is a deck size of 41 cards, 50 is a deck size of 80 cards. If you know the size of the maindeck that you'll be replacing the AI deck with, you can manually convert that quantity to hexadecimal and replace the characters NN with 28 representing 40 cards for example. Alternatively, you can use the first two characters of the fourth line of the recipe in the save file, since the maindeck size is stored here as well. If you do not use the correct number then your deck will not load properly.
C1 C1 C2 C2 C3 C3 is where the first 3 cards of the maindeck are stored. The next few lines each contain 8 cards as usual, until the main deck ends.
Immediately after the maindeck cards are listed, there is a four character separator of the format YY 00, which specifies the number of cards that are in the fusion deck. For example, 03 00 is the separator before a fusion deck containing 3 cards, whereas 0C 00 is the separator for a 15 card fusion deck. After the separator, the fusion deck is listed. If a deck has no fusion deck then it will not contain a separator.
Take a mental note of where these sections are. Also, if you haven't already, write down the starting address of the next AI deck within the AI deck file, in case you nudge it up or down.
10. Using the copying method of your choice (I did line by line, character by character), replace the maindeck of the AI deck in the AI deck file with the cards from your save file. Depending on your hexadecimal editor, you may end up inserting new characters instead of replacing existing ones, so check to ensure that the overall format of the AI deck file isn't being changed.
When you've finished replacing the AI's maindeck, if your new deck contains a fusion deck, add the appropriate fusion separator, such as 05 00 for a 5 card fusion deck. Then, in your save file, the fusion deck is listed in the final five lines before the buffer of FF FF FF FF before the next deck. The first line containing the fusion deck contains four cards (sixteen characters), and the rest of the fusion deck is listed immediately after. Copy the cards from the fusion deck in your save file into the AI deck file, immediately after the separator.
After all of the cards in your recipe have been added into the AI deck file, the rest of the characters are 00 00 00 00 until the line where the next deck begins. Ensure that the next deck starts on the same line that it did before you made any changes, and add or remove 00 00 00 00 until it is in the correct location.
11. Save any changes that you make and export the ROM if necessary so that you'll be launching the game using the new modified ROM.
=== Testing the Changes ===
12. Open the game, select CPU duel, and select the portrait of the AI whose deck you replaced. If you made an error, the game will freeze when you select their portrait. Otherwise, everything should be good to go. You might need to play against the new deck a few times to make sure there weren't any errors when copying the deck lists over.
=== Changing the AI Deck Name ===
13. AI deck names are stored in root/Data_arc_pac/bin2.pac . Use a search functionality to find the current name of the AI deck. AI decks have different length limits that I don't know how to change. Make sure that the starting position of the next deck's name doesn't move when you make changes. With this in mind, your hexadecimal editor should let you directly modify the deck name within the decoded text, and it should convert to hexadecimal automatically. If you have space after your new name and before the start of the next deck's name, you can pad it with 00 00 00.