Show progress bar when unpacking files.
This commit is contained in:
@@ -13,6 +13,7 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import wave
|
||||
from tqdm import tqdm
|
||||
|
||||
from arcane.ArcImage import *
|
||||
from arcane.ArcMesh import *
|
||||
@@ -29,6 +30,7 @@ from arcane.objects import ArcObj, ArcDoorObject, ArcStaticObject, ArcStructureO
|
||||
from arcane.util import *
|
||||
from arcane.zones import *
|
||||
|
||||
|
||||
DUMP_DIRECTORY = 'ARCANE_DUMP'
|
||||
WORKING_DIRECTORY = os.path.dirname(__file__)
|
||||
TARGET_DIRECTORY = os.path.join(WORKING_DIRECTORY, DUMP_DIRECTORY)
|
||||
@@ -148,6 +150,7 @@ def unpack_cobjects():
|
||||
|
||||
resources = load_cache_file('CObjects.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
in_stream = ResStream(data)
|
||||
magic = in_stream.read_dword()
|
||||
@@ -163,6 +166,7 @@ def unpack_cobjects():
|
||||
parsed = arc_in.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_cobjects():
|
||||
@@ -221,6 +225,7 @@ def unpack_czones():
|
||||
|
||||
resources = load_cache_file('CZone.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_zone = ArcZone()
|
||||
in_stream = ResStream(data)
|
||||
@@ -232,6 +237,7 @@ def unpack_czones():
|
||||
parsed = arc_zone.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_czones():
|
||||
@@ -278,6 +284,7 @@ def unpack_sound():
|
||||
|
||||
resources = load_cache_file('Sound.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_sound = ArcSound()
|
||||
in_stream = ResStream(data)
|
||||
@@ -291,6 +298,7 @@ def unpack_sound():
|
||||
wave_writer = wave.Wave_write(fp)
|
||||
arc_sound.save_wav(wave_writer)
|
||||
wave_writer.close()
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_sound():
|
||||
@@ -344,7 +352,11 @@ def test_sound():
|
||||
def unpack_texture():
|
||||
init_texture()
|
||||
|
||||
print('Decompressing Texture Cache...')
|
||||
resources = load_cache_file('Textures.cache')
|
||||
|
||||
print('Writing images')
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
filepath = os.path.join(
|
||||
TEXTURE_DIRECTORY,
|
||||
@@ -355,6 +367,7 @@ def unpack_texture():
|
||||
in_stream = ResStream(data)
|
||||
arc_texture.load_binary(in_stream)
|
||||
arc_texture.save_img(filepath)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_texture():
|
||||
@@ -408,6 +421,8 @@ def unpack_terrain():
|
||||
init_terrain()
|
||||
|
||||
resources = load_cache_file('TerrainAlpha.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
filepath = os.path.join(
|
||||
TERRAIN_DIRECTORY,
|
||||
@@ -418,6 +433,7 @@ def unpack_terrain():
|
||||
in_stream = ResStream(data)
|
||||
arc_terrain.load_binary(in_stream)
|
||||
arc_terrain.save_img(filepath)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_terrain():
|
||||
@@ -474,6 +490,7 @@ def unpack_mesh():
|
||||
|
||||
resources = load_cache_file('Mesh.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_mesh = ArcMesh()
|
||||
in_stream = ResStream(data)
|
||||
@@ -485,6 +502,7 @@ def unpack_mesh():
|
||||
parsed = arc_mesh.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_mesh():
|
||||
@@ -531,6 +549,7 @@ def unpack_visual():
|
||||
|
||||
resources = load_cache_file('Visual.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_visual = ArcVisual()
|
||||
in_stream = ResStream(data)
|
||||
@@ -542,6 +561,7 @@ def unpack_visual():
|
||||
parsed = arc_visual.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_visual():
|
||||
@@ -588,6 +608,7 @@ def unpack_motion():
|
||||
|
||||
resources = load_cache_file('Motion.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_motion = ArcMotion()
|
||||
in_stream = ResStream(data)
|
||||
@@ -599,6 +620,7 @@ def unpack_motion():
|
||||
parsed = arc_motion.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_motion():
|
||||
@@ -645,6 +667,7 @@ def unpack_tile():
|
||||
|
||||
resources = load_cache_file('Tile.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_tile = ArcTileManager()
|
||||
in_stream = ResStream(data)
|
||||
@@ -656,6 +679,7 @@ def unpack_tile():
|
||||
parsed = arc_tile.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_tile():
|
||||
@@ -702,6 +726,7 @@ def unpack_skeleton():
|
||||
|
||||
resources = load_cache_file('Skeleton.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_skeleton = ArcSkeleton()
|
||||
in_stream = ResStream(data)
|
||||
@@ -714,6 +739,7 @@ def unpack_skeleton():
|
||||
parsed = arc_skeleton.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_skeleton():
|
||||
@@ -760,6 +786,7 @@ def unpack_render():
|
||||
|
||||
resources = load_cache_file('render.cache')
|
||||
|
||||
with tqdm(total=len(resources)) as pBar:
|
||||
for res_id, data in resources:
|
||||
arc_render = ArcRender()
|
||||
in_stream = ResStream(data)
|
||||
@@ -772,6 +799,7 @@ def unpack_render():
|
||||
parsed = arc_render.save_json()
|
||||
with open(filepath, 'w') as fp:
|
||||
json.dump(parsed, fp, indent=2)
|
||||
pBar.update(1)
|
||||
|
||||
|
||||
def pack_render():
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
pillow==9.3.0
|
||||
|
||||
|
||||
tqdm~=4.64.1
|
||||
|
||||
Reference in New Issue
Block a user