The OS/2 port of CrystalSpace has a number of specific features that should be mentioned, so that you can better understand sourcecode and/or make modifications, if you need them (if you do, you should make them available to the public, as stated by LGPL).
The current implementation requires DIVE, so the application is compiled as a PM application. This is done by default (bin/os2link.cmd creates automatically a .def file). If you want to compile the application as a console application, you have to link it with the $(DO.LINK.CONSOLE.EXE) macro (have a look at apps/csregsvr/csregsvr.mak).
Other thing you should keep in mind is that DIVE library (libDIVE.cpp) uses a couple of resources, so you should not forget to link the resources to your application. Resources can be found in libDIVE.rc; this is added to linker dependencies for PM programs in CSDIVE driver makefile, so you also don't need to worry about it (but is still useful to know :-)
There is one not too pleasant feature related to DIVE (or to acceleration hardware specifics?). If DIVE image should be rescaled (i.e. the scale ratio is not 1:1) DIVE is almost TWICE (!) slower if DIVE window (the client rectangle, not the window border) is not on a two-aligned bound (at least such an effect I've got on my Matrox Mystique). If you get low frame rates, try moving the window by one pixel left/right.
To fix this if you use WINDOWX/WINDOWY keywords in cryst.cfg file
or -pos
You can use WINDOWWIDTH and WINDOWHEIGHT keywords in cryst.cfg file to define start window width and height (client window width and height, not counting borders and titlebar). If you won't define it, the DIVE window will be rescaled to the maximum possible integer factor such that window won't be larger than screen. For example, a 320x200 window in 1152x864 resolution will be automatically rescaled at startup to 960x600.
Here is a short list of implementation features related to DIVE:
WARNING: This is a Bad Fix {tm} however I didn't had other choice. It works for me with Matrox Mystique and Matrox Millenium ][ video cards, but I don't guarantee it will work for you.
Go to \MMOS2\DLL. Take the DIVE.DLL library. Unpack it, if it is
packed (lxlite /x dive.dll). Now find the following sequence of
bytes inside it:
83 C2 08 41 83 F9 [10]
This sequence happens only once in my DIVE.DLL; I hope this is true
for your DIVE.DLL as well. Now change the "10" that I took into square
brackets with "16". That's all.
Note that you will likely get wrong results if your current pixel format is NOT low-endian 32-bit (i.e. BGR4). That's not my fault.
Although docs states that DiveSetupBlitter is a longplay operation, I think if you should update only a small part of screen it is still faster to use it (for example, CSWS mostly needs to update only the portion of screen around mouse cursor). DiveSetupBlitter is not called multiple times if update region does not change, so if you always call Graphics2D::Print with a constant argument (or NULL for entire area), it won't be called more often than in the 'classic' situation.
I was too lazy to intercept system event queue, so code generates all CrystalSpace events from events that are passed to DIVE window. As a consequence, there are some (minor) flaws:
By default Crystal Space Windowing System will use builtin OS/2 mouse pointers whenever possible (there are three cursors that do not have their counterparts in OS/2 and will be emulated in software). This behaviour can be controlled by
SYS_MOUSE_CURSOR = {yes|no}
parameter in config file. If set to "yes", system mouse pointers will be
used when available; if set to "no", mouse pointers will be drawn by
CrystalSpace as 2D sprites. This is slower but more precise. Theoretically
csGraphics2D::SetMousePointer can be implemented to construct a OS/2
pointer from "native" CrystalSpace textures, but I was too lazy for this.
I had a precompiled version of the JPEG and PNG dynamic libraries that were compiled with -Zcrtdll. And compiled Crystal Space with -Zsys, i.e. without EMX C runtime DLLs. For some reason this combination doesn't work until C/C++ compilers and company are resident in memory (if you're using "set GCCLOAD"). So you should either recompile everything with -Zsys, or recompile everything with -Zcrtdll, or do a "emxload -q" before running such executables.
For the moment, there is only one contributor :-) If you have any problems/questions related to OS/2 port, mail them to me:
e-mail:
"Andrew Zabolotny" <bit@eltech.ru>You also may want to check the PGCC for OS/2 home page, which I'm maintaining. You also may want to use PGCC for CrystalSpace since it better optimizes for Pentium and alike than regular GCC.