LAG LAG and more LAG

If you're having problems with Snes9x, or think you've found a bug, this is the place to be.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

LAG LAG and more LAG

Post by blackprince »

Would somebody tell me please why does snes 9x 1.53 run slow on my pc?, I mean, as I show on the video, I've run both, my xbox and my pc at the same time, the same rom, and after like 10 minutes desynchronization becomes evident to the naked eye, besides that, I experiment a microlag in controller response... if I want both marios jumping at the same time I have to press the pc's controller's button first.

Of course I speed up the video so you don't have to see the same thing for 10 minutes.

PC specs:
amd phenom 9600 agena quad core black edition
6gb ram ddr2 corsair
nvidia 9500 gt 512 mb ddr3 (evga)
asus m3n ws

monitor res 1920x1080 set at a frequency of 60hz
I have sync video and sync audio activated on the emulator

both pc and xbox are running at 60fps

so whats the problem? I just don't understand.

And for those who think that this could be a filter and resolution matter, I've done the test with the lowest res and without filters.

http://www.youtube.com/watch?v=z2wy49YavD8
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

Predator82 wrote:Where is sync video?
under [video] > [display configuration] > [vsync]
User avatar
OV2
Official Win32 Porter/Dev
Posts: 679
Joined: Thu Aug 30, 2007 10:15 pm

Post by OV2 »

What xbox port are you using? What settings? What have you set in the display and sound settings in the windows port? There are many factors that change the emulation speed.

Syncing to vsync will definitely get you different results, since your monitor and tv most likely differ in their refresh rates.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

OV2 wrote:What xbox port are you using? What settings? What have you set in the display and sound settings in the windows port? There are many factors that change the emulation speed.

Syncing to vsync will definitely get you different results, since your monitor and tv most likely differ in their refresh rates.
Image

well i just said my monitor is set to a refresh rate of 60hz, the xbox port is
xSnes9x v1.42 wip 17 june 2004
main coder: lantus
www.lantus-x.com/xsnes9x

I put all the settings I could the same, in the xbox and pc.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

sunaiza wrote:what do u mean by it.................?
what do I mean by what?
adventure_of_link
Hero of Hyrule | Official Port Recruiter
Posts: 2588
Joined: Mon May 24, 2004 5:06 pm
Location: 255.255.255.255

Post by adventure_of_link »

blackprince wrote:
sunaiza wrote:what do u mean by it.................?
what do I mean by what?
it's a spambot. and you just replied to it.
Image

Unofficial Test Monkey For:
* Snes9X GX (Wii)
* Snes9X EX (Android)
* Snes9X 64-bits (PC/Mac)

ZSNES|Ben Heck|NSRT|Bob Smiley
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

adventure_of_link wrote:
blackprince wrote:
sunaiza wrote:what do u mean by it.................?
what do I mean by what?
it's a spambot. and you just replied to it.
lmao!, I didn't know there where forum's spambots... damm, what kind of ppl waste their time doing this kind of stuff...
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

There's a bazillion different factors that could contribute to the difference.

First off, the Xbox doesn't have anything running on it besides the emulator and the hypervisor. The PC, on the other hand, has a buttload of stuff running in the background that could soak up CPU time and slow down the emulator just enough to cause the sync issues.

the PC's running a new version of SNES9x, which is more processor intensive.

The sync on the monitor versus the TV might be slightly different. NTSC TVs have a refresh rate of 59.94 frames per second, whereas your PC monitor might be exactly 60 frames per second. If the emulator is compensating for the difference, that could cause the difference.

As for the controller, I would suggest making sure no other programs on your PC have that slight input lag. Some controller drivers have a lot of processing involved in them that can cause that sort of issue, and I wouldn't be surprised if the Xbox simply handles the inputs faster since it's designed as a gaming rig. It's also possible that the newest version of SNES9x is slightly slower on the controller input.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

SparroHawc wrote:There's a bazillion different factors that could contribute to the difference.

First off, the Xbox doesn't have anything running on it besides the emulator and the hypervisor. The PC, on the other hand, has a buttload of stuff running in the background that could soak up CPU time and slow down the emulator just enough to cause the sync issues.

the PC's running a new version of SNES9x, which is more processor intensive.

The sync on the monitor versus the TV might be slightly different. NTSC TVs have a refresh rate of 59.94 frames per second, whereas your PC monitor might be exactly 60 frames per second. If the emulator is compensating for the difference, that could cause the difference.

As for the controller, I would suggest making sure no other programs on your PC have that slight input lag. Some controller drivers have a lot of processing involved in them that can cause that sort of issue, and I wouldn't be surprised if the Xbox simply handles the inputs faster since it's designed as a gaming rig. It's also possible that the newest version of SNES9x is slightly slower on the controller input.
well, I don't think I'm lacking of processing power, it's a amd phenom quad core at 2.3 ghz running windows 7 x64, right now I could run call of duty black ops, need for speed hot pursuit and snes9x at the same time and there's no chance for one of them to slow down, I could probe it just by monitoring the performance with the task manager. I don't think there's a controller problem neither, cuz i have a xbox360 controller, genius usb minipad, original xbox controller, logitech wireless rumblepad 2 controller, a ps2 controller with its usb adapter and none of them have presented lag on any other emulator or game :), although I could set mi monitor at a refresh rate of 59.9hz and see what happens, i already tried running it at 50hz but it gets slower. older versions of snes9x are just worse, other emulators like bsnes present the same delay, and i would like to know if its a matter of configuration or something, like sound sample rate or something like that.

however thank you so much for your answer and for your time, i appreciate it.
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

Hm. The controller lag intrigues me, especially since you mention it doesn't exist in any other software. That may be something we'll have to delve further into.

I suspect it's related to the fact that SNES9x doesn't actually use DirectInput (I think). Might have to ask the other guys about that one.

I'm going to let you in on something that may or may not blow your mind though.

Quad-core does absolutely nothing for SNES9x.

I suppose I should clarify; it does allow other programs to move to other cores and get out of the way of SNES9x, but the emulator itself doesn't have any way to take advantage of multiple cores. It can't, thanks to how the emulation has to work. You can run Black Ops and NFS at the same time because they'll take two of the other three cores, Windows itself will mostly take up the last core, and you won't see -much- slowdown... but Black Ops and Need for Speed are far more forgiving when it comes to timing. If they take a bit too long to render a frame, they just figure out where everything's supposed to be after the frame's done and calculate the physics with that new timestamp. The emulator doesn't have that luxury. There's no vector physics to calculate, only CPU cycles - and if it takes a little too long to emulate the chip for that frame, it has two options - either finish late (which causes your slight emulator slowdown) or drop a frame of drawing to the screen in an effort to give it enough time to go through the additional clock cycles it has to go through to draw the next frame.

Oof, that was a wall of text.

One more thing to consider... Your Xbox might be running the emulator too fast.

Back to the controller, though - if you use the keyboard instead of a controller, does it still have the input delay?
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

SparroHawc wrote:Hm. The controller lag intrigues me, especially since you mention it doesn't exist in any other software. That may be something we'll have to delve further into.

I suspect it's related to the fact that SNES9x doesn't actually use DirectInput (I think). Might have to ask the other guys about that one.

I'm going to let you in on something that may or may not blow your mind though.

Quad-core does absolutely nothing for SNES9x.

I suppose I should clarify; it does allow other programs to move to other cores and get out of the way of SNES9x, but the emulator itself doesn't have any way to take advantage of multiple cores. It can't, thanks to how the emulation has to work. You can run Black Ops and NFS at the same time because they'll take two of the other three cores, Windows itself will mostly take up the last core, and you won't see -much- slowdown... but Black Ops and Need for Speed are far more forgiving when it comes to timing. If they take a bit too long to render a frame, they just figure out where everything's supposed to be after the frame's done and calculate the physics with that new timestamp. The emulator doesn't have that luxury. There's no vector physics to calculate, only CPU cycles - and if it takes a little too long to emulate the chip for that frame, it has two options - either finish late (which causes your slight emulator slowdown) or drop a frame of drawing to the screen in an effort to give it enough time to go through the additional clock cycles it has to go through to draw the next frame.

Oof, that was a wall of text.

One more thing to consider... Your Xbox might be running the emulator too fast.

Back to the controller, though - if you use the keyboard instead of a controller, does it still have the input delay?
good explanation, id like to know if you are a snes9x developer or something, so i know more or less what your pc skill level is and how i could speak to you in order to receive a more efficient help. yes, using the keyboard it still has the lag :), i don't think xbox is running the game faster than normal, controllers response are perfect and music too, theres no crackling sound, no video desync, etc. about the cpu, how's that other ppl with a less power cpu can run the game decently? in the 32bit version, in fact, besides the app, windows is who's in charge to distribute the processing charge among the processor cores, once again i could probe it just by running only the emulator and monitoring the performance of the cores usage. snes9x 64bit really takes advantage of all the cores because of the windows 7 new technology. sorry if my english is bad, im dominican :).

thanks again for your time.
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

Your English is good enough to get the message across. That's good enough for me. :D

I'm not an actual developer for SNES9x, but I -am- familiar with a few different programming languages, as well as a bit of experience working with the Win32 API and such. I just like to be helpful.

Now then - back to the issue at hand.

You mention that other people don't have problems with crackling audio. Do you currently have that problem?

Here's something to try as well - when SNES9x is running, press CTRL-ALT-DEL and bring up the task manager. Hit the Processes tab, find SNES9x and right click on it, then select 'Set Affinity...' Uncheck all but one check-box. That'll rule out any possible issues with the process getting shuffled between CPU cores.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

Oh that's nice, I'm very grateful of your help.

Yes I sometimes experiment crackling sound, more often in bsnes :( which comes with slowdowns and fps drop, I'm going to try the affinity stuff immediately to see what happens and I let you know.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

there you have, I left checked the last box (core 3), I don't think cpu is the problem here, sound cracked once a little and a second time while I was changing windows focus. controllers improved like a 0.002 seconds as I set the input rate at 31900. besides that everything still the same :(


Image
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

So it did help a little, especially with the audio... but your controller input's still lagging.

When I get some free time, I think I'm going to see if I can cobble together a quick-and-dirty branch of SNES9x that uses DirectX for controls, and see if that fixes the problem. If it does, that means something's doing some weird input processing on Windows.

Sorry I don't have an immediate solution.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

yeah it does still lagging :(, whats the quick and dirty branch about?, in bsnes I use rawinput instead of direct input and its still the same, I hope it solves the problem in snes9x, dont be sorry man, you have helped me a lot, I really appreciate it.
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

Well, Windows itself has the DirectX set of APIs which are designed to bypass a lot of the operating system's layers of handling for input and output. There may be something running on your computer that's messing with your input and making it lag, and I know that SNES9x uses raw input instead of DirectX. The fact that bsnes still lags either way might be attributed to the fact that bsnes just sucks up a lot more CPU time.

I'm just calling it a quick-and-dirty branch 'cause it's going to be a horrible hack as a proof of concept. I make no claims of being a five-star programmer. (No, I haven't started yet.)

--edit--

I just remembered that 'five-star programmer' isn't exactly a compliment when it comes to C. Oh well, you know what I mean.
blackprince
Snes9x White Belt
Posts: 16
Joined: Fri Jun 17, 2011 1:25 am

Post by blackprince »

nah men dont spend your time dealing with the controllers thing, im more than sure that its something related to the video/audio sync or something, cause all the rest of the things, emulators, games etc work perfectly. but if you want to anyway it is welcome.
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Post by SparroHawc »

There have been a couple issues with other people not being able to use controls in-game on Windows. I -think- DirectX input will solve that problem as well, so it's more a matter of killing two birds with one stone.
LAGonauta
Snes9x White Belt
Posts: 1
Joined: Sat Jul 09, 2011 5:50 pm

Post by LAGonauta »

I have the same problem as blackprince, and it is also happening on Ubuntu! (I dual-boot Windows Vista Home Premium x64 and Ubuntu 10.10)

Today I managed to fix it, at least partially... I disabled bilinear filtering and the LAG was there, but less noticiable. Maybe the video card driver is introducing this input lag? And I have crackling audio...
Tested on version 1.53-x64.

On ZSnes it works with no LAG and no crackling audio, bit it is a little unstable on my system, and its last update was on... 2007?

My specs:

Intel Core 2 Duo 2.0 GHz T5800
4GB DDR2
nVidia GeForce 9300M GS 512MB (64-bit DDR)

(X83VB notebook from Asus)

On Wii it works perfectly, also on my SNES xD
Tested with DKC2.
Post Reply