Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Ocean Deed crashing game #37

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/mm.ld
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SECTIONS{
*(.patch_KeepBowOnEpona)
}

.patch_RemoveTradeItemFromSlot 0x1AFE8C : {
.patch_RemoveTradeItemFromSlot 0x1AFE94 : {
*(.patch_RemoveTradeItemFromSlot)
}

Expand Down
2 changes: 1 addition & 1 deletion code/source/asm/trade_item_hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ hook_RemoveTradeItemFromExtSlot:
push {r0-r12, lr}
bl SaveFile_RemoveTradeItemFromSlot
pop {r0-r12, lr}
cpy r2,r1
cpy r4,r0
bx lr

.global hook_RemoveKafeiItemFromExtSlot
Expand Down
2 changes: 1 addition & 1 deletion code/source/asm/trade_item_patches.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.section .patch_RemoveTradeItemFromSlot
.global patch_RemoveTradeItemFromSlot
patch_RemoveTradeItemFromSlot:
bleq hook_RemoveTradeItemFromExtSlot
bl hook_RemoveTradeItemFromExtSlot

.section .patch_DoNotRemoveTradeItems
.global patch_DoNotRemoveTradeItems
Expand Down
2 changes: 1 addition & 1 deletion code/source/rnd/item_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ namespace rnd {
// This is to ensure fairness and allows us to place these items without second guessing in logic.
// Let's be a bit rude and give them fishing passes.
// XXX: This may be simplified with the IsItemObtained checks as well.
if (override.value.getItemId > 0x45 || override.value.getItemId < 0x4A) {
if (override.value.getItemId > 0x45 && override.value.getItemId < 0x4A) {
if (incomingGetItemId == (s16)GetItemID::GI_MOONS_TEAR &&
gExtSaveData.givenItemChecks.enObjMoonStoneGivenItem == 1) {
player->get_item_id = (s16)GetItemID::GI_FISHING_HOLE_PASS;
Expand Down
13 changes: 1 addition & 12 deletions code/source/rnd/savefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,6 @@ namespace rnd {
}

extern "C" void SaveFile_SaveExtSaveData() {
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
rnd::util::Print("%s: Saving extdata.\n", __func__);
#endif
game::CommonData& comData = game::GetCommonData();
char path[] = "/0.bin";

Expand All @@ -912,9 +909,6 @@ namespace rnd {

extern "C" void SaveFile_RemoveStoredTradeItem(u16 item, u8 slot) {
// This is a get item ID, we need to translate it to the regular item ID.
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
rnd::util::Print("%s: Item and slot are %#04x %u\n", __func__, item, slot);
#endif
if (slot != 5 && slot != 17)
return;
ItemRow* gidItemRow = ItemTable_GetItemRowFromIndex(item);
Expand All @@ -923,10 +917,6 @@ namespace rnd {
for (int i = 0; i < 9; i++) {
if (gidItemRow->itemId != (u8)gExtSaveData.collectedTradeItems[i] && firstItem == game::ItemId::None) {
if (slot == 17 && i > 5 && i < 8) {
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
rnd::util::Print("%s: Slot is 17 and our found item is %#04x\n", __func__,
gExtSaveData.collectedTradeItems[i]);
#endif
firstItem = gExtSaveData.collectedTradeItems[i];
}

Expand All @@ -942,9 +932,8 @@ namespace rnd {
saveData.inventory.items[slot] = firstItem;
}
extern "C" void SaveFile_RemoveTradeItemFromSlot(u16 item, u8 slot) {
// This is a get item ID, we need to translate it to the regular item ID.
if (slot == 5) {
for (int i = 0; i < 4; i++) {
for (int i = 0; i < 5; i++) {
if (item == (u16)gExtSaveData.collectedTradeItems[i]) {
gExtSaveData.collectedTradeItems[i] = game::ItemId::None;
break;
Expand Down
2 changes: 1 addition & 1 deletion code/source/rnd/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ namespace rnd {
"Bunny Hood",
"Keaton Mask",
"Garo Mask",
"ROmani Mask",
"Romani Mask",
"Circus Leader's Mask",
"Postman Hat",
"Couple's Mask",
Expand Down
Loading