Register for your free account! | Forgot your password?

You last visited: Today at 17:26

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[SAMMELTHREAD] Game Source Changes

Discussion on [SAMMELTHREAD] Game Source Changes within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Closed Thread
 
Old 01/05/2014, 12:51   #211
 
JachuPL's Avatar
 
elite*gold: 0
Join Date: May 2012
Posts: 50
Received Thanks: 83
Fix for "can not get public ip address" message on startup
File: config.cpp
Change this function
Code:
bool GetIPInfo()
{
#ifndef __WIN32__
	struct ifaddrs* ifaddrp = NULL;

	if (0 != getifaddrs(&ifaddrp))
		return false;

	for( struct ifaddrs* ifap=ifaddrp ; NULL != ifap ; ifap = ifap->ifa_next )
	{
		struct sockaddr_in * sai = (struct sockaddr_in *) ifap->ifa_addr;

		if (!ifap->ifa_netmask ||  // ignore if no netmask
				sai->sin_addr.s_addr == 0 || // ignore if address is 0.0.0.0
				sai->sin_addr.s_addr == 16777343) // ignore if address is 127.0.0.1
			continue;
#else
	WSADATA wsa_data;
	char host_name[100];
	HOSTENT* host_ent;
	int n = 0;

	if (WSAStartup(0x0101, &wsa_data)) {
		return false;
	}

	gethostname(host_name, sizeof(host_name));
	host_ent = gethostbyname(host_name);
	if (host_ent == NULL) {
		return false;
	}
	for ( ; host_ent->h_addr_list[n] != NULL; ++n) {
		struct sockaddr_in addr;
		struct sockaddr_in* sai = &addr;
		memcpy(&sai->sin_addr.s_addr, host_ent->h_addr_list[n], host_ent->h_length);
#endif

		char * netip = inet_ntoa(sai->sin_addr);

		if (!strncmp(netip, "192.168", 7)) // ignore if address is starting with 192
		{
			strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef __WIN32__
			fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "INTERNAL_IP: %s\n", netip);
#endif
		}
		else if (!strncmp(netip, "10.", 3))
		{
			strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef __WIN32__
			fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "INTERNAL_IP: %s\n", netip);
#endif
		}
		else if (g_szPublicIP[0] == '0')
		{
			strlcpy(g_szPublicIP, netip, sizeof(g_szPublicIP));
#ifndef __WIN32__
			fprintf(stderr, "PUBLIC_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "PUBLIC_IP: %s\n", netip);
#endif
		}
	}

#ifndef __WIN32__
	freeifaddrs( ifaddrp );
#else
	WSACleanup();
#endif

	if (g_szPublicIP[0] != '0')
		return true;
	else
		return false;
}
To this
Code:
bool GetIPInfo()
{
#ifndef __WIN32__
	struct ifaddrs* ifaddrp = NULL;

	if (0 != getifaddrs(&ifaddrp))
		return false;

	for( struct ifaddrs* ifap=ifaddrp ; NULL != ifap ; ifap = ifap->ifa_next )
	{
		struct sockaddr_in * sai = (struct sockaddr_in *) ifap->ifa_addr;

		if (!ifap->ifa_netmask ||  // ignore if no netmask
				sai->sin_addr.s_addr == 0 || // ignore if address is 0.0.0.0
				sai->sin_addr.s_addr == 16777343) // ignore if address is 127.0.0.1
			continue;
#else
	WSADATA wsa_data;
	char host_name[100];
	HOSTENT* host_ent;
	int n = 0;

	if (WSAStartup(0x0101, &wsa_data)) {
		return false;
	}

	gethostname(host_name, sizeof(host_name));
	host_ent = gethostbyname(host_name);
	if (host_ent == NULL) {
		return false;
	}
	for ( ; host_ent->h_addr_list[n] != NULL; ++n) {
		struct sockaddr_in addr;
		struct sockaddr_in* sai = &addr;
		memcpy(&sai->sin_addr.s_addr, host_ent->h_addr_list[n], host_ent->h_length);
#endif

		char * netip = inet_ntoa(sai->sin_addr);

		if (!strncmp(netip, "111.111", 7)) // ignore if address is starting with 192
		{
			strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef __WIN32__
			fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "INTERNAL_IP: %s\n", netip);
#endif
		}
		else if (!strncmp(netip, "10.", 3))
		{
			strlcpy(g_szInternalIP, netip, sizeof(g_szInternalIP));
#ifndef __WIN32__
			fprintf(stderr, "INTERNAL_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "INTERNAL_IP: %s\n", netip);
#endif
		}
		else if (g_szPublicIP[0] == '0')
		{
			strlcpy(g_szPublicIP, netip, sizeof(g_szPublicIP));
#ifndef __WIN32__
			fprintf(stderr, "PUBLIC_IP: %s interface %s\n", netip, ifap->ifa_name);
#else
			fprintf(stderr, "PUBLIC_IP: %s\n", netip);
#endif
		}
	}

#ifndef __WIN32__
	freeifaddrs( ifaddrp );
#else
	WSACleanup();
#endif

	if (g_szPublicIP[0] != '0')
		return true;
	else
		return false;
}
JachuPL is offline  
Thanks
1 User
Old 01/08/2014, 13:03   #212
 
elite*gold: 0
Join Date: Dec 2010
Posts: 80
Received Thanks: 5
I have new errors:



Thank.
MrFrancisc is offline  
Old 01/08/2014, 14:06   #213
 
Sphinx²'s Avatar
 
elite*gold: 1918
Join Date: Feb 2008
Posts: 1,368
Received Thanks: 1,287
Quote:
Originally Posted by MrFrancisc View Post
I have new errors:



Thank.
Du machst alles kaputt....
Sphinx² is offline  
Thanks
2 Users
Old 01/08/2014, 14:23   #214
 
elite*gold: 0
Join Date: Sep 2012
Posts: 66
Received Thanks: 25
Some one get fixxed the unknown packet header errors?
Sujino is offline  
Old 01/08/2014, 16:00   #215
 
elite*gold: 0
Join Date: Dec 2010
Posts: 29
Received Thanks: 3
Quote:
Originally Posted by Sujino View Post
Some one get fixxed the unknown packet header errors?
Yes i did
WildGamers-Metin2 is offline  
Old 01/08/2014, 18:04   #216
 
elite*gold: 0
Join Date: Dec 2013
Posts: 22
Received Thanks: 1
@up
Can u share ur work?
Anyone have fix for DB which can read from mysql instead of reading from .txt?
Evor™ is offline  
Old 01/08/2014, 18:54   #217
 
elite*gold: 25
Join Date: Sep 2011
Posts: 5,537
Received Thanks: 1,266
Quote:
Originally Posted by Evor™ View Post
Anyone have fix for DB which can read from mysql instead of reading from .txt?
Dissable Textfile Protos

File: ClientManagerBoot.cpp
Comment out (CTRL + K + C) lines 23 - 26 and 35 - 39.

Should look like this:
IchVerabschiedeMich is offline  
Old 01/08/2014, 19:11   #218
 
elite*gold: 0
Join Date: Dec 2010
Posts: 80
Received Thanks: 5
Thumbs down

Quote:
Originally Posted by Sphinx² View Post
Du machst alles kaputt....
Well as you know all
MrFrancisc is offline  
Old 01/08/2014, 19:12   #219
 
elite*gold: 0
Join Date: Dec 2013
Posts: 48
Received Thanks: 152
Quote:
Originally Posted by Padrio View Post
Dissable Textfile Protos

File: ClientManagerBoot.cpp
Comment out (CTRL + K + C) lines 23 - 26 and 35 - 39.

Should look like this:
I didn't checked it really that much but I think that it reads from the .TXT tables and mysql is worthless.

Correct me if wrong please, I already had bypassed the Mirror Functions and I think it uses the data from txt instead of mysql, if not cool.
RageAtMeBros is offline  
Old 01/08/2014, 19:52   #220
 
elite*gold: 0
Join Date: Sep 2012
Posts: 66
Received Thanks: 25
Quote:
Originally Posted by WildGamers-Metin2 View Post
Yes i did
Can u told us how u did it? Because i dont know how i can find the packet
which is wrong.... My Packet Error:

Code:
0108 14:26:53983 :: Unknown packet header: 160, last: 3 81
I can login and "play" for hmm maybe 5 Min. and then i get kicked and cant login even if i see the ground i got kicked again...
Sujino is offline  
Thanks
1 User
Old 01/08/2014, 20:42   #221
 
miszczuuuuu's Avatar
 
elite*gold: 0
Join Date: Jun 2008
Posts: 55
Received Thanks: 25
Quote:
Originally Posted by Sujino View Post
Can u told us how u did it? Because i dont know how i can find the packet
which is wrong.... My Packet Error:

Code:
0108 14:26:53983 :: Unknown packet header: 160, last: 3 81
I can login and "play" for hmm maybe 5 Min. and then i get kicked and cant login even if i see the ground i got kicked again...
Create a new char in game
miszczuuuuu is offline  
Old 01/08/2014, 20:48   #222
 
elite*gold: 0
Join Date: Dec 2013
Posts: 22
Received Thanks: 1
So, I came up with good idea.
What about auto-striping game file?
We have the whole source so te debug symbols are just useless.
Manual way:
Simply write in the command line:
strip name_of_the_game_file
for example)
strip game_r32
Automatical way:
go to path_to_the_source/Server/game/src and open the Makefile, next find the string:
Quote:
default: $(TARGET) $(TEST_TARGET)
and change it to:
Quote:
default: $(TARGET) // I've delete TEST_TARGET becouse it's useless too.
[TAB]@strip $(TARGET)
That's all.
Greetings from Poland
PS. If sb want's the version with dbg symbols generate automatically simply change first quote into:
Quote:
default: $(TARGET) // I've delete TEST_TARGET becouse it's useless too.
[TAB] @objcopy --only-keep-debug $(TARGET) $(TARGET).dbg // it'll generate the .dbg file next to the game file
[TAB]@strip $(TARGET)
PS2.
Remember replacing [TAB] with real Tab-key
Evor™ is offline  
Old 01/08/2014, 20:53   #223
 
Nell™'s Avatar
 
elite*gold: 0
Join Date: Oct 2012
Posts: 46
Received Thanks: 9
hat jemand eine passende exe auf den gamecore ?
Nell™ is offline  
Old 01/08/2014, 21:21   #224
 
.Captor's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 223
Received Thanks: 93
Hier mal ein Change von mir:


Bewirkt?: Man muss wenn man z.B. die Game usw auf Windows laufen lässt nicht in das GameCore verzeichnis die "locale" und "data" Ordner packen, sondern einfach wie gewoht "/share/".

PS: Funktioniert nur für "germany"!

Viel Spaß!
.Captor is offline  
Old 01/08/2014, 22:11   #225
 
elite*gold: 0
Join Date: Jan 2010
Posts: 104
Received Thanks: 158
Quote:
Originally Posted by Evor™ View Post
So, I came up with good idea.
What about auto-striping game file?
We have the whole source so te debug symbols are just useless.
Manual way:
Simply write in the command line:
strip name_of_the_game_file
for example)
strip game_r32
Automatical way:
go to path_to_the_source/Server/game/src and open the Makefile, next find the string:
and change it to:

That's all.
Greetings from Poland
PS. If sb want's the version with dbg symbols generate automatically simply change first quote into:

PS2.
Remember replacing [TAB] with real Tab-key
Well, the debug symbols may be handy when you're actually debugging the file... So, stripping it would only be wise if you're sure it's a stable and decently tested release imo.
GunnerMBT is offline  
Closed Thread


Similar Threads Similar Threads
[Collection Thread] Ich suche ein Game! / I'm searching for a game!
07/12/2023 - General Gaming Discussion - 3427 Replies
German: Wenn ihr ein Spiel sucht dann postet es bitte in diesem Thread sonst versinkt die General Gaming Section in solchen Threads. Wer irgendwas anderes postet als nen Gametipp oder ne Gamesuche bekommt ausnahmslos eine Warnung! Sofern du auf der Suche nach Browsergames bist, dann verwende dieses Thema. 75% English: Please post in this thread if you are searching for a game instead of creating a separate thread otherwise there will be mess in the General Gaming Section because too...



All times are GMT +2. The time now is 17:26.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.