.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
Re: very simple debugging question (MSVC)
Old
  (#11)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: very simple debugging question (MSVC) - 26-01-2004

is it possible to debug bot on non-dedicated server ?


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#12)
Lazy
Member
 
Lazy's Avatar
 
Status: Offline
Posts: 236
Join Date: Jan 2004
Location: Toronto, Ontario, Canada
Default Re: very simple debugging question (MSVC) - 26-01-2004

Yes, it works the same way except you can step through your code without timing out.
With steam its a little different though and I can't remember how exactly to do it.
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#13)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: very simple debugging question (MSVC) - 26-01-2004

There is, however, an internal check inside the Counter-Strike client.dll that will make the game simply exit if a debugger is detected in the system. Using the normal Counter-Strike client.dll it is NOT possible to debug your bot inside a listenserver.

What you can do however, is debug a DEDICATED server, then connect to it using the loopback connection :

hl.exe -dev -console +connect 127.0.0.1:27015

this command line will make HL connect to the HLDS server that is running on your OWN machine (this way you will be able to debug your bot while you are playing the game).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#14)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: very simple debugging question (MSVC) - 04-09-2004

Sorry to revive old thread, but I've found way how to debug without hlds

Quote:
Originally Posted by Pierre-Marie Baty
There is, however, an internal check inside the Counter-Strike client.dll that will make the game simply exit if a debugger is detected in the system. Using the normal Counter-Strike client.dll it is NOT possible to debug your bot inside a listenserver.
So client.dll is causing trouble ? Well ... I deleted it . And guess what. Counter-strike ran in debugger, only difference was that I could not join as player, I could only spectate (this is obvious, there is no client dll hehehe). I have CS 1.5. (I set debugger to call c:\sierra\half-life\hl.exe -dev -debug -console -game cstrike +deathmatch 1 +map de_aztec +maxplayers 15 -sw +sv_lan 1)

*edit* well I haven't spawned a bot yet, I wonder if they could spawn if ther is no client.dll, damn.

*edit2* Oh well, they spawn but they don't join Damn this client.dll. At least I can debug something.

BTW is cs client 1.6 with steam terminating if it detect debugger too ? Do you have to debug hlds.exe or you can debug hl.exe ?


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)

Last edited by koraX; 04-09-2004 at 10:35..
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#15)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: very simple debugging question (MSVC) - 04-09-2004

I think Count Floyd has a patched version of CS 1.3 which has that debugger check removed. You can find a version of CS 1.3 and take a look at the RACC install program source code for the patch. PMB has included it.

Also Cs 1.6 doesn't have debugger check code.
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#16)
koraX
Member
 
koraX's Avatar
 
Status: Offline
Posts: 145
Join Date: Jan 2004
Location: Slovak Republic
Default Re: very simple debugging question (MSVC) - 04-09-2004

I've found it
Code:
	FILE *fp,*fp2;

      fp = fopen ("client.dll", "rb+"); // opens CLIENT.DLL file readonly
      if (fp != NULL)
      {
         fp2 = fopen ("client.bak", "wb"); // opens backup file for writing
         if (fp2 != NULL)
         {
            int c, count = 0;

            // get the size of the CLIENT.DLL file
            while ((c = fgetc (fp)) != EOF)
               count++;

            //  if it differs from the CS 1.3 original DLL size
/*            if (count != 655360)
            {
               printf ("CLIENT.DLL is not the genuine Counter-Strike 1.3 DLL. Patch cancelled.\n");
               return -1; // don't allow it to be patched
            }
*/
            rewind (fp); // return back to beginning of file
            while ((c = fgetc (fp)) != EOF)
               fputc (c, fp2); // duplicate client.dll to client.bak

            fclose (fp2); // close backup file

            fseek (fp, 191620L, SEEK_SET); // seek at the start of patch offset
            fputc (0x2B, fp); // actually patch client.dll (at offset 191620)
            fclose (fp); // close patched file

            printf ("Counter-Strike's CLIENT.DLL has been successfully patched.\n");
         }
      }
      else
         printf ("CLIENT.DLL not found in ../cstrike/cl_dlls. Patch cancelled.\n");

      return 0; // end of processing
but it does not work in CS 1.5. It crashes. Of course size of client.dll is different than 1.3. If only somebody would know the position of 'patch offset' in cs 1.5 ...


kXBot
koraX's utils
- see my homepage for other projects (OpenGL CSG Editor, FAT16 Sim, NNetwork Sim, ...)

Last edited by koraX; 04-09-2004 at 14:08..
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#17)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: very simple debugging question (MSVC) - 04-09-2004

Well, that's an easy problem to solve.

Download CS 1.3, rename it from .dll to .xxx and open it in the MS-DOS debugger. Look at the instruction at address 191620 (0x2EC84 in hex). You can just write down the 5 or 6 bytes at and after that location.

Then copy the CS 1.5 client.dll to "client.xxx" and load it in the MS-DOS debugger. Do a search for those same 5 (or 6) bytes. Do a disassembly at the address(es) displayed and see if they match up with the ones from CS 1.3.

When you find a match, modify the above source code to use the proper offset instead of 191620L.

P.S. If you don't know how to use the MS-DOS debugger, try searching on google.com for "ms-dos debug" or something similar.

botman
  
Reply With Quote
Re: very simple debugging question (MSVC)
Old
  (#18)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: very simple debugging question (MSVC) - 05-09-2004

Quote:
Originally Posted by botman
Well, that's an easy problem to solve.

Download CS 1.3, rename it from .dll to .xxx and open it in the MS-DOS debugger. Look at the instruction at address 191620 (0x2EC84 in hex). You can just write down the 5 or 6 bytes at and after that location.

Then copy the CS 1.5 client.dll to "client.xxx" and load it in the MS-DOS debugger. Do a search for those same 5 (or 6) bytes. Do a disassembly at the address(es) displayed and see if they match up with the ones from CS 1.3.

When you find a match, modify the above source code to use the proper offset instead of 191620L.

P.S. If you don't know how to use the MS-DOS debugger, try searching on google.com for "ms-dos debug" or something similar.

botman
That won't work. If you open the CS 1.5 or 1.6 client.dll you'll find it isn't DLL at all. Valve just encrypted it.

However CS 1.3 client dll does work with CS 1.5 mp.dll (although there are some weird problems with spectating).

Last edited by Whistler; 05-09-2004 at 07:42..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com