(svn r1281) -Fix: the OS/2 is now finished. Fixes:
authortruelight
Mon, 27 Dec 2004 10:40:04 +0000
changeset 810 7c51ba5a4368
parent 809 86cc46f97149
child 811 d79a6b72783b
(svn r1281) -Fix: the OS/2 is now finished. Fixes:
- Networking
- File selector issue
- Keyboard input
- Dedicated server console issue (use dedicated.cmd to open a server)
- Plus many other minor issues
dedicated.c
docs/Readme_OS2.txt
docs/openttd.6
fileio.c
hal.h
intro_gui.c
lang/english.txt
network_core.h
openttd.tgt
os/os2/openttd.wpj
os2.c
sdl.c
strgen/strgen.tgt
--- a/dedicated.c	Mon Dec 27 10:24:38 2004 +0000
+++ b/dedicated.c	Mon Dec 27 10:40:04 2004 +0000
@@ -20,6 +20,8 @@
 #	include <unistd.h>
 #	include <conio.h>
 #	define STDIN 0  /* file descriptor for standard input */
+
+	extern void OS2_SwitchToConsoleMode();
 #endif
 
 #ifdef UNIX
@@ -100,6 +102,11 @@
 	SetConsoleTitle("OpenTTD Dedicated Server");
 #endif
 
+#ifdef __OS2__
+	// For OS/2 we also need to switch to console mode instead of PM mode
+	OS2_SwitchToConsoleMode();
+#endif
+
 	DEBUG(misc,0)("Loading dedicated server...");
 	return NULL;
 }
--- a/docs/Readme_OS2.txt	Mon Dec 27 10:24:38 2004 +0000
+++ b/docs/Readme_OS2.txt	Mon Dec 27 10:40:04 2004 +0000
@@ -1,48 +1,114 @@
-OpenTTD: OS/2 version  ** CURRENTLY INCOMPLETE **
+OpenTTD: OS/2 version
 =====================
 
-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.
+OpenTTD has been ported to work on OS/2 4.x or later (including
+eComStation). The game should work as well as it does on Windows
+or other platforms: the main issues you may encounter are graphics
+card problems, but that is really the fault of SDL.
+
+=========================
+USING OPENTTD FOR OS/2
+=========================
+
+LIBRARIES REQUIRED FOR END USERS
+--------------------------------
+
+SDL.DLL (SDL 1.2.7) and FSLib.dll are required to use this program:
+these can be downloaded from the Files section at
+http://sourceforge.net/projects/openttd/ - see "os2-useful.zip".
+
+Note that to actually play the game, I have found in my own
+experience that a version of the Scitech Display Drivers or its later
+incarnation (see www.scitech.com) are necessary for it to work. If
+you have trouble with your native drivers, try the Scitech drivers
+and see if they help the problem.
+
+KNOWN ISSUES
+------------
+
+- If an error occurs during loading, the OS/2 error message window
+  is not always displayed.
+
+A NOTE ABOUT MUSIC
+------------------
+
+OpenTTD includes a music driver which uses the MCI MIDI system. Unfortunately,
+due to the lack of proper MIDI hardware myself, I have been unable to test it,
+but during testing, I found that when MIDI was enabled, I got no sound
+effects. I therefore decided to DISABLE music by default.
+
+To enable music, start OpenTTD with the command line:
+
+   openttd -m os2
+
+If I hear enough responses that both music and sound work together (it might
+just be my system), I'll have the defaults changed.
+
+A NOTE ABOUT DEDICATED MULTIPLAYER SERVERS
+------------------------------------------
+
+To start a dedicated multiplayer server, you should run the dedicated.cmd
+file. This enables OpenTTD to open up a VIO console window to display
+its output and gather any necessary input. Running "openttd -D"
+directly will result in the console not being displayed. You may
+still pass any other parameters ('-D' is already passed) to
+dedicated.cmd.
+
+=========================
+BUILDING THE OS/2 VERSION
+=========================
 
 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.
+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.
+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:
+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. Do not use the makefiles
+provided, they are not designed for Watcom (apart from SDL):
 
 - zlib
-  http://www.zlib.org/ - contains a makefile for OS/2, but is out of date and uses EMX
+  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.
+  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).
+If you do not wish to build the libraries yourself, pre-built versions
+can be downloaded from the Files section at
+http://sourceforge.net/projects/openttd/ - see "os2-useful.zip".
 
 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
-
+To compile, open the os/os2/openttd.wpj file in the IDE and first build
+the strgen.exe target. This will build the .lng file generator, and will
+also attempt to build all the language files (plus the table\strings.h
+file which is required for openttd.exe to be built). Once strgen.exe and
+the language files are built successfully, you can build the openttd.exe
+target.
 
-** THESE DOCS ARE INCOMPLETE FOR THE MOMENT, WILL BE COMPLETED SOON **
+Contact Information
+-------------------
 
-If you have any questions, please contact me (owen@owenrudge.net) and I'll try to help you out
+If you have any questions regarding OS/2 issues, please contact me
+(owen@owenrudge.net) and I'll try to help you out. For general OpenTTD
+issues, see the Contacting section of readme.txt.
 
-- Owen Rudge, 18th December 2004
-
+- Owen Rudge, 26th December 2004
\ No newline at end of file
--- a/docs/openttd.6	Mon Dec 27 10:24:38 2004 +0000
+++ b/docs/openttd.6	Mon Dec 27 10:40:04 2004 +0000
@@ -22,13 +22,13 @@
 .RI [ options ]
 .br
 .SH DESCRIPTION
-Unfortanetely, there is no real manpage for openttd yet. Hopefully someone
+Unfortunately, there is no real manpage for openttd yet. Hopefully someone
 will write one soon. For now you should use
 .B openttd -h
 for more information, or check our Wiki manual: http://wiki.openttd.org/
 .PP
 .\" TeX users may be more comfortable with the \fB<whatever>\fP and
-.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, 
 .\" respectively.
 .\" \fBopenttd\fP is a program that...
 .SH OPTIONS
--- a/fileio.c	Mon Dec 27 10:24:38 2004 +0000
+++ b/fileio.c	Mon Dec 27 10:40:04 2004 +0000
@@ -1,6 +1,6 @@
 #include "stdafx.h"
 #include "ttd.h"
-#if defined(UNIX)
+#if defined(UNIX) || defined(__OS2__)
 #include <ctype.h> // required for tolower()
 #endif
 
--- a/hal.h	Mon Dec 27 10:24:38 2004 +0000
+++ b/hal.h	Mon Dec 27 10:40:04 2004 +0000
@@ -71,6 +71,10 @@
 extern const HalMusicDriver _bemidi_music_driver;
 #endif
 
+#if defined(__OS2__)
+extern const HalMusicDriver _os2_music_driver;
+#endif
+
 extern const HalVideoDriver _dedicated_video_driver;
 
 enum DriverType {
--- a/intro_gui.c	Mon Dec 27 10:24:38 2004 +0000
+++ b/intro_gui.c	Mon Dec 27 10:40:04 2004 +0000
@@ -199,6 +199,8 @@
 		SetDParam(0, STR_OSNAME_MORPHOS);
 #elif defined(__AMIGA__)  
 		SetDParam(0, STR_OSNAME_AMIGAOS);
+#elif defined(__OS2__)
+		SetDParam(0, STR_OSNAME_OS2);
 #else
 		SetDParam(0, STR_0134_UNIX);
 #endif
--- a/lang/english.txt	Mon Dec 27 10:24:38 2004 +0000
+++ b/lang/english.txt	Mon Dec 27 10:40:04 2004 +0000
@@ -311,6 +311,7 @@
 STR_OSNAME_BEOS							:BeOS
 STR_OSNAME_MORPHOS						:MorphOS
 STR_OSNAME_AMIGAOS						:AmigaOS
+STR_OSNAME_OS2							:OS/2
 
 STR_0139_IMPERIAL_MILES						:Imperial (miles)
 STR_013A_METRIC_KILOMETERS					:Metric (kilometers)
--- a/network_core.h	Mon Dec 27 10:24:38 2004 +0000
+++ b/network_core.h	Mon Dec 27 10:40:04 2004 +0000
@@ -88,7 +88,7 @@
 typedef struct ifreq IFREQ;
 #	define ioctlsocket ioctl
 #	define closesocket close
-#	define GET_LAST_ERROR() (errno)
+#	define GET_LAST_ERROR() (sock_errno())
 
 // Includes needed for OS/2 systems
 #	include <types.h>
@@ -103,6 +103,7 @@
 #	include <sys/time.h>
 #	include <netdb.h>
 #	include <nerrno.h>
+#	define INADDR_NONE 0xffffffff
 
 typedef unsigned long in_addr_t;
 #endif // OS/2
--- a/openttd.tgt	Mon Dec 27 10:24:38 2004 +0000
+++ b/openttd.tgt	Mon Dec 27 10:40:04 2004 +0000
@@ -130,8 +130,8 @@
 0
 33
 WString
-24
-png.lib zlib.lib sdl.lib
+34
+mmpm2.lib png.lib zlib.lib sdl.lib
 0
 34
 MVState
@@ -205,7 +205,7 @@
 COBJ
 54
 WVList
-14
+15
 55
 MVState
 56
@@ -343,17 +343,17 @@
 ENABLE_NETWORK=1 WITH_ZLIB=1 WITH_PNG=1 WITH_SDL=1
 0
 89
-MRState
+MCState
 90
 WString
 3
 WCC
 91
 WString
-20
-?????Pack structures
+31
+?????Force enums to be type int
 0
-0
+1
 92
 MRState
 93
@@ -362,10 +362,10 @@
 WCC
 94
 WString
-21
-?????4 byte alignment
+20
+?????Pack structures
 0
-1
+0
 95
 MRState
 96
@@ -374,8 +374,8 @@
 WCC
 97
 WString
-29
-?????No debugging information
+21
+?????4 byte alignment
 0
 1
 98
@@ -386,1706 +386,1718 @@
 WCC
 100
 WString
+29
+?????No debugging information
+0
+1
+101
+MRState
+102
+WString
+3
+WCC
+103
+WString
 28
 ?????Line number information
 0
 0
-101
+104
 WVList
 0
 -1
 1
 1
 0
-102
+105
 MItem
 4
 ai.c
-103
-WString
-4
-COBJ
-104
-WVList
-0
-105
-WVList
-0
-52
-1
-1
-0
 106
-MItem
-10
-ai_build.c
-107
-WString
-4
-COBJ
-108
-WVList
-0
-109
-WVList
-0
-52
-1
-1
-0
-110
-MItem
-8
-ai_new.c
-111
-WString
-4
-COBJ
-112
-WVList
-0
-113
-WVList
-0
-52
-1
-1
-0
-114
-MItem
-15
-ai_pathfinder.c
-115
-WString
-4
-COBJ
-116
-WVList
-0
-117
-WVList
-0
-52
-1
-1
-0
-118
-MItem
-11
-ai_shared.c
-119
-WString
-4
-COBJ
-120
-WVList
-0
-121
-WVList
-0
-52
-1
-1
-0
-122
-MItem
-14
-aircraft_cmd.c
-123
-WString
-4
-COBJ
-124
-WVList
-0
-125
-WVList
-0
-52
-1
-1
-0
-126
-MItem
-14
-aircraft_gui.c
-127
-WString
-4
-COBJ
-128
-WVList
-0
-129
-WVList
-0
-52
-1
-1
-0
-130
-MItem
-9
-airport.c
-131
-WString
-4
-COBJ
-132
-WVList
-0
-133
-WVList
-0
-52
-1
-1
-0
-134
-MItem
-13
-airport_gui.c
-135
-WString
-4
-COBJ
-136
-WVList
-0
-137
-WVList
-0
-52
-1
-1
-0
-138
-MItem
-8
-aystar.c
-139
-WString
-4
-COBJ
-140
-WVList
-0
-141
-WVList
-0
-52
-1
-1
-0
-142
-MItem
-12
-bridge_gui.c
-143
-WString
-4
-COBJ
-144
-WVList
-0
-145
-WVList
-0
-52
-1
-1
-0
-146
-MItem
-16
-callback_table.c
-147
-WString
-4
-COBJ
-148
-WVList
-0
-149
-WVList
-0
-52
-1
-1
-0
-150
-MItem
-11
-clear_cmd.c
-151
-WString
-4
-COBJ
-152
-WVList
-0
-153
-WVList
-0
-52
-1
-1
-0
-154
-MItem
-9
-command.c
-155
-WString
-4
-COBJ
-156
-WVList
-0
-157
-WVList
-0
-52
-1
-1
-0
-158
-MItem
-9
-console.c
-159
-WString
-4
-COBJ
-160
-WVList
-0
-161
-WVList
-0
-52
-1
-1
-0
-162
-MItem
-14
-console_cmds.c
-163
-WString
-4
-COBJ
-164
-WVList
-0
-165
-WVList
-0
-52
-1
-1
-0
-166
-MItem
-11
-dedicated.c
-167
-WString
-4
-COBJ
-168
-WVList
-0
-169
-WVList
-0
-52
-1
-1
-0
-170
-MItem
-14
-disaster_cmd.c
-171
-WString
-4
-COBJ
-172
-WVList
-0
-173
-WVList
-0
-52
-1
-1
-0
-174
-MItem
-10
-dock_gui.c
-175
-WString
-4
-COBJ
-176
-WVList
-0
-177
-WVList
-0
-52
-1
-1
-0
-178
-MItem
-12
-dummy_land.c
-179
-WString
-4
-COBJ
-180
-WVList
-0
-181
-WVList
-0
-52
-1
-1
-0
-182
-MItem
-9
-economy.c
-183
-WString
-4
-COBJ
-184
-WVList
-0
-185
-WVList
-0
-52
-1
-1
-0
-186
-MItem
-8
-engine.c
-187
-WString
-4
-COBJ
-188
-WVList
-0
-189
-WVList
-0
-52
-1
-1
-0
-190
-MItem
-12
-engine_gui.c
-191
 WString
 4
 COBJ
-192
-WVList
-0
-193
-WVList
-0
-52
-1
-1
-0
-194
-MItem
-8
-fileio.c
-195
-WString
-4
-COBJ
-196
-WVList
-0
-197
-WVList
-0
-52
-1
-1
-0
-198
-MItem
-5
-gfx.c
-199
-WString
-4
-COBJ
-200
-WVList
-0
-201
-WVList
-0
-52
-1
-1
-0
-202
-MItem
-11
-graph_gui.c
-203
-WString
-4
-COBJ
-204
-WVList
-0
-205
-WVList
-0
-52
-1
-1
-0
-206
-MItem
-14
-industry_cmd.c
-207
-WString
-4
-COBJ
-208
-WVList
-0
-209
-WVList
-0
-52
-1
-1
-0
-210
-MItem
-14
-industry_gui.c
-211
-WString
-4
-COBJ
-212
-WVList
-0
-213
-WVList
-0
-52
-1
-1
-0
-214
-MItem
-11
-intro_gui.c
-215
-WString
-4
-COBJ
-216
-WVList
-0
-217
-WVList
-0
-52
-1
-1
-0
-218
-MItem
-11
-landscape.c
-219
-WString
-4
-COBJ
-220
-WVList
-0
-221
-WVList
-0
-52
-1
-1
-0
-222
-MItem
-10
-main_gui.c
-223
-WString
-4
-COBJ
-224
-WVList
-0
-225
-WVList
-0
-52
-1
-1
-0
-226
-MItem
-5
-map.c
-227
-WString
-4
-COBJ
-228
-WVList
-0
-229
-WVList
-0
-52
-1
-1
-0
-230
-MItem
-5
-md5.c
-231
-WString
-4
-COBJ
-232
-WVList
-0
-233
-WVList
-0
-52
-1
-1
-0
-234
-MItem
-9
-minilzo.c
-235
-WString
-4
-COBJ
-236
-WVList
-0
-237
+107
 WVList
 0
-52
-1
-1
-0
-238
-MItem
-6
-misc.c
-239
-WString
-4
-COBJ
-240
-WVList
-0
-241
-WVList
-0
-52
-1
-1
-0
-242
-MItem
-10
-misc_cmd.c
-243
-WString
-4
-COBJ
-244
-WVList
-0
-245
-WVList
-0
-52
-1
-1
-0
-246
-MItem
-10
-misc_gui.c
-247
-WString
-4
-COBJ
-248
-WVList
-0
-249
-WVList
-0
-52
-1
-1
-0
-250
-MItem
-11
-music_gui.c
-251
-WString
-4
-COBJ
-252
-WVList
-0
-253
-WVList
-0
-52
-1
-1
-0
-254
-MItem
-9
-namegen.c
-255
-WString
-4
-COBJ
-256
-WVList
-0
-257
-WVList
-0
-52
-1
-1
-0
-258
-MItem
-9
-network.c
-259
-WString
-4
-COBJ
-260
-WVList
-0
-261
-WVList
-0
-52
-1
-1
-0
-262
-MItem
-16
-network_client.c
-263
-WString
-4
-COBJ
-264
-WVList
-0
-265
-WVList
-0
-52
-1
-1
-0
-266
-MItem
-14
-network_data.c
-267
-WString
-4
-COBJ
-268
-WVList
-0
-269
-WVList
-0
-52
-1
-1
-0
-270
-MItem
-18
-network_gamelist.c
-271
-WString
-4
-COBJ
-272
-WVList
-0
-273
-WVList
-0
-52
-1
-1
-0
-274
-MItem
-13
-network_gui.c
-275
-WString
-4
-COBJ
-276
-WVList
-0
-277
-WVList
-0
-52
-1
-1
-0
-278
-MItem
-16
-network_server.c
-279
-WString
-4
-COBJ
-280
-WVList
-0
-281
-WVList
-0
-52
-1
-1
-0
-282
-MItem
-13
-network_udp.c
-283
-WString
-4
-COBJ
-284
-WVList
-0
-285
+108
 WVList
 0
 52
 1
 1
 0
-286
-MItem
-8
-newgrf.c
-287
-WString
-4
-COBJ
-288
-WVList
-0
-289
-WVList
-0
-52
-1
-1
-0
-290
+109
 MItem
 10
-news_gui.c
-291
-WString
-4
-COBJ
-292
-WVList
-0
-293
-WVList
-0
-52
-1
-1
-0
-294
-MItem
-11
-oldloader.c
-295
-WString
-4
-COBJ
-296
-WVList
-0
-297
-WVList
-0
-52
-1
-1
-0
-298
-MItem
-11
-order_cmd.c
-299
-WString
-4
-COBJ
-300
-WVList
-0
-301
-WVList
-0
-52
-1
-1
-0
-302
-MItem
-11
-order_gui.c
-303
-WString
-4
-COBJ
-304
-WVList
-0
-305
-WVList
-0
-52
-1
-1
-0
-306
-MItem
-5
-os2.c
-307
-WString
-4
-COBJ
-308
-WVList
-0
-309
-WVList
-0
-52
-1
-1
-0
-310
-MItem
-10
-pathfind.c
-311
-WString
-4
-COBJ
-312
-WVList
-0
-313
-WVList
-0
-52
-1
-1
-0
-314
-MItem
-12
-player_gui.c
-315
-WString
-4
-COBJ
-316
-WVList
-0
-317
-WVList
-0
-52
-1
-1
-0
-318
-MItem
-9
-players.c
-319
-WString
-4
-COBJ
-320
-WVList
-0
-321
-WVList
-0
-52
-1
-1
-0
-322
-MItem
-7
-queue.c
-323
-WString
-4
-COBJ
-324
-WVList
-0
-325
-WVList
-0
-52
-1
-1
-0
-326
-MItem
-10
-rail_cmd.c
-327
-WString
-4
-COBJ
-328
-WVList
-0
-329
-WVList
-0
-52
-1
-1
-0
-330
-MItem
-10
-rail_gui.c
-331
+ai_build.c
+110
 WString
 4
 COBJ
-332
-WVList
-0
-333
-WVList
-0
-52
-1
-1
-0
-334
-MItem
-10
-road_cmd.c
-335
-WString
-4
-COBJ
-336
-WVList
-0
-337
-WVList
-0
-52
-1
-1
-0
-338
-MItem
-10
-road_gui.c
-339
-WString
-4
-COBJ
-340
-WVList
-0
-341
-WVList
-0
-52
-1
-1
-0
-342
-MItem
-13
-roadveh_cmd.c
-343
-WString
-4
-COBJ
-344
-WVList
-0
-345
-WVList
-0
-52
-1
-1
-0
-346
-MItem
-13
-roadveh_gui.c
-347
-WString
-4
-COBJ
-348
-WVList
-0
-349
-WVList
-0
-52
-1
-1
-0
-350
-MItem
-10
-saveload.c
-351
-WString
-4
-COBJ
-352
-WVList
-0
-353
+111
 WVList
 0
-52
-1
-1
-0
-354
-MItem
-12
-screenshot.c
-355
-WString
-4
-COBJ
-356
-WVList
-0
-357
-WVList
-0
-52
-1
-1
-0
-358
-MItem
-5
-sdl.c
-359
-WString
-4
-COBJ
-360
-WVList
-0
-361
-WVList
-0
-52
-1
-1
-0
-362
-MItem
-10
-settings.c
-363
-WString
-4
-COBJ
-364
-WVList
-0
-365
-WVList
-0
-52
-1
-1
-0
-366
-MItem
-14
-settings_gui.c
-367
-WString
-4
-COBJ
-368
-WVList
-0
-369
-WVList
-0
-52
-1
-1
-0
-370
-MItem
-10
-ship_cmd.c
-371
-WString
-4
-COBJ
-372
-WVList
-0
-373
-WVList
-0
-52
-1
-1
-0
-374
-MItem
-10
-ship_gui.c
-375
-WString
-4
-COBJ
-376
-WVList
-0
-377
-WVList
-0
-52
-1
-1
-0
-378
-MItem
-14
-smallmap_gui.c
-379
-WString
-4
-COBJ
-380
-WVList
-0
-381
+112
 WVList
 0
 52
 1
 1
 0
-382
-MItem
-7
-sound.c
-383
-WString
-4
-COBJ
-384
-WVList
-0
-385
-WVList
-0
-52
-1
-1
-0
-386
+113
 MItem
 8
-sprite.c
-387
-WString
-4
-COBJ
-388
-WVList
-0
-389
-WVList
-0
-52
-1
-1
-0
-390
-MItem
-13
-spritecache.c
-391
-WString
-4
-COBJ
-392
-WVList
-0
-393
-WVList
-0
-52
-1
-1
-0
-394
-MItem
-13
-station_cmd.c
-395
-WString
-4
-COBJ
-396
-WVList
-0
-397
-WVList
-0
-52
-1
-1
-0
-398
-MItem
-13
-station_gui.c
-399
-WString
-4
-COBJ
-400
-WVList
-0
-401
-WVList
-0
-52
-1
-1
-0
-402
-MItem
-8
-StdAfx.c
-403
+ai_new.c
+114
 WString
 4
 COBJ
-404
-WVList
-0
-405
-WVList
-0
-52
-1
-1
-0
-406
-MItem
-9
-strings.c
-407
-WString
-4
-COBJ
-408
-WVList
-0
-409
-WVList
-0
-52
-1
-1
-0
-410
-MItem
-13
-subsidy_gui.c
-411
-WString
-4
-COBJ
-412
-WVList
-0
-413
+115
 WVList
 0
-52
-1
-1
-0
-414
-MItem
-15
-terraform_gui.c
-415
-WString
-4
-COBJ
-416
-WVList
-0
-417
-WVList
-0
-52
-1
-1
-0
-418
-MItem
-9
-texteff.c
-419
-WString
-4
-COBJ
-420
-WVList
-0
-421
-WVList
-0
-52
-1
-1
-0
-422
-MItem
-10
-town_cmd.c
-423
-WString
-4
-COBJ
-424
-WVList
-0
-425
-WVList
-0
-52
-1
-1
-0
-426
-MItem
-10
-town_gui.c
-427
-WString
-4
-COBJ
-428
-WVList
-0
-429
+116
 WVList
 0
 52
 1
 1
 0
-430
-MItem
-11
-train_cmd.c
-431
-WString
-4
-COBJ
-432
-WVList
-0
-433
-WVList
-0
-52
-1
-1
-0
-434
+117
 MItem
-11
-train_gui.c
-435
-WString
-4
-COBJ
-436
-WVList
-0
-437
-WVList
-0
-52
-1
-1
-0
-438
-MItem
-10
-tree_cmd.c
-439
+15
+ai_pathfinder.c
+118
 WString
 4
 COBJ
-440
-WVList
-0
-441
-WVList
-0
-52
-1
-1
-0
-442
-MItem
-5
-ttd.c
-443
-WString
-4
-COBJ
-444
-WVList
-0
-445
+119
 WVList
 0
-52
-1
-1
-0
-446
-MItem
-18
-tunnelbridge_cmd.c
-447
-WString
-4
-COBJ
-448
-WVList
-0
-449
-WVList
-0
-52
-1
-1
-0
-450
-MItem
-15
-unmovable_cmd.c
-451
-WString
-4
-COBJ
-452
-WVList
-0
-453
+120
 WVList
 0
 52
 1
 1
 0
-454
+121
 MItem
-9
-vehicle.c
-455
+11
+ai_shared.c
+122
 WString
 4
 COBJ
-456
-WVList
-0
-457
+123
 WVList
 0
-52
-1
-1
-0
-458
-MItem
-13
-vehicle_gui.c
-459
-WString
-4
-COBJ
-460
-WVList
-0
-461
-WVList
-0
-52
-1
-1
-0
-462
-MItem
-10
-viewport.c
-463
-WString
-4
-COBJ
-464
-WVList
-0
-465
+124
 WVList
 0
 52
 1
 1
 0
-466
+125
 MItem
-11
-water_cmd.c
-467
+14
+aircraft_cmd.c
+126
 WString
 4
 COBJ
-468
+127
 WVList
 0
-469
+128
 WVList
 0
 52
 1
 1
 0
-470
+129
 MItem
-8
-widget.c
-471
+14
+aircraft_gui.c
+130
 WString
 4
 COBJ
-472
+131
 WVList
 0
-473
+132
 WVList
 0
 52
 1
 1
 0
-474
+133
 MItem
-8
-window.c
-475
+9
+airport.c
+134
 WString
 4
 COBJ
-476
+135
 WVList
 0
-477
+136
 WVList
 0
 52
 1
 1
 0
+137
+MItem
+13
+airport_gui.c
+138
+WString
+4
+COBJ
+139
+WVList
+0
+140
+WVList
+0
+52
+1
+1
+0
+141
+MItem
+8
+aystar.c
+142
+WString
+4
+COBJ
+143
+WVList
+0
+144
+WVList
+0
+52
+1
+1
+0
+145
+MItem
+12
+bridge_gui.c
+146
+WString
+4
+COBJ
+147
+WVList
+0
+148
+WVList
+0
+52
+1
+1
+0
+149
+MItem
+16
+callback_table.c
+150
+WString
+4
+COBJ
+151
+WVList
+0
+152
+WVList
+0
+52
+1
+1
+0
+153
+MItem
+11
+clear_cmd.c
+154
+WString
+4
+COBJ
+155
+WVList
+0
+156
+WVList
+0
+52
+1
+1
+0
+157
+MItem
+9
+command.c
+158
+WString
+4
+COBJ
+159
+WVList
+0
+160
+WVList
+0
+52
+1
+1
+0
+161
+MItem
+9
+console.c
+162
+WString
+4
+COBJ
+163
+WVList
+0
+164
+WVList
+0
+52
+1
+1
+0
+165
+MItem
+14
+console_cmds.c
+166
+WString
+4
+COBJ
+167
+WVList
+0
+168
+WVList
+0
+52
+1
+1
+0
+169
+MItem
+11
+dedicated.c
+170
+WString
+4
+COBJ
+171
+WVList
+0
+172
+WVList
+0
+52
+1
+1
+0
+173
+MItem
+14
+disaster_cmd.c
+174
+WString
+4
+COBJ
+175
+WVList
+0
+176
+WVList
+0
+52
+1
+1
+0
+177
+MItem
+10
+dock_gui.c
+178
+WString
+4
+COBJ
+179
+WVList
+0
+180
+WVList
+0
+52
+1
+1
+0
+181
+MItem
+12
+dummy_land.c
+182
+WString
+4
+COBJ
+183
+WVList
+0
+184
+WVList
+0
+52
+1
+1
+0
+185
+MItem
+9
+economy.c
+186
+WString
+4
+COBJ
+187
+WVList
+0
+188
+WVList
+0
+52
+1
+1
+0
+189
+MItem
+8
+engine.c
+190
+WString
+4
+COBJ
+191
+WVList
+0
+192
+WVList
+0
+52
+1
+1
+0
+193
+MItem
+12
+engine_gui.c
+194
+WString
+4
+COBJ
+195
+WVList
+0
+196
+WVList
+0
+52
+1
+1
+0
+197
+MItem
+8
+fileio.c
+198
+WString
+4
+COBJ
+199
+WVList
+0
+200
+WVList
+0
+52
+1
+1
+0
+201
+MItem
+5
+gfx.c
+202
+WString
+4
+COBJ
+203
+WVList
+0
+204
+WVList
+0
+52
+1
+1
+0
+205
+MItem
+11
+graph_gui.c
+206
+WString
+4
+COBJ
+207
+WVList
+0
+208
+WVList
+0
+52
+1
+1
+0
+209
+MItem
+14
+industry_cmd.c
+210
+WString
+4
+COBJ
+211
+WVList
+0
+212
+WVList
+0
+52
+1
+1
+0
+213
+MItem
+14
+industry_gui.c
+214
+WString
+4
+COBJ
+215
+WVList
+0
+216
+WVList
+0
+52
+1
+1
+0
+217
+MItem
+11
+intro_gui.c
+218
+WString
+4
+COBJ
+219
+WVList
+0
+220
+WVList
+0
+52
+1
+1
+0
+221
+MItem
+11
+landscape.c
+222
+WString
+4
+COBJ
+223
+WVList
+0
+224
+WVList
+0
+52
+1
+1
+0
+225
+MItem
+10
+main_gui.c
+226
+WString
+4
+COBJ
+227
+WVList
+0
+228
+WVList
+0
+52
+1
+1
+0
+229
+MItem
+5
+map.c
+230
+WString
+4
+COBJ
+231
+WVList
+0
+232
+WVList
+0
+52
+1
+1
+0
+233
+MItem
+5
+md5.c
+234
+WString
+4
+COBJ
+235
+WVList
+0
+236
+WVList
+0
+52
+1
+1
+0
+237
+MItem
+9
+minilzo.c
+238
+WString
+4
+COBJ
+239
+WVList
+0
+240
+WVList
+0
+52
+1
+1
+0
+241
+MItem
+6
+misc.c
+242
+WString
+4
+COBJ
+243
+WVList
+0
+244
+WVList
+0
+52
+1
+1
+0
+245
+MItem
+10
+misc_cmd.c
+246
+WString
+4
+COBJ
+247
+WVList
+0
+248
+WVList
+0
+52
+1
+1
+0
+249
+MItem
+10
+misc_gui.c
+250
+WString
+4
+COBJ
+251
+WVList
+0
+252
+WVList
+0
+52
+1
+1
+0
+253
+MItem
+11
+music_gui.c
+254
+WString
+4
+COBJ
+255
+WVList
+0
+256
+WVList
+0
+52
+1
+1
+0
+257
+MItem
+9
+namegen.c
+258
+WString
+4
+COBJ
+259
+WVList
+0
+260
+WVList
+0
+52
+1
+1
+0
+261
+MItem
+9
+network.c
+262
+WString
+4
+COBJ
+263
+WVList
+0
+264
+WVList
+0
+52
+1
+1
+0
+265
+MItem
+16
+network_client.c
+266
+WString
+4
+COBJ
+267
+WVList
+0
+268
+WVList
+0
+52
+1
+1
+0
+269
+MItem
+14
+network_data.c
+270
+WString
+4
+COBJ
+271
+WVList
+0
+272
+WVList
+0
+52
+1
+1
+0
+273
+MItem
+18
+network_gamelist.c
+274
+WString
+4
+COBJ
+275
+WVList
+0
+276
+WVList
+0
+52
+1
+1
+0
+277
+MItem
+13
+network_gui.c
+278
+WString
+4
+COBJ
+279
+WVList
+0
+280
+WVList
+0
+52
+1
+1
+0
+281
+MItem
+16
+network_server.c
+282
+WString
+4
+COBJ
+283
+WVList
+0
+284
+WVList
+0
+52
+1
+1
+0
+285
+MItem
+13
+network_udp.c
+286
+WString
+4
+COBJ
+287
+WVList
+0
+288
+WVList
+0
+52
+1
+1
+0
+289
+MItem
+8
+newgrf.c
+290
+WString
+4
+COBJ
+291
+WVList
+0
+292
+WVList
+0
+52
+1
+1
+0
+293
+MItem
+10
+news_gui.c
+294
+WString
+4
+COBJ
+295
+WVList
+0
+296
+WVList
+0
+52
+1
+1
+0
+297
+MItem
+11
+oldloader.c
+298
+WString
+4
+COBJ
+299
+WVList
+0
+300
+WVList
+0
+52
+1
+1
+0
+301
+MItem
+11
+order_cmd.c
+302
+WString
+4
+COBJ
+303
+WVList
+0
+304
+WVList
+0
+52
+1
+1
+0
+305
+MItem
+11
+order_gui.c
+306
+WString
+4
+COBJ
+307
+WVList
+0
+308
+WVList
+0
+52
+1
+1
+0
+309
+MItem
+5
+os2.c
+310
+WString
+4
+COBJ
+311
+WVList
+0
+312
+WVList
+0
+52
+1
+1
+0
+313
+MItem
+10
+pathfind.c
+314
+WString
+4
+COBJ
+315
+WVList
+0
+316
+WVList
+0
+52
+1
+1
+0
+317
+MItem
+12
+player_gui.c
+318
+WString
+4
+COBJ
+319
+WVList
+0
+320
+WVList
+0
+52
+1
+1
+0
+321
+MItem
+9
+players.c
+322
+WString
+4
+COBJ
+323
+WVList
+0
+324
+WVList
+0
+52
+1
+1
+0
+325
+MItem
+7
+queue.c
+326
+WString
+4
+COBJ
+327
+WVList
+0
+328
+WVList
+0
+52
+1
+1
+0
+329
+MItem
+10
+rail_cmd.c
+330
+WString
+4
+COBJ
+331
+WVList
+0
+332
+WVList
+0
+52
+1
+1
+0
+333
+MItem
+10
+rail_gui.c
+334
+WString
+4
+COBJ
+335
+WVList
+0
+336
+WVList
+0
+52
+1
+1
+0
+337
+MItem
+10
+road_cmd.c
+338
+WString
+4
+COBJ
+339
+WVList
+0
+340
+WVList
+0
+52
+1
+1
+0
+341
+MItem
+10
+road_gui.c
+342
+WString
+4
+COBJ
+343
+WVList
+0
+344
+WVList
+0
+52
+1
+1
+0
+345
+MItem
+13
+roadveh_cmd.c
+346
+WString
+4
+COBJ
+347
+WVList
+0
+348
+WVList
+0
+52
+1
+1
+0
+349
+MItem
+13
+roadveh_gui.c
+350
+WString
+4
+COBJ
+351
+WVList
+0
+352
+WVList
+0
+52
+1
+1
+0
+353
+MItem
+10
+saveload.c
+354
+WString
+4
+COBJ
+355
+WVList
+0
+356
+WVList
+0
+52
+1
+1
+0
+357
+MItem
+12
+screenshot.c
+358
+WString
+4
+COBJ
+359
+WVList
+0
+360
+WVList
+0
+52
+1
+1
+0
+361
+MItem
+5
+sdl.c
+362
+WString
+4
+COBJ
+363
+WVList
+0
+364
+WVList
+0
+52
+1
+1
+0
+365
+MItem
+10
+settings.c
+366
+WString
+4
+COBJ
+367
+WVList
+0
+368
+WVList
+0
+52
+1
+1
+0
+369
+MItem
+14
+settings_gui.c
+370
+WString
+4
+COBJ
+371
+WVList
+0
+372
+WVList
+0
+52
+1
+1
+0
+373
+MItem
+10
+ship_cmd.c
+374
+WString
+4
+COBJ
+375
+WVList
+0
+376
+WVList
+0
+52
+1
+1
+0
+377
+MItem
+10
+ship_gui.c
+378
+WString
+4
+COBJ
+379
+WVList
+0
+380
+WVList
+0
+52
+1
+1
+0
+381
+MItem
+14
+smallmap_gui.c
+382
+WString
+4
+COBJ
+383
+WVList
+0
+384
+WVList
+0
+52
+1
+1
+0
+385
+MItem
+7
+sound.c
+386
+WString
+4
+COBJ
+387
+WVList
+0
+388
+WVList
+0
+52
+1
+1
+0
+389
+MItem
+8
+sprite.c
+390
+WString
+4
+COBJ
+391
+WVList
+0
+392
+WVList
+0
+52
+1
+1
+0
+393
+MItem
+13
+spritecache.c
+394
+WString
+4
+COBJ
+395
+WVList
+0
+396
+WVList
+0
+52
+1
+1
+0
+397
+MItem
+13
+station_cmd.c
+398
+WString
+4
+COBJ
+399
+WVList
+0
+400
+WVList
+0
+52
+1
+1
+0
+401
+MItem
+13
+station_gui.c
+402
+WString
+4
+COBJ
+403
+WVList
+0
+404
+WVList
+0
+52
+1
+1
+0
+405
+MItem
+8
+StdAfx.c
+406
+WString
+4
+COBJ
+407
+WVList
+0
+408
+WVList
+0
+52
+1
+1
+0
+409
+MItem
+9
+strings.c
+410
+WString
+4
+COBJ
+411
+WVList
+0
+412
+WVList
+0
+52
+1
+1
+0
+413
+MItem
+13
+subsidy_gui.c
+414
+WString
+4
+COBJ
+415
+WVList
+0
+416
+WVList
+0
+52
+1
+1
+0
+417
+MItem
+15
+terraform_gui.c
+418
+WString
+4
+COBJ
+419
+WVList
+0
+420
+WVList
+0
+52
+1
+1
+0
+421
+MItem
+9
+texteff.c
+422
+WString
+4
+COBJ
+423
+WVList
+0
+424
+WVList
+0
+52
+1
+1
+0
+425
+MItem
+10
+town_cmd.c
+426
+WString
+4
+COBJ
+427
+WVList
+0
+428
+WVList
+0
+52
+1
+1
+0
+429
+MItem
+10
+town_gui.c
+430
+WString
+4
+COBJ
+431
+WVList
+0
+432
+WVList
+0
+52
+1
+1
+0
+433
+MItem
+11
+train_cmd.c
+434
+WString
+4
+COBJ
+435
+WVList
+0
+436
+WVList
+0
+52
+1
+1
+0
+437
+MItem
+11
+train_gui.c
+438
+WString
+4
+COBJ
+439
+WVList
+0
+440
+WVList
+0
+52
+1
+1
+0
+441
+MItem
+10
+tree_cmd.c
+442
+WString
+4
+COBJ
+443
+WVList
+0
+444
+WVList
+0
+52
+1
+1
+0
+445
+MItem
+5
+ttd.c
+446
+WString
+4
+COBJ
+447
+WVList
+0
+448
+WVList
+0
+52
+1
+1
+0
+449
+MItem
+18
+tunnelbridge_cmd.c
+450
+WString
+4
+COBJ
+451
+WVList
+0
+452
+WVList
+0
+52
+1
+1
+0
+453
+MItem
+15
+unmovable_cmd.c
+454
+WString
+4
+COBJ
+455
+WVList
+0
+456
+WVList
+0
+52
+1
+1
+0
+457
+MItem
+9
+vehicle.c
+458
+WString
+4
+COBJ
+459
+WVList
+0
+460
+WVList
+0
+52
+1
+1
+0
+461
+MItem
+13
+vehicle_gui.c
+462
+WString
+4
+COBJ
+463
+WVList
+0
+464
+WVList
+0
+52
+1
+1
+0
+465
+MItem
+10
+viewport.c
+466
+WString
+4
+COBJ
+467
+WVList
+0
+468
+WVList
+0
+52
+1
+1
+0
+469
+MItem
+11
+water_cmd.c
+470
+WString
+4
+COBJ
+471
+WVList
+0
+472
+WVList
+0
+52
+1
+1
+0
+473
+MItem
+8
+widget.c
+474
+WString
+4
+COBJ
+475
+WVList
+0
+476
+WVList
+0
+52
+1
+1
+0
+477
+MItem
+8
+window.c
+478
+WString
+4
+COBJ
+479
+WVList
+0
+480
+WVList
+0
+52
+1
+1
+0
--- a/os/os2/openttd.wpj	Mon Dec 27 10:24:38 2004 +0000
+++ b/os/os2/openttd.wpj	Mon Dec 27 10:40:04 2004 +0000
@@ -42,8 +42,8 @@
 WFileName
 17
 ..\..\openttd.tgt
-51
-52
+47
+47
 11
 VComponent
 12
--- a/os2.c	Mon Dec 27 10:24:38 2004 +0000
+++ b/os2.c	Mon Dec 27 10:40:04 2004 +0000
@@ -6,10 +6,16 @@
 #include <direct.h>
 #include <unistd.h>
 #include <sys/stat.h>
+#include <stdarg.h>
 #include <time.h>
 #include <dos.h>
 
+#define INCL_DOS
+#define INCL_WINDIALOGS
+#define INCL_OS2MM
+
 #include <os2.h>
+#include <os2me.h>
 
 #if defined(WITH_SDL)
 #include <SDL.h>
@@ -27,6 +33,7 @@
 		_fios_alloc += 256;
 		_fios_items = realloc(_fios_items, _fios_alloc * sizeof(FiosItem));
 	}
+
 	return &_fios_items[_fios_count++];
 }
 
@@ -45,6 +52,22 @@
 }
 
 
+static DIR *my_opendir(char *path, char *file)
+{
+	char paths[MAX_PATH];
+
+	append_path(paths, path, file);		
+	return opendir(paths);
+}
+
+static void append_path(char *out, char *path, char *file)
+{
+	if ((path[2] == '\\') && (path[3] == 0))
+		sprintf(out, "%s%s", path, file);
+	else
+		sprintf(out, "%s\\%s", path, file);
+}
+
 // Get a list of savegames
 FiosItem *FiosGetSavegameList(int *num, int mode)
 {
@@ -60,32 +83,31 @@
 		strcpy(_fios_save_path, _path.save_dir);
 	}
 
-	if(_game_mode==GM_EDITOR)
+	if (_game_mode == GM_EDITOR)
 		_fios_path = _fios_scn_path;
 	else
 		_fios_path = _fios_save_path;
 
-	// Parent directory, only if not in root already.
-	if (_fios_path[1] != 0) {
+	// Parent directory, only if not of the type C:\.
+	if (_fios_path[3] != 0) {
 		fios = FiosAlloc();
 		fios->type = FIOS_TYPE_PARENT;
-		fios->mtime = 0;
-		sprintf(fios->title, ".. (Parent directory)");
+		strcpy(fios->title, ".. (Parent directory)");
 	}
 
 	// Show subdirectories first
-	dir = opendir(_fios_path[0] ? _fios_path : "C:\\");
+	dir = my_opendir(_fios_path, "*.*");
 	if (dir != NULL) {
 		while ((dirent = readdir(dir))) {
-			sprintf (filename, "%s\\%s", _fios_path, dirent->d_name);
+			append_path(filename, _fios_path, dirent->d_name);
 			if (!stat(filename, &sb)) {
 				if (S_ISDIR(sb.st_mode)) {
-					if (dirent->d_name[0] != '.') {
+					if (!(dirent->d_name[0] == '.' && (dirent->d_name[1] == 0 || (dirent->d_name[1] == '.' && dirent->d_name[2] == 0))))
+					{
 						fios = FiosAlloc();
-						fios->mtime = 0;
 						fios->type = FIOS_TYPE_DIR;
-						fios->title[0] = 0;
-						sprintf(fios->name, "%s\\ (Directory)", dirent->d_name);
+						strcpy(fios->name, dirent->d_name);
+						sprintf(fios->title, "%s\\ (Directory)", dirent->d_name);
 					}
 				}
 			}
@@ -110,10 +132,10 @@
 	 *      .SV1    Transport Tycoon Deluxe (Patch) saved game
 	 *      .SV2    Transport Tycoon Deluxe (Patch) saved 2-player game
 	 */
-	dir = opendir(_fios_path[0] ? _fios_path : "C:\\");
+	dir = my_opendir(_fios_path, "*.*");
 	if (dir != NULL) {
 		while ((dirent = readdir(dir))) {
-			sprintf (filename, "%s\\%s", _fios_path, dirent->d_name);
+			append_path(filename, _fios_path, dirent->d_name);
 			if (!stat(filename, &sb)) {
 				if (!S_ISDIR(sb.st_mode)) {
 					char *t = strrchr(dirent->d_name, '.');
@@ -185,25 +207,35 @@
 	int sort_start;
 	char filename[MAX_PATH];
 
-	if (_fios_scn_path == NULL) {
-		_fios_scn_path = malloc(MAX_PATH);
+	if (mode == SLD_NEW_GAME || _fios_scn_path == NULL) {
+		if (_fios_scn_path == NULL)
+			_fios_scn_path = malloc(MAX_PATH);
 		strcpy(_fios_scn_path, _path.scenario_dir);
 	}
+
 	_fios_path = _fios_scn_path;
 
+	// Parent directory, only if not of the type C:\.
+	if (_fios_path[3] != 0 && mode != SLD_NEW_GAME) {
+		fios = FiosAlloc();
+		fios->type = FIOS_TYPE_PARENT;
+		strcpy(fios->title, ".. (Parent directory)");
+	}
+
 	// Show subdirectories first
-	dir = opendir(_fios_path[0] ? _fios_path : "C:\\");
+	dir = my_opendir(_fios_path, "*.*");
 	if (dir != NULL) {
 		while ((dirent = readdir(dir))) {
-			sprintf (filename, "%s\\%s", _fios_path, dirent->d_name);
+			append_path(filename, _fios_path, dirent->d_name);
 			if (!stat(filename, &sb)) {
 				if (S_ISDIR(sb.st_mode)) {
-					if (dirent->d_name[0] != '.') {
+					if (!(dirent->d_name[0] == '.' && (dirent->d_name[1] == 0 || (dirent->d_name[1] == '.' && dirent->d_name[2] == 0))))
+					{
 						fios = FiosAlloc();
 						fios->mtime = 0;
 						fios->type = FIOS_TYPE_DIR;
-						fios->title[0] = 0;
-						sprintf(fios->name, "%s\\ (Directory)", dirent->d_name);
+						strcpy(fios->name, dirent->d_name);
+						sprintf(fios->title, "%s\\ (Directory)", dirent->d_name);
 					}
 				}
 			}
@@ -219,10 +251,10 @@
 	 *      .SV0    Transport Tycoon Deluxe (Patch) scenario
 	 *      .SS0    Transport Tycoon Deluxe preset scenario
 	 */
-	dir = opendir(_fios_path[0] ? _fios_path : "C:\\");
+	dir = my_opendir(_fios_path, "*.*");
 	if (dir != NULL) {
 		while ((dirent = readdir(dir))) {
-			sprintf (filename, "%s\\%s", _fios_path, dirent->d_name);
+			append_path(filename, _fios_path, dirent->d_name);
 			if (!stat(filename, &sb)) {
 				if (!S_ISDIR(sb.st_mode)) {
 					char *t = strrchr(dirent->d_name, '.');
@@ -301,16 +333,28 @@
 	char *s;
 
 	switch(item->type) {
+	case FIOS_TYPE_DRIVE:
+		sprintf(path, "%c:\\", item->title[0]);
+		break;
+
 	case FIOS_TYPE_PARENT:
-		s = strrchr(path, '\\');
-		if (s != NULL) *s = 0;
+		// Skip drive part
+		path += 3;
+		s = path;
+		while (*path) {
+			if (*path== '\\')
+				s = path;
+			path++;
+		}
+		*s = 0;
 		break;
 
 	case FIOS_TYPE_DIR:
-		s = strchr((char*)item->name, '\\');
-		if (s) *s = 0;
-		while (*path) path++;
-		*path++ = '\\';
+		// Scan to end
+		while (*++path);
+		// Add backslash?
+		if (path[-1] != '\\') *path++ = '\\';
+
 		strcpy(path, item->name);
 		break;
 
@@ -325,7 +369,6 @@
 	case FIOS_TYPE_SCENARIO:
 		sprintf(str_buffr, "%s\\%s.scn", path, item->name);
 		return str_buffr;
-
 	case FIOS_TYPE_OLD_SCENARIO:
 		sprintf(str_buffr, "%s\\%s.%s", path, item->name, _old_extensions[item->old_extension]);
 		return str_buffr;
@@ -342,11 +385,11 @@
 	struct diskfree_t free;
 	char drive;
 	
-	*path = _fios_path[0] ? _fios_path : "C:\\";
-	drive = 'B' - *path[0];
+	*path = _fios_path;
+	drive = *path[0] - 'A'+1;
 
 	_getdiskfree(drive, &free);
-		
+
 	SetDParam(0, free.avail_clusters * free.sectors_per_cluster * free.bytes_per_sector);
 	return STR_4005_BYTES_FREE;
 }
@@ -367,33 +410,33 @@
 }
 
 const DriverDesc _video_driver_descs[] = {
-	{"null",	"Null Video Driver",    &_null_video_driver,    0},
+	{	"null",			"Null Video Driver",		&_null_video_driver,		0},
 #if defined(WITH_SDL)
-	{ "sdl",	"SDL Video Driver",	     &_sdl_video_driver,	     1},
+	{	"sdl",			"SDL Video Driver",			&_sdl_video_driver,			1},
 #endif
-	{ "dedicated", "Dedicated Video Driver", &_dedicated_video_driver, 0},
-	{ NULL,	 NULL,								   NULL,								   0}
+	{	"dedicated",	"Dedicated Video Driver",	&_dedicated_video_driver,	0},
+	{	NULL,			NULL,						NULL,						0}
 };
 
 const DriverDesc _sound_driver_descs[] = {
-	{"null",	"Null Sound Driver",    &_null_sound_driver,	    0},
+	{	"null",	"Null Sound Driver",	&_null_sound_driver,		0},
 #if defined(WITH_SDL)
-	{ "sdl",	"SDL Sound Driver",	     &_sdl_sound_driver,		     1},
+	{	"sdl",	"SDL Sound Driver",		&_sdl_sound_driver,			1},
 #endif
-	{ NULL,	 NULL,								   NULL,									   0}
+	{	NULL,	NULL,					NULL,						0}
 };
 
 const DriverDesc _music_driver_descs[] = {
-	{   "null",     "Null Music Driver",	    &_null_music_driver,	    0},
-	{     NULL,     NULL,									   NULL,									   0}
+	{	"os2",		"OS/2 Music Driver",		&_os2_music_driver,			0},
+	{   "null",     "Null Music Driver",	    &_null_music_driver,	    1},
+	{	NULL,		NULL,						NULL,						0}
 };
 
 /* GetOSVersion returns the minimal required version of OS to be able to use that driver.
-	 Not needed for *nix. */
+	 Not needed for OS/2. */
 byte GetOSVersion()
 {
 	return 2;  // any arbitrary number bigger then 0
-				// numbers lower than 2 breaks default music selection on mac
 }
 
 bool FileExists(const char *filename)
@@ -438,15 +481,15 @@
 	}
 }
 
+// for some reason these calls don't actually work properly :/
 void ShowInfo(const char *str)
 {
-	puts(str);
+	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
 }
 
 void ShowOSErrorBox(const char *buf)
 {
-	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 263, MB_OK | MB_APPLMODAL | MB_MOVEABLE | MB_ERROR);
-// TODO: FIX, doesn't always appear
+	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_ERROR);
 }
 
 int CDECL main(int argc, char* argv[])
@@ -529,3 +572,85 @@
 	mkdir(_path.scenario_dir);
 }
 
+// FUNCTION: OS2_SwitchToConsoleMode
+//
+// Switches OpenTTD to a console app at run-time, instead of a PM app
+// Necessary to see stdout, etc
+
+void OS2_SwitchToConsoleMode()
+{
+	PPIB pib;
+	PTIB tib;
+
+	DosGetInfoBlocks(&tib, &pib);
+
+	// Change flag from PM to VIO
+	pib->pib_ultype = 3;
+}
+
+
+/**********************
+ * OS/2 MIDI PLAYER
+ **********************/
+
+/* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API,
+ * eh? Anyone would think they both came from the same place originally! ;)
+ */
+
+static long CDECL MidiSendCommand(const char *cmd, ...)
+{
+	va_list va;
+	char buf[512];
+	va_start(va, cmd);
+	vsprintf(buf, cmd, va);
+	va_end(va);
+	return mciSendString(buf, NULL, 0, NULL, 0);
+}
+
+static void OS2MidiPlaySong(const char *filename)
+{
+	MidiSendCommand("close all");
+
+	if (MidiSendCommand("open %s type sequencer alias song", filename) != 0)
+		return;
+
+	MidiSendCommand("play song from 0");
+}
+
+static void OS2MidiStopSong()
+{
+	MidiSendCommand("close all");
+}
+
+static void OS2MidiSetVolume(byte vol)
+{
+	MidiSendCommand("set song audio volume %d", ((vol/127)*100));
+}
+
+static bool OS2MidiIsSongPlaying()
+{
+	char buf[16];
+	mciSendString("status song mode", buf, sizeof(buf), NULL, 0);
+	return strcmp(buf, "playing") == 0 || strcmp(buf, "seeking") == 0;
+}
+
+static char *OS2MidiStart(char **parm)
+{
+	return 0;
+}
+
+static void OS2MidiStop()
+{
+	MidiSendCommand("close all");
+}
+
+const HalMusicDriver _os2_music_driver = {
+	OS2MidiStart,
+	OS2MidiStop,
+	OS2MidiPlaySong,
+	OS2MidiStopSong,
+	OS2MidiIsSongPlaying,
+	OS2MidiSetVolume,
+};
+
+
--- a/sdl.c	Mon Dec 27 10:24:38 2004 +0000
+++ b/sdl.c	Mon Dec 27 10:40:04 2004 +0000
@@ -408,7 +408,7 @@
 	}
 
 	// check scancode for BACKQUOTE key, because we want the key left of "1", not anything else (on non-US keyboards)
-#if defined(WIN32)
+#if defined(WIN32) || defined(__OS2__)
 	if (sym->scancode == 41) key |= WKC_BACKQUOTE;
 #elif defined(__APPLE__)
 	if (sym->scancode == 10) key |= WKC_BACKQUOTE;
--- a/strgen/strgen.tgt	Mon Dec 27 10:24:38 2004 +0000
+++ b/strgen/strgen.tgt	Mon Dec 27 10:40:04 2004 +0000
@@ -15,13 +15,15 @@
 oc2en
 1
 0
-1
+0
 4
 MCommand
 0
 5
 MCommand
-0
+26
+..\os\os2\build_lang.cmd
+
 6
 MItem
 10
@@ -77,44 +79,68 @@
 COBJ
 19
 WVList
+2
+20
+MRState
+21
+WString
+3
+WCC
+22
+WString
+29
+?????No debugging information
 0
-20
+1
+23
+MRState
+24
+WString
+3
+WCC
+25
+WString
+28
+?????Line number information
+0
+0
+26
 WVList
 0
 -1
 1
 1
 0
-21
+27
 MItem
 8
 stdafx.c
-22
+28
 WString
 4
 COBJ
-23
+29
 WVList
 0
-24
+30
 WVList
 0
 17
 1
 1
 0
-25
+31
 MItem
 8
 strgen.c
-26
+32
 WString
 4
 COBJ
-27
+33
 WVList
 0
-28
+34
 WVList
 0
 17