30 lines
1.3 KiB
Python
30 lines
1.3 KiB
Python
with open(p(assetsPath,"indexes",launcherVariables["assets_index_name"] + ".json"),"r") as fileh: assetJson = json.loads(fileh.read())
|
|
|
|
legacyAssetType = False
|
|
if "map_to_resources" in assetJson and assetJson["map_to_resources"] == True:
|
|
legacyAssetType = "map_to_resources"
|
|
elif "virtual" in assetJson and assetJson["virtual"] == True:
|
|
legacyAssetType = "virtual"
|
|
|
|
if legacyAssetType != False:
|
|
print(colored(colorama.Fore.GREEN,"\nCopying legacy assets..."))
|
|
for asset in assetJson["objects"]:
|
|
hash = assetJson["objects"][asset]["hash"]
|
|
assetIn = p(assetsPath,"objects",hash[:2],hash)
|
|
assetOut = False
|
|
if legacyAssetType == "map_to_resources":
|
|
assetOut = p(launcherVariables["game_directory"],"resources",asset.replace("/",os.path.sep))
|
|
if legacyAssetType == "virtual":
|
|
assetOut = p(assetsPath,"virtual",launcherVariables["assets_index_name"],asset.replace("/",os.path.sep))
|
|
|
|
try:
|
|
os.makedirs(pUp(assetOut))
|
|
except:
|
|
pass
|
|
|
|
if (not os.path.isfile(assetOut)) and os.path.isfile(assetIn):
|
|
shutil.copyfile(assetIn,assetOut)
|
|
|
|
if legacyAssetType == "virtual":
|
|
launcherVariables["assets_root"] = p(launcherVariables["assets_root"],"virtual",launcherVariables["assets_index_name"])
|
|
launcherVariables["game_assets"] = launcherVariables["assets_root"] |