Skip to content

Make the Bag Able to Hold 120 Items Instead of 30

voloved edited this page Apr 8, 2023 · 4 revisions

Warning: This will break your save-file compatibility.

In include/constants/global.h:

#define SECRET_BASES_COUNT 20
#define TV_SHOWS_COUNT 25
#define POKE_NEWS_COUNT 16
#define PC_ITEMS_COUNT 50
-#define BAG_ITEMS_COUNT 30
+#define BAG_ITEMS_COUNT 120
#define BAG_KEYITEMS_COUNT 30
#define BAG_POKEBALLS_COUNT 16
#define BAG_TMHM_COUNT 64

In include/global.h, modify SaveBlock1 to still fit the new size. Since unused_3598[0x180] isn't used, we can delete the bytes needed for the change. Since each item needs 4 bytes, then we need to take away 360 bytes.

If you don't care about the comments of the byte location of each, just change:

-    /*0x3598*/ u8 unused_3598[0x180];
+    /*0x3598*/ u8 unused_3598[0x18];

If you do, then here's what you can paste in:

struct SaveBlock1
{
    /*0x00*/ struct Coords16 pos;
    /*0x04*/ struct WarpData location;
    /*0x0C*/ struct WarpData continueGameWarp;
    /*0x14*/ struct WarpData dynamicWarp;
    /*0x1C*/ struct WarpData lastHealLocation; // used by white-out and teleport
    /*0x24*/ struct WarpData escapeWarp; // used by Dig and Escape Rope
    /*0x2C*/ u16 savedMusic;
    /*0x2E*/ u8 weather;
    /*0x2F*/ u8 weatherCycleStage;
    /*0x30*/ u8 flashLevel;
    /*0x32*/ u16 mapLayoutId;
    /*0x34*/ u16 mapView[0x100];
    /*0x234*/ u8 playerPartyCount;
    /*0x238*/ struct Pokemon playerParty[PARTY_SIZE];
    /*0x490*/ u32 money;
    /*0x494*/ u16 coins;
    /*0x496*/ u16 registeredItem; // registered for use with SELECT button
    /*0x498*/ struct ItemSlot pcItems[PC_ITEMS_COUNT];
    /*0x560*/ struct ItemSlot bagPocket_Items[BAG_ITEMS_COUNT];
    /*0x740*/ struct ItemSlot bagPocket_KeyItems[BAG_KEYITEMS_COUNT];
    /*0x7B8*/ struct ItemSlot bagPocket_PokeBalls[BAG_POKEBALLS_COUNT];
    /*0x7F8*/ struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT];
    /*0x8F8*/ struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT];
    /*0x9B0*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT];
    /*0xAF0*/ u8 seen1[NUM_DEX_FLAG_BYTES];
    /*0xB24*/ u16 berryBlenderRecords[3];
    /*0xB2A*/ u8 unused_9C2[6];
    /*0xB30*/ u16 trainerRematchStepCounter;
    /*0xB32*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
    /*0xB98*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
    /*0xDD8*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
    /*0x13D8*/ u8 flags[NUM_FLAG_BYTES];
    /*0x1504*/ u16 vars[VARS_COUNT];
    /*0x1704*/ u32 gameStats[NUM_GAME_STATS];
    /*0x1804*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];
    /*0x1C04*/ struct SecretBase secretBases[SECRET_BASES_COUNT];
    /*0x2884*/ u8 playerRoomDecorations[DECOR_MAX_PLAYERS_HOUSE];
    /*0x2890*/ u8 playerRoomDecorationPositions[DECOR_MAX_PLAYERS_HOUSE];
    /*0x289C*/ u8 decorationDesks[10];
    /*0x28A6*/ u8 decorationChairs[10];
    /*0x28B0*/ u8 decorationPlants[10];
    /*0x28BA*/ u8 decorationOrnaments[30];
    /*0x28D8*/ u8 decorationMats[30];
    /*0x28F6*/ u8 decorationPosters[10];
    /*0x2900*/ u8 decorationDolls[40];
    /*0x2928*/ u8 decorationCushions[10];
    /*0x2934*/ TVShow tvShows[TV_SHOWS_COUNT];
    /*0x2CB8*/ PokeNews pokeNews[POKE_NEWS_COUNT];
    /*0x2CF8*/ u16 outbreakPokemonSpecies;
    /*0x2CFA*/ u8 outbreakLocationMapNum;
    /*0x2CFB*/ u8 outbreakLocationMapGroup;
    /*0x2CFC*/ u8 outbreakPokemonLevel;
    /*0x2CFD*/ u8 outbreakUnused1;
    /*0x2CFE*/ u16 outbreakUnused2;
    /*0x2D00*/ u16 outbreakPokemonMoves[MAX_MON_MOVES];
    /*0x2D08*/ u8 outbreakUnused3;
    /*0x2D09*/ u8 outbreakPokemonProbability;
    /*0x2D0A*/ u16 outbreakDaysLeft;
    /*0x2D0C*/ struct GabbyAndTyData gabbyAndTyData;
    /*0x2D18*/ u16 easyChatProfile[EASY_CHAT_BATTLE_WORDS_COUNT];
    /*0x2D24*/ u16 easyChatBattleStart[EASY_CHAT_BATTLE_WORDS_COUNT];
    /*0x2D30*/ u16 easyChatBattleWon[EASY_CHAT_BATTLE_WORDS_COUNT];
    /*0x2D3C*/ u16 easyChatBattleLost[EASY_CHAT_BATTLE_WORDS_COUNT];
    /*0x2D48*/ struct Mail mail[MAIL_COUNT];
    /*0x2F88*/ u8 additionalPhrases[NUM_ADDITIONAL_PHRASE_BYTES]; // bitfield for 33 additional phrases in easy chat system
    /*0x2F90*/ OldMan oldMan;
    /*0x2FCC*/ struct DewfordTrend dewfordTrends[SAVED_TRENDS_COUNT];
    /*0x2FF8*/ struct ContestWinner contestWinners[NUM_CONTEST_WINNERS]; // see CONTEST_WINNER_*
    /*0x3198*/ struct DayCare daycare;
    /*0x32B8*/ struct LinkBattleRecords linkBattleRecords;
    /*0x3310*/ u8 giftRibbons[GIFT_RIBBONS_COUNT];
    /*0x331B*/ struct ExternalEventData externalEventData;
    /*0x332F*/ struct ExternalEventFlags externalEventFlags;
    /*0x3344*/ struct Roamer roamer;
    /*0x3360*/ struct EnigmaBerry enigmaBerry;
    /*0x3394*/ struct MysteryGiftSave mysteryGift;
    /*0x3700*/ u8 unused_3700[0x18];
    /*0x3718*/ u32 trainerHillTimes[NUM_TRAINER_HILL_MODES];
    /*0x3728*/ struct RamScript ramScript;
    /*0x3B14*/ struct RecordMixingGift recordMixingGift;
    /*0x3B24*/ u8 seen2[NUM_DEX_FLAG_BYTES];
    /*0x3B58*/ LilycoveLady lilycoveLady;
    /*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20];
    /*0x3C88*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];
    /*0x3D5A*/ u8 unused_3D5A[10];
    /*0x3D64*/ struct TrainerHillSave trainerHill;
    /*0x3D70*/ struct WaldaPhrase waldaPhrase;
    // sizeof: 0x3D88
};

Then, Menu_ProcessInputNoWrap outputs as an s8, which is now too small for the menu.
In menu.c, copy Menu_ProcessInputNoWrap and paste it below, changing its output to s16 and its name to Menu_ProcessInputNoWrap2.

    return MENU_NOTHING_CHOSEN;
}

+s16 Menu_ProcessInputNoWrap2(void)
+{
+    u16 oldPos = sMenu.cursorPos;
+
+    if (JOY_NEW(A_BUTTON))
+    {
+        if (!sMenu.APressMuted)
+            PlaySE(SE_SELECT);
+        return sMenu.cursorPos;
+    }
+    else if (JOY_NEW(B_BUTTON))
+    {
+        return MENU_B_PRESSED;
+    }
+    else if (JOY_NEW(DPAD_UP))
+    {
+        if (oldPos != Menu_MoveCursorNoWrapAround(-1))
+            PlaySE(SE_SELECT);
+        return MENU_NOTHING_CHOSEN;
+    }
+    else if (JOY_NEW(DPAD_DOWN))
+    {
+        if (oldPos != Menu_MoveCursorNoWrapAround(1))
+            PlaySE(SE_SELECT);
+        return MENU_NOTHING_CHOSEN;
+    }
+    return MENU_NOTHING_CHOSEN;
+}
+
s8 ProcessMenuInput_other(void)
{
    if (JOY_NEW(A_BUTTON))

Declare it in menu.h:

s8 Menu_ProcessInput(void);
s8 Menu_ProcessInputNoWrap(void);
+s16 Menu_ProcessInputNoWrap2(void);
void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y);

And replace Menu_ProcessInputNoWrap with it:

static void Task_ItemContext_SingleRow(u8 taskId)
{
     if (MenuHelpers_ShouldWaitForLinkRecv() != TRUE)
     {
-        s8 selection = Menu_ProcessInputNoWrap();
+        s16 selection = Menu_ProcessInputNoWrap2();
         switch (selection)
         {
         case MENU_NOTHING_CHOSEN:
Clone this wiki locally