Analysis of the whole process of quick-cocos2d-x encryption

Source: Internet
Author: User
Recently, several friends have asked me about the quick script and resource encryption related issues, it seems that many people still have puzzled about the place, now detailed introduction, lest you toss for a long time.
1. The operation of the resources and script encryption, this article does not introduce, directly run a few command line to do, the specific can refer to the official tutorial.
2. The decryption of the script is also very simple, directly in accordance with the official set of key and signature can be, no longer modify any code.
3. Resource decryption, this modification is a bit more places. First, import the header file search path, $ (srcroot)/. /.. /runtime-src/classes/quick-src
3.1 Single image decryption, modify CCImage.cpp file,
3.1.1 Import header file, #include "extra/apptools/helperfunc.h"
3.1.2 Found function bool Image::initwithimagefile (const std::string& path)
Modify Data data = Fileutils::getinstance ()->getdatafromfile (_filepath); As Data data = Helperfunc::getdata (_filepath);
This completes the process of decrypting a single image.
3.2 CSB File decryption, modify CSLoader.cpp file,
3.2.1 Import header file, #include "extra/apptools/helperfunc.h"
3.2.2 Find function node* csloader::nodewithflatbuffersfile (const std::string &filename)
Modify Data BUF = Fileutils::getinstance ()->getdatafromfile (FullPath), for data BUF = Helperfunc::getdata (FullPath);
This completes the decryption process for the CSB file.
3.3 plist file decryption, modify CCFILEUTILS-APPLE.MM special attention, this article is modified for Xcode, the Android modification principle is similar
3.3.1 Import header file, #include "extra/apptools/helperfunc.h"
3.3.2 Find function ValueMap fileutilsapple::getvaluemapfromfile (const std::string& filename)
Replace nsdictionary* dict = [Nsdictionary Dictionarywithcontentsoffile:path]; for the following code
Data buf = helperfunc::getdata (filename);
NSData *data = [[[NSData Alloc] InitWithBytes:buf.getBytes () length:buf.getSize ()] autorelease];
Nspropertylistformat format;
NSString *error;
Nsmutabledictionary *dict = (nsmutabledictionary *) [
Nspropertylistserialization Propertylistfromdata:data
Mutabilityoption:nspropertylistmutablecontainersandleaves
Format:&format
errordescription:&error];
This completes the decryption process for the plist file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.