Morphing a PM app into a VIO app? - OS2

This is a discussion on Morphing a PM app into a VIO app? - OS2 ; Hi, I'm relatively new to OS/2 programming, and am porting a game, OpenTTD ( www.openttd.com ) to OS/2. An initial release is available from the Downloads section if you'd like to try it out, although there are some bugs with ...

+ Reply to Thread
Results 1 to 14 of 14

Thread: Morphing a PM app into a VIO app?

  1. Morphing a PM app into a VIO app?

    Hi,

    I'm relatively new to OS/2 programming, and am porting a game, OpenTTD
    (www.openttd.com) to OS/2. An initial release is available from the
    Downloads section if you'd like to try it out, although there are some bugs
    with that version. Anyway, this game is built as a PM app, but I'd like to
    be able to open a VIO console window for it to morph into when started as a
    dedicated server. I know you can morph a VIO app into a PM app with
    DosGetInfoBlocks, but is it possible to do the opposite? I tried setting
    pib_ultype to 2, but it seemed to have no effect.

    Thanks for your help!

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  2. Re: Morphing a PM app into a VIO app?

    On Sat, 25 Dec 2004 22:33:21 -0000, Owen Rudge wrote:

    Hey Owen,

    >I'm relatively new to OS/2 programming, and am porting a game, OpenTTD
    >(www.openttd.com) to OS/2. An initial release is available from the
    >Downloads section if you'd like to try it out, although there are some bugs
    >with that version. Anyway, this game is built as a PM app, but I'd like to


    sorry I can't answer your question but I just wanted to say thank you for
    porting OpenTTD, looking forward to it. I tried to run it but it does not
    even start on my system, I don't get an error message or anything, it just
    directly quits.

    cu

    Adrian

    --
    Adrian Gschwend
    netlabs.org

    ktk@netlabs.org
    -------
    The OS/2 OpenSource Project:
    http://www.netlabs.org



  3. Re: Morphing a PM app into a VIO app?

    On Sat, 25 Dec 2004 22:33:21 UTC, "Owen Rudge" wrote:

    > I'm relatively new to OS/2 programming, and am porting a game, OpenTTD
    > (www.openttd.com) to OS/2. An initial release is available from the
    > Downloads section if you'd like to try it out, although there are some bugs
    > with that version. Anyway, this game is built as a PM app, but I'd like to
    > be able to open a VIO console window for it to morph into when started as a
    > dedicated server. I know you can morph a VIO app into a PM app with
    > DosGetInfoBlocks, but is it possible to do the opposite? I tried setting
    > pib_ultype to 2, but it seemed to have no effect.


    Few things are easier :-) All my recent stuff is built like this:

    - Call the Morph() function (below) as the very first thing in main().
    - Link your app as a standard PM app (i.e. /PM:PM).
    - Start your app either with this command line:
    start /n /win myapp.exe
    or use my Run! util:
    rename run!.exe as myapp!v.exe, then execute myapp!v.exe.

    This method gives you a console window only when you tell the system
    to start your program as a VIO app. When started normally, it's just
    another PM app. Alternatively, you could link as a VIO app (/PM:VIO)
    and always get the console. A minor benefit of linking as PM is that
    the exe will display your icon.


    /************************************************** ******************/

    // enable this program to use PM functions
    // even if it was linked or started as a VIO app

    void Morph( void)

    {
    PPIB ppib;
    PTIB ptib;

    DosGetInfoBlocks( &ptib, &ppib);
    ppib->pib_ultype = 3;
    return;
    }

    /************************************************** ******************/


    --
    == == almost usable email address: rws AT e-vertise.com == ==
    __________________________________________________ _________________
    |
    | New - Remote Workplace Server v0.60
    Rich Walsh | interact with the WPS from any program
    Ft Myers, FL | http://e-vertise.com/rws/rws060.zip
    __________________________________________________ _________________

  4. Re: Morphing a PM app into a VIO app?

    > sorry I can't answer your question but I just wanted to say thank you for
    > porting OpenTTD, looking forward to it. I tried to run it but it does not
    > even start on my system, I don't get an error message or anything, it just
    > directly quits.


    Try running:

    openttd -d3 > stdout.txt 2> stderr.txt

    and check the content of the text files. The problem is likely related to
    SDL.

    I'll release an updated version of OpenTTD in the morning with keyboard
    input support and full working multiplayer support!

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  5. Re: Morphing a PM app into a VIO app?

    > - Call the Morph() function (below) as the very first thing in main().
    > - Link your app as a standard PM app (i.e. /PM:PM).
    > - Start your app either with this command line:
    > start /n /win myapp.exe


    Thanks very much Rich, that did the trick! A small cmd file to launch a
    dedicated server will also be included in the new update tomorrow. ;-)

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  6. Re: Morphing a PM app into a VIO app?

    On Sun, 26 Dec 2004 03:12:00 -0000, Owen Rudge wrote:

    >Try running:
    >
    >openttd -d3 > stdout.txt 2> stderr.txt
    >
    >and check the content of the text files. The problem is likely related to
    >SDL.


    ok will check that

    >I'll release an updated version of OpenTTD in the morning with keyboard
    >input support and full working multiplayer support!


    excellent! I'm looking forward to that

    cu

    Adrian

    --
    Adrian Gschwend
    netlabs.org

    ktk@netlabs.org
    -------
    The OS/2 OpenSource Project:
    http://www.netlabs.org



  7. Re: Morphing a PM app into a VIO app?

    > ok will check that

    Oh, do you have the original game data files, ideally from the Windows
    version of the game? If you don't, you can find out how to get them at
    www.tt-forums.net - while free replacement graphics are underway, it'll be
    some time until they're complete.

    > excellent! I'm looking forward to that


    I'm just fixing a few other OS/2-specific bugs and then I'll make a
    release - expect one by tonight. :-)

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  8. Re: Morphing a PM app into a VIO app?

    OK, I have released an update to OpenTTD 0.3.5 at
    http://sf.net/projects/openttd/ for anyone interested, featuring working
    networking, proper keyboard input support, a working file selector, and
    other updates. Hopefully, the OS/2 port should now be equal (if not better
    ) than the other ports... let me know how you get on! Remember to read
    both readme.txt and readme_os2.txt before trying to use this, and ensure you
    have a copy of the original data files - see www.tt-forums.net for more
    information.

    Have fun!

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  9. OpenTTD not running (was: Morphing a PM app into a VIO app?)

    On Mon, 27 Dec 2004 14:32:14 UTC, "Owen Rudge" wrote:

    > OK, I have released an update to OpenTTD 0.3.5 at
    > http://sf.net/projects/openttd/ for anyone interested, featuring working
    > networking, proper keyboard input support, a working file selector, and
    > other updates. Hopefully, the OS/2 port should now be equal (if not better
    > ) than the other ports... let me know how you get on! Remember to read
    > both readme.txt and readme_os2.txt before trying to use this, and ensure you
    > have a copy of the original data files - see www.tt-forums.net for more
    > information.


    Got curious, downloaded and tried, but I just get a beep and openttd
    quits. Running
    openttd -d3 > stdout.txt 2> stderr.txt
    I get this in stderr.txt:
    dbg: #Elements 22; #Terminals 2 in 1 group(s); #Helipads 0 in 0 group(s)
    dbg: #Elements 25; #Terminals 3 in 1 group(s); #Helipads 0 in 0 group(s)
    dbg: #Elements 27; #Terminals 3 in 1 group(s); #Helipads 0 in 0 group(s)
    dbg: #Elements 51; #Terminals 6 in 2 group(s); #Helipads 2 in 1 group(s)
    dbg: #Elements 9; #Terminals 0 in 0 group(s); #Helipads 1 in 1 group(s)
    dbg: Loading sound effects...
    ABNORMAL TERMINATION
    MMOS2 is installed and works fine otherwise...

    Hmm, readme.txt talks about required files from the original game (which
    of course I do not have). Should I understand this in that that I need
    the original game to play the clone? What then is the open source clone
    good for?! It seems I am missing the point... This should be more
    prominently stated somewhere before having to download.

    (Fup2 .games where this really belongs)
    --
    Greetings, Please reply in newsgroup, I rarely
    Peter. read emails to pweilba@gwdg.de...


  10. Re: OpenTTD not running (was: Morphing a PM app into a VIO app?)

    Hi,

    (crossposting due to programming issue in reply)

    > Hmm, readme.txt talks about required files from the original game (which
    > of course I do not have). Should I understand this in that that I need
    > the original game to play the clone? What then is the open source clone
    > good for?! It seems I am missing the point... This should be more
    > prominently stated somewhere before having to download.


    Well, at the moment, you do need the original data files. (It should pop up
    a message box, but for some reason, it doesn't want to - anyone any ideas
    why?:

    void ShowInfo(const char *str)
    {
    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK |
    MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
    }

    ). New, free replacement files are being worked on, but as you might
    imagine, it can be a long process. OpenTTD was originally created to enable
    people on other operating systems - other than the original Windows and
    DOS - to play the game, and then new features could be added onto it. I
    understand though that some people obviously won't have the original data
    files, but feel free to check the forums at www.tt-forums.net to see if
    there's any progress, or to see if you can find them elsewhere.

    Hope this helps clarify things!

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  11. Re: OpenTTD not running (was: Morphing a PM app into a VIO app?)

    On Mon, 27 Dec 2004 23:41:49 UTC, "Owen Rudge" wrote:

    > void ShowInfo(const char *str)
    > {
    > WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK |
    > MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
    > }


    Perhaps you need to use &str? But it's too late for me to really
    understand the Toolkit Docs...

    > New, free replacement files are being worked on, but as you might
    > imagine, it can be a long process. OpenTTD was originally created to enable
    > people on other operating systems - other than the original Windows and
    > DOS - to play the game, and then new features could be added onto it. I
    > understand though that some people obviously won't have the original data
    > files, but feel free to check the forums at www.tt-forums.net to see if
    > there's any progress, or to see if you can find them elsewhere.
    >
    > Hope this helps clarify things!


    Yes, perfectly, thanks! It was mostly just my initial disappointment
    speaking... I will definitely try to keep up with the progress, but
    unfortunately I personally feel lost very quickly in this kind of forum.
    (That's why I hang out here. :-) )
    --
    Greetings, Please reply in newsgroup, I rarely
    Peter. read emails to pweilba@gwdg.de...

  12. Re: OpenTTD not running

    In article <33bku1F3ubk44U1@individual.net>,
    "Owen Rudge" wrote:

    >Well, at the moment, you do need the original data files. (It should pop up
    >a message box, but for some reason, it doesn't want to - anyone any ideas
    >why?:
    >
    >void ShowInfo(const char *str)
    >{
    > WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, str, "OpenTTD", 0, MB_OK |
    >MB_SYSTEMMODAL | MB_MOVEABLE | MB_INFORMATION);
    >}


    the PM environment must be initialized before calling WinMessageBox :

    // init PM env.
    hmq = WinCreateMsgQueue((hab = WinInitialize(0)), 0);

    // display the box
    rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, pszText, pszTitle, 0, style);

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

    of course if PM had already been initialized the problem is elsewhere...

    besides that:

    !!!!! YOU MUST NEVER USE MB_SYSTEMMODAL FOR APPLICATION MESSAGE BOXES !!!!!

    OS/2 is not Windows 3.x ! Your application must not stop all the system
    to display a stupid error message !

    just remove that flag and the message box will be application modal
    i.e. will stop only your application.

    --
    bye
    Alessandro Cantatore
    email reply to: acantatore_at_tin_dot_it

  13. Re: OpenTTD not running

    > !!!!! YOU MUST NEVER USE MB_SYSTEMMODAL FOR APPLICATION MESSAGE BOXES
    > !!!!!


    I originally had an application modal dialog, that was just for testing to
    see if it helped make it appear, don't worry, I'll remove it before
    releasing anything. ;-)

    Thanks for your help, it's working perfectly now!

    --
    Owen Rudge
    http://www.owenrudge.net/

    MSN Messenger: owen@owenrudge.net
    ICQ: 125455765



  14. Re: Morphing a PM app into a VIO app?

    On Sun, 26 Dec 2004 13:52:57 -0000, Owen Rudge wrote:

    >Oh, do you have the original game data files, ideally from the Windows
    >version of the game? If you don't, you can find out how to get them at
    >www.tt-forums.net - while free replacement graphics are underway, it'll be
    >some time until they're complete.


    ah! That explains didn't got that correctly then, thanks for the hint.

    >I'm just fixing a few other OS/2-specific bugs and then I'll make a
    >release - expect one by tonight. :-)


    will get that and play around

    thanks

    cu

    Adrian


    --
    Adrian Gschwend
    netlabs.org

    ktk@netlabs.org
    -------
    The OS/2 OpenSource Project:
    http://www.netlabs.org



+ Reply to Thread