Jump to content

[Small C++] Remove packetinfo.txt / usage.txt


Guest Ezrekith

Recommended Posts

Guest Ezrekith

game / src / packet_info.cpp

 

void CPacketInfo::Log(const char * c_pszFileName)

 

Replace with:

 

void CPacketInfo::Log(const char * c_pszFileName)
{
#ifdef _I_Need_Packet_Info_Cause_My_Dingdong_Is_Heavy_Any_My_Cat_Cant_Handle_It_Oo_

	FILE * fp;

	fp = fopen(c_pszFileName, "w");

	if (!fp)
		return;

	std::map<int, TPacketElement *>::iterator it = m_pPacketMap.begin();

	fprintf(fp, "Name			 Called	 Load	   Ratio\n");

	while (it != m_pPacketMap.end())
	{
		TPacketElement * p = it->second;
		++it;

		fprintf(fp, "%-16s %-10d %-10u %.2f\n",
				p->stName.c_str(),
				p->iCalled,
				p->dwLoad,
				p->iCalled != 0 ? (float) p->dwLoad / p->iCalled : 0.0f);
	}

	fclose(fp);
#endif
}

If you ever decide to use it again just define this in your service.h:

#define _I_Need_Packet_Info_Cause_My_Dingdong_Is_Heavy_Any_My_Cat_Cant_Handle_It_Oo_

 

p2p_packet_info.txt

 

Replace this: CPacketInfoGG::~CPacketInfoGG()

 

CPacketInfoGG::~CPacketInfoGG()
{
#ifdef _I_Need_Packet_Info_Cause_My_Dingdong_Is_Heavy_Any_My_Cat_Cant_Handle_It_Oo_
	Log("p2p_packet_info.txt");
#endif
}

udp_packet_info.txt

 

game / src / input_udp.cpp

CPacketInfoUDP::~CPacketInfoUDP() replace this

 

CPacketInfoUDP::~CPacketInfoUDP()
{
#ifdef _I_Need_Packet_Info_Cause_My_Dingdong_Is_Heavy_Any_My_Cat_Cant_Handle_It_Oo_
	Log("udp_packet_info.txt");
#endif
}

 

db / src / clientmanager.cpp

 

void UsageLog() replace with this:

 

void UsageLog()
{   
#ifdef asd
	FILE* fp = NULL;

	time_t      ct;
	char        *time_s;
	struct tm   lt;

	int         avg = g_dwUsageAvg / 3600; // 60 ĂĘ * 60 şĐ

	fp = fopen("usage.txt", "a+");

	if (!fp)
		return;

	ct = time(0);
	lt = *localtime(&ct);
	time_s = asctime(&lt);

	time_s[strlen(time_s) - 1] = '\0';

	fprintf(fp, "| %4d %-15.15s | %5d | %5u |", lt.tm_year + 1900, time_s + 4, avg, g_dwUsageMax);

	fprintf(fp, "\n");
	fclose(fp);

	g_dwUsageMax = g_dwUsageAvg = 0;
#endif
}

Delete the txt files from the ch + db folers

 

(Or if you'd like to delete the whole function, just delete it from the cpp and h file.)

Edited by Ezrekith
Link to post
Share on other sites
Guest Ezrekith

If you don't like it in your CH folders.

It's kinda useless cause it have literally 0 functions. 

The game just logging the packets into a txt without any reason.

Link to post
Share on other sites
  • 1 year later...
  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...