libsnes: change frame boundary timing. from the perspective of the libsnes core, this choice is mostly arbitrary. from the perspective of the frontend, it's how input frames are divided up and lag frames are determined, and so can be rather important for TASing. the original choice of frame timing is a bit strange and causes excessive input latency and lag detection issues for pal224 and ntsc modes (but not pal239 mode). this change will most likely cause "off by one" errors in TAS sync; should be mostly easily correctable.
This commit is contained in:
parent
68de3b48b7
commit
3e139c7d7e
Binary file not shown.
|
@ -43,7 +43,7 @@ void CPU::mmio_w4016(uint8 data) {
|
|||
uint8 CPU::mmio_r4016() {
|
||||
uint8 r = regs.mdr & 0xfc;
|
||||
r |= input.port1->data();
|
||||
if (!status.auto_joypad_poll) interface->inputNotify(0);
|
||||
if (!status.auto_joypad_poll) interface->inputNotify(0x4016);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ uint8 CPU::mmio_r4016() {
|
|||
uint8 CPU::mmio_r4017() {
|
||||
uint8 r = (regs.mdr & 0xe0) | 0x1c;
|
||||
r |= input.port2->data();
|
||||
if (!status.auto_joypad_poll) interface->inputNotify(1);
|
||||
if (!status.auto_joypad_poll) interface->inputNotify(0x4017);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -183,6 +183,7 @@ uint8 CPU::mmio_r4212() {
|
|||
|
||||
//RDIO
|
||||
uint8 CPU::mmio_r4213() {
|
||||
// interface->inputNotify(0x4213); // if there are lag counter issues with super scope, uncomment this
|
||||
return status.pio;
|
||||
}
|
||||
|
||||
|
@ -206,14 +207,14 @@ uint8 CPU::mmio_r4217() {
|
|||
return status.rdmpy >> 8;
|
||||
}
|
||||
|
||||
uint8 CPU::mmio_r4218() { interface->inputNotify(8); return status.joy1 >> 0; } //JOY1L
|
||||
uint8 CPU::mmio_r4219() { interface->inputNotify(9); return status.joy1 >> 8; } //JOY1H
|
||||
uint8 CPU::mmio_r421a() { interface->inputNotify(10); return status.joy2 >> 0; } //JOY2L
|
||||
uint8 CPU::mmio_r421b() { interface->inputNotify(11); return status.joy2 >> 8; } //JOY2H
|
||||
uint8 CPU::mmio_r421c() { interface->inputNotify(12); return status.joy3 >> 0; } //JOY3L
|
||||
uint8 CPU::mmio_r421d() { interface->inputNotify(13); return status.joy3 >> 8; } //JOY3H
|
||||
uint8 CPU::mmio_r421e() { interface->inputNotify(14); return status.joy4 >> 0; } //JOY4L
|
||||
uint8 CPU::mmio_r421f() { interface->inputNotify(15); return status.joy4 >> 8; } //JOY4H
|
||||
uint8 CPU::mmio_r4218() { interface->inputNotify(0x4218); return status.joy1 >> 0; } //JOY1L
|
||||
uint8 CPU::mmio_r4219() { interface->inputNotify(0x4219); return status.joy1 >> 8; } //JOY1H
|
||||
uint8 CPU::mmio_r421a() { interface->inputNotify(0x421a); return status.joy2 >> 0; } //JOY2L
|
||||
uint8 CPU::mmio_r421b() { interface->inputNotify(0x421b); return status.joy2 >> 8; } //JOY2H
|
||||
uint8 CPU::mmio_r421c() { interface->inputNotify(0x421c); return status.joy3 >> 0; } //JOY3L
|
||||
uint8 CPU::mmio_r421d() { interface->inputNotify(0x421d); return status.joy3 >> 8; } //JOY3H
|
||||
uint8 CPU::mmio_r421e() { interface->inputNotify(0x421e); return status.joy4 >> 0; } //JOY4L
|
||||
uint8 CPU::mmio_r421f() { interface->inputNotify(0x421f); return status.joy4 >> 8; } //JOY4H
|
||||
|
||||
//DMAPx
|
||||
uint8 CPU::mmio_r43x0(uint8 i) {
|
||||
|
@ -406,7 +407,7 @@ void CPU::mmio_reset() {
|
|||
|
||||
uint8 CPU::mmio_read(unsigned addr) {
|
||||
addr &= 0xffff;
|
||||
|
||||
|
||||
//APU
|
||||
if((addr & 0xffc0) == 0x2140) { //$2140-$217f
|
||||
synchronize_smp();
|
||||
|
|
|
@ -235,7 +235,19 @@ void System::reset() {
|
|||
|
||||
void System::scanline() {
|
||||
video.scanline();
|
||||
if(cpu.vcounter() == 241) scheduler.exit(Scheduler::ExitReason::FrameEvent);
|
||||
/*
|
||||
* the idea is to have the frame boundary (for framestep tasing) come as soon as possible
|
||||
* after the end of a visible frame, so it comes before the input poll.
|
||||
* the old number was constant 241, which is at a very odd time for NTSC.
|
||||
* the new numbers are the minimum possible to still capture a full frame; any lower,
|
||||
* and the last scanline(s) of the frame are still from the old frame.
|
||||
*/
|
||||
int stopline;
|
||||
if (ppu.overscan()) // (region != Region::NTSC)
|
||||
stopline = 240;
|
||||
else
|
||||
stopline = 225;
|
||||
if(cpu.vcounter() == stopline) scheduler.exit(Scheduler::ExitReason::FrameEvent);
|
||||
}
|
||||
|
||||
void System::frame() {
|
||||
|
|
Loading…
Reference in New Issue