os2.c
changeset 818 546a7894f312
parent 810 a1494b19bd2a
child 915 d845fe7cf6f2
equal deleted inserted replaced
817:238bbdaa228b 818:546a7894f312
     9 #include <stdarg.h>
     9 #include <stdarg.h>
    10 #include <time.h>
    10 #include <time.h>
    11 #include <dos.h>
    11 #include <dos.h>
    12 
    12 
    13 #define INCL_DOS
    13 #define INCL_DOS
    14 #define INCL_WINDIALOGS
       
    15 #define INCL_OS2MM
    14 #define INCL_OS2MM
       
    15 #define INCL_WIN
    16 
    16 
    17 #include <os2.h>
    17 #include <os2.h>
    18 #include <os2me.h>
    18 #include <os2me.h>
    19 
    19 
    20 #if defined(WITH_SDL)
    20 #if defined(WITH_SDL)
   479 		chdir(exe);
   479 		chdir(exe);
   480 		*s = '\\';
   480 		*s = '\\';
   481 	}
   481 	}
   482 }
   482 }
   483 
   483 
   484 // for some reason these calls don't actually work properly :/
       
   485 void ShowInfo(const char *str)
   484 void ShowInfo(const char *str)
   486 {
   485 {
   487 	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
   486 	HAB hab;
       
   487 	HMQ hmq;
       
   488 	ULONG rc;
       
   489    
       
   490 	// init PM env.
       
   491 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
       
   492 
       
   493 	// display the box
       
   494 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_INFORMATION);
       
   495 
       
   496 	// terminate PM env.
       
   497 	WinDestroyMsgQueue(hmq);
       
   498 	WinTerminate(hab);
   488 }
   499 }
   489 
   500 
   490 void ShowOSErrorBox(const char *buf)
   501 void ShowOSErrorBox(const char *buf)
   491 {
   502 {
   492 	WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_SYSTEMMODAL | MB_MOVEABLE | MB_ERROR);
   503 	HAB hab;
       
   504 	HMQ hmq;
       
   505 	ULONG rc;
       
   506    
       
   507 	// init PM env.
       
   508 	hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);
       
   509 
       
   510 	// display the box
       
   511 	rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, buf, "OpenTTD", 0, MB_OK | MB_MOVEABLE | MB_ERROR);
       
   512 
       
   513 	// terminate PM env.
       
   514 	WinDestroyMsgQueue(hmq);
       
   515 	WinTerminate(hab);
   493 }
   516 }
   494 
   517 
   495 int CDECL main(int argc, char* argv[])
   518 int CDECL main(int argc, char* argv[])
   496 {
   519 {
   497 	// change the working directory to enable doubleclicking in UIs
   520 	// change the working directory to enable doubleclicking in UIs
   586 
   609 
   587 	// Change flag from PM to VIO
   610 	// Change flag from PM to VIO
   588 	pib->pib_ultype = 3;
   611 	pib->pib_ultype = 3;
   589 }
   612 }
   590 
   613 
   591 
       
   592 /**********************
   614 /**********************
   593  * OS/2 MIDI PLAYER
   615  * OS/2 MIDI PLAYER
   594  **********************/
   616  **********************/
   595 
   617 
   596 /* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API,
   618 /* Interesting how similar the MCI API in OS/2 is to the Win32 MCI API,