Skip to content

Commit

Permalink
GBA: Fixed open bus issues
Browse files Browse the repository at this point in the history
This fixes a freeze in Zelda Minish Cap (in the final dungeon) and fixes a test in the mGBA test suite (Misc -> DMA prefetch -> Read)
  • Loading branch information
SourMesen committed Dec 20, 2024
1 parent 71ecb09 commit 32ab5cf
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Core/GBA/GbaMemoryManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,19 @@ void GbaMemoryManager::UpdateOpenBus(uint32_t addr, uint32_t value)
value >>= 8;
}
memcpy(_state.InternalOpenBus, _state.IwramOpenBus, sizeof(_state.IwramOpenBus));
} else {
for(int i = 0; i < width; i++) {
_state.InternalOpenBus[i] = value;
value >>= 8;
}
} else if constexpr(width == 4) {
_state.InternalOpenBus[0] = value;
_state.InternalOpenBus[1] = value >> 8;
_state.InternalOpenBus[2] = value >> 16;
_state.InternalOpenBus[3] = value >> 24;
} else if constexpr(width == 2) {
_state.InternalOpenBus[2] = _state.InternalOpenBus[0] = value;
_state.InternalOpenBus[3] = _state.InternalOpenBus[1] = value >> 8;
} else if constexpr(width == 1) {
_state.InternalOpenBus[0] = value;
_state.InternalOpenBus[1] = value;
_state.InternalOpenBus[2] = value;
_state.InternalOpenBus[3] = value;
}
}

Expand Down

0 comments on commit 32ab5cf

Please sign in to comment.