README.OS2
author Patrice Mandin <patmandin@gmail.com>
Thu, 19 Jan 2006 21:28:52 +0000
changeset 1257 448a9a64537b
parent 1190 173c063d4f55
child 1442 e3242177fe4a
permissions -rw-r--r--
[PATCH] SDL_GetVideoMode() does not find best mode, part 2

Following commit 1.51, I come accross a problem when SDL must choose between
several video modes that could suit the one asked.

If I ask 320x240 with this list:
768x480 768x240 640x400 640x200 384x480 384x240 320x400 320x200

The smallest selectables modes are 384x240 and 320x400. And SDL choose the later
in this list, but 384x240 is more suitable. So I added a check to compare
the pixel count (surface) of modes, and select the one which has the smallest
pixel count.

In my example, 384x240 has 92160 pixels, and 320x400 has 128000 pixels. So now
SDL will choose 384x240 for the asked 320x240 mode.
icculus@1190
     1
icculus@1190
     2
===========
icculus@1190
     3
SDL on OS/2
icculus@1190
     4
===========
icculus@1190
     5
icculus@1190
     6
Last updated on Oct 02, 2005.
icculus@1190
     7
icculus@1190
     8
icculus@1190
     9
1. How to compile?
icculus@1190
    10
------------------
icculus@1190
    11
icculus@1190
    12
To compile this, you'll need the followings installed:
icculus@1190
    13
- The OS/2 Developer's Toolkit
icculus@1190
    14
- The OpenWatcom compiler 
icculus@1190
    15
  (http://www.openwatcom.org)
icculus@1190
    16
- The FSLib library
icculus@1190
    17
  (ftp://ftp.netlabs.org/pub/SDL)
icculus@1190
    18
icculus@1190
    19
Please edit the second, fourth and fifth lines of setvars.cmd file
icculus@1190
    20
to set the folders where the toolkit, the OW compiler and the FSLib are. 
icculus@1190
    21
You won't need NASM yet (The Netwide Assembler), you can leave that line.
icculus@1190
    22
Run setvars.cmd, and you should get a shell in which you can
icculus@1190
    23
compile SDL.
icculus@1190
    24
icculus@1190
    25
Check the "Watcom.mif" file. This is the file which is included by all the
icculus@1190
    26
Watcom makefiles, so changes here will affect the whole build process.
icculus@1190
    27
There is a line in there which determines if the resulting SDL.DLL will be
icculus@1190
    28
a 'debug' or a 'release' build. The 'debug' version is full of printf()'s,
icculus@1190
    29
so if something goes wrong, its output can help a lot for debugging.
icculus@1190
    30
icculus@1190
    31
Then go to the 'src' folder, and run "wmake -f makefile.wat".
icculus@1190
    32
This should create the SDL.DLL and the corresponding SDL.LIB file there.
icculus@1190
    33
icculus@1190
    34
To test applications, it's a good idea to use the 'debug' build of SDL, and
icculus@1190
    35
redirect the standard output and standard error output to files, to see what
icculus@1190
    36
happens internally in SDL.
icculus@1190
    37
(like: testsprite >stdout.txt 2>stderr.txt)
icculus@1190
    38
icculus@1190
    39
To rebuild SDL, use the following commands in 'src' folder:
icculus@1190
    40
wmake -f makefile.wat clean
icculus@1190
    41
wmake -f makefile.wat
icculus@1190
    42
icculus@1190
    43
icculus@1190
    44
icculus@1190
    45
2. How to compile the testapps?
icculus@1190
    46
-------------------------------
icculus@1190
    47
icculus@1190
    48
Once you have SDL.DLL compiled, navigate into the 'test' folder, copy in there
icculus@1190
    49
the newly built SDL.DLL, and copy in there FSLib.DLL.
icculus@1190
    50
icculus@1190
    51
Then run "wmake -f makefile.wat" in there to compile some of the testapps.
icculus@1190
    52
icculus@1190
    53
icculus@1190
    54
icculus@1190
    55
3. What is missing?
icculus@1190
    56
-------------------
icculus@1190
    57
icculus@1190
    58
The following things are missing from this SDL implementation:
icculus@1190
    59
- MMX, SSE and 3DNOW! optimized video blitters?
icculus@1190
    60
- HW Video surfaces
icculus@1190
    61
- OpenGL support
icculus@1190
    62
icculus@1190
    63
icculus@1190
    64
icculus@1190
    65
4. Special Keys / Full-Screen support
icculus@1190
    66
-------------------------------------
icculus@1190
    67
icculus@1190
    68
There are two special hot-keys implemented:
icculus@1190
    69
- Alt+Home switches between fullscreen and windowed mode
icculus@1190
    70
- Alt+End simulates closing the window (can be used as a Panic key)
icculus@1190
    71
Only the LEFT Alt key will work.
icculus@1190
    72
icculus@1190
    73
icculus@1190
    74
icculus@1190
    75
5. Joysticks on SDL/2
icculus@1190
    76
---------------------
icculus@1190
    77
icculus@1190
    78
The Joystick detection only works for standard joysticks (2 buttons, 2 axes
icculus@1190
    79
and the like). Therefore, if you use a non-standard joystick, you should
icculus@1190
    80
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
icculus@1190
    81
file or CONFIG.SYS, so SDL applications can provide full capability to your
icculus@1190
    82
device. The syntax is:
icculus@1190
    83
icculus@1190
    84
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
icculus@1190
    85
icculus@1190
    86
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
icculus@1190
    87
the line should be:
icculus@1190
    88
icculus@1190
    89
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
icculus@1190
    90
icculus@1190
    91
If you want to add spaces in your joystick name, just surround it with
icculus@1190
    92
quotes or double-quotes:
icculus@1190
    93
icculus@1190
    94
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
icculus@1190
    95
icculus@1190
    96
or
icculus@1190
    97
icculus@1190
    98
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
icculus@1190
    99
icculus@1190
   100
   Notive However that Balls and Hats are not supported under OS/2, and the
icculus@1190
   101
value will be ignored... but it is wise to define these correctly because 
icculus@1190
   102
in the future those can be supported.
icculus@1190
   103
   Also the number of buttons is limited to 2 when using two joysticks,
icculus@1190
   104
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
icculus@1190
   105
and 8 when using a joystick with 2 axes. Notice however these are limitations 
icculus@1190
   106
of the Joystick Port hardware, not OS/2.
icculus@1190
   107
icculus@1190
   108
icculus@1190
   109
icculus@1190
   110
6. Next steps...
icculus@1190
   111
----------------
icculus@1190
   112
icculus@1190
   113
Things to do:
icculus@1190
   114
- Implement missing stuffs (look for 'TODO' string in source code!)
icculus@1190
   115
- Finish video driver (the 'wincommon' can be a good example for missing
icculus@1190
   116
  things like application icon and so on...)
icculus@1190
   117
- Enable MMX/SSE/SSE2 acceleration functions
icculus@1190
   118
- Rewrite CDROM support using DOS Ioctl for better support.
icculus@1190
   119
icculus@1190
   120
icculus@1190
   121
icculus@1190
   122
7. Contacts
icculus@1190
   123
-----------
icculus@1190
   124
icculus@1190
   125
   You can contact the developers for bugs:
icculus@1190
   126
icculus@1190
   127
   Area					Developer		email
icculus@1190
   128
   General (Audio/Video/System)		Doodle			doodle@scenergy.dfmk.hu
icculus@1190
   129
   CDROM and Joystick			Caetano			daniel@caetano.eng.br
icculus@1190
   130
icculus@1190
   131
   Notice however that SDL/2 is 'in development' stage so ... if you want to help,
icculus@1190
   132
please, be our guest and contact us!
icculus@1190
   133