Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

NodeBB

  1. Home
  2. uncategorized
  3. ```

```

Scheduled Pinned Locked Moved uncategorized
9 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • a1ba@suya.placeA This user is from outside of this forum
    a1ba@suya.placeA This user is from outside of this forum
    a1ba@suya.place
    wrote on last edited by
    #1
    ```
    fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);

    nostdout = Cvar_Get("nostdout", "0", 0);
    if (!nostdout->value) {
    fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
    }
    ```

    I'm thinking about this piece of code present in Quake 2 but not in Quake III too much.

    What did they wanted to say...
    ttimo@mastodon.socialT 1 Reply Last reply
    0
    • a1ba@suya.placeA a1ba@suya.place
      ```
      fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);

      nostdout = Cvar_Get("nostdout", "0", 0);
      if (!nostdout->value) {
      fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
      }
      ```

      I'm thinking about this piece of code present in Quake 2 but not in Quake III too much.

      What did they wanted to say...
      ttimo@mastodon.socialT This user is from outside of this forum
      ttimo@mastodon.socialT This user is from outside of this forum
      ttimo@mastodon.social
      wrote on last edited by
      #2

      @a1ba most interesting! And I assume there is no good version of this in quake 1 either? But it can be found in common code?

      ttimo@mastodon.socialT 1 Reply Last reply
      0
      • ttimo@mastodon.socialT ttimo@mastodon.social

        @a1ba most interesting! And I assume there is no good version of this in quake 1 either? But it can be found in common code?

        ttimo@mastodon.socialT This user is from outside of this forum
        ttimo@mastodon.socialT This user is from outside of this forum
        ttimo@mastodon.social
        wrote on last edited by
        #3

        @a1ba so someone goofed of course, but maybe the original version was meant to either close stdout (redirect to /dev/null), or put stdin into non blocking to essentially make a console out of your terminal.

        ttimo@mastodon.socialT ? 2 Replies Last reply
        0
        • ttimo@mastodon.socialT ttimo@mastodon.social

          @a1ba so someone goofed of course, but maybe the original version was meant to either close stdout (redirect to /dev/null), or put stdin into non blocking to essentially make a console out of your terminal.

          ttimo@mastodon.socialT This user is from outside of this forum
          ttimo@mastodon.socialT This user is from outside of this forum
          ttimo@mastodon.social
          wrote on last edited by
          #4

          @a1ba the quake 3 code had a lot of goofy stuff and sharp edges, when id passed it over to me I spent the first few months cleaning up compiler warnings.

          It was a good way to familiarize with it, but I don't remember running into this.

          ? 1 Reply Last reply
          0
          • ttimo@mastodon.socialT ttimo@mastodon.social

            @a1ba so someone goofed of course, but maybe the original version was meant to either close stdout (redirect to /dev/null), or put stdin into non blocking to essentially make a console out of your terminal.

            ? Offline
            ? Offline
            Guest
            wrote on last edited by
            #5

            @TTimo @a1ba
            https://github.com/TTimo/doom3.gpl/blob/master/neo/sys/posix/posix_main.cpp#L582-L587
            looks kinda similar, except it correctly uses O_NONBLOCK (and STDIN_FILENO instead of 0, but STDIN_FILENO *is* 0)

            However, at least on Linux, FNDELAY is defined as O_NDELAY, which is defined as.. O_NONBLOCK
            so in the end that code does the same 🙂

            (except for the redundancy of calling that and then calling it again if the nostdout is set to 0)

            ttimo@mastodon.socialT 1 Reply Last reply
            0
            • ttimo@mastodon.socialT ttimo@mastodon.social

              @a1ba the quake 3 code had a lot of goofy stuff and sharp edges, when id passed it over to me I spent the first few months cleaning up compiler warnings.

              It was a good way to familiarize with it, but I don't remember running into this.

              ? Offline
              ? Offline
              Guest
              wrote on last edited by
              #6

              @TTimo @a1ba
              > I spent the first few months cleaning up compiler warnings

              the universal experience of throwing code written in Visual Studio at a real compiler 😄

              1 Reply Last reply
              0
              • ? Guest

                @TTimo @a1ba
                https://github.com/TTimo/doom3.gpl/blob/master/neo/sys/posix/posix_main.cpp#L582-L587
                looks kinda similar, except it correctly uses O_NONBLOCK (and STDIN_FILENO instead of 0, but STDIN_FILENO *is* 0)

                However, at least on Linux, FNDELAY is defined as O_NDELAY, which is defined as.. O_NONBLOCK
                so in the end that code does the same 🙂

                (except for the redundancy of calling that and then calling it again if the nostdout is set to 0)

                ttimo@mastodon.socialT This user is from outside of this forum
                ttimo@mastodon.socialT This user is from outside of this forum
                ttimo@mastodon.social
                wrote on last edited by
                #7

                @Doomed_Daniel @a1ba that part looks more like code I may have written, the quake 1 / 2 era stuff is an older C dialect, typically how JDC would write it.

                But yeah that all matches with the idea that it was for tty mode.

                ttimo@mastodon.socialT 1 Reply Last reply
                0
                • ttimo@mastodon.socialT ttimo@mastodon.social

                  @Doomed_Daniel @a1ba that part looks more like code I may have written, the quake 1 / 2 era stuff is an older C dialect, typically how JDC would write it.

                  But yeah that all matches with the idea that it was for tty mode.

                  ttimo@mastodon.socialT This user is from outside of this forum
                  ttimo@mastodon.socialT This user is from outside of this forum
                  ttimo@mastodon.social
                  wrote on last edited by
                  #8

                  @Doomed_Daniel @a1ba when we worked on Doom3 I was the one to refactor the low level code into Sys_ Win_ Posix_ etc. functions.

                  It turned out way better than a mess of ifdefs inside one 'portable' function declaration imo.

                  a1ba@suya.placeA 1 Reply Last reply
                  0
                  • a1ba@suya.placeA a1ba@suya.place shared this topic
                  • ttimo@mastodon.socialT ttimo@mastodon.social

                    @Doomed_Daniel @a1ba when we worked on Doom3 I was the one to refactor the low level code into Sys_ Win_ Posix_ etc. functions.

                    It turned out way better than a mess of ifdefs inside one 'portable' function declaration imo.

                    a1ba@suya.placeA This user is from outside of this forum
                    a1ba@suya.placeA This user is from outside of this forum
                    a1ba@suya.place
                    wrote last edited by
                    #9
                    @TTimo @Doomed_Daniel speaking of doom3, it's interesting how some tiny part of it ended up in RTCW (there is idLib folder at least) but RTCW itself also has bits that were removed in Q3 by the time it hit public release.
                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Login or register to search.
                    Powered by NodeBB Contributors
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups