Small improvements

This commit is contained in:
SimoneN64
2023-03-19 17:16:58 +01:00
parent e18eb6dd61
commit e3b3fe76db
2 changed files with 8 additions and 8 deletions

View File

@@ -206,7 +206,7 @@ void PIF::ProcessCommands(Mem &mem) {
} }
} }
void PIF::MempakRead(u8* cmd, u8* res) { void PIF::MempakRead(u8* cmd, u8* res) const {
u16 offset = cmd[3] << 8; u16 offset = cmd[3] << 8;
offset |= cmd[4]; offset |= cmd[4];
@@ -236,7 +236,7 @@ void PIF::MempakRead(u8* cmd, u8* res) {
res[32] = data_crc(&res[0]); res[32] = data_crc(&res[0]);
} }
void PIF::MempakWrite(u8* cmd, u8* res) { void PIF::MempakWrite(u8* cmd, u8* res) const {
// First two bytes in the command are the offset // First two bytes in the command are the offset
u16 offset = cmd[3] << 8; u16 offset = cmd[3] << 8;
offset |= cmd[4]; offset |= cmd[4];
@@ -262,7 +262,7 @@ void PIF::MempakWrite(u8* cmd, u8* res) {
res[0] = data_crc(&cmd[5]); res[0] = data_crc(&cmd[5]);
} }
void PIF::EepromRead(u8* cmd, u8* res, const Mem& mem) { void PIF::EepromRead(u8* cmd, u8* res, const Mem& mem) const {
assert(mem.saveType == SAVE_EEPROM_4k || mem.saveType == SAVE_EEPROM_16k); assert(mem.saveType == SAVE_EEPROM_4k || mem.saveType == SAVE_EEPROM_16k);
if (channel == 4) { if (channel == 4) {
u8 offset = cmd[3]; u8 offset = cmd[3];
@@ -279,7 +279,7 @@ void PIF::EepromRead(u8* cmd, u8* res, const Mem& mem) {
} }
} }
void PIF::EepromWrite(u8* cmd, u8* res, const Mem& mem) { void PIF::EepromWrite(u8* cmd, u8* res, const Mem& mem) const {
assert(mem.saveType == SAVE_EEPROM_4k || mem.saveType == SAVE_EEPROM_16k); assert(mem.saveType == SAVE_EEPROM_4k || mem.saveType == SAVE_EEPROM_16k);
if (channel == 4) { if (channel == 4) {
u8 offset = cmd[3]; u8 offset = cmd[3];

View File

@@ -102,10 +102,10 @@ struct PIF {
void UpdateController(); void UpdateController();
bool ReadButtons(u8*) const; bool ReadButtons(u8*) const;
void ControllerID(u8*) const; void ControllerID(u8*) const;
void MempakRead(u8*, u8*); void MempakRead(u8*, u8*) const;
void MempakWrite(u8*, u8*); void MempakWrite(u8*, u8*) const;
void EepromRead(u8*, u8*, const Mem&); void EepromRead(u8*, u8*, const Mem&) const;
void EepromWrite(u8*, u8*, const Mem&); void EepromWrite(u8*, u8*, const Mem&) const;
bool gamepadConnected = false; bool gamepadConnected = false;
SDL_GameController* gamepad{}; SDL_GameController* gamepad{};