Changeset - r818:cfc42440f301
[Not reviewed]
master
0 2 0
truelight - 20 years ago 2004-12-28 12:11:34
truelight@openttd.org
(svn r1289) -Fix: Minor fix for OS/2 message boxes (orudge)
2 files changed with 33 insertions and 7 deletions:
0 comments (0 inline, 0 general)
docs/Readme_OS2.txt
Show inline comments
 
@@ -7,24 +7,27 @@ or other platforms: the main issues you 
 
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 a newer version of SDL is now available at
 
ftp://ftp.netlabs.org/pub/sdl/sdl-dev-os2-2004-12-22.zip which may
 
help solve some problems).
 
 
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.
 
@@ -78,26 +81,27 @@ The following libraries are required. To
 
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
 
 
- 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.
 
  For 0.3.5, 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 20041222 is
 
  out now, which is recommended for stability updates.
 
 
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 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
os2.c
Show inline comments
 
@@ -2,26 +2,26 @@
 
#include "ttd.h"
 
#include "table/strings.h"
 
#include "hal.h"
 

	
 
#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
 
#define INCL_WIN
 

	
 
#include <os2.h>
 
#include <os2me.h>
 

	
 
#if defined(WITH_SDL)
 
#include <SDL.h>
 
#endif
 

	
 
static char *_fios_path;
 
static char *_fios_save_path;
 
static char *_fios_scn_path;
 
static FiosItem *_fios_items;
 
@@ -472,33 +472,56 @@ int GetLanguageList(char **languages, in
 
}
 

	
 
static void ChangeWorkingDirectory(char *exe)
 
{
 
	char *s = strrchr(exe, '\\');
 
	if (s != NULL) {
 
		*s = 0;
 
		chdir(exe);
 
		*s = '\\';
 
	}
 
}
 

	
 
// for some reason these calls don't actually work properly :/
 
void ShowInfo(const char *str)
 
{
 
	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
 
	HAB hab;
 
	HMQ hmq;
 
	ULONG rc;
 
   
 
	// init PM env.
 
	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
 

	
 
	// display the box
 
	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
 

	
 
	// terminate PM env.
 
	WinDestroyMsgQueue(hmq);
 
	WinTerminate(hab);
 
}
 

	
 
void ShowOSErrorBox(const char *buf)
 
{
 
	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_ERROR);
 
	HAB hab;
 
	HMQ hmq;
 
	ULONG rc;
 
   
 
	// init PM env.
 
	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
 

	
 
	// display the box
 
	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
 

	
 
	// terminate PM env.
 
	WinDestroyMsgQueue(hmq);
 
	WinTerminate(hab);
 
}
 

	
 
int CDECL main(int argc, char* argv[])
 
{
 
	// change the working directory to enable doubleclicking in UIs
 
	ChangeWorkingDirectory(argv[0]);
 

	
 
	_random_seeds[0][1] = _random_seeds[0][0] = time(NULL);
 

	
 

	
 
	return ttd_main(argc, argv);
 
}
 
@@ -579,25 +602,24 @@ void DeterminePaths()
 

	
 
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];
0 comments (0 inline, 0 general)