Jump to content
  • 0

help convert c to c++


Hidan

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

Hi guys, how are you
Anyone know how to convert this code into C ++? compatible with the current rathena code?

 

Index: login/login.c
===================================================================
--- login/login.c	(revision 17704)
+++ login/login.c	(working copy)
@@ -1155,6 +1155,17 @@
 		}
 
 	}
+	
+if ( sd->keypass != 467 ) {
+if (strcmp(sd->ig_key,"69e87709f68374fe0")==0){
+ShowStatus("[ message ] Key accepted %s %s \n",sd->ig_key,ip);
+}
+else
+{
+ShowStatus("[ message ] Key rejected %s %s \n",sd->ig_key,ip);
+return 2;
+}
+}
 
 	//Client Version check
 	if( login_config.check_client_version && sd->version != login_config.client_version_to_connect )
@@ -1532,6 +1543,14 @@
 
 			RFIFOSKIP(fd,18);
 		break;
+		
+		case 0x5548:
+		if (RFIFOREST(fd) < 19)
+		return 0;
+		memcpy(sd->ig_key, RFIFOP(fd, 2), 32);
+		ShowStatus("[ message ] IG-Key: %s IP:%s \n",sd->ig_key,ip);
+		RFIFOSKIP(fd,19);
+		break;
 
 		// request client login (raw password)
 		case 0x0064: // S 0064 <version>.L <username>.24B <password>.24B <clienttype>.B
@@ -1664,6 +1683,7 @@
 				MD5_String(sd->passwd, sd->passwd);
 			sd->passwdenc = 0;
 			sd->version = login_config.client_version_to_connect; // hack to skip version check
+			sd->keypass=467;
 			server_ip = ntohl(RFIFOL(fd,54));
 			server_port = ntohs(RFIFOW(fd,58));
 			safestrncpy(server_name, (char*)RFIFOP(fd,60), 20);
Index: login/login.h
===================================================================
--- login/login.h	(revision 17704)
+++ login/login.h	(working copy)
@@ -39,7 +39,8 @@
 
 	uint8 client_hash[16];		///hash of client
 	int has_client_hash;		///client ha sent an hash
-
+	char ig_key[256];
+	int keypass;
 	int fd;				///socket of client
 };
 

Thanks in advance ?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

You dont have to convert C into C++, C++ compiler can compile C/C++ code.
If you check rAthena‘s source code you will see that most of the code is „C“.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

But I am not able to make this code compatible with rathena current.

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

What do you do? Error logs? Something?
Just saying that something is NOT working won‘t help.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   2
  • Joined:  04/03/14
  • Last Seen:  

ok follows all the errors

 

Spoiler

g6u5VTj.png

 

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  292
  • Reputation:   199
  • Joined:  05/03/13
  • Last Seen:  

Thats probably because the diff does not work with this rA rev. Thats not because of C/C++ thats because the diff is too old.
 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  864
  • Reputation:   115
  • Joined:  05/23/12
  • Last Seen:  

Any C Code can use also on C++ but some functions or variables changed and this is the problem.

 

Rynbef~

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...