mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 07:02:27 +01:00
byuu says: Changelog: - MS, MD, PCE: remove controllers from scheduler in destructor [hex_usr] - PCE: no controller should return all bits set (still causing errant key presses when swapping gamepads) - PCE: emulate MDR for hardware I/O $0800-$17ff - PCE: change video resolution to 1140x242 - PCE: added tertiary background Vscroll register (secondary cache) - PCE: create classes out of VDC VRAM, SATB, CRAM for cleaner access and I/O registers - PCE: high bits of CRAM read should be set - PCE: partially emulated VCE display registers: color frequency, HDS, HDW, VDS, VDW - PCE: 32-width sprites now split to two 16-width sprites to handle overflow properly - PCE: hopefully emulated sprite zero hit correctly (it's not well documented, and not often used) - PCE: trigger line coincidence interrupts during the previous scanline's Hblank period - tomoko: raise viewport from 320x240 to 326x242 to accommodate PC Engine's max resolution - nall: workaround for Clang compilation bug that can't figure out that a char is an integral data type
30 lines
639 B
C++
30 lines
639 B
C++
#include <md/md.hpp>
|
|
|
|
namespace MegaDrive {
|
|
|
|
#include "gamepad/gamepad.cpp"
|
|
|
|
Controller::Controller(uint port) : port(port) {
|
|
if(!handle()) create(Controller::Enter, 100);
|
|
}
|
|
|
|
Controller::~Controller() {
|
|
scheduler.remove(*this);
|
|
}
|
|
|
|
auto Controller::Enter() -> void {
|
|
while(true) {
|
|
scheduler.synchronize();
|
|
if(peripherals.controllerPort1->active()) peripherals.controllerPort1->main();
|
|
if(peripherals.controllerPort2->active()) peripherals.controllerPort2->main();
|
|
if(peripherals.extensionPort->active()) peripherals.extensionPort->main();
|
|
}
|
|
}
|
|
|
|
auto Controller::main() -> void {
|
|
step(1);
|
|
synchronize(cpu);
|
|
}
|
|
|
|
}
|