mirror of https://github.com/mgba-emu/mgba.git
GBA SIO: Add writeRCNT callback, mostly for GPIO mode
This commit is contained in:
parent
5da4b1fc4d
commit
aad552ff47
|
@ -118,6 +118,7 @@ struct GBASIODriver {
|
||||||
int (*connectedDevices)(struct GBASIODriver* driver);
|
int (*connectedDevices)(struct GBASIODriver* driver);
|
||||||
int (*deviceId)(struct GBASIODriver* driver);
|
int (*deviceId)(struct GBASIODriver* driver);
|
||||||
uint16_t (*writeSIOCNT)(struct GBASIODriver* driver, uint16_t value);
|
uint16_t (*writeSIOCNT)(struct GBASIODriver* driver, uint16_t value);
|
||||||
|
uint16_t (*writeRCNT)(struct GBASIODriver* driver, uint16_t value);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GBASIOBattleChipGateFlavor {
|
enum GBASIOBattleChipGateFlavor {
|
||||||
|
|
|
@ -51,6 +51,7 @@ void GBASIOBattlechipGateCreate(struct GBASIOBattlechipGate* gate) {
|
||||||
gate->d.handlesMode = GBASIOBattlechipGateHandlesMode;
|
gate->d.handlesMode = GBASIOBattlechipGateHandlesMode;
|
||||||
gate->d.connectedDevices = GBASIOBattlechipGateConnectedDevices;
|
gate->d.connectedDevices = GBASIOBattlechipGateConnectedDevices;
|
||||||
gate->d.deviceId = NULL;
|
gate->d.deviceId = NULL;
|
||||||
|
gate->d.writeRCNT = NULL;
|
||||||
|
|
||||||
gate->event.context = gate;
|
gate->event.context = gate;
|
||||||
gate->event.callback = _battlechipTransferEvent;
|
gate->event.callback = _battlechipTransferEvent;
|
||||||
|
|
|
@ -193,6 +193,10 @@ void GBASIOWriteRCNT(struct GBASIO* sio, uint16_t value) {
|
||||||
sio->rcnt &= 0xF;
|
sio->rcnt &= 0xF;
|
||||||
sio->rcnt |= value & ~0xF;
|
sio->rcnt |= value & ~0xF;
|
||||||
_switchMode(sio);
|
_switchMode(sio);
|
||||||
|
if (sio->activeDriver && sio->activeDriver->writeRCNT) {
|
||||||
|
sio->rcnt &= 0xC000;
|
||||||
|
sio->rcnt |= sio->activeDriver->writeRCNT(sio->activeDriver, value) & 0x01FF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) {
|
void GBASIOWriteSIOCNT(struct GBASIO* sio, uint16_t value) {
|
||||||
|
@ -278,8 +282,6 @@ uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t valu
|
||||||
default:
|
default:
|
||||||
mLOG(GBA_SIO, DEBUG, "JOY write: Unknown reg %03X <- %04X", address, value);
|
mLOG(GBA_SIO, DEBUG, "JOY write: Unknown reg %03X <- %04X", address, value);
|
||||||
break;
|
break;
|
||||||
case GBA_REG_RCNT:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GBA_SIO_NORMAL_8:
|
case GBA_SIO_NORMAL_8:
|
||||||
|
@ -290,8 +292,6 @@ uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t valu
|
||||||
default:
|
default:
|
||||||
mLOG(GBA_SIO, DEBUG, "NORMAL8 %i write: Unknown reg %03X <- %04X", id, address, value);
|
mLOG(GBA_SIO, DEBUG, "NORMAL8 %i write: Unknown reg %03X <- %04X", id, address, value);
|
||||||
break;
|
break;
|
||||||
case GBA_REG_RCNT:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GBA_SIO_NORMAL_32:
|
case GBA_SIO_NORMAL_32:
|
||||||
|
@ -305,8 +305,6 @@ uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t valu
|
||||||
default:
|
default:
|
||||||
mLOG(GBA_SIO, DEBUG, "NORMAL32 %i write: Unknown reg %03X <- %04X", id, address, value);
|
mLOG(GBA_SIO, DEBUG, "NORMAL32 %i write: Unknown reg %03X <- %04X", id, address, value);
|
||||||
break;
|
break;
|
||||||
case GBA_REG_RCNT:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GBA_SIO_MULTI:
|
case GBA_SIO_MULTI:
|
||||||
|
@ -317,8 +315,6 @@ uint16_t GBASIOWriteRegister(struct GBASIO* sio, uint32_t address, uint16_t valu
|
||||||
default:
|
default:
|
||||||
mLOG(GBA_SIO, DEBUG, "MULTI %i write: Unknown reg %03X <- %04X", id, address, value);
|
mLOG(GBA_SIO, DEBUG, "MULTI %i write: Unknown reg %03X <- %04X", id, address, value);
|
||||||
break;
|
break;
|
||||||
case GBA_REG_RCNT:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -41,6 +41,7 @@ void GBASIODolphinCreate(struct GBASIODolphin* dol) {
|
||||||
dol->d.handlesMode = GBASIODolphinHandlesMode;
|
dol->d.handlesMode = GBASIODolphinHandlesMode;
|
||||||
dol->d.connectedDevices = GBASIODolphinConnectedDevices;
|
dol->d.connectedDevices = GBASIODolphinConnectedDevices;
|
||||||
dol->d.deviceId = NULL;
|
dol->d.deviceId = NULL;
|
||||||
|
dol->d.writeSIOCNT = NULL;
|
||||||
dol->event.context = dol;
|
dol->event.context = dol;
|
||||||
dol->event.name = "GB SIO Lockstep";
|
dol->event.name = "GB SIO Lockstep";
|
||||||
dol->event.callback = GBASIODolphinProcessEvents;
|
dol->event.callback = GBASIODolphinProcessEvents;
|
||||||
|
|
|
@ -54,6 +54,7 @@ void GBASIOPlayerInit(struct GBASIOPlayer* gbp) {
|
||||||
gbp->d.handlesMode = _gbpSioHandlesMode;
|
gbp->d.handlesMode = _gbpSioHandlesMode;
|
||||||
gbp->d.connectedDevices = _gbpSioConnectedDevices;
|
gbp->d.connectedDevices = _gbpSioConnectedDevices;
|
||||||
gbp->d.deviceId = NULL;
|
gbp->d.deviceId = NULL;
|
||||||
|
gbp->d.writeRCNT = NULL;
|
||||||
gbp->event.context = gbp;
|
gbp->event.context = gbp;
|
||||||
gbp->event.name = "GBA SIO Game Boy Player";
|
gbp->event.name = "GBA SIO Game Boy Player";
|
||||||
gbp->event.callback = _gbpSioProcessEvents;
|
gbp->event.callback = _gbpSioProcessEvents;
|
||||||
|
|
|
@ -47,6 +47,7 @@ void GBASIOLockstepNodeCreate(struct GBASIOLockstepNode* node) {
|
||||||
node->d.connectedDevices = GBASIOLockstepNodeConnectedDevices;
|
node->d.connectedDevices = GBASIOLockstepNodeConnectedDevices;
|
||||||
node->d.deviceId = GBASIOLockstepNodeDeviceId;
|
node->d.deviceId = GBASIOLockstepNodeDeviceId;
|
||||||
node->d.writeSIOCNT = NULL;
|
node->d.writeSIOCNT = NULL;
|
||||||
|
node->d.writeRCNT = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GBASIOLockstepAttachNode(struct GBASIOLockstep* lockstep, struct GBASIOLockstepNode* node) {
|
bool GBASIOLockstepAttachNode(struct GBASIOLockstep* lockstep, struct GBASIOLockstepNode* node) {
|
||||||
|
|
Loading…
Reference in New Issue