Announcement

Collapse
No announcement yet.

Adding condump to Quake engine

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding condump to Quake engine

    "condump" is a command that dumps the console text to a file, it first appeared in Quake 2 but was (to my knowledge) never added to any Quake engine so I decided to make it myself. Now that I got it working I thought I could share it, so here's how to do it:

    Open console.c and put this function in it:
    Code:
    /*
    ================
    Con_Dump_f
    
    From Quake 2, modified by RocketGuy to be Quake 1 compatible. 
    Save the console contents out to a file
    ================
    */
    void Con_Dump_f (void)
    {
    	int		l, x;
    	char	*line;
    	FILE	*f;
    	char	buffer[1024];
    	char    *n;
        
    	n = Cmd_Args();
    	if (n == "")
    	{
    		Con_Printf ("usage: condump <filename>\n");
    		return;
    	}
    
    	Con_Printf ("Dumped console text to %s/%s.%s\n", com_gamedir, n, "txt");
    	f = fopen(va("%s/%s.%s", com_gamedir, n, "txt"), "w");
    	if (!f)
    	{
    		Con_Printf ("ERROR: couldn't open.\n");
    		return;
    	}
    
    	// skip empty lines
    	for (l = con_current - con_totallines + 1 ; l <= con_current ; l++)
    	{
    		line = con_text + (l%con_totallines)*con_linewidth;
    		for (x=0 ; x<con_linewidth ; x++)
    			if (line[x] != ' ')
    				break;
    		if (x != con_linewidth)
    			break;
    	}
    
    	// write the remaining lines
    	buffer[con_linewidth] = 0;
    	for ( ; l <= con_current ; l++)
    	{
    		line = con_text + (l%con_totallines)*con_linewidth;
    		strncpy (buffer, line, con_linewidth);
    		for (x=con_linewidth-1 ; x>=0 ; x--)
    		{
    			if (buffer[x] == ' ')
    				buffer[x] = 0;
    			else
    				break;
    		}
    		for (x=0; buffer[x]; x++)
    			buffer[x] &= 0x7f;
    
    		fprintf (f, "%s\n", buffer);
    	}
    
    	fclose (f);
    }
    And put this in Con_Init function in console.c:
    Code:
    Cmd_AddCommand ("condump", Con_Dump_f);
    That's it! Run Quake and try it.
    I've tested this to work with QRACK and ProQuake.

  • #2
    Looks great RocketGuy, I know I once I asked for that feature in some different engines and was told it couldn't be done. I hope that gets added to the official releases of some of the active engines.
    Last edited by Baker; 05-14-2006, 08:55 AM.
    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

    Comment


    • #3
      Originally posted by Baker
      I know I once I asked for that features in some different engines and was told it couldn't be done.
      Sukers...
      This can still be messed up by names that contain / or \.

      Comment


      • #4
        Or you could just run quake.exe -condebug
        Inside3d - Because you can't be Outside 3D!

        Comment


        • #5
          Originally posted by scar3crow
          Or you could just run quake.exe -condebug
          i'm too lazy to do that, why do you think i made this?

          Comment


          • #6
            Because you have an inferior sense of laziness? Since that takes less effort really. That and most condumps only export the consoles current buffer...

            Eh, just seems silly to me - enabling -condebug by default would be better. Then just have a -nocondebug if you dont want it.
            Inside3d - Because you can't be Outside 3D!

            Comment


            • #7
              Originally posted by scar3crow
              Most condumps only export the consoles current buffer...
              well i usually use condump to save something that has been printed in console recently (like an email address).

              Comment


              • #8
                Ah
                I use it more for entity coordinates and loading information, to show what was going on at the time of an event, things like that.

                For an email I just write it down on a piece of paper nearby.
                Inside3d - Because you can't be Outside 3D!

                Comment


                • #9
                  i don't keep any paper here because i'm printerless right now.

                  Comment


                  • #10
                    Bank receipt with ip addresses all over it right here.

                    Then again I have a messy station...

                    For email addresses I just remember them, or alt tab over and type them into notepad. However most clients dont properly restore video after alt tabbing, which is another reason why I use DarkPlaces.
                    Inside3d - Because you can't be Outside 3D!

                    Comment


                    • #11
                      Originally posted by scar3crow
                      Most clients dont properly restore video after alt tabbing, which is another reason why I use DarkPlaces.
                      Qrack does.

                      Comment


                      • #12
                        Not on my machine. Not even when I tell it to do vid_restart.
                        Inside3d - Because you can't be Outside 3D!

                        Comment


                        • #13
                          Try using the desktop resolution settings (width, height and refresh rate).

                          Comment


                          • #14
                            I had alt-tabbing issues with all quake engines when I had an ati card. Ati has crap open gl support, so I got a geforce 4ti 4200. Cheap and fast and never any issues with alt-tabbing at any res.
                            uakene.com

                            Comment


                            • #15
                              Yeah I have Nvidia too.

                              Comment

                              Working...
                              X