Lukas Sabota Ramblings of a coder, musician, and a debatably nice guy.



To be honest, FCEUX was not built with OS X in mind.  I have never owned an Apple product (other than an iPod) and most of the FCEUX developers are PC-centric as well.  However, the SDL port is actively maintained and once I managed to succeed at compiling it on OS X and I was playing Castlevania on OS X.  A few commits later and FCEUX was actually quite usable on OS X.  The problem was that it was difficult to obtain all of the tools and libraries required to build FCEUX.  On Linux systems, grabbing the compiler and libraries are a yum/apt-get/pacman command away, but it was not always this easy on OS X.

Enter Homebrew. Homebrew is a source-based package manager for OS X with ruby-based packaging scripts. I'm no Ruby expert, but the documentation made it easy enough for me to put together a script to patch FCEUX to make it OS X compatible and to actually compile and build FCEUX. If you have homebrew installed, you can build FCEUX and the necessary dependencies with the following command:

brew install fceux

If you want to compile a command-line only version, you can use this command:

brew install --no-gtk fceux

Currently, the emulation window and the GTK GUI window are in two separate windows due to a limitation in the OS X X11 implementation. I have not yet tried Quartz yet, but it might work properly in a single window with that. Keep in mind that FCEUX was not originally intended for OS X, but SDL and the rest of the libraries utilized by FCEUX are available for OS X.

As always, patches are welcome.  If you run into issues first check the website and file a bug on the sourceforge tracker if necessary. Feel free to drop by #fceu in for any fceux-related discussion.

Here is the Ruby "Formula" for FCEUX in Homebrew's GitHub that I wrote if you want to check it out. You don't need that link if you want to build FUCEX however -- you can simply use the brew commands above



Filed under: Code, Fceux, NES 4 Comments

Gracefully killing “stuck” SSH sessions

On my home WiFi connection, I occasionally find my SSH sessions being stuck and completely unresponsive. The only way to resolve the issue has been to close the window of the terminal emulator, which is usually no big deal. This becomes more of an issue when using ChromeOS on my CR48 where you can't close the shell window by any means other than the "exit" command. Prior to discovering a more graceful solution, I had been using this somewhat lengthy workaround (which requires ChromeOS to be in dev mode):

  • Press Alt-Ctrl-T to open a new crosh shell.
  • Type "shell" to open a Linux shell.
  • Run "ps fax | grep ssh" to find the process id of the stuck ssh session.
  • Kill the stuck session with "kill -9 [process ID]"

Killing the process manually is not ideal, especially when your WiFi drops whenever the router yawns.

This solution that is built into the standard openSSH client takes a lot less time and closes the connection as opposed to just killing the client process. When the session is stuck, press the following keys to close the SSH connection:

  • Enter
  • Tilde ( "~" / shift back-tick )
  • Period

That's it! Your connection will be closed with the "Connection to [host] closed" message. I hope that you find this tip as useful as I did. Happy hacking!

Filed under: ChromeOS, Code 8 Comments

Exploring Perl

Throughout my years of programming, I have heard abundant praise about the Perl language.  On the other hand, I've known some programmers that refuse to touch Perl with a ten foot pole.  Python had been my scripting language of choice in the past. Regardless, I decided it was in my best interest as a programmer to at least be familiar with the language.

After some quality time with "man perlintro", I began to get fairly comfortable with the syntax.  Diving into "man perlretut" really opened my mind to ways to parse text in new ways with regular expressions instead of complicated code chock-full of nested loops and loads of conditionals that are quite frankly awkward to code.  Another great thing about regular expressions is that many other languages and programs have support for them or a similar syntax (python re and vim for starters). I highly recommend any programmer with some spare time to check out the perlintro and perlretut manpages if they haven't already.

I wanted to dive into a bit of web programming with Perl, so I installed and configured mod_perl for my apache2 server on my Linode.  On Arch Linux, you can install mod_perl with:

pacman -S mod_perl

I added the following entry to my httpd.conf file to enable mod_perl:

<Files ~ "\.(pl|cgi)$">
PerlResponseHandler ModPerl::Registry
Options +ExecCGI
PerlSendHeader On

Your mileage may vary with your distribution and version of everything, but that was enough to get me started with mod_perl and apache2.

My first script was a warsow server status checker for my warsow server. You can check it out here and the source can be found here. The script is pretty simple, it basically scrapes the output of qstat (a command-line program to query quake/warsow servers) and formats the output into an HTML friendly format. Regex is used to parse the qstat output into variables that can be used to form the HTML friendly output. The code probably isn't as optimal as it could be -- for anyone checking out the source keep in mind that I was learning everything about the language and regex as I was writing this. The output of the script is currently bare-bones HTML, but with CSS added the output could also be easily improved to be more eye-friendly. Maybe one day I will extend this script further, but as it stands it was a great learning experience and still serves a useful purpose. I'm looking forward to learning more Perl and regex; I feel as if I am only scratching the surface of how much these tools will make my life easier as a programmer.

Tagged as: , , , 2 Comments

FCEUX 2.1.5 Released!

Hey folks!  After many nights of dark LCD-lit rooms, coffee, and code the FCEUX team is pleased to bring you FCEUX 2.1.5.  Most notably, the GTK GUI for SDL platforms (Linux, BSD, OSX) has been drastically overhauled and moved from the previous two window layout (game window/menu window) into a single integrated window.

For the full list of changes, check the official press release and download it here.

For build instructions for SDL, check out my previous post.

Edit 6/17/11 - Arch Linux now includes fceux 2.1.5 in their community repository, so you can fetch it with "pacman -Sy fceux" (link).

If you're an impatient archlinux user, you can use this PKGBUILD with makepkg to build a fceux 2.1.5 package for your system before the official package is updated in the community repository. Just use the following commands:

  • sudo abs community/fceux
  • cp -R /var/abs/community/fceux /tmp
  • cd /tmp/fceux
  • wget
  • makepkg
  • sudo pacman -U fceux-*.pkg.tar.xz
  • Enjoy!


    Filed under: Code, Fceux, NES No Comments