Problems with ZSNES 1.50 in Linux

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Problems with ZSNES 1.50 in Linux

Post by hakonrk »

Just tried out 1.50, and noticed at least two serious problems in Linux (the Windows version still works) that weren't there in 1.42:

1. The sound started making crackling noises (seems to be related to the volume level - clipping perhaps?). Btw, I have read the FAQs regarding this issue, and none of the tips work (ALSA/OSS, 44.1 or 48 kHz, killing sound daemons, etc).

2. The emulator doesn't run as smoothly as before. This is most easily seen in the Contra 3 intro when the text "The Alien Wars Begin" start scrolling over the screen. It never scrolled perfectly smooth, but now it's become really bad.

Tried pinpointing the svn revision where the error first appeared. So far, I know that up until revision 2562, it was OK, and from 3048 it was broken. Most of the revisions between 2562 and 3048 seem to be completely unusable on Linux because of a bunch of unresolved symbols when linking, so I haved searched in that range yet. A bit worrying that 485 revisions could go by without anyone noticing that the Linux version didn't build. Makes me feel like I'm all alone in this. :)

Anyway, I thought I would post this before digging further into this problem. Would be nice to know if I'm not the only one seeing this.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

If you're using strictly 1.50, then you need to compile with --enable-release passed to ./configure.

Also, I think the unresolved symbols is a result of a failure to make clean in many instances. Yes, you are alone in your issue.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Deathlike2 wrote:If you're using strictly 1.50, then you need to compile with --enable-release passed to ./configure.
Makes no difference, aside from taking forever to compile.
Deathlike2 wrote:Also, I think the unresolved symbols is a result of a failure to make clean in many instances.
No, seems to be caused by these lines in cpu/execute.c:

Code: Select all

#ifdef __LINUX__
#include "../gblhdr.h"
#define DIR_SLASH "/"
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#define DIR_SLASH "\"
#endif
#include "../gblvars.h"
Deathlike2 wrote:Yes, you are alone in your issue.
You're as sure about that as you were about the above points?
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Not every commit is perfect, however I don't think literally "every" commit within that range is causing those problems.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Deathlike2 wrote:Not every commit is perfect, however I don't think literally "every" commit within that range is causing those problems.
I don't think so either, but somewhere in those 485 revisions, the two bugs started occuring, and I can't easily determine where because of the link issues. The piece of code I showed above fixes some of the link errors (actually, it reverses patch 2563), but more are introduced later and this makes it very time-consuming to debug the problem by binary searching revisions until I find the culprit.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Could you at least mention your specs, and Linux distro you are using?
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

If you're having sound issues, I recommend trying latest SVN, using --enable-libao (requires libao and libao-dev) to configure, and then trying one of the audio drivers you can pass to -ad, see zsnes --help.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Deathlike2 wrote:Could you at least mention your specs, and Linux distro you are using?
Sure: (I was going to eventually, but I thought I'd put some more effort in myself before filing a regular bug report)

Software:

Distro: Slackware 11.0
Kernel: 2.6.18.5
Libc: 2.3.6
ALSA: 1.0.11
X.org: 6.9.0
NVIDIA driver: 1.0.9629

Hardware:

CPU: Athlon 64 X2 3800+
M/B: ASUS A8N SLI
Graphics: Geforce 7800 GTX
Sound card: SB Live 5.1
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Nach wrote:If you're having sound issues, I recommend trying latest SVN, using --enable-libao (requires libao and libao-dev) to configure, and then trying one of the audio drivers you can pass to -ad, see zsnes --help.
It's getting very late here (almost 03:30 :), so I'll have to try this tomorrow. Thanks for the tip.

Anyway, I'm seeing the scrolling issue even when I disable sound completely, so if the two problems are related, I'm not very optimistic.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

hakonrk wrote:
Nach wrote:If you're having sound issues, I recommend trying latest SVN, using --enable-libao (requires libao and libao-dev) to configure, and then trying one of the audio drivers you can pass to -ad, see zsnes --help.
It's getting very late here (almost 03:30 :), so I'll have to try this tomorrow. Thanks for the tip.

Anyway, I'm seeing the scrolling issue even when I disable sound completely, so if the two problems are related, I'm not very optimistic.
Well if you can narrow down certain emu bugs to a particular revision, I'll gladly take a look. But please do tell me if any other audio options help you at all.

BTW I own an SB Live. With it I don't have ALSA, just OSS, have SDL using OSS, set ZSNES to 32000 Stereo sound, and it sounds fine in all games but ToP. When I get a chance I hope to try the new libao sound code on it which was just commited to SVN.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Well if you can narrow down certain emu bugs to a particular revision, I'll gladly take a look. But please do tell me if any other audio options help you at all.
Progress report: The audio bug turned out to be a regression that was introduced in revision 2757. By applying the following patch to the current SVN revision, the effects of revision 2757 is undone, and the sound works in Linux/ALSA again:

Code: Select all

Index: src/linux/audio.c
===================================================================
--- src/linux/audio.c   (revision 4300)
+++ src/linux/audio.c   (working copy)
@@ -215,9 +215,9 @@
       int *end_d = DSPBuffer+BufferSizeB;
       for (; d < end_d; d++, ptr++)
       {
-        if ((unsigned) (*d + 0x8000) <= 0xFFFF) { *ptr = *d; continue; }
-        if (*d > 0x7FFF) { *ptr = 0x7FFF; }
-        else { *d = 0x8000; }
+        if (*d > 32767) { *ptr = 32767; }
+        else if (*d < -32767) { *ptr = -32767; }
+        else { *ptr = *d; }
       }
     }

Now moving on to the scrolling bug... :D
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Found the source of the scrolling bug, too. This regression was introduced in 2625. As with the sound bug, it's an attempted optimization that didn't work. The commit comment says:
Optimisation to frame draw code, only draw frames that change
Apparently, the code doesn't detect changing frames very well, so I'm currently just using the below patch to disable this optimization:

Code: Select all

Index: src/linux/sw_draw.c
===================================================================
--- src/linux/sw_draw.c (revision 4302)
+++ src/linux/sw_draw.c (working copy)
@@ -153,7 +153,6 @@
 
   UpdateVFrame();
 
-  if (prevtot == frametot && (!GUIOn || !GUIOn2)) { return; }
 
   if (curblank || OGLModeCheck()) return;
   LockSurface();
Combined with the above patch for the mentioned sound issue, this fixes all the problems I've seen with 1.50.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Okay, I just applied a patch to SVN, let me know if that has good sound for you.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Nach wrote:Okay, I just applied a patch to SVN, let me know if that has good sound for you.
Sounds good now. Thanks for applying this so quickly!
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

hakonrk wrote:
Nach wrote:Okay, I just applied a patch to SVN, let me know if that has good sound for you.
Sounds good now. Thanks for applying this so quickly!
Thank you for finding.

BTW, can you try the new -ad oss option and tell me how that works for you? (must configure with --enable-libao, and make clean first)
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
hakonrk
Rookie
Posts: 20
Joined: Sun Jun 19, 2005 9:17 pm

Post by hakonrk »

Nach wrote:BTW, can you try the new -ad oss option and tell me how that works for you? (must configure with --enable-libao, and make clean first)
Tried -ad oss and -ad sdl, and they both seem to work fine. I'm using ALSA, though, so I'm not sure how valuable my -ad oss test was. At least I can say that it seems to be working with ALSA's OSS compability interface.
AWJ
Rookie
Posts: 17
Joined: Sat Aug 14, 2004 4:36 am

Post by AWJ »

hakonrk wrote:Found the source of the scrolling bug, too. This regression was introduced in 2625. As with the sound bug, it's an attempted optimization that didn't work. The commit comment says:
Optimisation to frame draw code, only draw frames that change
Apparently, the code doesn't detect changing frames very well, so I'm currently just using the below patch to disable this optimization:
This optimization also doesn't work well with the NTSC filter (use the NTSC filter with some RPG where the characters "walk on the spot" and you'll see what I mean) It should be disabled when the NTSC filter is active, because the NTSC artifacts (should) change every frame even if the image produced by the SNES doesn't.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

The optimization has been removed already, so feel free to update ZSNES from SVN.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
bruno321

Post by bruno321 »

I wasn't sure if to bump this thread or create a new one, but since I have the exact same problems as the poster, I decided to just bump it. Sorry if it wasn't the right choice.

Well, I'm on Ubuntu 6.10, and I've installed the zsnes 1.51 stable version. At first sound didn't go well. Installed it with libao, chose 32000 khz and it worked fine.

But then I reached a point where scrolling was annoyingly slow, it was when 4 sprites where on the screen (on Ys IV: Mask of the Sun).

I tried using the patch the poster proposed (I just had to add it on the line he put there, not removing anything, isn't that so? I'm new to Linux, and don't know anything of programming, so...), but the problem was still there.

I also tried the latest SVN version, and I believe the scrolling issue had been fixed (I say "I believe" because I've tried so many things already...), but because the sound core is being rebuilt as I read elsewhere on this board, sound was awful.

Anyway, thank you, and sorry if I'm not posting this on the right place :oops:
Post Reply