Jump to content

[PtHGSS] Editing Poké Mart Items


Recommended Posts

Editing Poké Mart Items
---

A quick addendum - this only definitely works for fixed item inventories, like the secondary clerk in some Poké Marts. I'm not sure how to edit the general market that changes after every few Badges.
This requires the use of a hex editor such as Hex Workshop or HxD.

This tutorial can be used for Platinum or HG/SS. I think the same steps may apply to Black/White as well, but in Black 2/White 2 it's stored in a different file (I believe a/2/8/2).

Step 1: Calculate the hex string for the items in the mart that you want to edit.
---
https://bulbapedia.bulbagarden.net/wiki/List_of_items_by_index_number_(Generation_IV)

This page lists all items in the game with their numerical index. Internally, the game has a list of items that appear in each Poké Mart.
Take note of the "Hex" column in that page. For example, a Protector has a hexadecimal index of 0x0141.
The other thing to note is that the game stores bytes in little endian form. That means internally, you'd see the Protector written as "41 01". Each byte is the opposite way around.
The hex string is just a few of these strung together.

So for example, let's say we had a mart that sold Grass Mail (0x0089), Flame Mail (0x008A) and Bubble Mail (0x008B) and it's listed in that exact order in-game...

Grass Mail
Flame Mail
Bubble Mail

That means we'll need to search "89 00 8A 00 8B 00" to find it - each individual item has its bytes flipped due to little endian form, and then they're just strung together.

In HG/SS, the item order is top left first, then top right, then middle left, middle right, bottom left, bottom right, top left on page two etc.

To find what items to search for, look at the Poké Mart inventory you want to edit, cross-reference it with the page linked above and you can produce the hex string from that.

Step 2: Extract the file the data is contained in.
---
Poké Mart data is located in the arm9.bin.
If you're playing Platinum, you can just open it up in the hex editor immediately. You can get your arm9.bin by extracting it with crystaltile2, or in the file folders SDSME/PPRE produce when a ROM is loaded into them.
If you're playing HG/SS, you need to first decompress the arm9.bin as it's compressed internally. To do this, extract the arm9.bin with crystaltile2 but select "Extract(U)" instead of "Export".

Step 3: Search the hex string in the arm9.bin
---
Simply open your arm9.bin file up in a hex editor and search for the string above. For example, I'd search "89 00 8A 00 8B 00" if I were following the example above.
Generally there should only be one result, as most of the fixed mart inventories are unique.

Step 4: Edit the hex string to be the items you want
---
Now we just change the items to what we want. Following the example above, let's say instead of Grass Mail, Flame Mail and Bubble Mail, I want to now sell Bloom Mail, Tunnel Mail and Steel Mail.
I replace Grass Mail with Bloom Mail; referencing the index number document, I replace 89 00 with 8C 00.
I replace Flame Mail with Tunnel Mail; so I change 8A 00 to be 8D 00.
I replace Bubble Mail with Steel Mail; so I change 8B 00 to be 8E 00.

That's all there is to this part! We can then save the arm9.bin file.

Step 5: Reinsert the arm9.bin file into the game
---
If this is Platinum and you just opened the arm9.bin file out of a folder PPRE/SDSME produced, you can just write the ROM. Otherwise, import the arm9.bin file over the current one with crystaltile2, then save your ROM.
For HG/SS, you'll need to right-click on the arm9.bin in the File Explorer on crystaltile2 again, and this time select "Compression" followed by your arm9.bin. You should have a short pause as it reinserts, then you can save your ROM.

You should now see the changes reflected in-game!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...