configure.ac: fix typo
[rofl0r-gnuboy.git] / docs / CONFIG
blobefb5cde6baf7d76479c6d9e84f0f87c69d02ed3f
2 GUIDE TO CONFIGURING GNUBOY
5 [ P A R T   I ]
6   OVERVIEW
8 There are two major ways of configuring the way gnuboy behaves at
9 runtime: setting the values of variables, and binding commands to keys
10 and joystick buttons. Each can be done either on the command line, or
11 from a config (rc) file.
13 If you don't want to read all this detailed info, look at the sample
14 rc files provided, then browse back through this file to clarify
15 anything that seems confusing. You might also skip down to Part II if
16 you're already familiar with the syntax of gnuboy rc files and such;
17 the second part explains the configurable variables which you can play
18 with.
21   WHAT HAPPENS AT STARTUP
23 When gnuboy is started, it first processes gnuboy.rc, the primary
24 configuration file. On *nix systems, gnuboy will initially look for
25 its rc files in ~/.gnuboy, or if that fails, the present working
26 directory. On DOS and Windows, the current directory will be searched
27 first, followed by the directory containing the gnuboy executable.
29 After finishing with gnuboy.rc, gnuboy next looks for an rc file with
30 the same base name as the rom to be loaded. For example, if the name
31 of the rom is mygame.gb, gnuboy will process mygame.rc, if it exists.
32 This allows you to configure different preferences on a per-rom
33 basis. The locations searched for the rom-specific rc file are the
34 same as those searched for gnuboy.rc, unless gnuboy.rc has changed the
35 search path (see below for more info).
37 Finally, options on the command line are processed. The command line
38 will override any settings in the auto-loaded rc files. This is a good
39 place for options that you just want to use occasionally, but not on a
40 regular basis.
42 After all of the above is finished, gnuboy loads the rom and starts
43 emulation.
46   RC FILES
48 The rc files gnuboy uses are plain text files, with one command on
49 each line. Lines that start with # are treated as comments, that is to
50 say they are ignored, and blank lines are ignored as well.
52 There are three major types of commands.
55   RC FILES -- SETTING VARIABLES
57 First of all, there is the "set" command, which is used for setting
58 the values of variables. For example,
60   set scale 2
62 will set the screen scaling factor to 2. If you need to include a
63 space in the value of a variable, you can do something like this:
65   set savename "I like spaces in my filenames"
67 and then your save files will be named something like:
69   I like spaces in my filenames.sav
70   I like spaces in my filenames.000
71   I like spaces in my filenames.001
72   I like spaces in my filenames.002
73   etc.
75 Finally, some variables allow multiple numbers to be given. For
76 example, to set the video mode to 640x480, 16bpp, you might do
77 something like this:
79   set vmode 640 480 16
81 Observe that each number is separate, and there are no quotation marks
82 used.
85   RC FILES -- KEYBINDINGS
87 Next, we have commands that deal with key and joystick bindings. These
88 are fairly simple.
90 The "unbindall" command removes all existing keybindings -- be
91 careful! -- and its main use is for people who want to redefine their
92 keyboard controls entirely and throw away the defaults. Be warned that
93 if you unbind the quit key and don't bind a new key for quitting, you
94 may be unable to exit gnuboy cleanly!
96 The "unbind" command is similar, but it only unbinds one key at a
97 time. For example, to unbind the "space" key, use this command:
99   unbind space
101 See below for a list of key names to use with unbind.
103 Now we get to the main useful keybinding command: "bind". For example,
104 if you want the "tab" key to perform the Gameboy "select" button
105 function, use the following bind command:
107   bind tab +select
109 The significance of the + sign will be explained below. As with the
110 "set" command, quotation marks can be used with bind if the command
111 needs to contain spaces.
114   KEY NAMES FOR BINDINGS
116 When using the bind and unbind commands, you need to tell gnuboy which
117 key you wish to affect. Most of the keys that correspond to a
118 character you can type can just be referenced by that character. For
119 example, the alphabetical keys are bound by the lowercase letter they
120 represent, and the numeral keys (on the main keyboard, not the numeric
121 keypad) can be bound by their numeral. Other keys require a name. Some
122 are really obvious:
124   shift, ctrl, alt, up, down, right, left
125   enter, tab, space, home, end, esc, pause
126   f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12
128 Others are a bit less obvious but still should make sense. Some of
129 these can also be referenced by other names; read the source file
130 keytable.c for a full list:
132   bs            Backspace
133   ins           Insert
134   del           Delete
135   prior         Page Up
136   next          Page Down
137   caps          Caps Lock
138   numlock       Num Lock
139   scroll        Scroll Lock
140   minus         - or _
141   equals        = or +
142   tilde         ` or ~
143   slash         / or ?
144   bslash        \ or |
145   semi          ; or :
146   quote         ' or "
148 The numeric keypad is referenced as follows
150   num0-num9     Numeral keys 0-9 (on keypad)
151   numplus       Numeric keypad +
152   numminus      Numeric keypad -
153   nummul        Numeric keypad *
154   numdiv        Numeric keypad /
155   numdot        Numeric keypad .
156   numenter      Numeric keypad Enter key
158 Joystick buttons and directions also have names for binding, and they
159 are bound just like ordinary keys. Their names are as follows:
161   joyup         Joystick up
162   joydown       Joystick down
163   joyleft       Joystick left
164   joyright      Joystick right
165   joy0-joy15    Joystick buttons
167 The way joystick buttons are numbered varies from one joystick to
168 another. Experiment to find the names that are right for the buttons
169 you want to use.
172   RC FILES -- THE SOURCE COMMAND
174 The "source" command simply causes gnuboy to process another rc file
175 before resuming processing of the current one. It is useful for
176 splitting up your config into multiple parts, perhaps one file
177 auto-generated by a front-end and another hand-customized. Use of this
178 command is very simple:
180   source myfile.rc
182 will perform all the commands in myfile.rc. Note that the source
183 command also provides a method for binding multiple commands to a
184 single key. For example, simply
186   bind f1 "source f1stuff.rc"
188 and then f1stuff.rc will be run whenever you press F1.
191   RC FILES -- ACTION COMMANDS
193 Finally, we have rc commands that perform actions. These commands are
194 probably only useful when bound to a key, and might cause unexpected
195 behavior or even crashes if used by themselves in an rc file loaded at
196 startup.
198 First of all, the "quit" command should be obvious. It simply exits
199 the emulator. If the rom that's loaded uses battery backed save ram or
200 realtime clock, these files will automatically be saved at exit.
202 The "reset" command should also be fairly obvious. It acts as a reset
203 button, restarting execution of the loaded rom at the beginning, as if
204 you turned the Gameboy power off and back on.
206 Slightly more interesting are the "savestate" and "loadstate"
207 commands. These are used for saving and resuming "saved state" files,
208 which allow you to save the exact status of the emulation environment
209 and restore it later, effectively letting you "save game" at any point
210 in any game. If a number is specified after either of those commands,
211 the indicated save slot number is used. Otherwise, the slot set in the
212 "saveslot" variable will be used. See the information on variables
213 below for more info.
215 Most importantly, we have the action commands that control the
216 emulated Gameboy input pad. They are described below:
219   COMMANDS THAT BEGIN WITH A PLUS SIGN
221 Normally, gnuboy only performs the command bound to a key when the key
222 is pressed; nothing happens when it is released. But for some things,
223 particularly the Gameboy pad buttons, it's important for something to
224 happen when the bound key is released. This is the purpose of commands
225 that begin with a + sign. When a key is released, gnuboy checks to see
226 if the bound command begins with +, and if so, it changes the + to -
227 and performs the resulting command. This causes the Gameboy pad
228 buttons to go back to their normal state when the keys bound to them
229 are released.
231 The Gameboy pad commands, which should be self-explanatory, are as
232 follows:
234   +a, +b, +start, +select, +up, +down, +left, +right
236 If you're at all familiar with Quake's config system, this should all
237 be clear.
240   THE GNUBOY COMMAND LINE
242 Additional rc files to process, variable settings, and keybindings can
243 be specified on the command line when gnuboy is run.
245 Processing an extra config file is simple:
247   gnuboy --source myfile.rc game.gb
249 Specifying an extra rc file on the command line like this is
250 especially useful for frontends, which may want to put all the options
251 they set in one rc file so they don't have to pass a super-long
252 command line to gnuboy.
254 Binding keys is also pretty simple. Just use something like:
256   gnuboy --bind tab +select game.gb
258 Setting variables is where things get a bit more complicated. For
259 on/off (boolean) settings, you can just do something like
261   gnuboy --no-sound game.gb
263 to turn a variable (sound) off, i.e. set it to 0. Likewise, boolean
264 variables can be turned on via something like
266   gnuboy --rgb332 game.gb
268 which turns the "rgb332" variable on (see below for information on
269 what it does).
271 For other variables where you actually want to set a number or a
272 string, use this form:
274   gnuboy --savename=mygame2 game.gb
276 Finally, for variables with multiple numbers to be set, you can
277 separate them by commas as follows:
279   gnuboy --vmode=512,384,32
281 to avoid having to quote the spaces.
284 [ P A R T   I I ]
285   GUIDE TO CONFIGURABLE VARIABLES
287 What follows is a detailed explanation of most of the configuration
288 variables available for your tweaking. They are organized by what part
289 of gnuboy's behavior they affect -- graphics, sound, emulation, and so
292 Some variables may or may not be available depending on how gnuboy was
293 built. For example, if you built gnuboy on a system without sound
294 support, some variables related to sound may not exist for you, and
295 attempts to set them will be silently ignored. In most cases, it's
296 noted in the documentation when variables might not be available.
298 Also, there are a few highly system-specific variables, such as names
299 of devices to use for video and sound on *nix systems. These are
300 listed separately at the end, and it should go without saying that
301 they will not be available on all builds of gnuboy.
304   VIDEO AND GRAPHICS SETTINGS
306 Since this is everyone's favorite thing to customize, video seems a
307 good place to start.
310   SCREEN SCALING
312 There are a number of variables that control how gnuboy scales the
313 display. The most basic is the "scale" option, which is just the
314 factor to scale by. For example
316   set scale 2
318 will double the size of the display. Set the scale factor to 1 for no
319 scaling.
321 There are two ways gnuboy can go about doing scaling. The preferable
322 way is to use your computer's graphics hardware to do all the work.
323 This cuts down on the amount of CPU time consumed and provides
324 filtering to smooth out the blocky pixels, but it's not available on
325 all systems. The other way is for gnuboy to scale the screen itself.
327 Normally gnuboy will choose hardware scaling automatically if it's
328 available, but if you want to force it on or off, you can set the
329 option "yuv" (for hardware YUV-colorspace scaling) to 1 or 0. Yes,
330 this option is poorly named, and is likely to change in future
331 versions of gnuboy.
333 On one display platform, Linux fbcon, it's possible to disable the
334 interpolation filter in the hardware scaling. To do this, set the
335 variable "yuvinterp" to 0. Some users who like a crisper display may
336 prefer this setting, especially on video cards that make the picture
337 look "muddy" when they scale it. Unfortunately SDL does not seem to
338 provide such an option, so interpolation is always enabled on the SDL
339 based ports.
341 When hardware scaling is disabled or not available, gnuboy will do its
342 own scaling. However, the scale factor is limited to 1, 2, 3, or 4.
343 Also, when performing its own scaling, gnuboy defaults to leaving some
344 scanlines blank. This saves a lot of CPU time and allows gnuboy to run
345 full speed on slower systems. You can configure what portion gets
346 filled in with the "density" variable. For example.
348   set scale 4
349   set density 4
351 will give you 4x scaling with no blank scanlines. Keep in mind that a
352 fairly fast computer (at least 400 MHz or so on x86, or something
353 comparable on other types of CPUs) is required to run fullspeed with
354 this setting. In general, "density" is the number of lines that get
355 filled in, so set it the same as "scale" if you want everything filled
356 in, or lower if you need more speed.
359   VIDEO MODE
361 The variable for setting the desired video mode is called "vmode", and
362 it's made up of three parts: width, height, and bits-per-pixel. For
363 example, to set 640x480x16bpp mode, use
365   set vmode 640 480 16
367 By default gnuboy will enable hardware scaling and try to scale to the
368 entire screen size if a video mode at least 320x288 is specified. If
369 you don't want this behavior, set the "yuv" option (see above) to 0.
370 Also, if you're setting the "scale" variable to do scaling, you
371 probably don't need to use the "vmode" option, since gnuboy will
372 try to automatically pick a mode that fits the scale. It's there in
373 case you need it, though.
375 Note that the DOS port is not yet capable of auto-choosing a video
376 mode, so if you want anything but the default 320x200x8bpp you'll have
377 to set "vmode" yourself. Also, not all ports are capable of all modes.
378 Experiment to find what works for you. Video mode selection is a
379 little bit messy and confusing at this time, and we hope to improve it
380 a good deal in the future.
383   FULLSCREEN VIDEO
385 Some versions of gnuboy provide both fullscreen and windowed
386 operation. The variable "fullscreen" can be set to 1 or 0 to enable or
387 disable fullscreen mode. Also, the variable "altenter" can be set to
388 enable or disable switching between fullscreen and windowed mode at
389 runtime with the Alt+Enter key combination. Unfortunately, this does
390 not yet work on Windows; we hope to fix this limitation in the
391 future.
394   DMG PALETTE SELECTION
396 gnuboy allows you to set the palette used for grayscale when running
397 DMG (original mono Gameboy) roms. There are four variables for this
398 purpose, allowing the background, window, and both sprite palettes to
399 be colored differently. Each one is made up of four numbers, the color
400 to use for each shade of gray, from lightest to darkest. Colors are
401 represented as 24bit numbers, with red in the low (rightmost) places
402 and blue in the upper (leftmost) places. Although you could specify
403 colors in decimal (base 10) if you really wanted, they'd be very
404 difficult to read, so it's preferable to use hex (base 16).
406 For example, to set the background to shades of white, the window to
407 shades of red, and the sprite palettes to shades of green and blue,
408 you could use:
410   set dmg_bgp  0xffffff 0xaaaaaa 0x555555 0x000000
411   set dmg_wndp 0x0000ff 0x0000aa 0x000055 0x000000
412   set dmg_obp0 0x00ff00 0x00aa00 0x005500 0x000000
413   set dmg_obp1 0xff0000 0xaa0000 0x550000 0x000000
415 This will of course look rather ugly, but it does the job illustrating
416 how you set various colors.
418 For more extensive examples, see the sample file palette.rc included
419 with gnuboy, which provides a number of sample palettes to try.
422   RGB MODE WITH ONLY 256 COLORS
424 Normally when run in 256-color (8bpp) modes, gnuboy will dynamically
425 allocate colors in the palette as they're needed. However, on the
426 Gameboy Color, it's possible to have well over 1000 colors on the
427 screen at a time, and in games that make use of these "hicolor"
428 tricks, gnuboy will run out of colors and things will look bad.
430 If you prefer, you can set the "rgb332" variable:
432   set rgb332 1
434 This tells gnuboy that instead of using 256-color mode as a
435 palette-based mode, you want it to setup a static palette and pretend
436 8bpp is just a really low quality "truecolor" mode, with only 3 bits
437 of precision in red and green, and only 2 bits of precision in blue.
438 In general this will make most games look worse, since colors have to
439 be approximated fairly poorly and since smooth color gradients are not
440 possible, but it will make "hicolor" Gameboy Color games look a good
441 deal better. Also, rgb332 mode should run slightly faster since it
442 avoids the overhead in dynamic palette allocation.
444 If you have to run at 8bpp mode, try it with and without this option
445 and see which way you like better. Of course, the better solution, if
446 at all possible, is to use 16bpp or higher mode, but that may run too
447 slowly on older computers.
450   COLOR FILTERING
452 Optionally, gnuboy can filter screen colors to make them look more
453 washed out or faded like on a real GBC. To enable this feature,
455   set colorfilter 1
457 By default, gnuboy will not apply the filter when running DMG (mono)
458 games, since many of the sample palettes are already designed to
459 immitate a Gameboy LCD. If you would like to have the filter also take
460 effect when running in DMG mode,
462   set filterdmg 1
464 You can also customize the filter parameters to get different color
465 effects from the default ones. See the sample file filters.rc for
466 examples.
469   SPRITE SORTING
471 Normally sprites are sorted and prioritized according to their x
472 coordinate when in DMG mode. However, this takes a little bit of extra
473 cpu time, and it's not needed by most DMG games, so it can be disabled
474 as follows:
476   set sprsort 0
478 Note that although sprite sorting was disabled in previous releases
479 because it was not working properly, it now works great, so unless you
480 really need to maximize performance, you should probably leave it
481 enabled.
484   SOUND OPTIONS
486 Fortunately sound is a lot simpler than video. At this time, there are
487 no fancy interpolation or filtering options, only your basic audio
488 parameters.
490 To enable or disable sound, set the "sound" variable to 1 or 0. By
491 default, it's enabled.
493 To enable or disable stereo sound, set the "stereo" variable to 1 or
494 0.  It defaults to 1 on most ports, but since stereo sometimes fails
495 to work properly on DOS, it's disabled by default on the DOS port.
496 Disabling stereo in no way improves performance, so it should only be
497 done if stereo mode causes a problem on your computer.
499 To set the audio sampling rate, use the "samplerate" variable. The
500 default is 44100 Hz. Setting this lower can improve performance. For
501 example, if you have a really slow computer, you might use:
503   set samplerate 8000
505 Keep in mind that this will sound really really bad.
508   BOOT ROM OPTIONS
510 Gnuboy can now optionally use one of the original boot roms.
511 This might or might not improve compatibility with some games or
512 test roms; either way it provides a more authentic experience.
516   set bootrom_dmg "/path/to/dmg_boot.bin"
517   set bootrom_cgb "/path/to/cgb_agb_boot.bin"
519 to set the bootroms for DMG or Color Game Boy, respectively.
520 Note that CGB bootrom(s) work also with DMG games, but not vice
521 versa. the SGB (Super Game Boy) boot roms don't work for either
522 mode, as they try to communicate with the host console via the
523 Joypad I/O port.
526   FILESYSTEM OPTIONS
528 There are a good deal of options that affect where and how files are
529 saved and loaded by gnuboy. First, there's "rcpath", which specifies
530 where gnuboy searches for rc files. The default depends on your
531 operating system; see the beginning of this file for details.
533 The search path for rc files can contain multiple directories.
534 Normally, the list is separated by colons (:), but on DOS and Windows
535 the colon is used for drive letters, so semicolon (;) must be used
536 instead. Here are some examples, first for *nix:
538   set rcpath "/home/laguna/.gnuboy:/usr/local/etc/gnuboy"
539   set rcpath "."
541 and for DOS/Windows:
543   set rcpath "c:/gnuboy;."
544   set rcpath "c:/Program Files/Gnuboy"
546 If you really insist on using backslashes on DOS or Windows, you'll
547 have to double them up, since the backslash normally means "treat the
548 next character literally." For example,
550   set rcpath "c:\\gnuboy"
552 This is untested, and your milage may vary. I recommend just using
553 forward slashes and keeping things simple.
556   SAVE RELATED OPTIONS
558 These are all fairly simple, so I'll just list them quickly, then give
559 a couple examples.
561   savedir     - directory to store saved games (SRAM and savestates) in
562   savename    - base filename to use for saves
563   saveslot    - which savestate slot to use
564   forcebatt   - always save SRAM even on carts that don't have battery
565   nobatt      - never save SRAM
566   syncrtc     - resync the realtime clock for elapsed time when loading
568 The "savename" variable is particularly useful if you wish to have
569 more than one save associated with a particular rom. Just do something
570 like:
572   gnuboy --savename=mygame2 mygame.gb
574 and the save files will be called mygame2.sav, mygame2.000, etc rather
575 than just mygame.sav, etc.
577 The "saveslot" variable is normally just changed by keybindings, so
578 you can pick a savestate slot while you're playing a game. However, if
579 you for example prefer that the default slot at startup be 1 rather
580 than 0, you can use:
582   set saveslot 1
584 The "forcebatt" and "nobatt" options are fairly self-explanatory and
585 not very useful, except perhaps for debugging or use with corrupted
586 roms.
588 The "syncrtc" option needs a bit of explanation. Some roms, notably
589 Pokemon ones and Harvest Moon, use a realtime clock to keep track of
590 the time of day even when they're not running. Since gnuboy is just an
591 emulator, it can't work like a real cartridge and make things like
592 this keep happening while the emulator is not running. However, it can
593 resync the Gameboy realtime clock based on your computer's clock when
594 it starts. This is what the "syncrtc" option does. By default it's
595 enabled. If you disable it, then no time will seem to have elapsed
596 between when you exit the emulator once and when you start it again
597 the next time.
600   JOYSTICK OPTIONS
602 So far there is just one joystick option, "joy", used to enable or
603 disable joystick support.
606   DEBUGGING OPTIONS
608 These probably won't be useful to most people, but if you're trying to
609 debug a homebrew game you're writing or fix a bug in gnuboy they might
610 be of help:
612 The "trace" variable, if enabled, dumps a full execution trace to
613 stdout. Be prepared for at least 20 megs of logs to look through at
614 minimum, and more like 150 megs if you want enough to find anything
615 useful. Redirecting stdout to a file is a must!
617 The "sprdebug" variable is used to see how many sprites are visible
618 per line. Try it and see!
621   PLATFORM-SPECIFIC OPTIONS
623 On certain *nix systems, you may need to specify device nodes to use
624 if the defaults don't work:
626   oss_device  - Open Sound System "DSP" device
627   fb_device   - Video framebuffer device
628   joy_device  - Joystick device
629   
630 The Linux fbcon version of gnuboy does not support the "vmode" option
631 yet, but it can set the mode for you by running the "fbset" program,
632 if you have it. Just set the "fb_mode" variable to the exact name of
633 the mode you want in /etc/fb.modes. For example,
635   set fb_mode 640x480-90
637 You can also override the default color depth with the "fb_depth"
638 variable.
640 The DOS port of gnuboy has support for real console system gamepads
641 via the "Directpad Pro" (DPP) connector. To enable this feature, set
642 "dpp" to 1, set "dpp_port" to the IO port number the pad is connected
643 to (e.g. 0x378 -- be sure to prefix it with 0x for hex!!), and set
644 "dpp_pad" to the number of the pad you want to use. This code has not
645 been heavily tested, so it may or may not work for you. Be sure to get
646 the port number right or bad things may happen!
649   CONCLUSION
651 Well, that's about it for configuration. Hopefully this document
652 clears up a lot of the confusion about what you can and can't
653 configure in gnuboy yet, and how you go about doing it. Again, check
654 the sample.rc, palette.rc, and classic.rc files for lots of examples
655 of how rc files work.
657 As always, more info will come as time passes on. Keep on the lookout
658 for new releases and more features. Thank you for flying gnuboy and
659 have a nice day.
663                                                  - Laguna