def _packimg_rgb_a8(tid, ctx, filePath): noneExt = os.path.splitext(filePath)[0] Log.printDetailln('exe packimg_data_single : ' + filePath) if ctx.platformType == Constant.PLATFORM_IOS : # IOS鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) else: # 瀹夊崜鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) if retval == 0 and re.match(r".*\.png", filePath) : cmd = str(Config.CMD_PACKIMG_A8).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) os.remove(filePath) return retval == 0
def _packimg_rgb(tid, ctx, filePath): noneExt = os.path.splitext(filePath)[0] Log.printDetailln('exec packimg_data_single : ' + filePath) cmd = str(Config.CMD_CONVERT_COLOR_LEVEL).format(fileName=filePath) retval = execCmd(cmd) if retval != 0 : return False if ctx.platformType == Constant.PLATFORM_IOS : # IOS鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) else: # 瀹夊崜鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) os.remove(filePath) return retval == 0
def sqlite_encrypt(ctx): dbFile = ctx.getOutputResPath() + os.sep + 'db' + os.sep + 'runehero.db' tempFile = Config.EXE_DBENCRYPT + os.sep + 'runehero.db' if os.path.exists(dbFile) and os.path.isfile(dbFile): shutil.copyfile(dbFile, tempFile) os.remove(dbFile) retval = execCmd(Config.CMD_SQLITE_ENCRYPT) shutil.copyfile(tempFile, dbFile) return Queue()
def __compileLuaJit(self, absFilePath, relativepath = ''): if self.useJit: if self.isiOS: ret = self.__compileLuaJitiOS(absFilePath) else: ret = execCmd(self.JitCompileCMD.format(filename = absFilePath)) else: return self.__compileLua(absFilePath, relativepath) return ret
def sqlite_encrypt(ctx): dbFile = ctx.getOutputResPath() + os.sep + 'db' + os.sep + 'runehero.db' tempFile = Config.EXE_DBENCRYPT + os.sep + 'runehero.db' if os.path.exists(dbFile) and os.path.isfile(dbFile) : shutil.copyfile(dbFile, tempFile) os.remove(dbFile) retval = execCmd(Config.CMD_SQLITE_ENCRYPT) shutil.copyfile(tempFile, dbFile) return Queue()
def __compileLuaJit(self, absFilePath, relativepath=''): if self.useJit: if self.isiOS: ret = self.__compileLuaJitiOS(absFilePath) else: ret = execCmd(self.JitCompileCMD.format(filename=absFilePath)) else: return self.__compileLua(absFilePath, relativepath) return ret
def _packimg_rgb_a8(tid, ctx, filePath): noneExt = os.path.splitext(filePath)[0] Log.printDetailln('exe packimg_data_single : ' + filePath) if ctx.platformType == Constant.PLATFORM_IOS: # IOS鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) else: # 瀹夊崜鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) if retval == 0 and re.match(r".*\.png", filePath): cmd = str(Config.CMD_PACKIMG_A8).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) os.remove(filePath) return retval == 0
def _packimg_rgb(tid, ctx, filePath): noneExt = os.path.splitext(filePath)[0] Log.printDetailln('exec packimg_data_single : ' + filePath) cmd = str(Config.CMD_CONVERT_COLOR_LEVEL).format(fileName=filePath) retval = execCmd(cmd) if retval != 0: return False if ctx.platformType == Constant.PLATFORM_IOS: # IOS鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_PVR).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) else: # 瀹夊崜鎵撳寘 cmd = str(Config.CMD_PACKIMG_RGB_ETC).format(fileName=filePath, noneExtName=noneExt) retval = execCmd(cmd) os.remove(filePath) return retval == 0
def __compileLuaJitiOS(self, absFilePath): os.chdir(LuaJitiOSx86Dir) execCmd(self.JitCompileCMD.format(filename = absFilePath)) os.chdir(LuaJitiOSx64Dir) execCmd(self.JitCompileCMD2.format(filename = absFilePath)) filepath32 = absFilePath+'.32' filepath64 = absFilePath+'.64' if os.path.exists(filepath32) and os.path.exists(filepath64): if os.path.exists(absFilePath): os.remove(absFilePath) return 0 else: if os.path.exists(filepath32): os.remove(filepath32) if os.path.exists(filepath64): os.remove(filepath64) return 1
def __compileLuaJitiOS(self, absFilePath): os.chdir(LuaJitiOSx86Dir) execCmd(self.JitCompileCMD.format(filename=absFilePath)) os.chdir(LuaJitiOSx64Dir) execCmd(self.JitCompileCMD2.format(filename=absFilePath)) filepath32 = absFilePath + '.32' filepath64 = absFilePath + '.64' if os.path.exists(filepath32) and os.path.exists(filepath64): if os.path.exists(absFilePath): os.remove(absFilePath) return 0 else: if os.path.exists(filepath32): os.remove(filepath32) if os.path.exists(filepath64): os.remove(filepath64) return 1
def _packimgdata(tid, ctx, folderPack): # 鍒犻櫎绾跨▼鎵�灞炰复鏃舵枃浠跺す tidPath = ctx.getTempPath() + os.sep + str(tid) if os.path.exists(tidPath) : shutil.rmtree(tidPath, True) # 澶嶅埗骞剁Щ闄よ繙鏂囦欢澶� dirName = os.path.basename(folderPack) dest = tidPath + os.sep + 'res' + os.sep + 'data' + os.sep + dirName shutil.copytree(folderPack, dest) shutil.rmtree(folderPack) # 鎵ц鎵撳寘鍛戒护 cmd = str(Config.CMD_PACKIMG_DATA).format(tempPath=os.path.normpath(tidPath), srcPath=os.path.normpath(folderPack), baseName=dirName) retval = execCmd(cmd) # 鍒犻櫎绾跨▼涓存椂鏂囦欢澶� shutil.rmtree(tidPath) return retval == 0
def _packimgdata(tid, ctx, folderPack): # 鍒犻櫎绾跨▼鎵�灞炰复鏃舵枃浠跺す tidPath = ctx.getTempPath() + os.sep + str(tid) if os.path.exists(tidPath): shutil.rmtree(tidPath, True) # 澶嶅埗骞剁Щ闄よ繙鏂囦欢澶� dirName = os.path.basename(folderPack) dest = tidPath + os.sep + 'res' + os.sep + 'data' + os.sep + dirName shutil.copytree(folderPack, dest) shutil.rmtree(folderPack) # 鎵ц鎵撳寘鍛戒护 cmd = str(Config.CMD_PACKIMG_DATA).format( tempPath=os.path.normpath(tidPath), srcPath=os.path.normpath(folderPack), baseName=dirName) retval = execCmd(cmd) # 鍒犻櫎绾跨▼涓存椂鏂囦欢澶� shutil.rmtree(tidPath) return retval == 0
def __compileLuac(self, absFilePath, relativepath = ''): if PackXXTea.Is(absFilePath): return 0 RemoveUtf8Bom.remove(absFilePath, relativepath) ret = 0 ret = execCmd(self.JitCompileCMD.format(filename = absFilePath)) if os.path.exists(absFilePath + 'c'): ret = PackXXTea.encode(absFilePath + 'c') if os.path.exists(absFilePath): os.remove(absFilePath) os.rename(absFilePath + 'c', absFilePath) else: return 1 return 0
def __compileLuac(self, absFilePath, relativepath=''): if PackXXTea.Is(absFilePath): return 0 RemoveUtf8Bom.remove(absFilePath, relativepath) ret = 0 ret = execCmd(self.JitCompileCMD.format(filename=absFilePath)) if os.path.exists(absFilePath + 'c'): ret = PackXXTea.encode(absFilePath + 'c') if os.path.exists(absFilePath): os.remove(absFilePath) os.rename(absFilePath + 'c', absFilePath) else: return 1 return 0
def _removebom(tid, ctx, filePath): Log.printDetailln('UTF-8 remove bom : ' + filePath) cmd = str(Config.CMD_REMOVE_BOM).format(fileName=filePath) retval = execCmd(cmd) return retval == 0
def _gzip_pvr(tid, ctx, filePath): cmd = str(Config.CMD_GZIP_PVR).format(fileName=filePath) retval = execCmd(cmd) os.remove(filePath) os.rename(filePath + '.gz', filePath) return retval == 0
def _data_encrypt(tid, ctx, filePath): cmd = str(Config.CMD_DATA_ENCRYPT).format(folderName=filePath) retval = execCmd(cmd) return retval == 0
def _luac_scriptlua(tid, ctx, filePath): cmd = str(Config.CMD_LUAC_SCRIPTLUA).format(fileName=filePath) retval = execCmd(cmd) return retval == 0
def _lua_to_byte(tid, ctx, filePath): cmd = str(Config.CMD_LUA_TO_BYTE).format(fileName=filePath) retval = execCmd(cmd) return retval == 0
def _poweroftwo_mapres_and_battlebg(tid, ctx, filePath): cmd = str(Config.CMD_POWER_OF_TWO).format(fileName=filePath) retval = execCmd(cmd) return retval == 0