SNEmulDS

From PHWiki

SNEmulDS is an SNES emulator that has been ported to the DS by Archeide, who also created the original "SNEmul" for the PC about 10 years ago. Unlike SNES DS and SnezziDS, SNEmulDS wasn't built from scratch to suit the specs of the DS. This in turn means that it has generally higher compatibility at the cost of speed, though speed increases with every release, and many games are at 100% now.

Contents

Features

  1. High compatibility
  2. Rom browser within the emulator (no need to reset to play a different rom)
  3. No patching software needed (.smc files are run straight from the "SNES" directory of your card)
  4. Touchscreen allows for navigation of the rom browser and options menu with the stylus
  5. Paging system that calls up 1-2 MB of ROM into RAM as needed, allowing large ROMS to be played when they would normally not fit into the DS's 4 MB of RAM.
  6. Savestate support in addition to regular in-game saving with .srm files.
  7. Mouse mode allows for certain games that used the SNES Mouse to be played via the touchscreen.
  8. Sleep mode when the DS lid is closed, which pauses emulation, cuts sound, turns off screens, and automatically saves SRAM

Current Issues

  1. Some games do not run at full speed.
  2. Some games do not boot at all, see SNES games with special chips for details.
  3. Some games have graphic glitches that range from minor, to making the game unplayable
  4. Certain larger sized roms will not fit into RAM and will not load correctly, if at all.

Installation

Instructions are current as of version 0.5 Beta.

  1. Download the latest binary from the official site and extract the contents
  2. View the "README" file for important info (rename it to end in .txt if necessary)
  3. Patch SNEmulDS.nds with the correct DLDI patch for your device and place it anywhere on your card
  4. Place SNEmul.cfg on the root of your card.
  5. Place your SNES games in a folder called "SNES" on the root of your card. Alternatively, open up SNEmul.cfg with Wordpad and change the default rom location
  6. Load up SNEmulDS.nds and select the game to play

Main Menu

When playing a game, the following options are available on the touchscreen:

  • Select ROM: return to the rom listing and choose another ROM. Note that SRAM for the current game is automatically saved when you do this.
  • Options: Enter the options menu (see below)
  • SPC Jukebox: play a .spc music file endlessly while playing your game. The SPC files must be in your SNES directory.
  • Reset: resets the game
  • Load State: Restores one of your 8 savestates
  • Save State: Save your exact position in the game into one of 8 slots, which are placed in the SNES directory alongside the ROM with the extension .SM1 .SM2 etc.
  • Save SRAM: IMPORTANT OPTION - After saving normally in-game, you must tap this option in order to save it to a *.sav file in your SNES directory. Without tapping this, the save will be lost soon after the DS is turned off. SRAM is also automatically saved when selecting another rom and when entering sleep mode.
  • GFX Config: enter the graphics config menu (see below)
  • Debug: This option is hidden under other text, but you can still tap it. It simply shows debug information and also clears the graphical registers to clear away garbage data.

The Options Menu

In the Options menu, you can change a few settings that relate to how the game runs overall. Game emulation is paused when this screen is entered.

  • Mode 3: Mode 3 is generally used for HUD and GUI images that remain onscreen at all times. Since SNEmulDS does not scale the screen as a whole, these HUDs may be chopped off at the top or bottom. This option removes information from the center of the screen to squish the Mode 3 layer, allowing you to see the entire HUD no matter which Yscroll setting you choose. Try it in Super Mario World for an example.
  • Sound: toggles sound on or off. Note that some games will only boot if you turn sound Off.
  • Layers: Tapping this will change the order of the graphics layers, scrolling through 10 good combinations that should work for most games. If none of them work, try changing them manually in the GFX config menu (see below). Note that after making a change, you will need to hit Back to go back to the emulation before the change takes effect.
  • Renderer: Hardware or Software renderer. Currently does not do anything, as both are the same. This used to toggle between the "tile engine" and the "line-by-line" engine. With v0.4, the Tile engine is recommended, while for the 0.5 alphas, line-by-line is recommended.
  • BG1 / BG2 / BG3 / SPR: Completely enable or disable the three background layers and sprites. Usually it's best to leave everything enabled and mess with the layer priority instead.
  • Yscroll: this dictates the vertical position of the DS screen. Since SNEmulDS does not scale the screen, part of the SNES screen is chopped off. This setting lets you change whether you want to see the top, middle, or bottom of the screen. This can also be changed in the config file to get settings in between these three options (as is the case with Super Mario World).
  • Vblank: this option dictates whether the DS should wait for a vblank or just ignore it and run the emulation as fast as possible. Setting it to "Wait Vblank" will set a hard limit at 100% speed, useful if games are running too fast. Sometimes "No Vblank" is necessary in order for some graphics to appear correctly.
  • Speed hacks: This enables certain speedhacks in order to emulate the game faster, useful when the "Wait Vblank" setting actually slows a game down too much. By default, no speedhacks are applied. Cycles Speedhack is the most stable, and works for the most games. Interrupt Speedhack works for some games and tends to be faster than Cycles. Full Speedhack combines Cycles and Interrupt.
  • Save: Saves the current options into the snemul.cfg file on your card.
  • Back: return to game emulation with new settings applied.

The GFX menu

GFX Config menu with some key areas outlined (click to enlarge)
Enlarge
GFX Config menu with some key areas outlined (click to enlarge)

The GFX config menu is new to v0.5 Beta and contains several options that may help make the graphics in games look closer to normal. The following options are available:

  • Priority per tile: in the SNES hardware, each background layer has two sub layers: high and low priority. The DS's 2D hardware doesn't have this feature, but it does have one more background layer. This option uses the additional layer to emulate the priority per tile for one SNES background. You can choose between none, BG1 or BG2, but note that this option CAN corrupt graphics or make other tiles disappear
  • BG3 block priority: this option emulates the priority per tile for BG3 by guessing, for each line, if the map contains more high or more low priority tiles, and then changes the priority of the BG3 for each line. This option is not perfect yet, and some text may disappear as a result. Note that it only works when the graphical layers are in Automatic mode.
  • Blank Tile: This is the number of a blank tile that will be used to fill the empty areas of a doubled layer. 0 works for most games, but some games may need a different value for different parts of the game. 666 seems to work well for Secret of Mana for instance. See the above image for the relative three areas to tap to change this setting. The far left area scrolls 100 at a time, the middle area scrolls 10 at a time, and the far right area scrolls 1 at a time.
  • BG1 / BG2 / BG3 / BGX(low): change the priority of each layer. Note that this is the same setting that can be found in the Options menu but allows for manual combinations to be used. The right portion of the screen switches between Automatic and the last combination entered (see image)
  • Sprite1 / Sprite2 / Sprite3 / Sprite4: changes the priority of the sprites. The SNES has 4 priorities like the DS, but sometimes it's useful to change the priorities for some games. For instance, while 3211 is the default, 3210 and 3221 are known to aid certain games (see the compatibility list). Tap on each number to change it.
  • (Fix): tap on this portion of the screen to clear the GFX buffers and fix most GFX garbage on the screen. (see image for relative area)

SNES Mouse Emulation

As of v0.5 Alpha 2, SNES Mouse emulation was added, allowing some games like Mario Paint and Populous II to be playable through the touchscreen.

Entering SNES Mouse mode

Press START+L+R+LEFT to make the two screens switch places. Then use the stylus to move the mouse cursor.

You can also switch the screen without selecting mouse emulation mode using START+L+R+RIGHT.

Types of SNES Mouse emulation

Currently there are two methods of emulation:

Relative distance

This method works with all games that use the SNES mouse. It computes the distance between two stylus "clicks" to emulate the movement of the mouse. This is not accurate and some games like Populous II use non-linear movement, so the mouse cursor doesn't follow the stylus. This is the default mode of operation.

Memory following

The emulator directly modifies variables in RAM where the game stores the X and Y positions of cursor. Using this method, the mouse cursor moves accurately. However, for this to work, each individual game must be searched through with a debugger in order to find the correct coordinates, just like sprite following in PocketNES. The X and Y addresses found are then stored in snemu.cfg, so it is important to have this file up-to-date as more games are added. If the coordinates are not found in the snemul.cfg file, the first method is used instead.

SNES Mouse Usage

For both methods, the D-pad is used to select the way the stylus emulates the mouse:

  • press LEFT (or Y): when the touch screen is pressed, the mouse is moved to this point and the mouse's left button is pressed
  • press RIGHT (or A): when the touch screen is pressed, the mouse is moved to this point and the mouse's right button is pressed
  • press DOWN (or B): when the touch screen is pressed, the mouse is moved to this point. When the touch screen is not pressed, the buttons are released and the cursor doesn't move.

Another option is available with first method of mouse emulation:

  • press UP (or X) and press the touchscreen at the same time to calibrate the stylus to that point. Use this if the mouse cursor doesn't follow the stylus correctly.

In mouse mode, you can also scroll the entire screen (all backgrounds). Press L (or R) and Up (or X) to scroll the screen up. Press L (or R) and Down (or B) to scroll the screen down.

Usage on GBA flash carts

Because SNEmulDS uses the DLDI system for loading games, many users of traditional NOR-based GBA flash carts may feel left out. However, there is a method of creating filesystem built-into the rom and having SNEmulDS use that. This same method may also be used for testing SNEmulDS in a DS emulator such as No$GBA. This method is called FCSR and stands for FlashCart SRAM. In essence, a FAT12 virtual filesystem is created and appended to the DS binary. Note however that FCSR is read-only, so you will not be able to save your progress, though you can use an existing *.srm file if you wish.

  • Go to http://gpf.dcemu.co.uk/ and look on the left hand side for fcsrimage.zip and fcsrDLDI.zip.
  • Extract both of those files, then copy the fcsr.dldi file over from the fcsfDLDI folder to the fcsrimage folder. Move this working folder to a location that has no spaces in the filename, something like C:\fcsrimage
  • You will need the .ds.gba version of the homebrew, which in the case of SNEmulDS doesn't exist. Get the SNEmulDS.nds file and prepend a loader (in this case ndsmall.bin) to it to make it a .ds.gba one. In order to do this, use the following command in the command shell:
copy /b ndsmall.bin + SNEmulDS.nds SNEmulDS.ds.gba
  • You will then need to padbin it. Go to Tepples's GBA page and download the GBFS distribution, copying the padbin.exe file from there into the working folder. Type the following command:
padbin.exe 512 SNEmulDS.ds.gba
  • Go to the "fcsr" subfolder, add the snemul.cfg file to it, then add an SNES directory and add your games and *.srm save files to it.
  • Go back to the main folder and type this command:
build.bat image.img fcsr
  • You will then combine the padbin'd SNEmulDS.ds.gba file with the image you just created with
copy /b SNEmulDS.ds.gba + image.img final.ds.gba
  • All you need to do now is DLDI patch the final.ds.gba file. Go to the DLDI homepage and download dlditool.exe and put it in your working folder. Type:
dlditool.exe fcsr.dldi final.ds.gba
  • Test the resulting file in No$GBA to ensure that it worked. It should be able to get past the filesystem checks and show you your list of games. Note that all games might not work in no$GBA, but this is due to inaccurate emulation.

Alternate Usage on GBA Flash Carts

There is a way to speed up the FCSR process by using the "DLDI Right Click" program, aka "DLDIrc". Versions 0.6 and above have support for FCSR image creation, which greatly simplifies the process.

  1. In the folder where SNEmulDS.nds is located, create a subfolder called "SNEmulDS" - note that this folder must match the name of the *.nds file, so if you rename one you must rename the other.
  2. In this SNEmulDS subfolder, add snemul.cfg and the "SNES" subfolder, adding any games and save files you want.
  3. Right-click SNEmulDS.nds and choose the FCSR option. If the building process does not hang up or fail at any point, it should output a large *.nds file that's ready to be tested in no$GBA or renamed to .ds.gba and flashed to a GBA flash cart

History

v0.1 was the initial release - July 15, 2006

v0.2 was released September 29, 2006, and featured numerous improvements:

  • Support for ROMs bigger than 2 MB
  • Speed improvement (+30-40%)
  • The ability to load and save states, 8 slots per game. Savestates stored in SNEmul file format (SML) in the SNES directory, along with the SNES ROM.
  • Fixes for most scrolling bugs
  • The ability to Load / Save SNES SRAM. SRAM is read from a SNESGAME.srm file put in the SNES directory, along with the SNES ROM. SRAM has to be saved manually using the "Save SRAM" option in the main menu.
  • New "No Vblank" mode which is by default enabled. This mode allows much faster emulation speed, and can fix some graphical problems, but can also bring other issues.
  • Fixes for the initial crashes due to "strange" filenames in SNES directory.
  • Fixes for many other bugs, and improved memory consumption.

However, saving was experimental due to the limitations of the FAT libraries.

v0.3, released January 15, 2007, saw some profound changes, including

  • Sound support with Gladius's sound core
  • DLDI support to increase compatibility of devices
  • SPC Jukebox that lets you listen to SPC tracks in the "SNES" folder in place of a game's normal music.
  • Increase in size of touchscreen menu items to allow for easier navigation, and a "back" button placed in the rom selection screen.

There were a few preview versions for v0.3 that introduced, among other things, the new sound capabilities and support for Max Media devices. These preview releases were the last not to use the DLDI interface.

In addition, due to the buggy nature of the FAT libraries and DLDI interface, test versions have been created for v0.2 and v0.3 that read the games directly off of the root directory instead of the SNES directory. In addition, for these test versions, the FAT init loop is removed because for some drivers the FAT_init functions return false when it has initialized correctly. As a result, users of the GBAMP and R4 have been able to use SNEmulDS when the usual versions failed for them.

v0.4 Alpha, released February 20, 2007, was the first to incorporate the SnezziDS CPU core, allowing for faster emulation speed. Other changes included:

  • MODE 7 implementation
  • Partial line by line engine for MODE 7 games
  • MODE 3,4 implementation (256 colors)
  • Use of devkitpro r20 and libfat library from chishm with DLDI support for better compatibility
  • paging system improvements, reducing bugs for Large ROMs (> 3 Mo)
  • various memory leak fixes, and also a fix for the famous "Unsupported Large LoRom" bug
  • Three levels of speed hacks introduced: no speed hacks, medium speed hacks, full speed hacks
  • various bugs fixed
  • Sources released under GPL as required by SnezziDS

v0.4 Beta, released only days afterward on February 26, 2007, fixed some bugs that were reported by users of the Alpha version. This consisted of:

  • broken BREAK and COP instructions fixed, allowing more games to boot
  • ROM write protection fixed, removing copyright notices in games
  • Emulation flag at startup fixed, allowing DKC3 to work
  • Speed improvements due to RAM optimizations
  • Reduced memory consumption
  • Experimental "line-by-line" engine introduced to aid graphics in some games
  • Manual background priority selector added, can be choosen in options or with START+L+R+UP or START+L+R+DOWN for automatic
  • "Interrupt speed hacks" option added, "medium" renamed to "Cycles"

v0.4 Final was then released on March 12, 2007, fixing several bugs and adding a couple new features:

  • ROM paging fixed again, stability improved (DKC2 fixed)
  • I/O port writing methods revised, stability increased (no longer crashes before first boss in Zelda)
  • Chrono trigger battle freeze bug fixed
  • Interpretation of blank screens modified (Street Fighter Turbo, RTYPE3, Final Fantasy Mystic Quest fixed)
  • SRAM bugs fixed, most ROM protections now unlocked (Uniracer, Bust-a-move)
  • Bugfix for sound core crashing when using line-by-line engine.
  • Sound core reset improvement for launching games one after another
  • Individual game options saved in savestates
  • Background layer selector added to enable/disable certain layers
  • Hinge support added, stopping emulation and saving SRAM upon lid closure
  • SRAM saved before loading new ROM

v0.5 Alpha was released March 25, 2007. Changes included:

  • New GFX engine added that supports tile address alteration (For RPG games and others)
  • Faster HDMA implemented to make games like Chrono Trigger run faster
  • Much better line by line engine implemented, the older tile engine nearly broken
  • Better transparency support added
  • Other graphical updates added: Moved sprites 1 pixel down, Background color alteration by scanlines, fixed 16px tiles flip, better mode 5, better scrolling, new squish method…
  • Configuration file added - snemul.cfg (no saving support) that allowed specific configuration for each game.
  • SNEmulDS icon added thanks to Lestat

v0.5 Alpha 2 was released April 2, 2007, and added some new features:

  • Critical sound bug fixed, now acting like v0.4 Final
  • Better graphics engine added that used dynamic memory allocation
  • SNES Mouse emulation mode added for specific games
  • Bug in decimal ADC instruction fixed (F-ZERO chronometer corrected)
  • Bugfix in counting the number of cycles used by DMA, allowing more games to boot
  • ARM7 entry addresses removed to fix NinjaDS usage

v0.5 Beta was released May 7, 2007, fixing sound support and adding a GFX config menu, among other changes:

  • Sound timers changed to provide for much more accurate audio
  • Sound RAM moved back into fast ARM7 RAM, unused code from ARM7 codes removed
  • Support for changing sprite addresses during frame implemented, fixes ogre Battle
  • Left-handed mode for SNES Mouse added
  • Saving support for config file options added
  • New GFX config menu added


Source Code

See Also

SNEmulDS Compatibility List, SNEmuIDS Wiki Editor, SnezziDS, Snezziboy, SNES DS, SNES Advance

External Links

Mirrors with the v0.6a and v0.6-WIP2 of SNEmulDS: