[Release] [C#] MapleLauncher - Custom Launcher
So after looking at this thread by @PerfectEnding, I decided to make this little application. It's a custom launcher (you can design it however you want) that connects to your server and once connected, sends a custom packet that contains the hash checksum of the users' .WZ files, so custom-edited .WZ server owners can check if the users have the required files before logging into the game. If they do not, you can simply disconnect the client!
How To Setup
1. Clone the Git repository to a local folder on your machine.
2. Open the project using Visual Studio 2013 or 2015.
3. Add a reference to Newtonsoft.Json.dll.
4. Edit Program.cs to your liking. Here's a list of the values to know about:
- Name: The name of your server. This will show up in some places
- IP: The IP Address of your server to connect to.
- Port: The Port of your server to connect to.
- ServerIP: The operation code of the ServerIP packet. That's usualy 0x000B, so you don't have to modify this.
- MaskIP: Should the program mask the IP Address? In case you have a localhost that connects to 127.0.0.1, you can leave this disabled.
- MaskedIP: The IP Address to mask. That's mostly for higher-version servers, where the client connects to Neckson's servers.
- ClientName: The name of the client (localhost.exe, MapleStory.exe, etcetera).
- Website: The link to your website (used for the tray icon).
- Forums: The link to your forums (used for the tray icon).
- ConfigName: The path to the configuration file (config.json as default).
- UseMapleEncryption: Should the launcher encrypt data with the MapleStory custom encryption? (False for higher versions, true for lower).
5. Edit the frmMain's design to your liking.
6. Build the application.
7. ???
8. PROFIT!
How To Calculate Hash?
Included in the solution is an application called "CalculateHash" which will return the calculated hash checksum of a file. Simply drag the .wz file on it and it will display it's hash checksum!
Handling The Packet
Handling the custom packet is quite easy. Here's a small example to help you get started!
(Sorry for my rusty Java skills):
Code:
case WZ_CHECKSUM:
Map<String, String> wzFiles = new Map<String, String>();
wzFiles.put("Base", "1");
wzFiles.put("Character", "2");
wzFiles.put("Effect", "3");
wzFiles.put("Etc", "4");
wzFiles.put("Item", "5");
wzFiles.put("Map", "6");
wzFiles.put("Mob", "7");
wzFiles.put("Morph", "8");
wzFiles.put("Npc", "9");
wzFiles.put("Quest", "10");
wzFiles.put("Reactor", "11");
wzFiles.put("Skill", "12");
wzFiles.put("Sound", "13");
wzFiles.put("String", "14");
wzFiles.put("TamingMob", "15");
wzFiles.put("UI", "16");
};
while (slea.Available() >= 0) {
String name = slea.readMapleString();
String hash = slea.readMapleString();
String computedHash = map.get(name);
if (hash != computedHash) {
c.disconnect();
break;
}
}
break;
Thanks to @Diamondo25 for MapleKeys & Session class.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Everything good and all, but why didnt you use NuGet for Newtonsoft.Json ?
And I assume you had your reasons not to use the default JavaScriptSerializer ?
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Minike
Everything good and all, but why didnt you use NuGet for Newtonsoft.Json ?
And I assume you had your reasons not to use the default
JavaScriptSerializer ?
I did use NuGet, but the .gitignore file ignores it for some reason. If you know how to mess with it, create a pull request and I'll gladly merge it.
As for the Json serialization, my emulator uses this class (JsonUtilities) with several more methods in it, but I only included these two. I was too lazy and just imported the file.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Fraysa
I did use NuGet, but the .gitignore file ignores it for some reason. If you know how to mess with it, create a pull request and I'll gladly merge it.
https://github.com/Fraysa/ms-MapleLauncher/pull/1
I enabled NuGet auto-restore for you.
You can do this by right clicking the solution btw.
And I think something went wrong with your gitignore? there were quite a lot of junk files.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Minike
This .gitignore is automatically generated by GitHub.
Thanks, merged.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Fraysa
This .gitignore is automatically generated by GitHub.
Normally I let my Visual Studio create the repo, this also creates a proper gitignore.
Though I do sync everything with Github for Windows / Mac.
Re: [Release] [C#] MapleLauncher - Custom Launcher
This could have saved me some time a few weeks ago, but I can't really complain, as your How to make a MapleStory Redirector tutorial provided everything I needed to do something similar. Nice release.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Hello Fraysa,
Firstly I would like to personally thank you for releasing this launcher to Ragezone.
I tried to create a similar project myself behind the scene some time ago by modifying another launcher's source, and as I am simply not experienced enough in writing .net applications, I scrapped it.. Your launcher could help me out greatly, I really appreciate the efford and this thread.. :adore:
Where should one reference this case?
Thank you in advance.
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Linkerzz
Where should one reference this case? PlayerLoggedinHandler.java? Does this belong in it's own class?
Thank you in advance.
You should make a new handler in net.channel.handler (or your similar package). Don't forget to register the handler in PacketProcessor when you receive the appropriate Op Code.
Also, in Fraya's example, note that the 1, 2, 3, 4, etc. (for the wzFiles.put argument) should be the hash for that wz file.
Re: [Release] [C#] MapleLauncher - Custom Launcher
I've installed Visual Studio 2015 so I could play around with your launcher,
as soon as I tried building it VS crashed and now it just keeps on restarting itself everytime I try building it.
Are you familiar with this issue? Do you know how to fix it?
I have another small question I hope you don't mind, incase I can get the launcher to work, how do I make sure that the players actually enter the game from the launcher that checks their WZs and not from the original client?
Would I need to check it from the source, something like -> if the WZ_CHECKSUM packet wasn't sent then close the connection with the session?
Thank you for your time!
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
dorkie4ever
I've installed Visual Studio 2015 so I could play around with your launcher,
as soon as I tried building it VS crashed and now it just keeps on restarting itself everytime I try building it.
Are you familiar with this issue? Do you know how to fix it?
I have another small question I hope you don't mind, incase I can get the launcher to work, how do I make sure that the players actually enter the game from the launcher that checks their WZs and not from the original client?
Would I need to check it from the source, something like -> if the WZ_CHECKSUM packet wasn't sent then close the connection with the session?
Thank you for your time!
Pretty much, yeah. You could have MapleClient store a variable such as "bool authenticated = false", and when the instance is created start a timer for a certain amount of time. When you handle the packet, set authenticated to true... If the packet is never received and the timer goes off, disconnect the client.
However, note that a new client connection is created when connecting to the channelserver as well as the loginserver, so you have to add some kind of check to make sure this only happens when you first launch. It's up to you to figure that out. :)
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
SSFM
Pretty much, yeah. You could have MapleClient store a variable such as "bool authenticated = false", and when the instance is created start a timer for a certain amount of time. When you handle the packet, set authenticated to true... If the packet is never received and the timer goes off, disconnect the client.
However, note that a new client connection is created when connecting to the channelserver as well as the loginserver, so you have to add some kind of check to make sure this only happens when you first launch. It's up to you to figure that out. :)
Alright thanks, do you happen to know what's that "config.json" file the launcher is creating? All it contains is "null".
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
dorkie4ever
Alright thanks, do you happen to know what's that "config.json" file the launcher is creating? All it contains is "null".
https://github.com/Fraysa/ms-MapleLa...#configuration
Re: [Release] [C#] MapleLauncher - Custom Launcher
Quote:
Originally Posted by
Minike
Thanks I set up the configuration file!
I'm assuming it was not meant to be running from the maplestory folder since it only runs fine when outside of the maplestory folder.
If it's in im getting this:
http://oi60.tinypic.com/v6qm8x.jpg
Re: [Release] [C#] MapleLauncher - Custom Launcher
First off, thanks for this great release! Unfortunately I also have to spam this thread with my problems: When I try to run the launcher, it get an error message (roughly translated from german) "Could not access the socket because of the socket's access privileges.". Does anyone know why this happens? Did I mess up the configuration? I tried to follow the guide exactly.