Increase Bag Space - pret/pokered GitHub Wiki
This increases Bag Space from original 20 limit to 50.
All credit goes to Vortiene for showing me how to do this!
First we need to find where the bag capacity is located. Menu Constants will show both item and pc capacity at the top of the page.
constants/menu_constants.asm
- DEF BAG_ITEM_CAPACITY EQU 20
+ DEF BAG_ITEM_CAPACITY EQU 50
We are changing the 20 to 50 because we want the Item bag to be able to carry 50 items now instead of 20.
Next step is to go to Wram and down to line 1750 and make the following changes ram/wram.asm
- wNumBagItems:: db
- ; item, quantity
- wBagItems:: ds BAG_ITEM_CAPACITY * 2 + 1
+ ds 42
The reason we make this ds 42 is bag space equation is NUM ITEM X 2 + 1 (20 bag space itemsX 2 + 1) = 41 + the byte for NumBagItems (1) which equals 42. Since we need to move it, we add 42 bytes of free space back to this location.
But we have to move those wram bytes elsewhere…
To increase bag space to any bigger size, we need to find a bigger wram byte space. Fortunately there is a section with 128 byes of free space.
Look at line 1827 and make the following changes ram/wram.asm
- ds 128
+ ;;;;;;;;; note: CHANGED: this empty space is now used for bigger bag space
+ UNION
+ original size of this empty space
+ ds 128
+ NEXTU
+ :: db
+ ; item, quantity
+ wBagItems:: ds BAG_ITEM_CAPACITY * 2 + 1 ; now holds 50 items
+ ;;;;
+ ; 26 bytes left to use
+ ENDU
+ ;;;;;;;;;;
We are dedicating a portion of the unused big space by moving the bag space wram bytes to this location.
The Same equation as above applies: NUM ITEM X 2 + 1 (50 bag space items X 2 + 1) = 101 bytes needed + the byte for NumBagItems (1) which equals 102 bytes. 128-102 = 26 bytes of free space left to use for other new additions.
*Note doing this will alter save compatibility. All current items will be removed from bag or replaced by glitch items. If you want to keep your current save file, I suggest putting your important items in the PC first. Once you purchase a new item the bag space glitch items will disappear.
Also using a save editor like PKHEX will not work if you try to add items to your bag. If you must use a save editor. You can add items to your PC and withdraw them and put them in your bag that way.
I have tried it for the sake of this tutorial but use at your own risk!*