Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2015, 07:59 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Since the buffer was an allocation and not an initialization, it would be possible to have the character at eq_cse.Name[<strlen> + 1]
not be 0...

And since I was taking name strlen from the eq buffer and not emu buffer, it could have thrown off the length of the entry.


If you still have issues, let me know and I'll look at the server generation code.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #2  
Old 05-23-2015, 08:54 AM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

One of my servers is working off January source, and until I can move some of my custom things over, I am going to have to keep using that source. These are the lines I will have to change if I am thinking right.

Code:
bufptr += strlen(emu->name[r]);
And add this, like you did, which both will have to be done differently. The entire function has changed.

Code:
eq_cse->Name[0] = '\0';
This is the current function in total.

Code:
ENCODE(OP_SendCharInfo)
	{
		ENCODE_LENGTH_EXACT(CharacterSelect_Struct);
		SETUP_VAR_ENCODE(CharacterSelect_Struct);

		//EQApplicationPacket *packet = *p;
		//const CharacterSelect_Struct *emu = (CharacterSelect_Struct *) packet->pBuffer;

		int char_count;
		int namelen = 0;
		for (char_count = 0; char_count < 10; char_count++) {
			if (emu->name[char_count][0] == '\0')
				break;
			if (strcmp(emu->name[char_count], "<none>") == 0)
				break;
			namelen += strlen(emu->name[char_count]);
		}

		int total_length = sizeof(structs::CharacterSelect_Struct)
			+ char_count * sizeof(structs::CharacterSelectEntry_Struct)
			+ namelen;

		ALLOC_VAR_ENCODE(structs::CharacterSelect_Struct, total_length);

		//unsigned char *eq_buffer = new unsigned char[total_length];
		//structs::CharacterSelect_Struct *eq_head = (structs::CharacterSelect_Struct *) eq_buffer;

		eq->char_count = char_count;
		eq->total_chars = 10;

		unsigned char *bufptr = (unsigned char *)eq->entries;
		int r;
		for (r = 0; r < char_count; r++) {
			{	//pre-name section...
				structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr;
				eq2->level = emu->level[r];
				eq2->hairstyle = emu->hairstyle[r];
				eq2->gender = emu->gender[r];
				memcpy(eq2->name, emu->name[r], strlen(emu->name[r]) + 1);
			}
			//adjust for name.
			bufptr += strlen(emu->name[r]);
			{	//post-name section...
				structs::CharacterSelectEntry_Struct *eq2 = (structs::CharacterSelectEntry_Struct *) bufptr;
				eq2->beard = emu->beard[r];
				eq2->haircolor = emu->haircolor[r];
				eq2->face = emu->face[r];
				int k;
				for (k = 0; k < _MaterialCount; k++) {
					eq2->equip[k].material = emu->equip[r][k].material;
					eq2->equip[k].unknown1 = emu->equip[r][k].unknown1;
					eq2->equip[k].elitematerial = emu->equip[r][k].elitematerial;
					eq2->equip[k].color.color = emu->equip[r][k].color.color;
				}
				eq2->primary = emu->primary[r];
				eq2->secondary = emu->secondary[r];
				eq2->tutorial = emu->tutorial[r]; // was u15
				eq2->u15 = 0xff;
				eq2->deity = emu->deity[r];
				eq2->zone = emu->zone[r];
				eq2->u19 = 0xFF;
				eq2->race = emu->race[r];
				eq2->gohome = emu->gohome[r];
				eq2->class_ = emu->class_[r];
				eq2->eyecolor1 = emu->eyecolor1[r];
				eq2->beardcolor = emu->beardcolor[r];
				eq2->eyecolor2 = emu->eyecolor2[r];
				eq2->drakkin_heritage = emu->drakkin_heritage[r];
				eq2->drakkin_tattoo = emu->drakkin_tattoo[r];
				eq2->drakkin_details = emu->drakkin_details[r];
			}

			bufptr += sizeof(structs::CharacterSelectEntry_Struct);
		}

		FINISH_ENCODE();
	}
Reply With Quote
  #3  
Old 05-23-2015, 08:58 AM
provocating's Avatar
provocating
Demi-God
 
Join Date: Nov 2007
Posts: 2,175
Default

Compiling now, I will report back.

Yeah, still crashing before character select.
Reply With Quote
Reply

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

Forum Jump

   

All times are GMT -4. The time now is 10:50 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3