Linux port

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

pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Linux port

Post by pagefault »

Ok basically want input from the linux community here and basically what I am asking is what would you guys like to see in this port. Linux is my main operating system now so this will be my primary focus from now on.
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

Since you are running Linux, this might apply too. See if it can run more flawlessly on other *nix variants too, like I run FreeBSD and in order to get ZSNES to even run, I have to edit a small section of the linux/zfilew.c file, otherwise it crashes on load with a free() error. Plus, I dunno if it's my system or what, but the OpenGL video modes go very, very slow for me while the few non-OpenGL ones run nice and fast.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Magus`
Cap'n Gin | Admin
Posts: 194
Joined: Tue Jul 27, 2004 10:59 pm
Location: Missouri

Post by Magus` »

TRAITOR.
Aerdan
Winter Knight
Posts: 467
Joined: Mon Aug 16, 2004 10:16 pm
Contact:

Re: Linux port

Post by Aerdan »

pagefault wrote:Ok basically want input from the linux community here and basically what I am asking is what would you guys like to see in this port. Linux is my main operating system now so this will be my primary focus from now on.
OpenGL code that was *not* spawned by the Devil, please.
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

I probably should've posted this last night, but I was tired and didn't think about it.

When I first was trying to use ZSNES *nix version on my FreeBSD system (which I think was back when 1.36 was the only official (non-WIP) one out), it worked fine for me. But then, I updated it to 1.42 via the FreeBSD ports system, and then whenever I tried to use it, it wouldn't load. Instead, this would happen: (and it happened with 1.41's code and up, including the WIPs)

Code: Select all

[kirby /shared/zsnes_1_42/src]# ./zsnes

ZSNES v1.42 (c) 1997-2005, ZSNES Team

Be sure to check http://www.zsnes.com/ for the latest version.
Please report crashes to zsnes-devel@lists.sourceforge.net.

ZSNES is written by the ZSNES Team (See AUTHORS.TXT)
ZSNES comes with ABSOLUTELY NO WARRANTY.  This is free software,
and you are welcome to redistribute it under certain conditions;
please read 'LICENSE' thoroughly before doing so.

Use ZSNES -? for command line definitions.

zsnes in free(): error: junk pointer, too high to make sense
Abort (core dumped)
In order to fix that, I had to go into the linux/zfilew.c file and change the following part of the obtaindir() function:

Code: Select all

void obtaindir()
{
  char *homedir = 0;
  DIR *tmp;

  if ((homedir = (char *)getenv("HOME")) == 0)
  {
    homedir = (char *)malloc(ZCFG_DIR_LEN);
    getcwd(homedir, ZCFG_DIR_LEN);
  }
  strcpy(zcfgdir, homedir);
  free(homedir);
  strcat(zcfgdir, ZCFG_DIR);
...
to this:

Code: Select all

void obtaindir()
{
  char *homedir = 0;
  DIR *tmp;
  int alloc = 0;

  if ((homedir = (char *)getenv("HOME")) == 0)
  {
    homedir = (char *)malloc(ZCFG_DIR_LEN);
    getcwd(homedir, ZCFG_DIR_LEN);
    alloc = 1;
  }
  strcpy(zcfgdir, homedir);
  if (alloc) free(homedir);
  strcat(zcfgdir, ZCFG_DIR);
...
I believe this is because the getenv() function in FreeBSD returns a memory address outside the ZSNES program memory store, so trying to free is means that it's trying to free memory it didn't create. Thus the junk pointer message. Adding that 'int alloc' and using it as a flag got around that problem.

Also, I have to use the following shell script to successfully compile ZSNES, as normally it wouldn't include the right include directories: (I got the sed commands out of the FreeBSD port of ZSNES)

Code: Select all

#!/bin/sh

aclocal15	--acdir=`sdl11-config --prefix`/share/aclocal	# thanks asfand
autoconf253
sed -i.bak -e 's| -pipe||g ; s| -I/usr/local/include||g ; s| -I/usr/include||g ; s| -O3 .* -s||g' ./configure
sed -i.bak -e 's|@CXX@ @CFLAGS@ -o|@CXX@ @CXXFLAGS@ @CPPFLAGS@ -o|g ; s|@CC@ @CFLAGS@ |@CC@ @CFLAGS@ @CPPFLAGS@ |g' ./Makefile.in
env CPPFLAGS="-I/usr/local/include -I/usr/X11R6/include" LDFLAGS="-L/usr/local/lib -L/usr/X11R6/lib" ./configure
gmake
Hope this helps at all.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

CyberBotX wrote:I believe this is because the getenv() function in FreeBSD returns a memory address outside the ZSNES program memory store, so trying to free is means that it's trying to free memory it didn't create.
Um... No.
The problem is getenv() is simply not failing for you.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
anomie
Lurker
Posts: 151
Joined: Tue Dec 07, 2004 1:40 am

Post by anomie »

Nach wrote:
CyberBotX wrote:I believe this is because the getenv() function in FreeBSD returns a memory address outside the ZSNES program memory store, so trying to free is means that it's trying to free memory it didn't create.
Um... No.
The problem is getenv() is simply not failing for you.
Um... Not really.
The problem is that the string returned by getenv() should probably not be free()ed. It returns "a pointer to the value in the environment".
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

anomie wrote:
Nach wrote:
CyberBotX wrote:I believe this is because the getenv() function in FreeBSD returns a memory address outside the ZSNES program memory store, so trying to free is means that it's trying to free memory it didn't create.
Um... No.
The problem is getenv() is simply not failing for you.
Um... Not really.
The problem is that the string returned by getenv() should probably not be free()ed. It returns "a pointer to the value in the environment".
That's what I just said.
The problem is it not failing thus freeing something not malloc'd.

It's also been fixed for a while now.

Code: Select all

  if ((homedir = (char *)getenv("HOME")) == 0)
  {
    getcwd(zcfgdir, ZCFG_DIR_LEN);
  }
  else
  {
    strcpy(zcfgdir, homedir);
  }
  strcat(zcfgdir, ZCFG_DIR);
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Sol
Rookie
Posts: 14
Joined: Sun Jan 09, 2005 7:36 am

Post by Sol »

Yay :)

I'd been having this problem too on my FreeBSD 5.3-Release machine. Glad it was everyone's problem and not just specific to me.
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

And I'm guessing that the getenv() call in that file must've been changed after the latest 2/28 WIP, because I know the code wasn't like that in the 2/28 WIP. But good to know that it has been fixed and I don't need to mess with the code next time.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

CyberBotX wrote:And I'm guessing that the getenv() call in that file must've been changed after the latest 2/28 WIP, because I know the code wasn't like that in the 2/28 WIP.
Yeah, I commited the fix yesterday once I saw your post on the forum. I meant to earlier but forgot about it.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

I am working on some significant speed improvements to the linux version. Some of it is in CVS but more coming. The plan is to have it working as fast or faster than the windows version. This should be pretty easy to do, there is just a lot of slow code to rewrite.
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

Does your checkin "Major framerate improvement when using new graphics engine" only apply to the Linux port, or is it for all ports?
[u][url=http://bash.org/?577451]#577451[/url][/u]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Noxious Ninja wrote:Does your checkin "Major framerate improvement when using new graphics engine" only apply to the Linux port, or is it for all ports?
All ports.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Noxious Ninja
Dark Wind
Posts: 1271
Joined: Thu Jul 29, 2004 8:58 pm
Location: Texas
Contact:

Post by Noxious Ninja »

Sweet. :mrgreen:
[u][url=http://bash.org/?577451]#577451[/url][/u]
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Magus` wrote:TRAITOR.
Linux is clearly a better operating system. There is no traitor about it.
adventure_of_link
Locksmith of Hyrule
Posts: 3634
Joined: Sun Aug 08, 2004 7:49 am
Location: 255.255.255.255
Contact:

Post by adventure_of_link »

...you know PF, every OS has its advantages and disadvantages...
<Nach> so why don't the two of you get your own room and leave us alone with this stupidity of yours?
NSRT here.
snkcube
Hero of Time
Posts: 2646
Joined: Fri Jul 30, 2004 2:49 am
Location: In front of the monitor
Contact:

Post by snkcube »

adventure_of_link wrote:...you know PF, every OS has its advantages and disadvantages...
Yeah, that's true. Nothing is perfect.
Try out CCleaner and other free software at Piriform
Image
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

You guys are right about that, but I've experienced less problems with *nix-based systems than with Windows-based systems. Hell, my FreeBSD only crashes or stops working because of me using it constantly, espcially with VMware running non-stop too. That on it's own could probably kill any machine running FreeBSD, since it's not designed for FreeBSD, but for Linux. But yeah, Linux does have it's problems, but it doesn't crash as often as Windows does if it's used right.
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Tallgeese
Justice is Blind
Posts: 620
Joined: Wed Jul 28, 2004 3:33 pm
Location: Test
Contact:

Post by Tallgeese »

...And, surprise, Windows XP doesn't crash often (read: at all) if used properly either unless met with a hardware failure or a really horrible bug in software. Thus voiding your post and your argument halfway CyberBotX.

As for stopping, I myself don't get any if I let it initally sit idle after bootup for... ten seconds?

Please stop the outright general OS superiority biases (on ALL sides), they are bullshit a grand majority of the time.
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Metatron wrote:...And, surprise, Windows XP doesn't crash often (read: at all) if used properly either unless met with a hardware failure or a really horrible bug in software.
I bought a new machine with WinXP pre installed. And I got it to crash within the first week. In fact, ~1/3 times I use XP it crashes on me.

Perhaps what I use a PC for WinXP just can't handle...
Regardless of how good WinXP is overall, I find it personally one of the worst operating systems I could possibly use.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Tallgeese
Justice is Blind
Posts: 620
Joined: Wed Jul 28, 2004 3:33 pm
Location: Test
Contact:

Post by Tallgeese »

What kind of insanity were you subjecting it to? I've left my two year old XP machine on for a weeks at a time when DLing some monstrous, multi-GB files times five, and I didn't get any kind of crash...
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

Metatron wrote:What kind of insanity were you subjecting it to? I've left my two year old XP machine on for a weeks at a time when DLing some monstrous, multi-GB files times five, and I didn't get any kind of crash...
Coding + Debugging.
Video Editing.
IRC.
GAIM.

Locks up XP all the time.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Jipcy
Veteran
Posts: 768
Joined: Thu Feb 03, 2005 8:18 pm
Contact:

Post by Jipcy »

Well, the preinstalled WindowsXP is part of the problem. OEM-default installations of WinXP are VERY buggy. Usually lots of bloatware in there too. My suggestion is to back up, format, and reinstall.

By the very nature of Windows, every new program you install increases the chance of decreased reliability of WinXP. Old Win95 programs can nicely screw up a system. It really just depends.
[url=http://zsnes-docs.sf.net]Official ZSNES Docs[/url] | [url=http://zsnes-docs.sf.net/nsrt]NSRT Guide[/url] | [url=http://endoftransmission.net/phpBB3/viewtopic.php?t=394]Using a Wiimote w/ emulators[/url]
Nach
ZSNES Developer
ZSNES Developer
Posts: 3904
Joined: Tue Jul 27, 2004 10:54 pm
Location: Solar powered park bench
Contact:

Post by Nach »

bitcopy wrote:Well, the preinstalled WindowsXP is part of the problem. OEM-default installations of WinXP are VERY buggy. Usually lots of bloatware in there too. My suggestion is to back up, format, and reinstall.
I hosed the disk, partitioned, installed WinXP fresh and Linux on it the same day I got it.

WinXP on it still gives me trouble, hence why I rarely use it in WinXP.
WinXP on other machines give me trouble too, I find it to be a lousy OS.
May 9 2007 - NSRT 3.4, now with lots of hashing and even more accurate information! Go download it.
_____________
Insane Coding
Post Reply