Honorable Member martysama0134 7178 Posted March 13, 2015 Honorable Member Share Posted March 13, 2015 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) Intro This release will explain how to "convert" your root .py files to .c ones. Actually, Cython only converts those files to pure CPython code. Download This is the hidden content, please Sign In or Sign Up This is the hidden content, please Sign In or Sign Up As requested by many people, you can download the compatible and clean official cn root dated 20131228-0034 without further edits: This is the hidden content, please Sign In or Sign Up This is the hidden content, please Sign In or Sign Up This is the hidden content, please Sign In or Sign Up Is Cython really worth it? Pros All the modules are compiled, and they can't be "extracted as .py" anymore. We can always disassemble the launcher with IDA, but the result will be pseudo-c code after waiting 6-8h of analyzing. Since we're not using .pyx files but directly .py ones, there's no "so much optimization". At least, 10% of performance increasing is guaranteed. Cons For testing purposes, it's heavy to maintain. Everytime you try to re-compile your root files, you should wait 5-10 minutes. You can always use the uncythonized root (.py files) when you perform tests, and compile cython whenever you will make an update in your live server. The launcher's size will increase ~10mb. You can actually pack it to save space. If you directly use a .pyd (still 10mb), the launcher's size won't increase. VideoTutorial Credits Me (lollo_9_1/martysama0134) Night (OST suggestion) Random Testers What's New: vsimpl Visual studio implementation automatic cythonization when compiling only the edited files will be compiled v2.0 The module's name check is now case-insensitive (colorInfo == colorinfo) Added a new function rootlib/uiscriptlib.getList() to retrieve a tuple of all the available cythonized modules. Now you can compile a uiscriptlib library from the uiscript*.py files! (implemented as __USE_EXTRA_CYTHON__) Added a sample ui.py containing the code to run uiscriptlib. 211 2 4 1 1 1 2 4 1 74 13 177 Check out my GitHub Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 13, 2015 Share Posted March 13, 2015 Thanks , many thanks. Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted March 13, 2015 Share Posted March 13, 2015 Thanks, but i think you should put a guide of how to repair the errors give the *.py files when you are cythonicing, a lot of people cant use the system if dont know how repair it. <-- this is not going for me, I know how to fix it. Only to increase the information in the post. https://m2admin.net/ Link to comment Share on other sites More sharing options...
Lyrex 6 Posted March 13, 2015 Share Posted March 13, 2015 Absolutely worth a like. Well, I think this is a good start for everybody who wants to start protecting his client a bit more and probably event get some more performance out of the client. Based on this tutorial, everybody who knows c++ can go further and try things like removing the pack-module (or at least modifying it) or do some other fancy stuff So again: Great tutorial! I'd be way too lazy to spend that much effort in something like doing tutorials but its great to see that others do. Keep up the good work. @ѕeмa™: Don't you think that you should let at least a small part of work up to the people? Everybody who is capable of reading at least a bit english or even just using a translator should be able to read the error messaged and thus be able to fix them. It's really not that hard. Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted March 13, 2015 Share Posted March 13, 2015 @ѕeмa™: Don't you think that you should let at least a small part of work up to the people? Everybody who is capable of reading at least a bit english or even just using a translator should be able to read the error messaged and thus be able to fix them. It's really not that hard. yep, you have right xd https://m2admin.net/ Link to comment Share on other sites More sharing options...
metin2team 766 Posted March 13, 2015 Share Posted March 13, 2015 but i think you should put a guide of how to repair the errors give the *.py files when you are cythonicing, a lot of people cant use the system if dont know how repair it. <-- this is not going for me, I know how to fix it. why don't you do it ? Link to comment Share on other sites More sharing options...
Active Member Koray 1999 Posted March 13, 2015 Active Member Share Posted March 13, 2015 Great work thanks for share Link to comment Share on other sites More sharing options...
valessio 13 Posted March 13, 2015 Share Posted March 13, 2015 great great work, nice tutorial your knowledge is the best of metin2dev forum. LIKE +1! Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 13, 2015 Author Honorable Member Share Posted March 13, 2015 Thanks, but i think you should put a guide of how to repair the errors give the *.py files when you are cythonicing, a lot of people cant use the system if dont know how repair it. <-- this is not going for me, I know how to fix it. Only to increase the information in the post. The only two errors you could get when you compile your root are: "Decoding error, missing or incorrect coding"Since all the .py files are processed as korean strings, all of them written with a different charset (arabic) will trigger this issue. It's explained in the .txt file, and you can simply bypass this just writing the text in the locale_game.txt file. "Expected an increase in indentation level"This happens when the .py file has a bad tabulation, so bad written: It's clear that you won't be able to compile unworkable/unrunnable/broken .py files. 8 Check out my GitHub Link to comment Share on other sites More sharing options...
Night 366 Posted March 13, 2015 Share Posted March 13, 2015 Thanks, but i think you should put a guide of how to repair the errors give the *.py files when you are cythonicing, a lot of people cant use the system if dont know how repair it. <-- this is not going for me, I know how to fix it. Only to increase the information in the post. The only two errors you could get when you compile your root are: "Decoding error, missing or incorrect coding" Since all the .py files are processed as korean strings, all of them written with a different charset (arabic) will trigger this issue. It's explained in the .txt file, and you can simply bypass this just writing the text in the locale_game.txt file. "Expected an increase in indentation level" This happens when the .py file has a bad tabulation, so bad written: It's clear that you won't be able to compile unworkable/unrunnable/broken .py files. i rarely do something like that but some encoding error happened , well ppl should use what was made for such a thing (localeinfo/uiscriptlocale) + nice tuto and thanks for the Credits ahah 1 Link to comment Share on other sites More sharing options...
MMOGuardian 0 Posted March 13, 2015 Share Posted March 13, 2015 Maybe a stupid question, but can you cythonize all the python files of the client? I mean really each py file, including every script Link to comment Share on other sites More sharing options...
Ira™ 41 Posted March 13, 2015 Share Posted March 13, 2015 Maybe a stupid question, but can you cythonize all the python files of the client? I mean really each py file, including every script Only .py files. Yes you can, to make uiscript .pyd Link to comment Share on other sites More sharing options...
aviragames 0 Posted March 13, 2015 Share Posted March 13, 2015 Thank how to, help error " at top of source (cannot decode with encoding 'cp949': illegal multibyte s" Link to comment Share on other sites More sharing options...
Ira™ 41 Posted March 13, 2015 Share Posted March 13, 2015 Thank how to, help error " at top of source (cannot decode with encoding 'cp949': illegal multibyte s" serverinfo.py ? Delete spaces. Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 13, 2015 Author Honorable Member Share Posted March 13, 2015 Maybe a stupid question, but can you cythonize all the python files of the client? I mean really each py file, including every script The script as "it is", right now, creates a "rootlib" module. There are tons of way to do what you asked. (at least, 10 ways)The easier one to do so, using cython, would be making a "uiscriptlib" library, and re-writing the Sandbox.execfile method inside the utils.py file. Check out my GitHub Link to comment Share on other sites More sharing options...
Premium mogulul 17 Posted March 13, 2015 Premium Share Posted March 13, 2015 (edited) I have a problem.I follow this steps: -Copy all your root*.py files into the .MainRootLib folder -Copy python.exe, RootLibCythonizer.bat, and RootLibCythonizer.py from .Main into the .MainRootLib folder -Run .MainRootLibRootLibCythonizer.bat ----at this step I have a problem Can someone help me please? Edited August 24, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
Premium Galet 510 Posted March 13, 2015 Premium Share Posted March 13, 2015 I have all the files to cytonize since some months, but I can't cythonise due to some issues. Now, I can, love you marty ! One of the best How-To ever <3 Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 13, 2015 Author Honorable Member Share Posted March 13, 2015 (edited) When I run the MakeFile_VC_Release.bat file, I get the following errors: 'cl' is not recognized as an internal or external command, operable program or batch file. 'lib' is not recognized as an internal or external command, operable program or batch file. It's simple: it happens when the visual studio path is not specified in the %PATH% environment variable.You have few solutions: Add the visual studio path in the %PATH% environment variable. (I won't suggest it) Add something like this at the beginning of the MakeFile_VC_Release.bat file and run it as administrator: (easy way) call "C:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" You should run as admininistrator the Visual Studio Command Prompt (2010)" and then recall the .bat from there. (highly preferable) NB: I've used vs2010, but it works without any problems with any vs version. Edited March 13, 2015 by martysama0134 Check out my GitHub Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 13, 2015 Share Posted March 13, 2015 I can compile a few files from the root or all files is needed? Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 13, 2015 Author Honorable Member Share Posted March 13, 2015 I can compile a few files from the root or all files is needed?If you use the files as "they are", only system.py and prototype.py are required.If the module you want to include is not present in the rootlib one, the client will try to open the relative <modulename>.py file. 1 Check out my GitHub Link to comment Share on other sites More sharing options...
aviragames 0 Posted March 13, 2015 Share Posted March 13, 2015 How to fix Error: pack_open ? Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 14, 2015 Author Honorable Member Share Posted March 14, 2015 How to fix Error: pack_open ? system.py, below this: __builtins__.new_open = open add: __builtins__.pack_open = open 1 Check out my GitHub Link to comment Share on other sites More sharing options...
aviragames 0 Posted March 14, 2015 Share Posted March 14, 2015 How to fix Error: pack_open ? system.py, below this: __builtins__.new_open = open add: __builtins__.pack_open = open Thank you Link to comment Share on other sites More sharing options...
-TÜRK- 23 Posted March 14, 2015 Share Posted March 14, 2015 Hi, marty. When cythonized, is there still need dynamic linking e.g: python27.dll or library files? Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted March 14, 2015 Author Honorable Member Share Posted March 14, 2015 Hi, marty. When cythonized, is there still need dynamic linking e.g: python27.dll or library files?Yes, the python27.dll, and the lib folder are still required.You can now develop an interesting hash check of these files in the __hybrid_import function inside system.py. Check out my GitHub Link to comment Share on other sites More sharing options...
Recommended Posts