Page 1 of 1

CTD with PluginsAddSpawn

Posted: Sun Oct 10, 2004 6:57 am
by Digitalxero
I get this crash while using my mq2spawnalert plugin, but since it is not showing me any code from my file(Yes I have the PDB) I can not debug it, any help would be usefull.

What I can tell though from the variables pSpawn is getting Unicode characters, and I think this is breaking something.
Call Stack wrote:>MQ2SPAWNALERT! _output + 1178 bytes
MQ2SPAWNALERT! sprintf + 46 bytes
MQ2SPAWNALERT! CheckSpawn(char *,char *,char *) + 110 bytes
MQ2SPAWNALERT! OnAddSpawn + 36 bytes
PluginsAddSpawn(EQData::_SPAWNINFO * 0x03b4e3b2) line 448 + 3 bytes
EQPlayerHook::EQPlayer_Detour(EQPlayerHook * const 0x0000008d, unsigned long 0, unsigned long 0, unsigned long 1, unsigned long 1, unsigned long 6147660) line 144 + 9 bytes
EQGAME! 004bb11d()
EQGAME! 004bcd2b()
Disasembaly for MQ2SPAWNALERT! _output + 1178 bytes wrote:0345273E cmp byte ptr [eax],0
Disasembaly for MQ2SPAWNALERT! sprintf + 46 bytes wrote:03451C4E add esp,0Ch
Disasembaly for MQ2SPAWNALERT! CheckSpawn(char *,char *,char *) + 110 bytes wrote:0345178E mov al,[SpawnAlertOn (0345f150)]
Disasembaly for MQ2SPAWNALERT! OnAddSpawn + 36 bytes wrote:03451A94 add esp,0Ch
Disasembaly for PluginsAddSpawn(EQData::_SPAWNINFO * 0x03b4e3b2) line 448 + 3 bytes wrote: 444: while(pPlugin)
03B4C56E cmp esi,ebp
03B4C570 je PluginsAddSpawn+10Ch (03b4c58c)
445: {
446: if (pPlugin->AddSpawn)
03B4C572 mov eax,dword ptr [esi+130h]
03B4C578 cmp eax,ebp
03B4C57A je PluginsAddSpawn+102h (03b4c582)
447: {
448: pPlugin->AddSpawn(pNewSpawn);
03B4C57C push ebx
03B4C57D call eax
>>03B4C57F add esp,4
449: }
450: pPlugin=pPlugin->pNext;
03B4C582 mov esi,dword ptr [esi+144h]
03B4C588 cmp esi,ebp
03B4C58A jne PluginsAddSpawn+0F2h (03b4c572)
451: }

Code: Select all

VOID PluginsAddSpawn(PSPAWNINFO pNewSpawn)
{
	PluginDebug("PluginsAddSpawn(%s,%d,%d)",pNewSpawn->Name,pNewSpawn->Race,pNewSpawn->BodyType);
	SpawnByName[pNewSpawn->Name]=pNewSpawn;
	if (!bPluginCS)
		return;
	if (gGameState>GAMESTATE_CHARSELECT)
		SetNameSpriteState(pNewSpawn,1);
	if (GetBodyTypeDesc(pNewSpawn->BodyType)[0]=='*')
	{
		WriteChatf("Spawn '%s' has unknown bodytype %d",pNewSpawn->Name,pNewSpawn->BodyType);
	}
	CAutoLock Lock(&gPluginCS);
	PMQPLUGIN pPlugin=pPlugins;
	while(pPlugin)
	{
		if (pPlugin->AddSpawn)
		{
>>			pPlugin->AddSpawn(pNewSpawn);
		}
		pPlugin=pPlugin->pNext;
	}
}
Disasembaly for EQPlayerHook::EQPlayer_Detour(EQPlayerHook * const 0x0000008d, unsigned long 0, unsigned long 0, unsigned long 1, unsigned long 1, unsigned long 6147660) line 144 + 9 bytes wrote: 144: EQPlayer_ExtraDetour(pSpawn);
03B4E3A9 mov ecx,dword ptr [pSpawn]
03B4E3AC push ecx
03B4E3AD call PluginsAddSpawn (03b4c480)
>>03B4E3B2 add esp,4

Code: Select all

	void EQPlayer_Trampoline(DWORD,DWORD,DWORD,DWORD,DWORD);
	void EQPlayer_Detour(DWORD a,DWORD b,DWORD c,DWORD d,DWORD e)
	{
		PSPAWNINFO pSpawn;
		__asm {mov [pSpawn], ecx};

		EQPlayer_Trampoline(a,b,c,d,e);
>>		EQPlayer_ExtraDetour(pSpawn);
		/**/
	}
[quote=""Variables for PluginsAddSpawn(EQData::_SPAWNINFO * 0x03b4e3b2) line 448 + 3 bytes"]

Code: Select all

-	pNewSpawn	0x03b4e3b2
	Unknown0x0	131 'ƒ'
+	Lastname	0x03b4e3b3 "Ä_^ZY[X_^[‹å]Â"
	Y	-3.95388e+024
	X	-1.#QNAN
	Z	3.50949e+013
	SpeedY	2.06757e+018
	SpeedX	-5.70210e-029
	SpeedZ	-4.00015e+029
	SpeedRun	-3.87105e-037
	Heading	1112.19
	field_48	1.88754e-031
	field_4C	141869188
	field_50	440
	CameraAngle	4.36936e-040
+	Unknown0x58	0x03b4e40a "Pè üÿÿÂ"
+	Name	0x03b4e492 "·h8 ºÿ"
+	DisplayedName	0x03b4e4d2 "º¡Ø’¹Pè€Büÿ‹
Ü’¹QètBüÿƒÄ_А¡T º…ÀtO¡P º…ÀtFh8 ºÿ"
	SpeedHeading	-0.000611192
+	pActorInfo	0x0815ff03
	field_168	2701375232
	CanFindLocation	80 'P'
	Sneak	32 ' '
	Linkdead	186 'º'
	field_16F	3 ''
	LFG	133 '…'
	field_171	192 'À'
	IsABoat	116 't'
	Unknown0x173	39 '''
+	ArmorColor	0x03b4e526
+	Equipment	{...}
	Zone	37640
	Instance	952
	field_1c0	1536185
	field_1c4	3217044224
	field_1c8	62468320
+	pNext	0xc933abf3
+	pCharInfo	0x0d89ff33
	field_1d4	62529364
+	pPrev	0xc483028b
+	Unknown0x1dc	0x03b4e58e ";ÇtEV‹5"
	field_1e0	1.03814e-006
	field_1e4	62427904
	RunSpeed	-1.18185e+020
	field_1ec	-2.53690e-032
	field_1f0	2.74053e-012
	AvatarHeight	-3.03265e+015
	WalkSpeed	1.99370e+021
	Type	40 '('
	HairColor	65 'A'
	BeardColor	137 '‰'
	Field_1f7	13 '
'
	Eyes	84 'T'
	Eyes2	31 ''
	BeardType	186 'º'
	Holding	3 ''
	Level	217 'Ù'
	FaceHair	192 'À'
	Gender	216 'Ø'
	PvPFlag	201 'É'
	HideMode	217 'Ù'
	StandState	194 'Â'
	Class	216 'Ø'
	Light	203 'Ë'
	InNonPCRaceIllusion	222 'Þ'
	Field_20d	193 'Á'
	GM	217 'Ù'
	Field_20f	250 'ú'
	SpawnID	3638418141
	MasterID	3704429785
	Race	2332277040
	Anon	117888
	field_220	1975991040
	AFK	1617452739
	BodyType	1778627818
	HPCurrent	3764932872
	AARank	48 '0'
+	Unknown0x231	0x03b4e5e3 "¹èƒï"
	GuildStatus	61315
	Deity	3113408673
	HPMax	3689435139
	GuildID	2348809281
	Levitate	21 ''
+	Unknown0x245	0x03b4e5f7 " ͸¡X ºƒÄB;lj ͸t.=¸"
+	Title	0x03b4e60e "=¸"
[/quote]
Variables for EQPlayerHook::EQPlayer_Detour(EQPlayerHook * const 0x0000008d, unsigned long 0, unsigned long 0, unsigned long 1, unsigned long 1, unsigned long 6147660) line 144 + 9 bytes wrote:

Code: Select all

	a	0
	b	0
	c	1
	d	1
	e	6147660

-	pSpawn	0x19055220
	Unknown0x0	3 ''
+	Lastname	0x19055221 ""
	Y	0.000000
	X	0.000000
	Z	9.00000
	SpeedY	0.000000
	SpeedX	0.000000
	SpeedZ	0.000000
	SpeedRun	0.000000
	Heading	0.000000
	field_48	0.000000
	field_4C	0
	field_50	0
	CameraAngle	0.000000
+	Unknown0x58	0x19055278 ""
+	Name	0x19055300 "load"
+	DisplayedName	0x19055340 "load"
	SpeedHeading	0.000000
+	pActorInfo	0x08d83de8
	field_168	0
	CanFindLocation	97 'a'
	Sneak	0 ''
	Linkdead	0 ''
	field_16F	0 ''
	LFG	0 ''
	field_171	0 ''
	IsABoat	0 ''
	Unknown0x173	253 'ý'
+	ArmorColor	0x19055394
+	Equipment	{...}
	Zone	0
	Instance	0
	field_1c0	0
	field_1c4	4294967295
	field_1c8	4294967295
+	pNext	0x00000000
+	pCharInfo	0x00000000
	field_1d4	0
+	pPrev	0x00000000
+	Unknown0x1dc	0x190553fc ""
	field_1e0	3.00000
	field_1e4	0
	RunSpeed	0.700000
	field_1ec	7.44000
	field_1f0	3.75000
	AvatarHeight	6.00000
	WalkSpeed	0.460000
	Type	0 ''
	HairColor	255 'ÿ'
	BeardColor	255 'ÿ'
	Field_1f7	255 'ÿ'
	Eyes	255 'ÿ'
	Eyes2	255 'ÿ'
	BeardType	255 'ÿ'
	Holding	0 ''
	Level	0 ''
	FaceHair	0 ''
	Gender	0 ''
	PvPFlag	0 ''
	HideMode	0 ''
	StandState	100 'd'
	Class	1 ''
	Light	0 ''
	InNonPCRaceIllusion	255 'ÿ'
	Field_20d	255 'ÿ'
	GM	0 ''
	Field_20f	23 ''
	SpawnID	0
	MasterID	0
	Race	1
	Anon	0
	field_220	0
	AFK	0
	BodyType	1
	HPCurrent	50
	AARank	0 ''
+	Unknown0x231	0x19055451 ""
	GuildStatus	0
	Deity	0
	HPMax	50
	GuildID	4294967295
	Levitate	0 ''
+	Unknown0x245	0x19055465 ""
+	Title	0x1905547c ""

+	this	0x0000008d

Posted: Sun Oct 10, 2004 7:52 am
by Digitalxero
Ok I did some more debuging and found that this was caused by the fact that the plugin was still checking spawns after camp because gGameState does not change while zoning, and when it is loading the "load" zone it sends unicode characters to pSpawn, thus causing the crash. I came up with a fix for my plugin by using a diff variable for game state and setting it in onpulse unless the character has started camping, then reseting it if the abandon camping.

Posted: Sun Oct 10, 2004 10:36 am
by Cr4zyb4rd
Hrm, I've had another 1 or 2 occasional CTDs while zoning that I hadn't tracked down yet, but it wouldn't surprise me to find that they're also caused by recent changes to gamestate. Thanks for the heads-up.

Posted: Sun Oct 10, 2004 6:19 pm
by GD
Damn, nice to know the debug I started for SpawnAlert may fix some of the other crashes.