Skip to content

Commit

Permalink
Change where we break S9xMainLoop/Scan for input ("Brunnis lag fix")
Browse files Browse the repository at this point in the history
  • Loading branch information
bearoso committed Nov 22, 2017
1 parent 8d4539a commit 10e0ef0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cpuexec.cpp
Expand Up @@ -444,7 +444,6 @@ void S9xDoHEventProcessing (void)

ICPU.Frame++;
PPU.HVBeamCounterLatched = 0;
CPU.Flags |= SCAN_KEYS_FLAG;
}

// From byuu:
Expand Down Expand Up @@ -474,6 +473,9 @@ void S9xDoHEventProcessing (void)
if (CPU.V_Counter == PPU.ScreenHeight + FIRST_VISIBLE_LINE) // VBlank starts from V=225(240).
{
S9xEndScreenRefresh();

CPU.Flags |= SCAN_KEYS_FLAG;

PPU.HDMA = 0;
// Bits 7 and 6 of $4212 are computed when read in S9xGetPPU.
#ifdef DEBUGGER
Expand Down

3 comments on commit 10e0ef0

@OV2
Copy link
Collaborator

@OV2 OV2 commented on 10e0ef0 Nov 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this really makes much of a difference, but I guess it can't hurt either.
When using polling buttons we already read directly in S9xDoAutoJoypad.

@bearoso
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I didn't notice much of a difference. It looks like it could save latency because it now polls after the screen update has been sent to the port and possibly had to wait for vblank, which means the input poll is closer to when the physical screen is updated.

Basically, it can't make things worse.

@Tatsuya79
Copy link
Contributor

@Tatsuya79 Tatsuya79 commented on 10e0ef0 Jan 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, just tested it with your 1.55 libretro core vs one I compiled.
Boot up Mario World, put the game on pause, keep jump button pushed down, do "next frame".
Mario now jump in 3 frames vs 4 before.

It's more noticeable on say Super Aleste with ship at max speed, moving around.

Please sign in to comment.