2015-11-10 11:02:29 +00:00
|
|
|
Device device;
|
|
|
|
|
|
|
|
Device::Device() {
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
connect(0, ID::None);
|
|
|
|
connect(1, ID::None);
|
|
|
|
connect(2, ID::None);
|
2015-11-10 11:02:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Device::~Device() {
|
|
|
|
if(controllerPort1) delete controllerPort1;
|
|
|
|
if(controllerPort2) delete controllerPort2;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Device::connect(uint port, Device::ID id) -> void {
|
|
|
|
if(port == 0 || port == 1) {
|
|
|
|
Controller*& controller = (port == 0 ? controllerPort1 : controllerPort2);
|
|
|
|
|
|
|
|
if(controller) {
|
|
|
|
delete controller;
|
|
|
|
controller = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(id) { default:
|
|
|
|
case ID::None: controller = new Controller(port); break;
|
|
|
|
case ID::Gamepad: controller = new Gamepad(port); break;
|
|
|
|
case ID::Multitap: controller = new Multitap(port); break;
|
|
|
|
case ID::Mouse: controller = new Mouse(port); break;
|
|
|
|
case ID::SuperScope: controller = new SuperScope(port); break;
|
|
|
|
case ID::Justifier: controller = new Justifier(port, false); break;
|
|
|
|
case ID::Justifiers: controller = new Justifier(port, true); break;
|
|
|
|
case ID::USART: controller = new USART(port); break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(port) {
|
|
|
|
case 0: configuration.controllerPort1 = id; break;
|
|
|
|
case 1: configuration.controllerPort2 = id; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(port == 2) {
|
|
|
|
configuration.expansionPort = id;
|
|
|
|
}
|
|
|
|
}
|