Revert PcToSnes implementation

This commit is contained in:
scawful
2024-01-31 14:09:26 -05:00
parent cbc523e427
commit c59f354450

View File

@@ -2,7 +2,6 @@
#include <imgui/imgui.h>
#include <bitset>
#include <chrono>
#include <cstdint>
#include <functional>
@@ -44,19 +43,16 @@ uint32_t SnesToPc(uint32_t addr) {
}
uint32_t PcToSnes(uint32_t addr) {
std::bitset<24> addr_bits(addr);
std::bitset<24> result_bits;
uint8_t *b = reinterpret_cast<uint8_t *>(&addr);
b[2] = static_cast<uint8_t>(b[2] * 2);
// Shift the address left by 1 bit
addr_bits <<= 1;
if (b[1] >= 0x80) {
b[2] += 1;
} else {
b[1] += 0x80;
}
// Set the most significant bit of the second byte
addr_bits.set(15, true);
// Convert the modified bitset back to an integer
uint32_t result = static_cast<uint32_t>(addr_bits.to_ulong());
return result;
return addr;
}
uint32_t MapBankToWordAddress(uint8_t bank, uint16_t addr) {