| 1 | |
| 2 | =========== |
| 3 | SDL on OS/2 |
| 4 | =========== |
| 5 | |
| 6 | Last updated on May. 17, 2006. |
| 7 | |
| 8 | |
| 9 | 1. How to compile? |
| 10 | ------------------ |
| 11 | |
| 12 | To compile this, you'll need the followings installed: |
| 13 | - The OS/2 Developer's Toolkit |
| 14 | - The OpenWatcom compiler |
| 15 | (http://www.openwatcom.org) |
| 16 | |
| 17 | First of all, you have to unzip the Watcom-OS2.zip file. This will result in a |
| 18 | file called "makefile" and a file called "setvars.cmd" in this folder (and some |
| 19 | more files...). |
| 20 | |
| 21 | Please edit the second, fourth and fifth lines of setvars.cmd file |
| 22 | to set the folders where the toolkit, the OW compiler and the FSLib are. |
| 23 | You won't need NASM yet (The Netwide Assembler), you can leave that line. |
| 24 | Run setvars.cmd, and you should get a shell in which you can |
| 25 | compile SDL. |
| 26 | |
| 27 | Check the "makefile" file. There is a line in there which determines if the |
| 28 | resulting SDL.DLL will be a 'debug' or a 'release' build. The 'debug' version |
| 29 | is full of printf()'s, so if something goes wrong, its output can help a lot |
| 30 | for debugging. |
| 31 | |
| 32 | Then run "wmake". |
| 33 | This should create the SDL12.DLL and the corresponding SDL12.LIB file here. |
| 34 | |
| 35 | To test applications, it's a good idea to use the 'debug' build of SDL, and |
| 36 | redirect the standard output and standard error output to files, to see what |
| 37 | happens internally in SDL. |
| 38 | (like: testsprite >stdout.txt 2>stderr.txt) |
| 39 | |
| 40 | To rebuild SDL, use the following commands in this folder: |
| 41 | wmake clean |
| 42 | wmake |
| 43 | |
| 44 | |
| 45 | |
| 46 | 2. How to compile the testapps? |
| 47 | ------------------------------- |
| 48 | |
| 49 | Once you have SDL12.DLL compiled, navigate into the 'test' folder, copy in |
| 50 | there the newly built SDL12.DLL, and copy in there FSLib.DLL. |
| 51 | |
| 52 | Then run "wmake" in there to compile some of the testapps. |
| 53 | |
| 54 | |
| 55 | |
| 56 | 3. What is missing? |
| 57 | ------------------- |
| 58 | |
| 59 | The following things are missing from this SDL implementation: |
| 60 | - MMX, SSE and 3DNOW! optimized video blitters? |
| 61 | - HW Video surfaces |
| 62 | - OpenGL support |
| 63 | |
| 64 | |
| 65 | |
| 66 | 4. Special Keys / Full-Screen support |
| 67 | ------------------------------------- |
| 68 | |
| 69 | There are two special hot-keys implemented: |
| 70 | - Alt+Home switches between fullscreen and windowed mode |
| 71 | - Alt+End simulates closing the window (can be used as a Panic key) |
| 72 | Only the LEFT Alt key will work. |
| 73 | |
| 74 | |
| 75 | |
| 76 | 5. Joysticks on SDL/2 |
| 77 | --------------------- |
| 78 | |
| 79 | The Joystick detection only works for standard joysticks (2 buttons, 2 axes |
| 80 | and the like). Therefore, if you use a non-standard joystick, you should |
| 81 | specify its features in the SDL_OS2_JOYSTICK environment variable in a batch |
| 82 | file or CONFIG.SYS, so SDL applications can provide full capability to your |
| 83 | device. The syntax is: |
| 84 | |
| 85 | SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] |
| 86 | |
| 87 | So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, |
| 88 | the line should be: |
| 89 | |
| 90 | SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 |
| 91 | |
| 92 | If you want to add spaces in your joystick name, just surround it with |
| 93 | quotes or double-quotes: |
| 94 | |
| 95 | SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 |
| 96 | |
| 97 | or |
| 98 | |
| 99 | SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 |
| 100 | |
| 101 | Notive However that Balls and Hats are not supported under OS/2, and the |
| 102 | value will be ignored... but it is wise to define these correctly because |
| 103 | in the future those can be supported. |
| 104 | Also the number of buttons is limited to 2 when using two joysticks, |
| 105 | 4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes |
| 106 | and 8 when using a joystick with 2 axes. Notice however these are limitations |
| 107 | of the Joystick Port hardware, not OS/2. |
| 108 | |
| 109 | |
| 110 | |
| 111 | 6. Proportional windows |
| 112 | ----------------------- |
| 113 | |
| 114 | For some SDL applications it can be handy to have proportional windows, so |
| 115 | the windows will keep their aspect ratio when resized. |
| 116 | This can be achieved in two ways: |
| 117 | |
| 118 | - Before starting the given SDL application, set the |
| 119 | SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.: |
| 120 | |
| 121 | SET SDL_USE_PROPORTIONAL_WINDOW=1 |
| 122 | dosbox.exe |
| 123 | |
| 124 | - If you have a HOME environment variable set, then SDL will look for a file |
| 125 | in there called ".sdl.proportionals". If that file contains the name of the |
| 126 | currently running SDL executable, then that process will have proportional |
| 127 | windows automatically. |
| 128 | |
| 129 | Please note that this file is created automatically with default values |
| 130 | at the first run. |
| 131 | |
| 132 | |
| 133 | |
| 134 | 7. Audio in SDL applications |
| 135 | ---------------------------- |
| 136 | |
| 137 | Audio effects are one of the most important features in games. Creating audio |
| 138 | effects in sync with the game and without hickups and pauses in the audio are |
| 139 | very important things. |
| 140 | |
| 141 | However there are multithreaded SDL applications that have tight loops as their |
| 142 | main logic loop. This kills performance in OS/2, and takes too much CPU from |
| 143 | other threads in the same process, for example from the thread to create the |
| 144 | sound effects. |
| 145 | |
| 146 | For this reason, the OS/2 port of SDL can be instructed to run the audio thread |
| 147 | in high priority, which makes sure that there will be enough time for the |
| 148 | processing of the audio data. |
| 149 | |
| 150 | At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well |
| 151 | written and well behaving SDL applications should work well in this mode. |
| 152 | For other applications, you can tell SDL/2 to run the audio thread at |
| 153 | TimeCritical priority by setting an env.variable before starting the SDL app: |
| 154 | |
| 155 | SET SDL_USE_TIMECRITICAL_AUDIO=1 |
| 156 | |
| 157 | Please note that this is a bit risky, because if the SDL application runs a |
| 158 | tight infinite loop in this thread, this will make the whole system |
| 159 | unresponsive, so use it with care, and only for applications that need it! |
| 160 | |
| 161 | |
| 162 | |
| 163 | 8. Next steps... |
| 164 | ---------------- |
| 165 | |
| 166 | Things to do: |
| 167 | - Implement missing stuffs (look for 'TODO' string in source code!) |
| 168 | - Finish video driver (the 'wincommon' can be a good example for missing |
| 169 | things like application icon and so on...) |
| 170 | - Enable MMX/SSE/SSE2 acceleration functions |
| 171 | - Rewrite CDROM support using DOS Ioctl for better support. |
| 172 | |
| 173 | |
| 174 | |
| 175 | 9. Contacts |
| 176 | ----------- |
| 177 | |
| 178 | You can contact the developers for bugs: |
| 179 | |
| 180 | Area Developer email |
| 181 | General (Audio/Video/System) Doodle doodle@scenergy.dfmk.hu |
| 182 | CDROM and Joystick Caetano daniel@caetano.eng.br |
| 183 | |
| 184 | Notice however that SDL/2 is 'in development' stage so ... if you want to help, |
| 185 | please, be our guest and contact us! |
| 186 | |
| 187 | |
| 188 | |
| 189 | 10. Changelog of the OS/2 port |
| 190 | ------------------------------ |
| 191 | |
| 192 | Version 1.2.10 - 2006-05-17 - Doodle |
| 193 | - Small modifications for v1.2.10 release |
| 194 | - Changed DLL name to include version info (currently SDL12.dll) |
| 195 | |
| 196 | Version 1.2 - 2006-05-01 - Doodle |
| 197 | - Modified makefile system to have only one makefile |
| 198 | - Included FSLib headers, DLL and LIB file |
| 199 | |
| 200 | Version 1.2 - 2006-02-26 - Doodle |
| 201 | - Updated the official SDL version with the OS/2 specific changes. |
| 202 | - Added support for real unicode keycode conversion. |
| 203 | |
| 204 | Version 1.2.7 - 2006-01-20 - Doodle |
| 205 | - Added support for selectively using timecritical priority for |
| 206 | audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable. |
| 207 | (e.g.: |
| 208 | SET SDL_USE_TIMECRITICAL_AUDIO=1 |
| 209 | dosbox.exe |
| 210 | ) |
| 211 | |
| 212 | Version 1.2.7 - 2005-12-22 - Doodle |
| 213 | - Added support for proportional SDL windows. |
| 214 | There are two ways to have proportional (aspect-keeping) windows for |
| 215 | a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW |
| 216 | environment variable to something before starting the application |
| 217 | (e.g.: |
| 218 | SET SDL_USE_PROPORTIONAL_WINDOW=1 |
| 219 | dosbox.exe |
| 220 | ) |
| 221 | or, if you have the HOME environment variable set, then SDL12.DLL will |
| 222 | create a file in that directory called .sdl.proportionals, and you can |
| 223 | put there the name of executable files that will be automatically made |
| 224 | proportional. |
| 225 | |
| 226 | Version 1.2.7 - 2005-10-14 - Doodle |
| 227 | - Enabled Exception handler code in FSLib to be able to restore original |
| 228 | desktop video mode in case the application crashes. |
| 229 | - Added the missing FSLib_Uninitialize() call into SDL. |
| 230 | (The lack of it did not cause problems, but it's cleaner this way.) |
| 231 | - Fixed a mouse problem in Fullscreen mode where any mouse click |
| 232 | re-centered the mouse. |
| 233 | |
| 234 | Version 1.2.7 - 2005-10-09 - Doodle |
| 235 | - Implemented window icon support |
| 236 | |
| 237 | Version 1.2.7 - 2005-10-03 - Doodle |
| 238 | - Reworked semaphore support again |
| 239 | - Tuned thread priorities |
| 240 | |
| 241 | Version 1.2.7 - 2005-10-02 - Doodle |
| 242 | - Added support for custom mouse pointers |
| 243 | - Fixed WM_CLOSE processing: give a chance to SDL app to ask user... |
| 244 | - Added support for MMX-accelerated audio mixers |
| 245 | - Other small fixes |
| 246 | |
| 247 | Version 1.2.7 - 2005-09-12 - Doodle |
| 248 | - Small fixes for DosBox incorporated into public release |
| 249 | - Fixed semaphore support (SDL_syssem.c) |
| 250 | - Fixed FSLib to have good clipping in scaled window mode, |
| 251 | and to prevent occasional desktop freezes. |
| 252 | |
| 253 | Version 1.2.7 - 2004-09-08a - Caetano |
| 254 | - Improved joystick support (general verifications about hardware). |
| 255 | - Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks. |
| 256 | - Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick. |
| 257 | - Improved Joystick test to handle every type of joystick and display only relevant information. |
| 258 | - Merged with Doodle 2004-09-08 |
| 259 | - Little tid up in README.OS2 |
| 260 | - Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2 |
| 261 | |
| 262 | Version 1.2.7 - 2004-09-07 - Caetano |
| 263 | - Merged with changes in headers for GCC compiling. |
| 264 | - Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1. |
| 265 | - Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so... |
| 266 | - Modified makefile in test to compile "testjoystick". Anyway, it's useless, since it seems to cause a lot of trouble in OS/2 (because os video routines, not Joystick support). |
| 267 | - Created separated Joystick test program to test only joystick functions. |
| 268 | - Improved joystick auto-centering. |
| 269 | - Improved the coordinate correction routine to use two scale factors for each axis. |
| 270 | |
| 271 | Version 1.2.7 - 2004-07-05 - Caetano |
| 272 | - Corrected the time returned by status in CDROM support (it was incorrect) |
| 273 | - Added the testcdrom.c and corrected the linking directive (it was causing an error) |
| 274 | |
| 275 | Version 1.2.7 - 2004-07-02a - Caetano |
| 276 | - Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment) |
| 277 | - Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c) |
| 278 | - Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support |
| 279 | - Added the "extra" SDL_types.h forgotten in 2004-07-02 version. |
| 280 | |
| 281 | <End-Of-File> |