mirror of https://github.com/OpenTTD/OpenTTD
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
Works fine, beside some minor stuff: - Network is not working yet - Keyboard is not working - No MIDI support - 'A few file selector bugs involving drives'release/0.4.5
parent
d91326fb4a
commit
a9bb5be49d
11
dedicated.c
11
dedicated.c
|
@ -13,6 +13,15 @@
|
||||||
# include <windows.h> /* GetTickCount */
|
# include <windows.h> /* GetTickCount */
|
||||||
# include <conio.h>
|
# include <conio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OS2__
|
||||||
|
# include <sys/time.h> /* gettimeofday */
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <conio.h>
|
||||||
|
# define STDIN 0 /* file descriptor for standard input */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
# include <sys/time.h> /* gettimeofday */
|
# include <sys/time.h> /* gettimeofday */
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
|
@ -134,7 +143,7 @@ static void DedicatedHandleKeyInput()
|
||||||
#endif
|
#endif
|
||||||
static char input_line[200] = "";
|
static char input_line[200] = "";
|
||||||
|
|
||||||
#ifdef UNIX
|
#if defined(UNIX) || defined(__OS2__)
|
||||||
if (InputWaiting()) {
|
if (InputWaiting()) {
|
||||||
if (_exit_game)
|
if (_exit_game)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
OpenTTD: OS/2 version ** CURRENTLY INCOMPLETE **
|
||||||
|
=====================
|
||||||
|
|
||||||
|
OpenTTD has been ported to work on OS/2 4.x or later (including eComStation). At the moment, it does not work properly, but it
|
||||||
|
can compile and work to an extent.
|
||||||
|
|
||||||
|
Compiler
|
||||||
|
--------
|
||||||
|
|
||||||
|
Open Watcom 1.3 was used to build OpenTTD (earlier versions will NOT work). See http://www.openwatcom.org/ to download it.
|
||||||
|
It may also be possible to build OpenTTD under OS/2: I attempted this before using Open Watcom, but found the tools available
|
||||||
|
for OS/2 at the time to be a bit more tricky to get working.
|
||||||
|
|
||||||
|
Due to complexities in my set-up, I actually used the Win32 version of Open Watcom to initially compile OpenTTD for OS/2. There
|
||||||
|
should be no reason of course why the OS/2 version cannot be used.
|
||||||
|
|
||||||
|
Libraries Required
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The following libraries are required. To build zlib and libpng, I simply added the required files (watch out for sample
|
||||||
|
programs, etc) to an IDE project file and built a library:
|
||||||
|
|
||||||
|
- zlib
|
||||||
|
http://www.zlib.org/ - contains a makefile for OS/2, but is out of date and uses EMX
|
||||||
|
|
||||||
|
- libpng
|
||||||
|
http://www.libpng.org/ - contains an EMX/gcc makefile
|
||||||
|
|
||||||
|
- SDL for OS/2
|
||||||
|
I used ftp://ftp.netlabs.org/pub/sdl/SDL-1.2.7-src-20040908a.zip - take SDL.dll and SDL.lib from the src/ directory.
|
||||||
|
|
||||||
|
Note that to use the compiled program, you also need FSLib.dll (from src/ in the SDL zip) and a version of the Scitech
|
||||||
|
Display Drivers or its later incarnation (see www.scitech.com).
|
||||||
|
|
||||||
|
Compiling
|
||||||
|
---------
|
||||||
|
|
||||||
|
To compile, open the os/os2/openttd.wpj file in the IDE and build the openttd.exe target.
|
||||||
|
|
||||||
|
TODO: compilation of language files properly
|
||||||
|
|
||||||
|
|
||||||
|
** THESE DOCS ARE INCOMPLETE FOR THE MOMENT, WILL BE COMPLETED SOON **
|
||||||
|
|
||||||
|
If you have any questions, please contact me (owen@owenrudge.net) and I'll try to help you out
|
||||||
|
|
||||||
|
- Owen Rudge, 18th December 2004
|
||||||
|
|
||||||
|
OpenTTD: OS/2 version ** CURRENTLY INCOMPLETE **
|
||||||
|
=====================
|
||||||
|
|
||||||
|
OpenTTD has been ported to work on OS/2 4.x or later (including eComStation). At the moment, it does not work properly, but it
|
||||||
|
can compile and work to an extent.
|
||||||
|
|
||||||
|
Compiler
|
||||||
|
--------
|
||||||
|
|
||||||
|
Open Watcom 1.3 was used to build OpenTTD (earlier versions will NOT work). See http://www.openwatcom.org/ to download it.
|
||||||
|
It may also be possible to build OpenTTD under OS/2: I attempted this before using Open Watcom, but found the tools available
|
||||||
|
for OS/2 at the time to be a bit more tricky to get working.
|
||||||
|
|
||||||
|
Due to complexities in my set-up, I actually used the Win32 version of Open Watcom to initially compile OpenTTD for OS/2. There
|
||||||
|
should be no reason of course why the OS/2 version cannot be used.
|
||||||
|
|
||||||
|
Libraries Required
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The following libraries are required. To build zlib and libpng, I simply added the required files (watch out for sample
|
||||||
|
programs, etc) to an IDE project file and built a library:
|
||||||
|
|
||||||
|
- zlib
|
||||||
|
http://www.zlib.org/ - contains a makefile for OS/2, but is out of date and uses EMX
|
||||||
|
|
||||||
|
- libpng
|
||||||
|
http://www.libpng.org/ - contains an EMX/gcc makefile
|
||||||
|
|
||||||
|
- SDL for OS/2
|
||||||
|
I used ftp://ftp.netlabs.org/pub/sdl/SDL-1.2.7-src-20040908a.zip - take SDL.dll and SDL.lib from the src/ directory.
|
||||||
|
|
||||||
|
Note that to use the compiled program, you also need FSLib.dll (from src/ in the SDL zip) and a version of the Scitech
|
||||||
|
Display Drivers or its later incarnation (see www.scitech.com).
|
||||||
|
|
||||||
|
Compiling
|
||||||
|
---------
|
||||||
|
|
||||||
|
To compile, open the os/os2/openttd.wpj file in the IDE and build the openttd.exe target.
|
||||||
|
|
||||||
|
TODO: compilation of language files properly
|
||||||
|
|
||||||
|
|
||||||
|
** THESE DOCS ARE INCOMPLETE FOR THE MOMENT, WILL BE COMPLETED SOON **
|
||||||
|
|
||||||
|
If you have any questions, please contact me (owen@owenrudge.net) and I'll try to help you out
|
||||||
|
|
||||||
|
- Owen Rudge, 18th December 2004
|
||||||
|
|
|
@ -38,9 +38,13 @@ bool IsValidTile(uint tile);
|
||||||
static inline Point RemapCoords(int x, int y, int z)
|
static inline Point RemapCoords(int x, int y, int z)
|
||||||
{
|
{
|
||||||
#if !defined(NEW_ROTATION)
|
#if !defined(NEW_ROTATION)
|
||||||
Point pt = { (y - x) * 2, y + x - z };
|
Point pt;
|
||||||
|
pt.x = (y - x) * 2;
|
||||||
|
pt.y = y + x - z;
|
||||||
#else
|
#else
|
||||||
Point pt = { (x + y) * 2, x - y - z };
|
Point pt;
|
||||||
|
pt.x = (x + y) * 2;
|
||||||
|
pt.y = x - y - z;
|
||||||
#endif
|
#endif
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,32 @@ typedef struct ifreq IFREQ;
|
||||||
# include <netdb.h>
|
# include <netdb.h>
|
||||||
#endif // UNIX
|
#endif // UNIX
|
||||||
|
|
||||||
|
// OS/2 stuff
|
||||||
|
#if defined(__OS2__)
|
||||||
|
# define SOCKET int
|
||||||
|
# define INVALID_SOCKET -1
|
||||||
|
typedef struct ifreq IFREQ;
|
||||||
|
# define ioctlsocket ioctl
|
||||||
|
# define closesocket close
|
||||||
|
# define GET_LAST_ERROR() (errno)
|
||||||
|
|
||||||
|
// Includes needed for OS/2 systems
|
||||||
|
# include <types.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
# include <sys/socket.h>
|
||||||
|
# include <netinet/in.h>
|
||||||
|
# include <netinet/tcp.h>
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# include <net/if.h>
|
||||||
|
# include <errno.h>
|
||||||
|
# include <sys/time.h>
|
||||||
|
# include <netdb.h>
|
||||||
|
# include <nerrno.h>
|
||||||
|
|
||||||
|
typedef unsigned long in_addr_t;
|
||||||
|
#endif // OS/2
|
||||||
|
|
||||||
// MorphOS and Amiga stuff
|
// MorphOS and Amiga stuff
|
||||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||||
# include <exec/types.h>
|
# include <exec/types.h>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -164,7 +164,10 @@ static void *FindVehicleCallb(Vehicle *v, FindVehS *f)
|
||||||
|
|
||||||
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
|
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
|
||||||
{
|
{
|
||||||
FindVehS fs = {tile, owner, 0};
|
FindVehS fs;
|
||||||
|
fs.tile = tile;
|
||||||
|
fs.owner = owner;
|
||||||
|
fs.type = 0;
|
||||||
return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb);
|
return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
40
|
||||||
|
projectIdent
|
||||||
|
0
|
||||||
|
VpeMain
|
||||||
|
1
|
||||||
|
WRect
|
||||||
|
0
|
||||||
|
40
|
||||||
|
10320
|
||||||
|
9920
|
||||||
|
2
|
||||||
|
MProject
|
||||||
|
3
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
2
|
||||||
|
5
|
||||||
|
WFileName
|
||||||
|
17
|
||||||
|
..\..\openttd.tgt
|
||||||
|
6
|
||||||
|
WFileName
|
||||||
|
23
|
||||||
|
..\..\strgen\strgen.tgt
|
||||||
|
7
|
||||||
|
WVList
|
||||||
|
2
|
||||||
|
8
|
||||||
|
VComponent
|
||||||
|
9
|
||||||
|
WRect
|
||||||
|
0
|
||||||
|
0
|
||||||
|
5700
|
||||||
|
4240
|
||||||
|
0
|
||||||
|
0
|
||||||
|
10
|
||||||
|
WFileName
|
||||||
|
17
|
||||||
|
..\..\openttd.tgt
|
||||||
|
51
|
||||||
|
52
|
||||||
|
11
|
||||||
|
VComponent
|
||||||
|
12
|
||||||
|
WRect
|
||||||
|
690
|
||||||
|
680
|
||||||
|
5700
|
||||||
|
4240
|
||||||
|
0
|
||||||
|
0
|
||||||
|
13
|
||||||
|
WFileName
|
||||||
|
23
|
||||||
|
..\..\strgen\strgen.tgt
|
||||||
|
0
|
||||||
|
2
|
||||||
|
8
|
||||||
|
40
|
||||||
|
projectIdent
|
||||||
|
0
|
||||||
|
VpeMain
|
||||||
|
1
|
||||||
|
WRect
|
||||||
|
0
|
||||||
|
40
|
||||||
|
10320
|
||||||
|
9920
|
||||||
|
2
|
||||||
|
MProject
|
||||||
|
3
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
2
|
||||||
|
5
|
||||||
|
WFileName
|
||||||
|
17
|
||||||
|
..\..\openttd.tgt
|
||||||
|
6
|
||||||
|
WFileName
|
||||||
|
23
|
||||||
|
..\..\strgen\strgen.tgt
|
||||||
|
7
|
||||||
|
WVList
|
||||||
|
2
|
||||||
|
8
|
||||||
|
VComponent
|
||||||
|
9
|
||||||
|
WRect
|
||||||
|
0
|
||||||
|
0
|
||||||
|
5700
|
||||||
|
4240
|
||||||
|
0
|
||||||
|
0
|
||||||
|
10
|
||||||
|
WFileName
|
||||||
|
17
|
||||||
|
..\..\openttd.tgt
|
||||||
|
51
|
||||||
|
52
|
||||||
|
11
|
||||||
|
VComponent
|
||||||
|
12
|
||||||
|
WRect
|
||||||
|
690
|
||||||
|
680
|
||||||
|
5700
|
||||||
|
4240
|
||||||
|
0
|
||||||
|
0
|
||||||
|
13
|
||||||
|
WFileName
|
||||||
|
23
|
||||||
|
..\..\strgen\strgen.tgt
|
||||||
|
0
|
||||||
|
2
|
||||||
|
8
|
|
@ -726,9 +726,7 @@ static void SlLoadChunks()
|
||||||
//*******************************************
|
//*******************************************
|
||||||
#define LZO_SIZE 8192
|
#define LZO_SIZE 8192
|
||||||
|
|
||||||
int CDECL lzo1x_1_compress( const byte *src, uint src_len,byte *dst, uint *dst_len,void *wrkmem );
|
#include "minilzo.h"
|
||||||
uint32 CDECL lzo_adler32(uint32 adler, const byte *buf, uint len);
|
|
||||||
int CDECL lzo1x_decompress( const byte *src, uint src_len,byte *dst, uint *dst_len,void *wrkmem /* NOT USED */ );
|
|
||||||
|
|
||||||
static uint ReadLZO()
|
static uint ReadLZO()
|
||||||
{
|
{
|
||||||
|
|
24
stdafx.h
24
stdafx.h
|
@ -24,6 +24,10 @@
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OS2__)
|
||||||
|
# include <types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __BEOS__
|
#ifdef __BEOS__
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,6 +81,18 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WATCOMC__)
|
||||||
|
# define NORETURN
|
||||||
|
# define FORCEINLINE inline
|
||||||
|
# define CDECL
|
||||||
|
# define NOT_REACHED()
|
||||||
|
# define GCC_PACK
|
||||||
|
# undef TTD_ALIGNMENT_4
|
||||||
|
# undef TTD_ALIGNMENT_2
|
||||||
|
|
||||||
|
# include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// Stuff for MSVC
|
// Stuff for MSVC
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# include <malloc.h> // alloca()
|
# include <malloc.h> // alloca()
|
||||||
|
@ -93,7 +109,7 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Windows has always LITTLE_ENDIAN
|
// Windows has always LITTLE_ENDIAN
|
||||||
#if defined(WIN32)
|
#if defined(WIN32) || defined(__OS2__)
|
||||||
#define TTD_LITTLE_ENDIAN
|
#define TTD_LITTLE_ENDIAN
|
||||||
#else
|
#else
|
||||||
// Else include endian.h, which has the endian-type, autodetected by the Makefile
|
// Else include endian.h, which has the endian-type, autodetected by the Makefile
|
||||||
|
@ -182,7 +198,11 @@ enum {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Compile time assertions
|
// Compile time assertions
|
||||||
#define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)])
|
#ifdef __OS2__
|
||||||
|
# define assert_compile(expr)
|
||||||
|
#else
|
||||||
|
# define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)])
|
||||||
|
#endif
|
||||||
|
|
||||||
assert_compile(sizeof(uint32) == 4);
|
assert_compile(sizeof(uint32) == 4);
|
||||||
assert_compile(sizeof(uint16) == 2);
|
assert_compile(sizeof(uint16) == 2);
|
||||||
|
|
|
@ -0,0 +1,246 @@
|
||||||
|
40
|
||||||
|
targetIdent
|
||||||
|
0
|
||||||
|
MProject
|
||||||
|
1
|
||||||
|
MComponent
|
||||||
|
0
|
||||||
|
2
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
OEXE
|
||||||
|
3
|
||||||
|
WString
|
||||||
|
5
|
||||||
|
oc2en
|
||||||
|
1
|
||||||
|
0
|
||||||
|
1
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
5
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
6
|
||||||
|
MItem
|
||||||
|
10
|
||||||
|
strgen.exe
|
||||||
|
7
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
OEXE
|
||||||
|
8
|
||||||
|
WVList
|
||||||
|
2
|
||||||
|
9
|
||||||
|
MRState
|
||||||
|
10
|
||||||
|
WString
|
||||||
|
7
|
||||||
|
OS2LINK
|
||||||
|
11
|
||||||
|
WString
|
||||||
|
25
|
||||||
|
?????No debug information
|
||||||
|
1
|
||||||
|
1
|
||||||
|
12
|
||||||
|
MRState
|
||||||
|
13
|
||||||
|
WString
|
||||||
|
7
|
||||||
|
OS2LINK
|
||||||
|
14
|
||||||
|
WString
|
||||||
|
14
|
||||||
|
?????Debug All
|
||||||
|
1
|
||||||
|
0
|
||||||
|
15
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
16
|
||||||
|
WPickList
|
||||||
|
3
|
||||||
|
17
|
||||||
|
MItem
|
||||||
|
3
|
||||||
|
*.c
|
||||||
|
18
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
19
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
20
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
21
|
||||||
|
MItem
|
||||||
|
8
|
||||||
|
stdafx.c
|
||||||
|
22
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
23
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
24
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
17
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
25
|
||||||
|
MItem
|
||||||
|
8
|
||||||
|
strgen.c
|
||||||
|
26
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
27
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
28
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
17
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
40
|
||||||
|
targetIdent
|
||||||
|
0
|
||||||
|
MProject
|
||||||
|
1
|
||||||
|
MComponent
|
||||||
|
0
|
||||||
|
2
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
OEXE
|
||||||
|
3
|
||||||
|
WString
|
||||||
|
5
|
||||||
|
oc2en
|
||||||
|
1
|
||||||
|
0
|
||||||
|
1
|
||||||
|
4
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
5
|
||||||
|
MCommand
|
||||||
|
0
|
||||||
|
6
|
||||||
|
MItem
|
||||||
|
10
|
||||||
|
strgen.exe
|
||||||
|
7
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
OEXE
|
||||||
|
8
|
||||||
|
WVList
|
||||||
|
2
|
||||||
|
9
|
||||||
|
MRState
|
||||||
|
10
|
||||||
|
WString
|
||||||
|
7
|
||||||
|
OS2LINK
|
||||||
|
11
|
||||||
|
WString
|
||||||
|
25
|
||||||
|
?????No debug information
|
||||||
|
1
|
||||||
|
1
|
||||||
|
12
|
||||||
|
MRState
|
||||||
|
13
|
||||||
|
WString
|
||||||
|
7
|
||||||
|
OS2LINK
|
||||||
|
14
|
||||||
|
WString
|
||||||
|
14
|
||||||
|
?????Debug All
|
||||||
|
1
|
||||||
|
0
|
||||||
|
15
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
16
|
||||||
|
WPickList
|
||||||
|
3
|
||||||
|
17
|
||||||
|
MItem
|
||||||
|
3
|
||||||
|
*.c
|
||||||
|
18
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
19
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
20
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
-1
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
21
|
||||||
|
MItem
|
||||||
|
8
|
||||||
|
stdafx.c
|
||||||
|
22
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
23
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
24
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
17
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
||||||
|
25
|
||||||
|
MItem
|
||||||
|
8
|
||||||
|
strgen.c
|
||||||
|
26
|
||||||
|
WString
|
||||||
|
4
|
||||||
|
COBJ
|
||||||
|
27
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
28
|
||||||
|
WVList
|
||||||
|
0
|
||||||
|
17
|
||||||
|
1
|
||||||
|
1
|
||||||
|
0
|
Loading…
Reference in New Issue