mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-10-04 23:51:47 +02:00
Changelog: - S-SMP core code style updated - S-SMP loads reset vector from IPLROM ($fffe-ffff) - sfc/base => sfc/expansion - system/input => system/device - added expansion/eBoot (simulation of defparam's SNES-Boot device) - expansion port device can now be selected from Super Famicom menu option - improved GBA MROM/SRAM reading endrift's memory test is up to 1388/1552. Note: I added the expansion port devices to the same group as controller ports. I also had to move "None" to the top of the list. Before v096, I am going to have to add caching of port selections to the configuration file, check the proper default item in the system menu, and remove the items with no mappings from the input configuration window. Lots of work >_>
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#ifdef SYSTEM_CPP
|
|
|
|
Device device;
|
|
|
|
Device::Device() {
|
|
connect(0, ID::Gamepad);
|
|
connect(1, ID::Gamepad);
|
|
connect(2, ID::eBoot);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
#endif
|