Skip to content

Commit e83b995

Browse files
committed
ChangeInventoryC update + Fix another incorrect address
When adding a new item or badge, if the cursor is currently over an existing item or badge, then the one added will be the same as the one that the cursor is over.
1 parent 18af487 commit e83b995

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ttyd-tools/rel/source/codes/ChangeInventoryC.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extern uint16_t InventoryRemoveItemOrBadgeFirstButtonCombo;
1616
extern uint16_t InventoryPreviousValueFirstButtonCombo;
1717
extern uint16_t InventoryNextValueFirstButtonCombo;
1818

19-
void addItemOrBadge(uint32_t PouchAddress, uint16_t ItemOrBadge, int16_t LoopCounter, uint32_t SubMenu)
19+
void addItemOrBadge(uint32_t PouchAddress, uint32_t CursorCurrentItem, uint16_t ItemOrBadge, int16_t LoopCounter, uint32_t SubMenu)
2020
{
2121
if (SubMenu != 1)
2222
{
@@ -32,6 +32,12 @@ void addItemOrBadge(uint32_t PouchAddress, uint16_t ItemOrBadge, int16_t LoopCou
3232
else
3333
{
3434
// Slot is empty, so add item
35+
if ((CursorCurrentItem >= 1) && (CursorCurrentItem <= 338))
36+
{
37+
// Add selected item/badge
38+
ItemOrBadge = CursorCurrentItem;
39+
}
40+
3541
*reinterpret_cast<uint16_t *>(PouchAddress) = ItemOrBadge;
3642
break;
3743
}
@@ -156,12 +162,12 @@ void Mod::changeInventory()
156162
if (CurrentTab == 2)
157163
{
158164
// Standard items menu
159-
addItemOrBadge(PouchStandardInventoryAddress, GoldBar, StandardItemsLoopCounter, SubMenuImportantItems);
165+
addItemOrBadge(PouchStandardInventoryAddress, CursorItem, GoldBar, StandardItemsLoopCounter, SubMenuImportantItems);
160166
}
161167
else if (CurrentTab == 3)
162168
{
163169
// Badges menu
164-
addItemOrBadge(PouchBadgeInventoryAddress, PowerJump, BadgesLoopCounter, SubMenuEquippedBadges);
170+
addItemOrBadge(PouchBadgeInventoryAddress, CursorItem, PowerJump, BadgesLoopCounter, SubMenuEquippedBadges);
165171
}
166172
}
167173
ChangeInventoryButtonHoldCounter++;

ttyd-tools/rel/source/global.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
uint32_t r13 = 0x8041CF20;
1010
uint32_t NPCAddressesStart = r13 + 0x19A0;
1111
uint32_t PauseMenuAddressesStart = r13 + 0x1D10;
12-
uint32_t BattleAddressesStart = r13 + 0x1BE0;
12+
uint32_t BattleAddressesStart = r13 + 0x1C70;
1313
char *NextBero = reinterpret_cast<char *>(r13 + 0x1688);
1414
char *NextMap = reinterpret_cast<char *>(r13 + 0x16A8);
1515
char *NextArea = reinterpret_cast<char *>(r13 + 0x16C8);
@@ -25,7 +25,7 @@ extern "C" {
2525
uint32_t r13 = 0x80429760;
2626
uint32_t NPCAddressesStart = r13 + 0x1A80;
2727
uint32_t PauseMenuAddressesStart = r13 + 0x1DF0;
28-
uint32_t BattleAddressesStart = r13 + 0x1CC0;
28+
uint32_t BattleAddressesStart = r13 + 0x1D50;
2929
char *NextBero = reinterpret_cast<char *>(r13 + 0x1768);
3030
char *NextMap = reinterpret_cast<char *>(r13 + 0x1788);
3131
char *NextArea = reinterpret_cast<char *>(r13 + 0x17A8);

0 commit comments

Comments
 (0)