Skip to content

Commit

Permalink
Updated OS/2 build, yay!
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 26, 2006
1 parent ed6d681 commit 3c6650d
Show file tree
Hide file tree
Showing 32 changed files with 727 additions and 675 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Expand Up @@ -36,7 +36,7 @@ SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@

DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.in MPWmake.sea.bin PBProjects.tar.gz README* sdl-config.in sdl.m4 SDL.qpg.in SDL.spec SDL.spec.in setvars.cmd src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom.mif WhatsNew Xcode21.tar.gz Xcode.tar.gz XcodeUniversal.tar.gz
DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.in MPWmake.sea.bin PBProjects.tar.gz README* sdl-config.in sdl.m4 SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip WhatsNew Xcode21.tar.gz Xcode.tar.gz XcodeUniversal.tar.gz

LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
Expand Down
150 changes: 147 additions & 3 deletions README.OS2
Expand Up @@ -3,7 +3,7 @@
SDL on OS/2
===========

Last updated on Oct 02, 2005.
Last updated on Feb. 26, 2006.


1. How to compile?
Expand All @@ -16,6 +16,11 @@ To compile this, you'll need the followings installed:
- The FSLib library
(ftp://ftp.netlabs.org/pub/SDL)

First of all, you have to put the OS/2-specific Watcom makefiles into the
source code tree by unzipping the file Watcom-OS2.zip here. This will
result in a Watcom.mif and a setvars.cmd file in this folder, and several
Makefile.wat files in the src\ folder and in some of its subfolders.

Please edit the second, fourth and fifth lines of setvars.cmd file
to set the folders where the toolkit, the OW compiler and the FSLib are.
You won't need NASM yet (The Netwide Assembler), you can leave that line.
Expand Down Expand Up @@ -107,7 +112,59 @@ of the Joystick Port hardware, not OS/2.



6. Next steps...
6. Proportional windows
-----------------------

For some SDL applications it can be handy to have proportional windows, so
the windows will keep their aspect ratio when resized.
This can be achieved in two ways:

- Before starting the given SDL application, set the
SDL_USE_PROPORTIONAL_WINDOW environment variable to something, e.g.:

SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe

- If you have a HOME environment variable set, then SDL will look for a file
in there called ".sdl.proportionals". If that file contains the name of the
currently running SDL executable, then that process will have proportional
windows automatically.

Please note that this file is created automatically with default values
at the first run.



7. Audio in SDL applications
----------------------------

Audio effects are one of the most important features in games. Creating audio
effects in sync with the game and without hickups and pauses in the audio are
very important things.

However there are multithreaded SDL applications that have tight loops as their
main logic loop. This kills performance in OS/2, and takes too much CPU from
other threads in the same process, for example from the thread to create the
sound effects.

For this reason, the OS/2 port of SDL can be instructed to run the audio thread
in high priority, which makes sure that there will be enough time for the
processing of the audio data.

At default, SDL/2 runs the audio thread at ForegroundServer+0 priority. Well
written and well behaving SDL applications should work well in this mode.
For other applications, you can tell SDL/2 to run the audio thread at
TimeCritical priority by setting an env.variable before starting the SDL app:

SET SDL_USE_TIMECRITICAL_AUDIO=1

Please note that this is a bit risky, because if the SDL application runs a
tight infinite loop in this thread, this will make the whole system
unresponsive, so use it with care, and only for applications that need it!



8. Next steps...
----------------

Things to do:
Expand All @@ -119,7 +176,7 @@ Things to do:



7. Contacts
9. Contacts
-----------

You can contact the developers for bugs:
Expand All @@ -131,3 +188,90 @@ Things to do:
Notice however that SDL/2 is 'in development' stage so ... if you want to help,
please, be our guest and contact us!



10. Changelog of the OS/2 port
------------------------------

Version 1.2 - 2006-02-26 - Doodle
- Updated the official SDL version with the OS/2 specific changes.
- Added support for real unicode keycode conversion.

Version 1.2.7 - 2006-01-20 - Doodle
- Added support for selectively using timecritical priority for
audio threads by SDL_USE_TIMECRITICAL_AUDIO environment variable.
(e.g.:
SET SDL_USE_TIMECRITICAL_AUDIO=1
dosbox.exe
)

Version 1.2.7 - 2005-12-22 - Doodle
- Added support for proportional SDL windows.
There are two ways to have proportional (aspect-keeping) windows for
a given SDL application: Either set the SDL_USE_PROPORTIONAL_WINDOW
environment variable to something before starting the application
(e.g.:
SET SDL_USE_PROPORTIONAL_WINDOW=1
dosbox.exe
)
or, if you have the HOME environment variable set, then SDL.DLL will
create a file in that directory called .sdl.proportionals, and you can
put there the name of executable files that will be automatically made
proportional.

Version 1.2.7 - 2005-10-14 - Doodle
- Enabled Exception handler code in FSLib to be able to restore original
desktop video mode in case the application crashes.
- Added the missing FSLib_Uninitialize() call into SDL.
(The lack of it did not cause problems, but it's cleaner this way.)
- Fixed a mouse problem in Fullscreen mode where any mouse click
re-centered the mouse.

Version 1.2.7 - 2005-10-09 - Doodle
- Implemented window icon support

Version 1.2.7 - 2005-10-03 - Doodle
- Reworked semaphore support again
- Tuned thread priorities

Version 1.2.7 - 2005-10-02 - Doodle
- Added support for custom mouse pointers
- Fixed WM_CLOSE processing: give a chance to SDL app to ask user...
- Added support for MMX-accelerated audio mixers
- Other small fixes

Version 1.2.7 - 2005-09-12 - Doodle
- Small fixes for DosBox incorporated into public release
- Fixed semaphore support (SDL_syssem.c)
- Fixed FSLib to have good clipping in scaled window mode,
and to prevent occasional desktop freezes.

Version 1.2.7 - 2004-09-08a - Caetano
- Improved joystick support (general verifications about hardware).
- Added support up to 8 buttons in 2 axes joysticks and 6 buttons in 3 axes joysticks.
- Added support to environment variable SDL_OS2_JOYSTICK to specify a joystick.
- Improved Joystick test to handle every type of joystick and display only relevant information.
- Merged with Doodle 2004-09-08
- Little tid up in README.OS2
- Added explanation about SDL_OS2_JOYSTICK environment variable on README.OS2

Version 1.2.7 - 2004-09-07 - Caetano
- Merged with changes in headers for GCC compiling.
- Added Joystick support using basic IBM GAME$ support, allowing it to work with all joystick drivers since OS/2 2.1.
- Improved joystick detection (hacked!). OS/2 do not allow real joystick detection, so...
- 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).
- Created separated Joystick test program to test only joystick functions.
- Improved joystick auto-centering.
- Improved the coordinate correction routine to use two scale factors for each axis.

Version 1.2.7 - 2004-07-05 - Caetano
- Corrected the time returned by status in CDROM support (it was incorrect)
- Added the testcdrom.c and corrected the linking directive (it was causing an error)

Version 1.2.7 - 2004-07-02a - Caetano
- Corrected a little problem in a comment at SDL-1.2.7\test\torturethread.c, line 18 (missing */, nested comment)
- Added CDROM support to tree (SDL-1.2.7\src\cdrom\os2\SDL_syscdrom.c)
- Modified makefile (SDL-1.2.7\src\makefiles.wat and SDL-1.2.7\watcom.mif) to build with CDROM support
- Added the "extra" SDL_types.h forgotten in 2004-07-02 version.

<End-Of-File>
Binary file added Watcom-OS2.zip
Binary file not shown.
33 changes: 0 additions & 33 deletions Watcom.mif

This file was deleted.

2 changes: 2 additions & 0 deletions include/SDL_config.h
Expand Up @@ -36,6 +36,8 @@
#include "SDL_config_macosx.h"
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#else
/* This is the minimal configuration that can be used to build SDL */

Expand Down
2 changes: 2 additions & 0 deletions include/SDL_config.h.minimal
Expand Up @@ -36,6 +36,8 @@
#include "SDL_config_macosx.h"
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#else
/* This is the minimal configuration that can be used to build SDL */

Expand Down
136 changes: 136 additions & 0 deletions include/SDL_config_os2.h
@@ -0,0 +1,136 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/

#ifndef _SDL_config_os2_h
#define _SDL_config_os2_h

/* This is a set of defines to configure the SDL features */

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef unsigned int size_t;
typedef unsigned long uintptr_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;

#define SDL_HAS_64BIT_TYPE 1

/* Use Watcom's LIBC */
#define HAVE_LIBC 1

/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1

/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
#define HAVE__STRLWR 1
#define HAVE_INDEX 1
#define HAVE_RINDEX 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_ITOA 1
#define HAVE__LTOA 1
#define HAVE__UITOA 1
#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
#define HAVE__I64TOA 1
#define HAVE__UI64TOA 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1
#define HAVE_CLOCK_GETTIME 1

/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DART 1

/* Enable various cdrom drivers */
#define SDL_CDROM_OS2 1

/* Enable various input drivers */
#define SDL_JOYSTICK_OS2 1

/* Enable various shared object loading systems */
#define SDL_LOADSO_OS2 1

/* Enable various threading systems */
#define SDL_THREAD_OS2 1

/* Enable various timer systems */
#define SDL_TIMER_OS2 1

/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_OS2FS 1

/* Enable OpenGL support */
/* Nothing here yet for OS/2... :( */

/* Enable assembly routines where available */
#define SDL_ASSEMBLY_ROUTINES 1

#endif /* _SDL_config_os2_h */
4 changes: 2 additions & 2 deletions include/SDL_thread.h
Expand Up @@ -65,8 +65,8 @@ typedef struct SDL_Thread SDL_Thread;
#endif

#ifdef __OS2__
typedef int (__cdecl *pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
typedef void (__cdecl *pfnSDL_CurrentEndThread)(void);
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
typedef void (*pfnSDL_CurrentEndThread)(void);
#else
#ifdef __GNUC__
#include <stdint.h>
Expand Down

0 comments on commit 3c6650d

Please sign in to comment.