Compiling a "Windows Console" version

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dean Anderson
    Adept
    • Nov 2009
    • 193

    #16
    Originally posted by konijn_
    Sure,


    Its in the root folder.
    That is one of the other zip files which is not part of the 'newest files', so its not obvious you need this zip file as well.

    T.
    Thanks

    I downloaded that and messed about with the files, but ended up with more linker errors than I started with.

    So I just gave up in the end, ditched 'main-gcu.c', and wrote my own 'main-wcn.c' from scratch (well, from 'main-xxx.c' to be precise) that bypasses Curses completely and uses native Win32 Console code.

    It works like a treat, and it's far more straightforward!

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #17
      Originally posted by Dean Anderson
      Thanks

      I downloaded that and messed about with the files, but ended up with more linker errors than I started with.

      So I just gave up in the end, ditched 'main-gcu.c', and wrote my own 'main-wcn.c' from scratch (well, from 'main-xxx.c' to be precise) that bypasses Curses completely and uses native Win32 Console code.

      It works like a treat, and it's far more straightforward!
      If you'd be happy to release that under the GPL, I'm sure Takkaria would welcome it into the codebase ...
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • konijn_
        Hellband maintainer
        • Jul 2007
        • 367

        #18
        Originally posted by Dean Anderson
        Thanks

        I downloaded that and messed about with the files, but ended up with more linker errors than I started with.

        So I just gave up in the end, ditched 'main-gcu.c', and wrote my own 'main-wcn.c' from scratch (well, from 'main-xxx.c' to be precise) that bypasses Curses completely and uses native Win32 Console code.

        It works like a treat, and it's far more straightforward!
        Does it support big screen or resizable screen ?

        T.
        * Are you ready for something else ? Hellband 0.8.8 is out! *

        Comment

        • Dean Anderson
          Adept
          • Nov 2009
          • 193

          #19
          Originally posted by Magnate
          If you'd be happy to release that under the GPL, I'm sure Takkaria would welcome it into the codebase ...
          Fine by me.

          I need to fix a bug or too first (closing the window while on the "splash" screen or "death" screen seems to be making it try to save the game while not in a valid game state).

          Comment

          • Dean Anderson
            Adept
            • Nov 2009
            • 193

            #20
            Originally posted by konijn_
            Does it support big screen or resizable screen ?

            T.
            Resizable will be a pain - you can't make the window bigger than the console area (but why would you want to?) and making the window smaller just gives you scroll bars if it can't fit all of the console area on at once.

            Bigscreen shouldn't be too difficult providing it only makes the screen taller as opposed to wider - but I haven't looked at it yet.

            Comment

            • zaimoni
              Knight
              • Apr 2007
              • 590

              #21
              Originally posted by Dean Anderson
              Resizable will be a pain - you can't make the window bigger than the console area (but why would you want to?) and making the window smaller just gives you scroll bars if it can't fit all of the console area on at once.
              The console area can be pretty huge vertically on W2K and higher, though.
              Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
              Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
              Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

              Comment

              • Magnate
                Angband Devteam member
                • May 2007
                • 5110

                #22
                Originally posted by Dean Anderson
                Fine by me.

                I need to fix a bug or too first (closing the window while on the "splash" screen or "death" screen seems to be making it try to save the game while not in a valid game state).
                That would be excellent. If you could make a patch against svn HEAD I'll happily commit it if Takk agrees.
                "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                Comment

                • Dean Anderson
                  Adept
                  • Nov 2009
                  • 193

                  #23
                  Bumpity-bump...

                  I realise it's a year since this thread was started, but I'm back - and I have my patch.

                  No, it hasn't taken me all year to write...

                  I've attached a zip of it to this post. The zip contains a copy of my "main-wcn.c" file, and three diff files for main.c, main.h and h-basic.h. In each case, there's only two or three lines of code that have changed.

                  I've done the diffs against the 3.1.2v2 version, because that's the version I'm currently playing, and it's tested on my system (Windows 7 and VS2010).

                  For those that haven't read the thread and want clarification, it's a new "main-xxx" file that compiles Angband efficiently as a native Windows Console application rather than forcing it to mess around with third party libraries such as PDCurses.
                  Attached Files

                  Comment

                  • Magnate
                    Angband Devteam member
                    • May 2007
                    • 5110

                    #24
                    Originally posted by Dean Anderson
                    Bumpity-bump...

                    I realise it's a year since this thread was started, but I'm back - and I have my patch.

                    No, it hasn't taken me all year to write...

                    I've attached a zip of it to this post. The zip contains a copy of my "main-wcn.c" file, and three diff files for main.c, main.h and h-basic.h. In each case, there's only two or three lines of code that have changed.

                    I've done the diffs against the 3.1.2v2 version, because that's the version I'm currently playing, and it's tested on my system (Windows 7 and VS2010).

                    For those that haven't read the thread and want clarification, it's a new "main-xxx" file that compiles Angband efficiently as a native Windows Console application rather than forcing it to mess around with third party libraries such as PDCurses.
                    Well, many thanks for the efforts. Unfortunately the code internals have changed significantly since 3.1.2v2 so it might be quite difficult to apply this, but I'll pass it to someone better qualified than me to attempt it.
                    "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                    Comment

                    • Dean Anderson
                      Adept
                      • Nov 2009
                      • 193

                      #25
                      Originally posted by Magnate
                      Well, many thanks for the efforts. Unfortunately the code internals have changed significantly since 3.1.2v2 so it might be quite difficult to apply this, but I'll pass it to someone better qualified than me to attempt it.
                      I'd be surprised if the code changes from 3.1.2v2 to the current nightly builds have been that extensive - the "main-xxx" template that this is based on hasn't changed significantly since the Ben Harrison days back in the '90s, and didn't change at all between 3.0.9 and 3.1.2v2. We're talking about the sort of low level system routines such as "create a window", "draw a character to the screen" "translate a keypress into an ASCII character" and so forth, not high level game routines...

                      Comment

                      • Magnate
                        Angband Devteam member
                        • May 2007
                        • 5110

                        #26
                        Originally posted by Dean Anderson
                        I'd be surprised if the code changes from 3.1.2v2 to the current nightly builds have been that extensive - the "main-xxx" template that this is based on hasn't changed significantly since the Ben Harrison days back in the '90s, and didn't change at all between 3.0.9 and 3.1.2v2. We're talking about the sort of low level system routines such as "create a window", "draw a character to the screen" "translate a keypress into an ASCII character" and so forth, not high level game routines...
                        Yes, you're probably right - fizzix is in #angband-dev testing it now ...
                        "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

                        Comment

                        • fizzix
                          Prophet
                          • Aug 2009
                          • 3025

                          #27
                          Originally posted by Dean Anderson
                          I'd be surprised if the code changes from 3.1.2v2 to the current nightly builds have been that extensive - the "main-xxx" template that this is based on hasn't changed significantly since the Ben Harrison days back in the '90s, and didn't change at all between 3.0.9 and 3.1.2v2. We're talking about the sort of low level system routines such as "create a window", "draw a character to the screen" "translate a keypress into an ASCII character" and so forth, not high level game routines...
                          tried compiling with the current nightly builds and your code and got the following error:

                          undefined reference to `WinMain@16' in main.c

                          In order to compile, a made a Makefile-wcn and changed main-win.o to main-wcn.o after applying the patches.

                          edit: I'm attempting to compile on XP using MingW if that makes a difference.
                          Last edited by fizzix; December 2, 2010, 19:19.

                          Comment

                          • Dean Anderson
                            Adept
                            • Nov 2009
                            • 193

                            #28
                            Originally posted by fizzix
                            tried compiling with the current nightly builds and your code and got the following error:

                            undefined reference to `WinMain@16' in main.c
                            That's strange. The 3.1.2v2 version of main.c contains no mention of "WinMain"; and I wouldn't expect the nightly build version of main.c to either - that's a Win32 specific function that I'd expect to find in main-win.c, not in main.c (which I'd expect to still be platform-neutral).

                            Unlike main-win.c, main-wcn.c has no custom "main" function of its own, and uses the generic one found in main.c.

                            This error may be due to you including both main-win.c and main-wcn.c (see below).

                            In order to compile, a made a Makefile-wcn and changed main-win.o to main-wcn.o after applying the patches.
                            I don't use makefiles; I use Visual Studio.

                            Having said that, renaming the file shouldn't be necessary because there shouldn't be a main-win.o to rename.

                            You should be including main-wcn.c instead of main-win.c, not as well as main-win.c.

                            Comment

                            • fizzix
                              Prophet
                              • Aug 2009
                              • 3025

                              #29
                              Originally posted by Dean Anderson
                              I don't use makefiles; I use Visual Studio.

                              Having said that, renaming the file shouldn't be necessary because there shouldn't be a main-win.o to rename.

                              You should be including main-wcn.c instead of main-win.c, not as well as main-win.c.
                              Yes. I wasn't clear with what I did. Where the makefile said to refer to main-win.o I changed it to main-wcn.o. When compiling it makes a main-wcn.o but does not make a main-win.o

                              I verified that the version I downloaded compiles properly with main-win.c

                              Comment

                              • Dean Anderson
                                Adept
                                • Nov 2009
                                • 193

                                #30
                                So does that mean you've managed to get it to work now?

                                In the Visual Stuido IDE, I compile it with:

                                1) The compiler constant USE_WCN defined
                                2) The compiler constant WINDOWS defined
                                3) main-wcn.c included, but not any of the other main-xxx.c files

                                I wouldn't know how to create a makefile to do that, though.

                                Comment

                                Working...
                                😀
                                😂
                                🥰
                                😘
                                🤢
                                😎
                                😞
                                😡
                                👍
                                👎