mirror of https://github.com/mgba-emu/mgba.git
GBA: Use GBALog with appropriate GBA object in new GPIO code
This commit is contained in:
parent
6938c8bea6
commit
b51710e92f
|
@ -341,7 +341,7 @@ void _lightReadPins(struct GBACartridgeGPIO* gpio) {
|
||||||
}
|
}
|
||||||
if (gpio->p1) {
|
if (gpio->p1) {
|
||||||
struct GBALuminanceSource* lux = gpio->p->luminanceSource;
|
struct GBALuminanceSource* lux = gpio->p->luminanceSource;
|
||||||
GBALog(0, GBA_LOG_DEBUG, "[SOLAR] Got reset");
|
GBALog(gpio->p, GBA_LOG_DEBUG, "[SOLAR] Got reset");
|
||||||
gpio->lightCounter = 0;
|
gpio->lightCounter = 0;
|
||||||
if (lux) {
|
if (lux) {
|
||||||
lux->sample(lux);
|
lux->sample(lux);
|
||||||
|
@ -357,7 +357,7 @@ void _lightReadPins(struct GBACartridgeGPIO* gpio) {
|
||||||
|
|
||||||
bool sendBit = gpio->lightCounter >= gpio->lightSample;
|
bool sendBit = gpio->lightCounter >= gpio->lightSample;
|
||||||
_outputPins(gpio, sendBit << 3);
|
_outputPins(gpio, sendBit << 3);
|
||||||
GBALog(0, GBA_LOG_DEBUG, "[SOLAR] Output %u with pins %u", gpio->lightCounter, gpio->pinState);
|
GBALog(gpio->p, GBA_LOG_DEBUG, "[SOLAR] Output %u with pins %u", gpio->lightCounter, gpio->pinState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// == Tilt (not technically GPIO)
|
// == Tilt (not technically GPIO)
|
||||||
|
@ -375,7 +375,7 @@ void GBAGPIOTiltWrite(struct GBACartridgeGPIO* gpio, uint32_t address, uint8_t v
|
||||||
if (value == 0x55) {
|
if (value == 0x55) {
|
||||||
gpio->tiltState = 1;
|
gpio->tiltState = 1;
|
||||||
} else {
|
} else {
|
||||||
GBALog(0, GBA_LOG_GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
GBALog(gpio->p, GBA_LOG_GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x8100:
|
case 0x8100:
|
||||||
|
@ -394,11 +394,11 @@ void GBAGPIOTiltWrite(struct GBACartridgeGPIO* gpio, uint32_t address, uint8_t v
|
||||||
gpio->tiltX = (x >> 21) + 0x3A0; // Crop off an extra bit so that we can't go negative
|
gpio->tiltX = (x >> 21) + 0x3A0; // Crop off an extra bit so that we can't go negative
|
||||||
gpio->tiltY = (y >> 21) + 0x3A0;
|
gpio->tiltY = (y >> 21) + 0x3A0;
|
||||||
} else {
|
} else {
|
||||||
GBALog(0, GBA_LOG_GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
GBALog(gpio->p, GBA_LOG_GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GBALog(0, GBA_LOG_GAME_ERROR, "Invalid tilt sensor write to %04x: %02x", address, value);
|
GBALog(gpio->p, GBA_LOG_GAME_ERROR, "Invalid tilt sensor write to %04x: %02x", address, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,7 @@ uint8_t GBAGPIOTiltRead(struct GBACartridgeGPIO* gpio, uint32_t address) {
|
||||||
case 0x8500:
|
case 0x8500:
|
||||||
return (gpio->tiltY >> 8) & 0xF;
|
return (gpio->tiltY >> 8) & 0xF;
|
||||||
default:
|
default:
|
||||||
GBALog(0, GBA_LOG_GAME_ERROR, "Invalid tilt sensor read from %04x", address);
|
GBALog(gpio->p, GBA_LOG_GAME_ERROR, "Invalid tilt sensor read from %04x", address);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0xFF;
|
return 0xFF;
|
||||||
|
|
Loading…
Reference in New Issue