|
|
|
@ -13,6 +13,7 @@ import json
@@ -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
@@ -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,21 +150,23 @@ def unpack_cobjects():
@@ -148,21 +150,23 @@ def unpack_cobjects():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('CObjects.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
magic = in_stream.read_dword() |
|
|
|
|
obj_type = in_stream.read_dword() |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
magic = in_stream.read_dword() |
|
|
|
|
obj_type = in_stream.read_dword() |
|
|
|
|
|
|
|
|
|
arc_in = COBJECTS_MAP[obj_type]() |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
COBJECTS_DIRECTORY, |
|
|
|
|
OBJECT_TYPE_TO_STRING[obj_type], |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_in.load_binary(in_stream) |
|
|
|
|
parsed = arc_in.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
arc_in = COBJECTS_MAP[obj_type]() |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
COBJECTS_DIRECTORY, |
|
|
|
|
OBJECT_TYPE_TO_STRING[obj_type], |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_in.load_binary(in_stream) |
|
|
|
|
parsed = arc_in.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_cobjects(): |
|
|
|
@ -221,17 +225,19 @@ def unpack_czones():
@@ -221,17 +225,19 @@ def unpack_czones():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('CZone.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_zone = ArcZone() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
CZONE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_zone.load_binary(in_stream) |
|
|
|
|
parsed = arc_zone.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_zone = ArcZone() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
CZONE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_zone.load_binary(in_stream) |
|
|
|
|
parsed = arc_zone.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_czones(): |
|
|
|
@ -278,19 +284,21 @@ def unpack_sound():
@@ -278,19 +284,21 @@ def unpack_sound():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Sound.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_sound = ArcSound() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
SOUND_DIRECTORY, |
|
|
|
|
f'{res_id:d}.wav' |
|
|
|
|
) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_sound = ArcSound() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
SOUND_DIRECTORY, |
|
|
|
|
f'{res_id:d}.wav' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
arc_sound.load_binary(in_stream) |
|
|
|
|
with open(filepath, 'wb') as fp: |
|
|
|
|
wave_writer = wave.Wave_write(fp) |
|
|
|
|
arc_sound.save_wav(wave_writer) |
|
|
|
|
wave_writer.close() |
|
|
|
|
arc_sound.load_binary(in_stream) |
|
|
|
|
with open(filepath, 'wb') as fp: |
|
|
|
|
wave_writer = wave.Wave_write(fp) |
|
|
|
|
arc_sound.save_wav(wave_writer) |
|
|
|
|
wave_writer.close() |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_sound(): |
|
|
|
@ -344,17 +352,22 @@ def test_sound():
@@ -344,17 +352,22 @@ def test_sound():
|
|
|
|
|
def unpack_texture(): |
|
|
|
|
init_texture() |
|
|
|
|
|
|
|
|
|
print('Decompressing Texture Cache...') |
|
|
|
|
resources = load_cache_file('Textures.cache') |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TEXTURE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.tga' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
arc_texture = ArcTexture() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
arc_texture.load_binary(in_stream) |
|
|
|
|
arc_texture.save_img(filepath) |
|
|
|
|
print('Writing images') |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TEXTURE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.tga' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
arc_texture = ArcTexture() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
arc_texture.load_binary(in_stream) |
|
|
|
|
arc_texture.save_img(filepath) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_texture(): |
|
|
|
@ -408,16 +421,19 @@ def unpack_terrain():
@@ -408,16 +421,19 @@ def unpack_terrain():
|
|
|
|
|
init_terrain() |
|
|
|
|
|
|
|
|
|
resources = load_cache_file('TerrainAlpha.cache') |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TERRAIN_DIRECTORY, |
|
|
|
|
f'{res_id:d}.tga' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
arc_terrain = ArcTerrain() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
arc_terrain.load_binary(in_stream) |
|
|
|
|
arc_terrain.save_img(filepath) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TERRAIN_DIRECTORY, |
|
|
|
|
f'{res_id:d}.tga' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
arc_terrain = ArcTerrain() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
arc_terrain.load_binary(in_stream) |
|
|
|
|
arc_terrain.save_img(filepath) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_terrain(): |
|
|
|
@ -474,17 +490,19 @@ def unpack_mesh():
@@ -474,17 +490,19 @@ def unpack_mesh():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Mesh.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_mesh = ArcMesh() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
MESH_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_mesh.load_binary(in_stream) |
|
|
|
|
parsed = arc_mesh.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_mesh = ArcMesh() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
MESH_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_mesh.load_binary(in_stream) |
|
|
|
|
parsed = arc_mesh.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_mesh(): |
|
|
|
@ -531,17 +549,19 @@ def unpack_visual():
@@ -531,17 +549,19 @@ def unpack_visual():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Visual.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_visual = ArcVisual() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
VISUAL_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_visual.load_binary(in_stream) |
|
|
|
|
parsed = arc_visual.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_visual = ArcVisual() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
VISUAL_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_visual.load_binary(in_stream) |
|
|
|
|
parsed = arc_visual.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_visual(): |
|
|
|
@ -588,17 +608,19 @@ def unpack_motion():
@@ -588,17 +608,19 @@ def unpack_motion():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Motion.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_motion = ArcMotion() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
MOTION_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_motion.load_binary(in_stream) |
|
|
|
|
parsed = arc_motion.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_motion = ArcMotion() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
MOTION_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_motion.load_binary(in_stream) |
|
|
|
|
parsed = arc_motion.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_motion(): |
|
|
|
@ -645,17 +667,19 @@ def unpack_tile():
@@ -645,17 +667,19 @@ def unpack_tile():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Tile.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_tile = ArcTileManager() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TILE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_tile.load_binary(in_stream) |
|
|
|
|
parsed = arc_tile.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_tile = ArcTileManager() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
TILE_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_tile.load_binary(in_stream) |
|
|
|
|
parsed = arc_tile.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_tile(): |
|
|
|
@ -702,18 +726,20 @@ def unpack_skeleton():
@@ -702,18 +726,20 @@ def unpack_skeleton():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('Skeleton.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_skeleton = ArcSkeleton() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
SKELETON_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_skeleton.load_binary(in_stream) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_skeleton = ArcSkeleton() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
SKELETON_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_skeleton.load_binary(in_stream) |
|
|
|
|
|
|
|
|
|
parsed = arc_skeleton.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
parsed = arc_skeleton.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_skeleton(): |
|
|
|
@ -760,18 +786,20 @@ def unpack_render():
@@ -760,18 +786,20 @@ def unpack_render():
|
|
|
|
|
|
|
|
|
|
resources = load_cache_file('render.cache') |
|
|
|
|
|
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_render = ArcRender() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
RENDER_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_render.load_binary(in_stream) |
|
|
|
|
|
|
|
|
|
parsed = arc_render.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
with tqdm(total=len(resources)) as pBar: |
|
|
|
|
for res_id, data in resources: |
|
|
|
|
arc_render = ArcRender() |
|
|
|
|
in_stream = ResStream(data) |
|
|
|
|
filepath = os.path.join( |
|
|
|
|
RENDER_DIRECTORY, |
|
|
|
|
f'{res_id:d}.json' |
|
|
|
|
) |
|
|
|
|
arc_render.load_binary(in_stream) |
|
|
|
|
|
|
|
|
|
parsed = arc_render.save_json() |
|
|
|
|
with open(filepath, 'w') as fp: |
|
|
|
|
json.dump(parsed, fp, indent=2) |
|
|
|
|
pBar.update(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pack_render(): |
|
|
|
|