lfnetwork.com mark read register faq members calendar

Thread: Some strange crashes
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 06-12-2006, 01:28 PM   #1
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Some strange crashes

OK I've been experiencing some odd crashes lately. The first (If using the Debug DLL. If you use the Final DLL it just crashes) gives two Run Time warnings saying the stack around the variable "text"/"string" is courrupted. Now I looked at the lines it was complaining about and the first is in the G_Printf() function and the other is in G_LogPrintf(). I think it might be the infamous buffer overflow bug because if I increase the text/string buffer to 2000 it works OK. Is there a permananet fix for this? Secondly some of the stranger ones are: If I try and slash at a body on the ground it crashes the server for no reason and if I plant lots of Trip Mines or Det Packs and they explode it crahses the server. I have absolutley NO idea why this is happening. Could anyone enlighten me?
Dom_152 is offline   you may: quote & reply,
Old 06-12-2006, 02:16 PM   #2
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
well for 1 they made the g_printf and logprintf only 1024 for a reason because most strings or even commands for that matter should never exceed 1022 especially ones being sent via trap_SendServerCommand (ie: print, chat, cp, etc the ones handled in cg_servercmds.c)


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-12-2006, 03:03 PM   #3
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Hmm that's odd... This is where it crashes:

http://i6.tinypic.com/144beh2.jpg

I had a thought... it couldn't be because I am setting too many Cvars to CVAR_SERVERINFO and it can't handle them all in one go could it?

And also I keep getting the "Info String length exceeded" even when there's no-one on the server a lot. Is this majorly bad? If so how can it be fixed.
Dom_152 is offline   you may: quote & reply,
Old 06-12-2006, 03:38 PM   #4
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
yes, it might be.

like how many cvars are you adding?

the reason why the "Info string length exceeded" message is showing up is because this function:

Info_SetValueForKey, dont go changing it because it most likely wont help you as its used in the engine also and i think its because how big your serverinfo is.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-12-2006, 04:28 PM   #5
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Yeah i removed all the Serverinfo Cvars my Mod was using and it starts up fine. Now to fix those other two weeeeird crashes and my Mod will be crash free ^_^
Dom_152 is offline   you may: quote & reply,
Old 06-12-2006, 05:14 PM   #6
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
OK I have uploaded a small movie showing what happens when I try and slash a body. It's less than 2MB so it shouldn't take too long to D/L. You can watch it here: http://rapidshare.de/files/22897984/Mod_Crash.wmv.html
Dom_152 is offline   you may: quote & reply,
Old 06-12-2006, 05:32 PM   #7
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Heres another Movie showing the crash with Det Packs: http://rapidshare.de/files/22899316/...ash_2.wmv.html
Dom_152 is offline   you may: quote & reply,
Old 06-12-2006, 06:42 PM   #8
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
ewww why rapidshare.

no clue have you changed any of the weapon code? or any of the code in any q_* files?


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-13-2006, 03:21 AM   #9
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Sorry it was the first site I thought of. I don't think I've changed any weapon code... but I do remembr changing the GIB_HEALTH to -10 at one point abut I changed it back 'cos it's -40 again.

Last edited by Dom_152; 06-13-2006 at 12:33 PM.
Dom_152 is offline   you may: quote & reply,
Old 06-13-2006, 09:48 AM   #10
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
well that may be the prob with saber slahshing thing.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-13-2006, 10:32 AM   #11
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Ahhh but I changed it back to the original value sooo whats going on there?
Dom_152 is offline   you may: quote & reply,
Old 06-13-2006, 02:14 PM   #12
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
you used the jka universal source zip file?

maybe you should extract that somewhere and do a diff and see what exactly you changed. You don't really have to, but just a suggestion because it may help.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-13-2006, 02:58 PM   #13
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
No i used the BASE JKA SDK. And can you suggest a good Diff tool?
Dom_152 is offline   you may: quote & reply,
Old 06-13-2006, 07:48 PM   #14
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
that IS the base jka source bewb... but whatever

and not really... i use the svn one because thats what i have. or u could use winmerge which lets u compare files. use something to compare the base source you downloaded and compare it with urs.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-13-2006, 10:06 PM   #15
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Quote:
Originally Posted by Dom_152
No i used the BASE JKA SDK. And can you suggest a good Diff tool?
I like Exam Diff myself.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-13-2006, 10:11 PM   #16
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Your first crash might be caused by the body fade code.
As for the det pack crash, could it be due to the dets causing damage to each other?

What sort of changes did you make to the code?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-14-2006, 03:20 AM   #17
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
That's just it. I don't remember ever changing any code because I didn't need to. I tried changing the GIB_HEALTH as I said above but I changed it back to -40. I'll try and find the Bodt Fade code. Am I right in thinking it would be in the Body Die function?
Dom_152 is offline   you may: quote & reply,
Old 06-14-2006, 02:38 PM   #18
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Well, if you changed the gib health level, and you were attacking the body, it's possible that that's the problem.

Which compiler are you using? Can you just run it in the debugger and figure out what the problem is?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-14-2006, 02:57 PM   #19
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Using MSVC++ 2005. I'll try that but I really don't see how it could cause a problem if I changed it back to the original value! I just tried using the debugging stuff with JAMPDed Server but it can't load any PK3 files 'cos it's lookign in the wrong place... hwo can I make it look in the correct place :S


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-14-2006, 04:01 PM   #20
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
ok dokie. Under your start up project's (the bolded one in your solution explorer) property, look under Configuration Properties.

Set "Command" to your jamp.exe location. Don't use the dedicated exe directly since you can dual use jamp.exe for dedicated or local use with a simple command line arguement. Mine is D:\games\Jedi Knight Academy\GameData\jamp.exe.

Your "Command Arguments" needs to include the following (with your folder names replacing mine)...
+set fs_cdpath "d:\games\Jedi Knight Academy\GameData" +set fs_game ojpbasic +set fs_dirbeforepak 1 +set sv_pure 0

fs_cdpath tells where your real /base folder is so that it can load the primary game assets.
fs_game tells where your mod assets are and to load the mod. This is simply the name of your mod's folder.
I'm not totally sure about fs_dirbeforepak but I think it makes sure that your debugging assets override things in the .pk3s
sv_pure turns off the requirement that all your assets be inside of pk3s.

You can also add whatever command line arguements you need for your debugging. For example, there's my current one for my OJP Basic solution....
+set fs_cdpath "d:\games\Jedi Knight Academy\GameData" +set fs_game ojpbasic +set fs_dirbeforepak 1 +set sv_pure 0 +set r_fullscreen 0 +set viewlog 1 +set g_gametype 5 +map t3_rift

I'm currently debugging my CoOp gametype on t3_rift. I always use a windowed game screen (+set r_fullscreen 0) and like to see to game's console during game loading (+set viewlog 1).

Set "Working Directory" to whatever your debug folder is. Mine is D:\JKA Editing\codemp\Basic\Debug.

Finally, you'll need to set your linker for each project to output to debug/yourmodfoldername rather than simply /debug. Any additional mod assets will need to be in debug/yourmodfoldername to be found by the game.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder

Last edited by razorace; 06-14-2006 at 04:32 PM.
razorace is offline   you may: quote & reply,
Old 06-14-2006, 05:23 PM   #21
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Thank you! Oh and By the Way I tried using the OJP text wrap command for my MOTD but it does not work fully. It doesn't seem to recognise \n New Line characters :S I tried altering it slightly but it still didn't work.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-14-2006, 05:45 PM   #22
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
OK Debugging helped in no way: I got this message when the crash happened:

No symbols are loaded for any call stack frame. The source code cannot be displayed.

And that's it.. not too helpful.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-14-2006, 08:34 PM   #23
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Is your build set to debug?

Also, try looking around in your /debug folder, if you have more than one of yourmodfolder's, it means that one of your debug settings isn't correct. Alternatively, you can check to make sure your debugger is working properly by watching the Output window while the game is loading up. If it reports something like the following, you're in business....
Code:
'jamp.exe': Loaded 'D:\JKA Editing\codemp\Basic\Debug\ojpbasic\jampgamex86.dll', Symbols loaded.
ICARUS Instance successfully created
'jamp.exe': Loaded 'D:\JKA Editing\codemp\Basic\Debug\ojpbasic\uix86.dll', Symbols loaded.
'jamp.exe': Loaded 'D:\JKA Editing\codemp\Basic\Debug\ojpbasic\cgamex86.dll', Symbols loaded.
However, I should note that the debugger isn't the end all of fixes. There are some crashes/bugs that occur inside the game engine itself. Those kind of bugs will give the 'source code cannot be displayed' sort of error even if your debugger is running properly. The only way around those issues is to determine what you did in your code/assets to cause the crash....which can be tough.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-14-2006, 10:44 PM   #24
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Quote:
Originally Posted by razorace
I'm not totally sure about fs_dirbeforepak but I think it makes sure that your debugging assets override things in the .pk3s
fs_dirbeforepak was something raven added, it attempts to load folders/directories before it goes looking in pk3s.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-15-2006, 03:07 AM   #25
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
That's the error I got. Source code could not be displayed.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-15-2006, 03:09 AM   #26
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
'jamp.exe': Loaded 'C:\Games\LucasArts\Star Wars Jedi Knight Jedi Academy\GameData\jamp.exe', Binary was not built with debug information.
'jamp.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\Games\LucasArts\Star Wars Jedi Knight Jedi Academy\GameData\OpenAL32.dll', Binary was not built with debug information.
'jamp.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\wsock32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\glu32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\atioglxx.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\dsound.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\wintrust.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\crypt32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\msasn1.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\imagehlp.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Unloaded 'C:\WINDOWS\system32\wdmaud.drv'
'jamp.exe': Loaded 'C:\WINDOWS\system32\wdmaud.drv', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\msacm32.drv', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\msacm32.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\midimap.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\setupapi.dll', No symbols loaded.
'jamp.exe': Unloaded 'C:\WINDOWS\system32\setupapi.dll'
'jamp.exe': Loaded 'C:\WINDOWS\system32\ksuser.dll', No symbols loaded.
'jamp.exe': Loaded 'C:\Documents and Settings\-Dom-\Desktop\JKA\MP Xtra Mod\codemp\debug\uix86.dll', Symbols loaded.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-15-2006, 03:50 PM   #27
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
The good news is that your debugger is working properly...at least for the ui project.

Is it crashing on map load or in the menus? I don't see entries for the game and cgame sides of the code.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-15-2006, 04:32 PM   #28
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Nope it runs fine except for the Body Slash Crash and Det Pack problem.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-15-2006, 07:40 PM   #29
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
mmm, well, if it's ingame crashes, you should at least have the game and cgame .dlls mentioned in your output log after the uix86.dll is loaded.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-15-2006, 07:41 PM   #30
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
mmm, well, if it's ingame crashes, you should at least have the game and cgame .dlls mentioned in your output log after the uix86.dll is loaded.

Run the debugger, load up a map, and then doublecheck. The output should state that both the game and cgame are loaded with symbols.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-16-2006, 03:18 AM   #31
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
AHA! I found the culprit piece of code!

It's in g_combat.c just after the check for Godmode:

Code:
/*MP XTRA MOD*/
//Check for stunnage :D
if ((targ->client->sess.state & PLAYER_STUN) > 0)
{
	return;
}
It basically checks to see if the target player is stunned and if they are don't hurt them. So I wonder what's wrong with this piece of code. I'm going to do another bit of deugging and see if I can find out any more info.

Hmm look at this:

http://i6.tinypic.com/14kvfj7.jpg

For some reason it can't seem to evaluate the state variable. This could be what is causing it to crash. Well now I'm going to look into the Det Pack crash see what's going on there. OK it seems that it is the exact same piece of code that is causing the Det pack crash as well.

Hmm I just commented out the above bit of code and it now crashes on this line in w_saber.c:

G_Damage( victim, self, self, dmgDir[i], dmgSpot[i], totalDmg[i], dflags, MOD_SABER );

I commented out all my code from G_Damage() and it's still crashing...
Nope I lie it does work... so now to slowly uncomment bits out and find the EXACT cause.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------

Last edited by Dom_152; 06-16-2006 at 12:23 PM.
Dom_152 is offline   you may: quote & reply,
Old 06-16-2006, 12:44 PM   #32
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
OK I have narrowed it down to these two pieces of code:

Code:
	
if (targ->client->sess.state & PLAYER_STUN)
{
      return;
}

//Check if chat Protection has been set and if so protect those who are chatting
if(mpx_chatProtection.integer == 1 && targ->client->ps.eFlags & EF_TALK)
{
	return;
}
Both check flags before doing something... coincidence? Hmmm....


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-16-2006, 05:30 PM   #33
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Well, according to your picture, your client object isn't valid, that's why all the sub-data isn't accessable. What does the actual error message say when your game crashes?

Normally what you need to do is check each of the variables on the line that causes the crash. You'll be able to tell which line it is since the debugger will place an arrow next to it. Whatever variable that is showing as 0x00000000 is the problem since that means that it's currently NULL (when it should be pointing to something in memory). From there, you need to work backwards and determine why that variable isn't valid at that point in the code.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-16-2006, 06:31 PM   #34
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Error Message:

Unhandled exception at 0x201c7918 (jampgamex86.dll) in jamp.exe: 0xC0000005: Access violation reading location 0x000007ac.

I think it's the Client pointer:

http://i5.tinypic.com/14m5dec.jpg

But I don't get why 'cos the client pointer is used earlier on in the code :S


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-16-2006, 07:16 PM   #35
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Oh, it's probably because only NPCs and players have client structs. Are you sure that this function has filtered out non-NPCS/players by this point?

Maybe if you'd post more of the code around that section of the code.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 06-16-2006, 08:20 PM   #36
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
ah hah, i know why this is in G_Damage right?

your if statement should be:

Code:
if ( targ->client && targ->client->sess.state & PLAYER_STUN )
the reason is, some entitiy is being damage possibly but its not even a client. this should fix both problems im assuming. ie: dead body, or detpacks.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 06-17-2006, 05:34 AM   #37
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
Ahhhh! Thanks. I'll try it straight away! Thanks sooo much it works fine now! Now I gotta work out why SanitizeString2() crashes when I use it in my G_ClientNumberFromPartialName() function :S.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------

Last edited by Dom_152; 06-17-2006 at 05:49 AM.
Dom_152 is offline   you may: quote & reply,
Old 06-17-2006, 06:31 AM   #38
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
I'm back with another crazy problem. All I'm trying to do is Sanitize each players name so I can compare it to my partial name. But when it gets SanitizeString2() it crashes giving me this error:

Unhandled exception at 0x201af7c3 (jampgamex86.dll) in jamp.exe: 0xC0000005: Access violation writing location 0xcccccccc.

Here is my G_ClientNumberFromPartialName() function:

Code:
/*
=============================
G_ClientNumberFromPartialName

Gets a client number from only a partial name
=============================
*/
int G_ClientNumberFromPartialName(char *partialname)
{
	int clientnumber = 0;
	gentity_t *tent;
	gentity_t *final;		
	char *name = "";
	char *tempname;
	int i;	
	int matches = 0;	
	int finalmatch = 0;
	
	//No need here. Just make sure you sanitize the partial string before sending it here
	//SanitizeString(partial, partialname);	

	//First client pass
	for(i = 0; i < MAX_CLIENTS; i++)
	{
		tent = &g_entities[i];	

		if(!tent->client)
		{
			continue; //if the client doesn't exist move on to the next one.
		}

		//If we are here the entity is definatly a client so it should be safe to put this here
		tempname = tent->client->pers.netname; 				
		SanitizeString2(tempname, name);

		if(strstr(name, partialname) == NULL)
		{
			//Nope not there move on!
			continue;
		}
		else
		{
			//Partial name found in a full name!
			//Log it!
			matches += 1;
			//Log the Client number that matches... we need it later on
			finalmatch = i;
		}
	}	

	if(matches > 1) //Too many matches!
	{
		return -2;
	}
	if(matches < 1) //no Matches
	{
		return -1;
	}
	
	final = &g_entities[finalmatch];	
	clientnumber = G_ClientNumberFromStrippedName(final->client->pers.netname);

	return clientnumber;
}
SanitizeString2() works fine in all the other parts of my code so whats going on? I have run it in debug mode but I can't see anything strange apart from the fact that out[] (In sanitizeString2() is "")


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Old 06-17-2006, 03:18 PM   #39
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
lol that function is so gross...

why did u barrow the G_ClientNumber function... ClientNumbersFromString works perfectly fine...

Code:
/*
==================
stristr
==================
*/
char *stristr(char *str, char *charset) {
	int i;

	while(*str) {
		for (i = 0; charset[i] && str[i]; i++) {
			if (toupper(charset[i]) != toupper(str[i])) break;
		}
		if (!charset[i]) return str;
		str++;
	}
	return NULL;
}

/*
==================
ClientNumbersFromString

Sets plist to an array of integers that represent client numbers that have 
names that are a partial match for s. List is terminated by a -1.

Returns number of matching clientids.
==================
*/
int ClientNumbersFromString( char *s, int *plist) {
	gclient_t *p;
	int i, found = 0;
	char s2[MAX_STRING_CHARS];
	char n2[MAX_STRING_CHARS];
	char n1[MAX_STRING_CHARS];
	char *m;
	qboolean is_slot = qtrue;

	*plist = -1;

	// if a number is provided, it might be a slot # 
	for(i=0; i<(int)strlen(s); i++) { 
		if(s[i] < '0' || s[i] > '9') {
			is_slot = qfalse;
			break;
		}
	}
	if(is_slot) {
		i = atoi(s);
		if(i >= 0 && i < level.maxclients) {
			p = &level.clients[i];
			if(p->pers.connected == CON_CONNECTED ||
				p->pers.connected == CON_CONNECTING) {

				*plist++ = i;
				*plist = -1;
				return 1;
			}
		}
	}

	// now look for name matches
	Q_CleanStr(s);
	Q_strncpyz(s2, s, sizeof(s2));
	if(strlen(s2) < 1) return 0;
	for(i=0; i < level.maxclients; i++) {
		p = &level.clients[i];
		if(p->pers.connected != CON_CONNECTED &&
			p->pers.connected != CON_CONNECTING) {
			
			continue;
		}
		Q_strncpyz(n1, p->pers.netname, sizeof(n1));
		Q_CleanStr(n1);
		Q_strncpyz(n2, n1, sizeof(n2));
		m = stristr(n2, s2);
		if(m != NULL) {
			*plist++ = i;
			found++;
		}
	}
	*plist = -1;
	return found;
}
that is a little different than clientnumberfromstring, this is an array and allows multiple matches.

show me the function your trying to make use that and ill fix it to the new one.

now, do you want it to only match one person or do you want it to match multiple clients?

if ur only wanting one then add this too:

Code:
qboolean G_MatchOnePlayer(int *plist, char *err, int len) 
{
	gclient_t *cl;
	int *p;
	char line[MAX_NAME_LENGTH+10];

	err[0] = '\0';
	line[0] = '\0';
	if(plist[0] == -1) {
		Q_strcat(err, len, 
			"no connected player by that name or slot #");
		return qfalse;
	}
	if(plist[1] != -1) {
		Q_strcat(err, len, "more than one player name matches. "
			"be more specific or use the slot #:\n");
		for(p = plist;*p != -1; p++) {
			cl = &level.clients[*p];
			if(cl->pers.connected == CON_CONNECTED) {
				sprintf(line, "%2i - %s^7\n",
					*p,	
					cl->pers.netname);
				if(strlen(err)+strlen(line) > len)
					break;
				Q_strcat(err, len, line);
			}
		}
		return qfalse;
	}
	return qtrue;
}
here is some test command for a single match:

Code:
void G_test_print(gentity_t *ent) 
{
	int pids[MAX_CLIENTS];
	char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS];
	gentity_t *vic;

	if ( trap_Argc() != 2 )
		trap_SendServerCommand(ent-g_entities, "Usage: testprint [name|slot#]\n");
		return qfalse;
	}

	trap_Argv( 1, name, sizeof( name ) ); 

	if(ClientNumbersFromString(name, pids) != 1) {
		G_MatchOnePlayer(pids, err, sizeof(err));
		trap_SendServerCommand(ent-g_entities, va("testprint: %s\n", err)); // testprint being the cmdname
		return;
	}

	vic = &g_entities[pids[0]];

	trap_SendServerCommand(ent-g_entities, va("print \"Test Message Sent to %s\"", vic->client->pers.netname ));
}


iojamp project lead / coder

Last edited by ensiform; 06-17-2006 at 03:30 PM.
ensiform is offline   you may: quote & reply,
Old 06-17-2006, 03:53 PM   #40
Dom_152
Rookie
 
Dom_152's Avatar
 
Join Date: Jan 2006
Location: England
Posts: 150
OK Thanks but why split it up into so many separate functions when mine works fine but for some reason SanatizeString2() doesn't seem to.


-----------------------------------------------------
MultiPlayer Xtra
Jedi Academy MP Mod
(Released! Source Code and all!)

Jedi Academy - Xtra
Coming Soon...

-----------------------------------------------------
Dom_152 is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > Some strange crashes

Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:52 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.