Back to index




Welcome to DSLua

DSLua is a port of the Lua scripting language to the Nintendo DS. Originally made by waruwaru, now maintained by sypherce, daltonlaffs, and me, Jeremysr. You can get it or the source code from DSLua.com, on the download page. This document will explain how to use DSLua and write programs for it.




Installation

  1. Download DSLua 0.7 from the DSLua.com download page.
  2. Unzip it with some program like Winzip.
  3. Patch the DSLua rom (either DSLua.nds or DSLua.sc.nds or DSLua.ds.gba) with DLDI.
  4. Copy the scripts directory, which was in the download, to the root directory of your card. You only need scripts/main.lua which is a file browser that lets you execute lua scripts (DSLua won't work without it.) All the other files are just example programs.
  5. Copy the DSLua rom to your card.
  6. That's all you have to do, it's now installed!




Running Programs

First find some games/apps for DSLua at these or other webpages:



I recommend making a directory on the root of your card called "dslua", and putting all the DSLua homebrew you download in there, each in their own directory inside the dslua directory. This is because many DSLua projects come with around 10 to 50 different files for all the code, graphics, savefiles, and sound/music. Also a lot of games/apps using the Auto-start feature want you to have the game directory inside the /dslua directory.

After you've put the game files onto your card, run DSLua.nds (or DSLua.sc.nds or DSLua.ds.gba...). The file browser should run. If it doesn't you either have to patch it with DLDI or you didn't copy the "scripts" directory to the root of your card. (Read the installation section to fix these problems.) Navigate to the directory where your DSLua program is stored using the up, down, and a buttons. Find the .lua file that you're supposed to run. Most programs will come with more than one .lua file. The one you should run is usually called either main.lua or (The title of the game).lua. Select this file and press A to run it.




Auto-start

The Auto-start feature lets you make a DSLua file that will automatically run a certain file on the storage device (or GBFS). See auto-start.bat for instructions and an example.




gfx2gba

Currently your game sprites must be in .raw/.pal format, and your backgrounds must be in .raw/.pal/.map format. To convert them, use gfx2gba.exe which is found in the bin directory. From the command line, run this to make a sprite:

gfx2gba -poutput.pal input.bmp


The output will be a palette file (output.pal) and a raw image file with the same name as your input (in this example it would be input.raw). The input file must be a 256-colour bitmap (.bmp). Its width and height must be 16, 32, or 64 pixels. (Examples: 16x16, 32x64, 64x16...)

To make a background (tile map), you need to add -m to the command:

gfx2gba -m -poutput.pal input.bmp


With this example it will output three files: input.raw, input.map, and output.pal. Like sprites, the input bitmap must be 256 colours and the width and height must be in multiples of 8.




More Information


Back to index