SNES9x for Android

This is for people involved in the developement of Snes9x, or SNES emulators in general.
BUG REPORTS BELONG IN TECH SUPPORT/BUG TRACKING!
Post Reply
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

SNES9x for Android

Post by SparroHawc »

--EDIT--

Rakashazi now has a functional Android port that doesn't use any of Yong's code. This should be considered as superseding this version, as the binary can be distributed without any issues and is maintained by someone who has proven to be far more capable than me when it comes to working with Android.

Information is here: http://www.snes9x.com/phpbb2/viewtopic.php?t=4868

--END EDIT--

I got it working, complete with save-state support! If you, too, want to compile and run Yong Zhang's port of SNES9x for Android, here's what you need to do. I'll try to use relatively easy directions, but as Linux is involved, it may require some advanced knowledge. I apologize if I'm too vague for newbies or too condescending for veterans - I'm trying to get a good middle-ground. I'm going to assume you know how to navigate a shell, at least.

Pretz also informs me that you can compile the program in Windows (using Cygwin) and in OSX. Linux is what I had on hand, though, so for the time being that's what the instructions are for.

NOTE: The source code is completely lacking in copyright information for Yong himself. The Java code may still be owned by Yong. DO NOT DISTRIBUTE THE COMPILED PROGRAM TO ANYONE. Yet. I'm still doing research.

1. Get a Linux distribution with a graphical desktop. If you already have a Linux distro, good for you - knowing how to use it will make this much easier. Ubuntu will work fine, and it's easy to get and (relatively) easy to install and work with.

2. From within Linux, download the Android SDK from here: http://developer.android.com/sdk/index.html Stick it in your home directory if you don't know where else to put it.

3. Download the Android NDK from here: http://developer.android.com/sdk/ndk/index.html Again, if you don't know where to put it, stick it in your home directory.

4. Download Eclipse from here: http://www.eclipse.org/downloads/?osType=linux Specifically, you want the Eclipse IDE for Java Developers. If you don't know whether or not you're running 64-bit, grab the 32-bit version.

5. Make sure you have the Java SDK installed. To do this, pop open a terminal window (xterm is fine) and type

Code: Select all

java -version
and

Code: Select all

javac -version
If the version listed is less than 1.6.x then you need to upgrade. That's beyond the scope of this though.

6. Untar everything. This can be done with the command

Code: Select all

tar -zxvf <filename>
Replace <filename> with what you want to untar.

7. Set up the Android development platform. Go into the directory created by untar'ing the Android SDK (not NDK) and run

Code: Select all

tools/android
This MUST be done within an x terminal. If you're running from a plain text terminal, this won't work.

When the window pops up, select 'Available packages' on the left, and check the 'Android Repository' box. You don't need any of the third-party add-ons. Hit 'Install Selected' and wait for it to chew through the downloading and installing. Once that's done, close the window.

8. Make sure you have git installed. This can be done like so:

Code: Select all

git --version
If you don't have it installed, and if you have apt-get (if you are running Ubuntu, you probably do), you should be able to install it with the following command:

Code: Select all

sudo apt-get install git
You'll need sudo permission for this. Again, if you don't, it's beyond the scope of this document. You'll have to check the interwebs.

9. Use git to get the sourcecode off of github. From whichever directory you want the folder containing the source, use the following command:

Code: Select all

git clone git://github.com/Pretz/SNesoid.git
10. cd into the SNesoid directory that git made. Type the following commands:

Code: Select all

git submodule init
git submodule update
This should download the common code all of Yong's emulators use.

11. Time to compile the native code! cd into the SNesoid directory inside the SNesoid directory and run the build command in the Android NDK directory. For me, the command is like this:

Code: Select all

~/android-ndk-r5b/ndk-build
If you don't have the r5b version of the NDK, you'll have to replace that with the directory that the NDK was untar'd into.

If it throws an error about not finding a file ending in .o.d.org just run the ndk-build command again. This may happen up to four times. Eventually it'll finish with only warnings, and no errors.

12. Fix your .bashrc file to 'install' the Android SDK. You'll need to add the utilities directory to the path. cd into the directory you untar'd the SDK into, then go into the 'tools' directory and type 'pwd'. Copy down the result. Edit the .bashrc file by typing

Code: Select all

nano ~/.bashrc
Go to the very bottom of the file and add

Code: Select all

export PATH=${PATH}:<directory>
replacing <directory> with what you copied. Write to file, yes you want to overwrite, exit.

12. Start up Eclipse. cd into the directory you unpacked Eclipse into, and just run ./eclipse from an x terminal. This should bring up the IDE. Just use the default workspace - we won't really be using it anyways.

13. Install the Android plugin for Eclipse. Under the Help menu, select 'Install software...' and put the following URL in the 'Work with:' field:

Code: Select all

http://dl-ssl.google.com/android/eclipse/
Click 'add'. Once it finds the information, check the 'Developer tools' box and hit 'next'. Blah blah once it's done hit Finish. You should have a usable Android development environment now, more or less.

14. Make a new project for SNesoid. Go to File -> New -> Project... and select Android Project. Click Next. Name the project SNesoid and hit the 'Create project from existing source' radio box. Click the 'Browse...' button and select the SNesoid directory (the one inside the SNesoid directory). Don't navigate into it - just select the directory and hit OK. You should be able to hit Next at this point. Leave the next screen alone and just click Finish.

15. Make the .apk file. Right-click on the SNesoid folder icon on the left side of the screen (in the 'Package Explorer' window) and click Android Tools -> Export Unsigned Application Package.... Save the resulting .apk wherever you want. This is your Android application. Copy it to your phone, run it with app manager, and install it. DONE!

Yes, it's ridiculous. But hey - now you have a full Android development environment and you can edit the source code, compile the changes, and copy it to your phone.

Later I'll post the .apk file for general consumption, but as mentioned above, I need to make sure I don't get my pants sued off before I do that.
Last edited by SparroHawc on Mon Mar 21, 2011 6:21 pm, edited 2 times in total.
Screwtape
Snes9x White Belt
Posts: 49
Joined: Thu May 26, 2005 12:59 pm

Re: SNES9x for Android

Post by Screwtape »

SparroHawc wrote: You need an account on Github, and you need an SSH public/private key pair.
You totally don't. The github page mentions a "git read-only" URL that works just fine without any account setup at all:

Code: Select all

$ git clone git://github.com/Pretz/SNesoid.git
Initialized empty Git repository in /tmp/SNesoid/.git/
remote: Counting objects: 530, done.
remote: Compressing objects: 100% (330/330), done.
remote: Total 530 (delta 191), reused 517 (delta 185)
Receiving objects: 100% (530/530), 1.57 MiB | 242 KiB/s, done.
Resolving deltas: 100% (191/191), done.
SparroHawc
Official Android Porter
Posts: 303
Joined: Mon Feb 07, 2011 9:20 pm
Location: All up in your business

Re: SNES9x for Android

Post by SparroHawc »

Screwtape wrote:
SparroHawc wrote: You need an account on Github, and you need an SSH public/private key pair.
You totally don't. The github page mentions a "git read-only" URL that works just fine without any account setup at all:
Ohcool. Gotta give that a try. Will adjust the instructions accordingly, thanks. :D
Kuntley
Snes9x White Belt
Posts: 1
Joined: Wed Apr 27, 2011 9:36 pm
Location: US

Android app save file

Post by Kuntley »

Sorry, i've been having a little trouble with the sn9x ex app for the android. i can't seem to figure out how to take the save files off my computer and put them into my phone. i think the app save in a .0A.s96 file or something. ive tried just dragging the .srm file to my android, but i dont know how to access it(if i even can) with the app.

if you know how to transport the file or convert it if you have to, please help me!
Rakashazi
Official iOS & Android Porter
Posts: 79
Joined: Sat Jan 01, 2011 9:51 pm
Location: Washington DC, USA

Re: Android app save file

Post by Rakashazi »

Kuntley wrote:Sorry, i've been having a little trouble with the sn9x ex app for the android. i can't seem to figure out how to take the save files off my computer and put them into my phone. i think the app save in a .0A.s96 file or something. ive tried just dragging the .srm file to my android, but i dont know how to access it(if i even can) with the app.

if you know how to transport the file or convert it if you have to, please help me!
All you need to do is replace the existing .srm file in the same directory as the ROM on your device. The .0A.s96 file is for auto-save states so just delete it or disable that function in the options, otherwise the state will replace your new save ram the next time you load the game (you can turn it back on afterwards).
lordbug
Snes9x White Belt
Posts: 2
Joined: Thu Apr 28, 2011 3:38 am

Trying to configure touchscreen controls on my DroidX

Post by lordbug »

Hi! First of all, thank you so much for making this emulator available on my phone! The emulation is fantastic!

I am, however, having no luck with the touchscreen controls :/ the ABXY configuration is jumbled by default and sadly counterintuitive, at least for me. When I try to reconfigure them in the options menu, the prompt to press a button for "A" doesn't display any controls. Am I just missing some detail? Thanks.

P.s. I did search for this before posting and did not see any relevant posts. Thanks again!
Rakashazi
Official iOS & Android Porter
Posts: 79
Joined: Sat Jan 01, 2011 9:51 pm
Location: Washington DC, USA

Re: Trying to configure touchscreen controls on my DroidX

Post by Rakashazi »

lordbug wrote:Hi! First of all, thank you so much for making this emulator available on my phone! The emulation is fantastic!

I am, however, having no luck with the touchscreen controls :/ the ABXY configuration is jumbled by default and sadly counterintuitive, at least for me. When I try to reconfigure them in the options menu, the prompt to press a button for "A" doesn't display any controls. Am I just missing some detail? Thanks.
Hi, the face button arrangement for the on-screen controls is currently fixed but you can align/resize them by going to the "On-screen Config" option. The options you were looking at are for setting up keyboard controls and don't affect the on-screen ones. I'm working on better features and redesigned graphics for them to be included in a future update :)
lordbug
Snes9x White Belt
Posts: 2
Joined: Thu Apr 28, 2011 3:38 am

Re: Trying to configure touchscreen controls on my DroidX

Post by lordbug »

Rakashazi wrote: Hi, the face button arrangement for the on-screen controls is currently fixed but you can align/resize them by going to the "On-screen Config" option. The options you were looking at are for setting up keyboard controls and don't affect the on-screen ones. I'm working on better features and redesigned graphics for them to be included in a future update :)
Sounds good to me! I can probably make due until then :) Thanks for the info and keep up the good work!
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 one major thing I hadn't spotted in my rather minimal testing.

You have to go into the settings and check 'Use C Core'. The PocketSNES core doesn't seem to work for some reason.
Post Reply