Skip to content

Commit

Permalink
Merge pull request #149 from kk49/develop
Browse files Browse the repository at this point in the history
v0.2.18 release
  • Loading branch information
kk49 authored Jun 14, 2023
2 parents 484adc2 + a2dfa35 commit 0089444
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 32 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#### v0.2.18 Lucid Knows
* add: support for Ravenbound Demo
* fix: bug with skeleton extraction on Windows and path setup
* fix: extracted raw files used directory name without slash

#### v0.2.17 can't sleep, hotfix time
* Fixed bug with loading because of ADF5 type discovery (https://github.com/kk49/deca/issues/144)
* fix: bug with loading because of ADF5 type discovery (https://github.com/kk49/deca/issues/144)

#### v0.2.16 what would it be like to be a raven?
* Support for processing of uncompressed COTW ADF save files
Expand Down
9 changes: 6 additions & 3 deletions python/deca/deca/db_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1338,9 +1338,12 @@ def file_obj_from(self, node: VfsNode):
# buffer_ret = in_buffer
# ret = compressed_len
elif compression_type in {compression_v4_03_zstd}:
dc = zstd.ZstdDecompressor()
buffer_ret = dc.decompress(in_buffer)
ret = len(buffer_ret)
if compressed_len == uncompressed_len:
buffer_ret, ret = in_buffer, len(in_buffer)
else:
dc = zstd.ZstdDecompressor()
buffer_ret = dc.decompress(in_buffer)
ret = len(buffer_ret)
else:
if compressed_len == uncompressed_len:
buffer_ret, ret = in_buffer, len(in_buffer)
Expand Down
11 changes: 7 additions & 4 deletions python/deca/deca/export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def extract_node_raw(
if node.offset is not None:
with ArchiveFile(vfs.file_obj_from(node)) as f:
if node.v_path is None:
out_file = extract_dir + node.v_hash_to_str() + '.dat'
out_file = os.path.join(extract_dir, node.v_hash_to_str() + '.dat')
else:
out_file = extract_dir + '{}'.format(node.v_path.decode('utf-8'))
out_file = os.path.join(extract_dir, '{}'.format(node.v_path.decode('utf-8')))

vfs.logger.log('Exporting Raw: {}'.format(out_file))

Expand Down Expand Up @@ -172,7 +172,8 @@ def nodes_export_gltf(

except EDecaFileExists as e:
vfs.logger.log(
'WARNING: Extracting {} Failed: overwrite disabled and {} exists, skipping'.format(node.v_path, e.args[0]))
'WARNING: Extracting {} Failed: overwrite disabled and {} exists, skipping'.format(node.v_path,
e.args[0]))
except EDecaMissingAdfType as e:
vfs.logger.log(
'ERROR: Extracting {} Failed: Missing ADF Type 0x{:08x} '.format(node.v_path, e.type_id))
Expand Down Expand Up @@ -207,6 +208,7 @@ def nodes_export_processed(
vs_rtpc = []
vs_images = []
vs_fsb5cs = []
vs_rename = []
vs_other = []
node_map = vfs_view.nodes_selected_get()
for k, (nodes_real, nodes_sym) in node_map.items():
Expand Down Expand Up @@ -236,7 +238,8 @@ def nodes_export_processed(
vs_images.append(node)
elif node.file_type in {FTYPE_FSB5C}:
vs_fsb5cs.append(node)
elif isinstance(node.v_path, bytes) and (node.v_path.endswith(b'.csvc') or node.v_path.endswith(b'.bmpc')):
elif isinstance(node.v_path, bytes) and (
node.v_path.endswith(b'.csvc') or node.v_path.endswith(b'.bmpc')):
vs_rename.append(node)
else:
vs_other.append(node)
Expand Down
25 changes: 16 additions & 9 deletions python/deca/deca/ff_aaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def load_aaf_header(fin):
aafh = AafHeader()
aafh.magic = f.read(4)
aafh.version = f.read_u32()
aafh.aic = f.read(8+16+4)
aafh.aic = f.read(8 + 16 + 4)
aafh.size_u = f.read_u32() # uncompressed length, whole file
aafh.section_size = f.read_u32() # uncompress length, max any section?
aafh.section_count = f.read_u32() # section count? Normally 1 (2-5 found), number of 32MiB blocks?
Expand All @@ -28,7 +28,7 @@ def extract_aaf(src):
f = src
magic = f.read(4)
version = f.read_u32()
aic = f.read(8+16+4)
aic = f.read(8 + 16 + 4)
uncompressed_length = f.read_u32() # uncompressed length, whole file
section_size = f.read_u32() # uncompress length, max any section?
section_count = f.read_u32() # section count? Normally 1 (2-5 found), number of 32MiB blocks?
Expand All @@ -39,16 +39,23 @@ def extract_aaf(src):
section_compressed_length = f.read_u32() # compressed length no including padding
section_uncompressed_length = f.read_u32() # full length?
section_length_with_header = f.read_u32() # padded length + 16
magic_ewam = f.read(4) # 'EWAM'
magic_ewam = f.read(4) # 'EWAM'
buf_in = f.read(section_compressed_length)
buf_out = zlib.decompress(buf_in, -15)
if len(buf_out) != section_uncompressed_length:
raise Exception(
'Uncompress Failed Section {}/{}: scs:{}, sus:{}, bl:{}, m:{}'.format(
i, section_count, section_compressed_length, section_uncompressed_length, len(buf_out),
magic_ewam,
))
buffer_out = buffer_out + buf_out

if len(buf_out) != section_uncompressed_length:
# raise Exception(
print('WARNING: Uncompress Failed Section {}/{}: scs:{}, sus:{}, bl:{}, m:{}'.format(
i, section_count, section_compressed_length, section_uncompressed_length, len(buf_out),
magic_ewam,
))

if len(buf_out) > section_uncompressed_length:
raise Exception("len(buf_out) > section_uncompressed_length")

# buffer_out += b'\x00' * (section_compressed_length - len(buf_out))

f.seek(section_length_with_header + section_start)
# print(section_compressed_length, section_uncompressed_length, section_length_with_header, magic_ewam)

Expand Down
28 changes: 15 additions & 13 deletions python/deca_gui/deca_gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
from PySide2.QtWidgets import QApplication, QMainWindow, QMessageBox, QFileDialog, QStyle
from PySide2.QtGui import QDesktopServices, QKeyEvent


window_title = 'decaGUI: v0.2.17'
window_title = 'decaGUI: v0.2.18'


class MainWindowDataSource(IVfsViewSrc):
Expand Down Expand Up @@ -297,13 +296,13 @@ def slot_folder_show_clicked(self, checked):
path = self.vfs_view_current().common_prefix()

if self.sender() == self.ui.bt_extract_folder_show:
root = self.vfs.working_dir + 'extracted/'
root = os.path.join(self.vfs.working_dir, 'extracted')
elif self.sender() == self.ui.bt_extract_gltf_3d_folder_show:
root = self.vfs.working_dir + 'gltf2_3d/'
root = os.path.join(self.vfs.working_dir, 'gltf2_3d')
elif self.sender() == self.ui.bt_mod_folder_show:
root = self.vfs.working_dir + 'mod/'
root = os.path.join(self.vfs.working_dir, 'mod')
elif self.sender() == self.ui.bt_mod_build_folder_show:
root = self.vfs.working_dir + 'build/'
root = os.path.join(self.vfs.working_dir, 'build')
path = None
else:
root = None
Expand All @@ -326,7 +325,7 @@ def slot_folder_show_clicked(self, checked):

def slot_extract_clicked(self, checked):
self.extract(
'Extraction', self.vfs.working_dir + 'extracted/',
'Extraction', os.path.join(self.vfs.working_dir, 'extracted'),
export_raw=self.ui.chkbx_export_raw_extract.isChecked(),
export_contents=self.ui.chkbx_export_contents_extract.isChecked(),
save_to_processed=self.ui.chkbx_export_processed_extract.isChecked(),
Expand All @@ -337,7 +336,7 @@ def slot_extract_clicked(self, checked):

def slot_extract_gltf_clicked(self, checked):
self.extract_gltf(
'GLTF2 / 3D', self.vfs.working_dir + 'gltf2_3d/',
'GLTF2 / 3D', os.path.join(self.vfs.working_dir, 'gltf2_3d'),
save_to_one_dir=self.ui.chkbx_export_save_to_one_dir.isChecked(),
include_skeleton=self.ui.chkbx_export_3d_include_skeleton.isChecked(),
texture_format=self.ui.cmbbx_texture_format.currentText(),
Expand All @@ -348,7 +347,7 @@ def slot_mod_build_subset_clicked(self, checked):

def slot_mod_prep_clicked(self, checked):
self.extract(
'Mod Prep', self.vfs.working_dir + 'mod/',
'Mod Prep', os.path.join(self.vfs.working_dir, 'mod'),
export_raw=self.ui.chkbx_export_raw_mods.isChecked(),
export_contents=self.ui.chkbx_export_contents_mods.isChecked(),
save_to_processed=self.ui.chkbx_export_processed_mods.isChecked(),
Expand All @@ -365,8 +364,8 @@ def slot_mod_build_clicked(self, checked):

self.builder.build_dir(
self.vfs,
self.vfs.working_dir + 'mod/',
self.vfs.working_dir + 'build/',
os.path.join(self.vfs.working_dir, 'mod'),
os.path.join(self.vfs.working_dir, 'build'),
subset=subset,
symlink_changed_file=False,
do_not_build_archive=self.ui.chkbx_mod_do_not_build_archives.isChecked()
Expand Down Expand Up @@ -470,7 +469,8 @@ def project_new(self, checked):
@Slot()
def project_open(self, checked):

filename = QFileDialog.getOpenFileName(self, 'Open Project ...', os.path.join(deca_root(), '..', 'work'), 'Project File (project.json)')
filename = QFileDialog.getOpenFileName(self, 'Open Project ...', os.path.join(deca_root(), '..', 'work'),
'Project File (project.json)')
if filename is not None and len(filename[0]) > 0:
project_file = filename[0]
vfs = vfs_structure_open(project_file)
Expand All @@ -490,7 +490,9 @@ def external_add(self, checked):

@Slot()
def file_gz_open(self, checked):
filenames, selected_filter = QFileDialog.getOpenFileNames(self, 'Open GZ File ...', os.path.join(deca_root(), '..', 'work'), 'Any File (*)')
filenames, selected_filter = QFileDialog.getOpenFileNames(self, 'Open GZ File ...',
os.path.join(deca_root(), '..', 'work'),
'Any File (*)')

if filenames and len(filenames[0]) > 0:
path, _ = os.path.split(filenames[0])
Expand Down
6 changes: 4 additions & 2 deletions resources/deca/gameinfo/hp.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"hp_mexico_",
"hp_delta_",
"hp_finland_",
"hp_nh_"
"hp_nh_",
"hp_trophyworld_3_"
],
"world_indexes": [0,1,2,3,4,5],
"world_patches": [
Expand Down Expand Up @@ -62,7 +63,8 @@
"textures/ui/map_reserve_11/",
"textures/ui/map_reserve_12/",
"textures/ui/map_reserve_13/",
"textures/ui/map_reserve_14/"
"textures/ui/map_reserve_14/",
"textures/ui/map_reserve_15/"
],
"unarchived_files": [],
"archive_paths": [
Expand Down
104 changes: 104 additions & 0 deletions resources/deca/gameinfo/rb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"game_id": "rb",
"exe_match": ".*Ravenbound.*",
"archive_version": 5,
"file_hash_size": 8,
"oo_decompress_dll": "${GAME_DIR}/oo2core_7_win64.dll",
"area_prefixes": [
"",
"testbed",
"prototype"
],
"world_indexes": [0,1,2,3,4,5],
"world_patches": [
"worlds/prototype/terrain/patches/width_3/",
"worlds/prototype/terrain/patches/width_4/",
"worlds/prototype/terrain/patches/width_8/",
"worlds/prototype/terrain/veg_streampatches/width_3/",
"worlds/prototype/terrain/veg_streampatches/width_4/",
"worlds/prototype/terrain/veg_streampatches/width_8/",
"worlds/testbed/terrain/patches/width_3/",
"worlds/testbed/terrain/patches/width_4/",
"worlds/testbed/terrain/patches/width_8/",
"worlds/testbed/terrain/veg_streampatches/width_3/",
"worlds/testbed/terrain/veg_streampatches/width_4/",
"worlds/testbed/terrain/veg_streampatches/width_8/"
],
"world_occluders": [
"worlds/prototype/terrain/occluder/",
"worlds/testbed/terrain/occluder/"
],
"world_navheightfields": [
"worlds/prototype/terrain/hp/navheightfield/globalhires/",
"worlds/testbed/terrain/hp/navheightfield/globalhires/"
],
"world_hm": [
"worlds/prototype/terrain/hp/horizonmap/horizon_${AREA_PREFIX}",
"worlds/testbed/terrain/hp/horizonmap/horizon_${AREA_PREFIX}"
],
"world_ai": [
"ai/tiles/",
"worlds/prototype/ai/tiles/",
"worlds/testbed/ai/tiles/",
"worlds/world${WORLD_INDEX}/ai/tiles/"
],
"map_zooms": [0,1,2,3],
"map_max_count": 500,
"map_prefixes": [
"worlds/${AREA_PREFIX}/world_map/worldmap_"
],
"unarchived_files": [],
"archive_paths": [
"${GAME_DIR}/archives_win64/"
],
"mdic_ftype": "mdi",
"navmesh_ftype": "h2014",
"obc_ftype": "",
"pfs_ftype": "pfx",
"has_garcs": true,
"file_assoc": [
{
".ee": "sarc",
".epe": "rtpc"
},
{
".bl": "META-ANY-TYPE",
".nl": "META-ANY-TYPE",
".fl": "META-ANY-TYPE",
".blo": "rtpc",
".nl.mdic": "adf",
".fl.mdic": "adf",
".pfs": "tag0",
".obc": "obc"
},
{
".meshc": "adf",
".hrmeshc": "adf",
".modelc": "adf",
".model_xml": "txt",
".model_deps": "txt",
".pfxc": "pfx"
},
{
".ddsc": "avtx,dds",
".hmddsc": "atx,META-NO-TYPE",
".atx0": "atx,META-NO-TYPE",
".atx1": "atx,META-NO-TYPE",
".atx2": "atx,META-NO-TYPE"
},
{
".fmod_sbankc": "txt",
".fmod_bankc": "riff"
},
{
".swf": "gfx",
".cfx": "gfx",
".gfx": "gfx"
},
{
".gdc": "adf",
".gsc": "adf",
".stringlookup": "adf"
}
]
}

0 comments on commit 0089444

Please # to comment.