Update SnesToPc and PcToSnes
This commit is contained in:
@@ -7,14 +7,20 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
unsigned int SnesToPc(unsigned int addr) {
|
uint32_t SnesToPc(uint32_t addr) {
|
||||||
if (addr >= 0x808000) {
|
if (addr >= 0x808000) {
|
||||||
addr -= 0x808000;
|
addr -= 0x808000;
|
||||||
}
|
}
|
||||||
unsigned int temp = (addr & 0x7FFF) + ((addr / 2) & 0xFF8000);
|
uint32_t temp = (addr & 0x7FFF) + ((addr / 2) & 0xFF8000);
|
||||||
return (temp + 0x0);
|
return (temp + 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t PcToSnes(uint32_t addr) {
|
||||||
|
if (addr >= 0x400000) return -1;
|
||||||
|
addr = ((addr << 1) & 0x7F0000) | (addr & 0x7FFF) | 0x8000;
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3) {
|
int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3) {
|
||||||
return (addr1 << 16) | (addr2 << 8) | addr3;
|
return (addr1 << 16) | (addr2 << 8) | addr3;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
unsigned int SnesToPc(unsigned int addr);
|
uint32_t SnesToPc(uint32_t addr);
|
||||||
|
uint32_t PcToSnes(uint32_t addr);
|
||||||
|
|
||||||
int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3);
|
int AddressFromBytes(uint8_t addr1, uint8_t addr2, uint8_t addr3);
|
||||||
int HexToDec(char *input, int length);
|
int HexToDec(char *input, int length);
|
||||||
bool StringReplace(std::string &str, const std::string &from,
|
bool StringReplace(std::string &str, const std::string &from,
|
||||||
|
|||||||
Reference in New Issue
Block a user